diff --git a/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_content_list.json b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8b8a81458dd99f76c46f149a07686246c899b499 --- /dev/null +++ b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d54ebf5269832095905af786b3a1602692697a1e345352bb8602691cb4bdaca6 +size 79747 diff --git a/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_model.json b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_model.json new file mode 100644 index 0000000000000000000000000000000000000000..42fcccd7efad1732e1827916f0a3d23c36be388f --- /dev/null +++ b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6295c1a968b50797ed45ca07032b9879079269df375ffecc6bb31563a4e61a48 +size 97161 diff --git a/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_origin.pdf b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b3b91e095e42bbf26dd27cdec135de7f031e7c3b --- /dev/null +++ b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/8e29a750-0529-4176-9967-ce2a937bf837_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:753b93cfa78dce5e2f0a63c2d1b8b604a0680ba44077bc50713c0dba2840f8cd +size 898797 diff --git a/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/full.md b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/full.md new file mode 100644 index 0000000000000000000000000000000000000000..25ae746ecd93b31040953fb21a9585873855fc50 --- /dev/null +++ b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/full.md @@ -0,0 +1,384 @@ +# Sparsity and Sentence Structure in Encoder-Decoder Attention of Summarization Systems + +Potsawee Manakul and Mark J. F. Gales +Department of Engineering, University of Cambridge +pm574@cam.ac.uk, mjfg@eng.cam.ac.uk + +# Abstract + +Transformer models have achieved state-of-the-art results in a wide range of NLP tasks including summarization. Training and inference using large transformer models can be computationally expensive. Previous work has focused on one important bottleneck, the quadratic self-attention mechanism in the encoder. Modified encoder architectures such as LED or LoBART use local attention patterns to address this problem for summarization. In contrast, this work focuses on the transformer's encoder-decoder attention mechanism. The cost of this attention becomes more significant in inference or training approaches that require model-generated histories. First, we examine the complexity of the encoder-decoder attention. We demonstrate empirically that there is a sparse sentence structure in document summarization that can be exploited by constraining the attention mechanism to a subset of input sentences, whilst maintaining system performance. Second, we propose a modified architecture that selects the subset of sentences to constrain the encoder-decoder attention. Experiments are carried out on abstractive summarization tasks, including CNN/DailyMail, XSum, Spotify Podcast, and arXiv. + +# 1 Introduction + +The Transformer architecture (Vaswani et al., 2017) with large-scale pre-training has become the defacto approach for a wide range of NLP tasks, from classification (Devlin et al., 2019) to seq2seq (Raffel et al., 2020). Training and inference using large transformer models can be computationally expensive because the self-attention's time and memory grow quadratically with sequence length. Hence, there has been significant interest in efficient transformer architectures. A number of approaches have + +been proposed to tackle the quadratic complexity, and a comprehensive survey on efficient transformers has been compiled in Tay et al. (2020). Most existing approaches are developed for encoder-only architectures. For seq2seq tasks, efficient models such as BigBird (Zaheer et al., 2020) or LED (Beltagy et al., 2020) consist of an efficient encoder with the vanilla decoder. For long-document summarization, this combination has been shown effective because the major bottleneck is the encoder self-attention (Manakul and Gales, 2021). The attention mechanisms in the decoder consist of self-attention and encoder-decoder attention. Techniques such as local attention are applicable to self-attention in both the encoder and decoder, while this work focuses on the encoder-decoder attention. + +When humans produce a summary, the information conveyed by each word/part in the summary is likely drawn from some key sentences in the original document. Inspired by this, we hypothesize that if the encoder-decoder attention is constrained dynamically to salient sentences, the computation cost will be reduced. For instance, sentence-level structures for the encoder-decoder attention have been shown effective in the traditional RNN encoder-decoder attention (Cohan et al., 2018; Li et al., 2019; Manakul et al., 2020) + +In this work, first, we compare the decoder's cost in the training and inference stages. We study the sparsity of the encoder-decoder attention in a common transformer-based abstractive summarization model. An approximation method to exploit this sparsity is described, and an empirical upper bound performance is given. Second, we propose a modified decoder architecture that can dynamically select salient input sentences to constrain the encoder-decoder attention without having to compute complete attention at inference time. Techniques to train our proposed model are described, and compared to the full attention baseline performance and empirical upper bound. + +# 2 Models and Data + +Vanilla Transformers. We use BART (Lewis et al., 2020) and local-attention BART (LoBART) (Manakul and Gales, 2021) as our base models. BART's maximum input length is 1024, while that of LoBART is 4096 with attention width of 1024. BART is fine-tuned to CNN/DailyMail and XSum, and LoBART is fine-tuned to Podcast and arXiv. + +Data. CNN/DailyMail (Hermann et al., 2015) and XSum (Narayan et al., 2018) are used with BART, while long-document arXiv (Cohan et al., 2018) and Spotify Podcast (Clifton et al., 2020) are used with LoBART. More details about models, data, and training are provided in Appendix A. + +# 3 Attention in the Transformer + +Time and memory are dominated by the encoder self-attention, and models such as LoBART adopt local attention in its encoder to mitigate this bottleneck, while keeping the original decoder (Manakul and Gales, 2021). Training is fast because attention is highly parallelizable. However, during inference, the decoder uses its histories, becoming less parallelizable. To understand when the decoder might become a bottleneck, we fix the input length $N$ and measure the computational time as a function of the target length $M$ : + +$$ +\mathrm {t i m e} = \bar {c} _ {1} + \bar {c} _ {2} M + \bar {c} _ {3} M ^ {2} \tag {1} +$$ + +in three operating modes: i) Forward+Backward, e.g. at training time; ii) Forward only, e.g. forward-pass where the input to the decoder is provided in advance; iii) Inference, e.g. the decoder using its own back histories as the input. + +Through a curve-fitting method, the results in Table 1 show that the relative decoder cost during inference is almost one order of magnitude larger than that during training, e.g. forward+backward or forward only. More details are provided in Appendix B, where we also show that the encoder-decoder attention cost is greater than the decoder self-attention cost. Therefore, this work will focus on the encoder-decoder attention. + +# 3.1 Encoder-Decoder Attention + +Let $M =$ the summary length, $N =$ the input length, $N_{1} = \#$ sentences, and $N_{2} =$ the average number of words in a sentence, e.g. $N = N_{1}N_{2}$ . The standard encoder-decoder attention in Eq. 2 (scaling factor omitted) where $\mathbf{Q}\in \mathcal{R}^{M\times D}$ and $\mathbf{K},\mathbf{V}\in \mathcal{R}^{N\times D}$ + +
Modec2/¯1(10-3)¯3/¯1(10-6)
Forward+Backward1.080.17
Forward only1.140.25
Inference9.961.30
+ +Table 1: Empirical computational time as a function of the target length $M$ where ${\bar{c}}_{1},{\bar{c}}_{2},{\bar{c}}_{3}$ are the coefficients in Eq. 1. The analysis is based on BART from Wolf et al. (2020) and the input length is 1024 . + +has the complexity: $\mathcal{O}(MN) = \mathcal{O}(MN_1N_2)$ . Note that we fix the representation dimension $D$ , so $D$ is omitted in our complexity notation. + +$$ +\mathbf {A} = \operatorname {s o f t m a x} \left(\mathbf {Q K} ^ {T}\right) \mathbf {V} \tag {2} +$$ + +If the attention is concentrated on some $r$ sentences, by selecting appropriate $r$ , the speed of the encoder-decoder attention can be improved by a factor of $N_{1} / r$ in average. This is equivalent to: + +$$ +\mathbf {A} \approx \hat {\mathbf {A}} = \operatorname {s o f t m a x} \left(\mathbf {Q} \hat {\mathbf {K}} ^ {T}\right) \hat {\mathbf {V}} \tag {3} +$$ + +where $\hat{\mathbf{K}},\hat{\mathbf{V}}\in \mathcal{R}^{rN_2\times D}$ , resulting in $\mathcal{O}(MrN_2)$ + +# 3.2 Sparsity of Encoder-Decoder Attention + +Let the subscript $(i,j)$ denote the position of the $j$ -th word in the $i$ -th input sentence, e.g. $\mathbf{K} = [\underbrace{\mathbf{k}_{1,1},\mathbf{k}_{1,2},\mathbf{k}_{1,J_1}}_{\text{sent1}},\dots,\underbrace{\mathbf{k}_{i,1},\mathbf{k}_{i,J_i}}_{\text{sent} i},\dots,\underbrace{\mathbf{k}_{N_1,1},\mathbf{k}_{N_1,J_{N_1}}}_{\text{sent} N_1}]$ . + +At inference time, the outputs are generated sequentially: $\mathbf{a}_m = \mathrm{softmax}(\mathbf{q}_m\mathbf{K}^T)\mathbf{V}$ , so $r$ sentences can be determined independently for each $\mathbf{q}_m$ . Consider the following sum of attention weights as the saliency at decoding step $m$ of sentence $i$ : + +$$ +\alpha_ {m, i} ^ {\mathbf {s}} = \frac {1}{Z _ {m}} \sum_ {j = 1} ^ {J _ {i}} \exp \left(\mathbf {q} _ {m} \cdot \mathbf {k} _ {i, j}\right) \tag {4} +$$ + +where $Z_{m} = \sum_{\forall i^{\prime}}\sum_{\forall j^{\prime}}\exp (\mathbf{q}_{m}\cdot \mathbf{k}_{i^{\prime},j^{\prime}})$ . We then compute $\sum_{i}\alpha_{m,i}^{\mathrm{s}}$ up to $r$ sentences ranked by $\alpha_{m,i}^{\mathrm{s}}$ . The results in Fig. 1a show that $r = 25$ is required to achieve the sum of attention weights at $90\%$ . In addition to the vanilla model, we can fine-tune BART explicitly to make the attention sparse using: + +$$ +\mathcal {L} _ {\mathrm {A}} = \mathcal {L} _ {\text {x e n t}} + \gamma \mathcal {L} _ {\text {s p a r s e}} \tag {5} +$$ + +where $\mathcal{L}_{\mathrm{xent}}$ is the teacher-forced cross entropy loss, $\mathcal{L}_{\mathrm{sparse}} = \frac{1}{M}\sum_{m=1}^{M}\mathrm{H}(\pmb{\alpha}_m^{\mathrm{s}})$ , and entropy + +$\mathrm{H}(\pmb{\alpha}_{m}^{\mathbf{s}}) = -\sum_{i=1}^{N_{1}} \alpha_{m,i}^{\mathbf{s}} \log \alpha_{m,i}^{\mathbf{s}}$ . We show in Fig. 1b that the fine-tuned models ( $\gamma = 0.1$ & $\gamma = 1.0$ ) retain close to $100\%$ of attention weights for small $r$ . Subsequently, we investigate how selecting $r$ sentences impacts the summarization performance. + +![](images/971939ba8b0ae7b34c05891b3c57890d6d999aa6a8c77d7f37909f850602c7b2.jpg) +(a) Layers 1,4,8,12 + +![](images/eb4411c5d62f4c002deffcf1cfbb5714b97cf1333abe524bd5f365dd00900121.jpg) +(b) $\mathcal{L}_{\mathrm{A}}$ -tuned (Layer1) +Figure 1: The sum of attention weights against the number of retained sentences $(r)$ evaluated on CNNDM. + +To obtain an empirical upper bound performance of Eq. 3, for each $\mathbf{q}_m$ , we can get ideal $\mathbf{k}, \mathbf{v}$ corresponding to the top $r$ sentences ranked by $\alpha_{m,i}^{\mathrm{s}}$ : + +$$ +\mathcal {I} _ {m} ^ {r} = \left[ (i, j) \text {s . t .} i \in \operatorname {t o p} - r \left(\alpha_ {m, i} ^ {\mathbf {s}}\right) \right] \tag {6} +$$ + +$\hat{\mathbf{K}}_m = [\mathbf{k}_{i,j}:(i,j)\in \mathcal{I}_m^r ],$ and the same method is applied to obtain $\hat{\mathbf{V}}_m$ + +
SystemrIrmrR1R2RL
Vanilla (γ = 0.0)AllN/A44.0320.9240.99
5Ideal43.9420.8240.81
5Random39.0614.3236.07
γ = 0.15Ideal44.2221.0141.19
γ = 1.05Ideal43.6120.4640.60
+ +Table 2: Sparsity and Selection $(\mathcal{I}_m^r)$ on CNNDM. + +The results in Table 2 show that: + +- For the vanilla model, despite the sum of attention weights being around $50\%$ at $r = 5$ (Fig. 1a), the model is sufficiently sparse, and constraining to $r$ ideal sentences $(\mathrm{All} \to \mathcal{I}_m^{r,\mathrm{Ideal}})$ results in a small performance degradation. +- Forcing for sparsity (Fig.1b) does not yield a significant performance improvement; but this forcing also makes the model more sensitive to random selection (results in Appendix C). + +Thus, for summarization, there is an observable sparsity, which allows us to reduce the cost of encoder-decoder attention with a minimal degradation. Next, we investigate how to build an efficient form of approximator to obtain salient sentences. + +# 4 Sentence-Level Structure for Encoder-Decoder Attention + +In Section 3.1, we use ideal selection $\mathcal{I}_m^r$ (Eq. 6), which requires computing $\alpha_{m,i}^{\mathrm{s}}$ (Eq. 4) using all input words. This process cannot make the decoder more efficient. By exploiting the sentence structure in the document, we propose the following partition for the sentence-level attention score (Eq. 4) to allow a compact approximation: + +$$ +\alpha_ {m, i} ^ {\mathbf {s}} \approx \tilde {\alpha} _ {m, i} ^ {\mathbf {s}} = \operatorname {s o f t m a x} \left(f _ {1} \left(\mathbf {q} _ {m}\right) \cdot f _ {2} \left(\mathbf {k} _ {i, 1}, \dots , \mathbf {k} _ {i, J _ {i}}\right)\right) \tag {7} +$$ + +where $\sum_{i=1}^{N_1} \tilde{\alpha}_{m,i}^{\mathbf{s}} = 1.0$ . Essentially, we modify the standard encoder-decoder attention such that it performs sentence selection based on $\tilde{\alpha}_{m,i}^{\mathbf{s}}$ (Eq. 7) and computes subset attention $\hat{\mathbf{A}}$ (Eq. 3). + +# 4.1 Complexity of Modified Attention + +The modified encoder-decoder attention consists of two components: i) sentence-level attention over $N_{1}$ sentences; ii) word-level attention over $rN_{2}$ words. Let $p$ denote a unit of matrix multiplication cost and $q$ denote a unit of softmax cost. The costs associated with attention are: + +i) Sentence-level (Eq.7): $pMN_{1}D + qMN_{1}$ +ii) Word-level (Eq.3): $2pMrN_{2}D + qMrN_{2}$ + +The additional cost associated with the sentence-level representation on the encoder side grows with the input length $N = N_{1}N_{2}$ . Thus, as opposed to $\mathcal{O}(MN_1N_2)$ in the case of vanilla encoder-decoder attention, the overall complexity of the modified attention is $\mathcal{O}(MN_1 + k_wMrN_2 + k_eN_1N_2)$ , where $k_w\approx \frac{2pD + q}{pD + q}$ and $k_{e}$ depends on the exact form of sentence-level representation computation. + +# 4.2 Model-based Neural Approximator + +To utilize the simple partition and sentence-level structure in Eq. 7, we use a linear mapping for $f_{1}$ and a bidirectional RNN for $f_{2}$ as follows: + +$$ +f _ {1} \left(\mathbf {q} _ {m}\right) = \mathbf {q} _ {m} \mathbf {W} ^ {\mathbb {Q}} \tag {8} +$$ + +$$ +f _ {2} \left(\mathbf {k} _ {i, 1}, \dots , \mathbf {k} _ {i, J _ {i}}\right) = \mathbf {y} _ {i} \mathbf {W} ^ {\mathrm {K}} \tag {9} +$$ + +$$ +\mathbf {y} _ {i} = \operatorname {R N N} \left(\mathbf {k} _ {i, 1}, \dots , \mathbf {k} _ {i, J _ {i}}\right) \tag {10} +$$ + +As illustrated in Fig. 3, the base transformer model is extended by augmenting two layers: i) sentence-level encoder-decoder attention computing $\tilde{\alpha}_{m,i}^{\mathrm{s}}$ in Eq. 7; ii) sentence encoder computing the sentence-level representation in Eq. 10. The details about model parameters are provided in Appendix A. + +![](images/5ec15d3c0c3c7a62a773b02980fa2c01d8a55f951b6d4973c42e434e32efc2c7.jpg) +(a) BART(1k) & CNNDM + +![](images/bc79258f23a625a0d173e923f918ed71077d583023ae5ceaea0f0cb0e7cf013b.jpg) +(b) BART(1k) & XSum + +![](images/902870fc0881dff429a86edcc0f6ca5936d39da4f997ce64a47e5e89f1677cf7.jpg) +(c) LoBART(4k) & Podcast + +![](images/7f3de6b82a723ae74de74d3e3672fe6eed1ea04e6b26eb2cc438730d518416b6.jpg) +(d) LoBART(4k) & arXiv + +![](images/afc0a9386a88678407bc4d91745701b253f4de3ebe58380c8ee004b00ad77a30.jpg) +Figure 2: Performance (ROUGE-1) of BART & LoBART. The integrated training is based on $\mathcal{I}_m^{r,\mathrm{Apx}}$ . +Figure 3: Modified architecture with model-based approximator where the base model is BART/LoBART. Model-based neural approximator is shown in orange. + +# 4.3 KL Loss and Integrated Training + +Let $\theta_{\mathrm{dec}}$ denote the original decoder, and $\tilde{\theta}$ denote the neural approximator. We train $\tilde{\theta}$ by minimizing: + +$$ +\mathcal {L} _ {\mathrm {K L}} = \frac {1}{M} \sum_ {m = 1} ^ {M} \mathrm {K L} \left(\boldsymbol {\alpha} _ {m} ^ {\mathrm {s}} | | \tilde {\boldsymbol {\alpha}} _ {m} ^ {\mathrm {s}}\right) \tag {11} +$$ + +where $\mathrm{KL}(.) = \sum_{i=1}^{N_1} \alpha_{m,i}^{\mathsf{s}} \log (\alpha_{m,i}^{\mathsf{s}} / \tilde{\alpha}_{m,i}^{\mathsf{s}})$ . In addition, we can integrate $\theta_{\mathrm{dec}}$ in the training process. With the teacher-forced cross entropy loss $\mathcal{L}_{\mathrm{xent}}$ , we define the integrated training loss: + +$$ +\mathcal {L} _ {\mathrm {I}} = \mathcal {L} _ {\mathrm {x e n t}} + \lambda \mathcal {L} _ {\mathrm {K L}} \tag {12} +$$ + +We cannot optimize $\mathcal{L}_{\mathrm{I}}$ in an end-to-end fashion because the top- $r$ operation in Eq. 6 is not differentiable. Hence, we interleave the training, i.e., update $\theta_{\mathrm{dec}}$ at fixed $\tilde{\theta}$ and update $\tilde{\theta}$ using $\mathcal{L}_{\mathrm{KL}}$ only: + +$$ +\begin{array}{l} \Delta \boldsymbol {\theta} _ {\mathrm {d e c}} = \nabla_ {\boldsymbol {\theta} _ {\mathrm {d e c}}} \mathcal {L} _ {\mathrm {I}} | _ {\tilde {\boldsymbol {\theta}}} = \nabla_ {\boldsymbol {\theta} _ {\mathrm {d e c}}} \mathcal {L} _ {\mathrm {x e n t}} | _ {\tilde {\boldsymbol {\theta}}} + \lambda \nabla_ {\boldsymbol {\theta} _ {\mathrm {d e c}}} \mathcal {L} _ {\mathrm {K L}} | _ {\tilde {\boldsymbol {\theta}}} \\ \Delta \tilde {\boldsymbol {\theta}} = \nabla_ {\tilde {\boldsymbol {\theta}}} \mathcal {L} _ {\mathrm {I}} = \underbrace {\nabla_ {\tilde {\boldsymbol {\theta}}} \mathcal {L} _ {\text {x e n t}} ^ {- 1}} _ {+} + \lambda \nabla_ {\tilde {\boldsymbol {\theta}}} \mathcal {L} _ {\mathrm {K L}} \tag {13} \\ \end{array} +$$ + +Because during training, we compute both $\alpha_{m,i}^{\mathrm{s}}$ (ideal) and $\tilde{\alpha}_{m,i}^{\mathrm{s}}$ (approx), we can use either in the top- $r$ selection. Also, inspired by scheduled sampling (Bengio et al., 2015), we try mixing them: $\alpha_{m,i}^{\mathrm{s}}$ with probability $1 - \frac{\text{step}}{\text{epoch\_size}}$ , otherwise $\tilde{\alpha}_{m,i}^{\mathrm{s}}$ . + +# 4.4 System Performance + +In Table 3, we provide two vanilla baselines: random $(\mathcal{I}_m^{r,\mathrm{Rnd}})$ obtained by random selection; ideal + +
SystemTrainInferenceR1R2RL
VanillaXIrrnD39.0614.3236.07
VanillaXIrrdIdl43.9420.8240.81
KL-onlyLKLIrrApx43.0220.0239.89
Int-IdlLl(ImrIdl)IrrApx43.0320.0440.05
Int-ApxLl(ImrApx)IrrApx43.7220.4040.70
Int-MixLl(Mix)IrrApx43.3120.2140.35
+ +Table 3: Performance on CNNDM where $r = 5$ for both training and inference. KL-only $= \tilde{\theta}$ trained on $\mathcal{L}_{\mathrm{KL}}$ ; Int $= (\theta_{\mathrm{dec}} \& \tilde{\theta})$ trained on $\mathcal{L}_{\mathrm{I}}$ . Rnd=random, Idl=ideal, Apx=approximation, Mix=scheduled(Idl/Apx). + +$(\mathcal{I}_m^{r,\mathrm{Idl}})$ obtained by Eq. 6. The results show that the KL-only system clearly outperforms the random selection baseline, and the performance degradation of the KL-only system can be reduced by our integrated training. The results verify the effectiveness of our modified decoder that attends to a subset of sentences. Also, Table 3 shows that it is best to use $\mathcal{I}_m^{r,\mathrm{Apx}}$ as reference in integrated training. This result is likely because we initialized integrated training from the KL-only model. In addition, we apply the modified architecture to BART trained on XSum ( $\leq 1\mathrm{k}$ words), and to LoBART trained on Podcast and arXiv ( $\leq 4\mathrm{k}$ words). The results in Fig. 2 confirm that the performance of our proposed method converges to that of the full attention baseline across all models and datasets. + +In addition, $r^* \approx 5,10,30,30$ , respectively. Although XSum has fewer sentences in average compared to CNNDM, $r_{\mathrm{XSum}}^* > r_{\mathrm{CNNDM}}^*$ as XSum is more abstractive. For longer summarization tasks as shown by Podcast and arXiv, the performance degradation appears larger, meaning that the task of constraining to salient sentences in longer tasks is more challenging, and larger $r$ is required. + +# Sensitivity of $r$ in Integrated Training + +We train BART in three settings: $r^{\mathrm{train}} = 2,5,10$ , and we show the performance level w.r.t. the model with $r^{\mathrm{train}} = 5$ in Fig. 4. The results show that setting $r^{\mathrm{train}}$ beyond $r^{*}$ is not necessarily beneficial as shown by the model with $r^{\mathrm{train}} = 10$ in the CNNDM result, and it is best to set $r^{\mathrm{train}}$ close to $r^{\mathrm{inference}}$ . + +![](images/ebf7ded4a35ef410fa133e529b2eea1f9949f51a41c36306f3a590e6cdb42ddb.jpg) +(a) CNNDM + +![](images/aaec4dbcb5e8b93bef64f3ca96c8de587d167179a48730c39fd5b5b055ffbbcf.jpg) +(b) XSum +Figure 4: $\Delta \mathrm{R}1$ (Y-axis) against $r$ at inference (X-axis). + +# 4.5 Further Discussion on Sentence-Level Encoder-Decoder Attention + +The results in Section 4.4 demonstrate empirically that a neural network can predict sparsity, therefore, allowing sentence selection. Our novel framework requires an addition of modules to the original attention mechanism, and the real gain in speed will depend on the balance of the sparsity against the computational cost of the additional modules. Consequently, the challenge is to make these additional modules highly efficient. Because the particular network realization selected in this paper is to show the feasibility of our framework, its limitations and possible improvements are discussed as follows. + +# Limitations and Possible Improvements + +The model choice of using RNN for the sentence encoder in Eq. 10 leads to a large additional computational cost (specifically large $k_{e}$ ) because the computational cost of RNN grows with $N_{1}N_{2}D^{2}$ . Because the goal is to obtain a sentence-level representation, there is an opportunity to replace RNN by a hierarchical attention that runs over sentences, which could instead lead to a computational cost that grows with $N_{1}N_{2}D$ . Additional sentence-level query and key mappings in Eq. 8 and Eq. 9 also incur a large computational cost. + +# Model-free Approximator + +Lastly, we re-visit the sentence-level attention in Eq. 4, which have been approximated by Eq. 7 and the model-based approximator. It is a challenge to attempt via a model-free algebraic approximation, which does not require any training and has + +little additional inference-time cost. We examined various forms, and we present one model-free approach as well as experimental results in Appendix D, but the current form has worse summarization performance than our model-based approach. + +# 5 Related Work + +The discrepancy between low/moderate attention weight sparsity and good sparse approximation could be because a considerable amount of the attention weight is assigned to special tokens, e.g. ‘.’ in all sentences, but their vector norm is small, which was observed in Kobayashi et al. (2020). + +The sparse attention (Eq. 3) with ideal selection (Eq. 6) can be considered as content selection, which has been shown to improve summarization (Gehrmann et al., 2018; Hsu et al., 2018). Recently, head-wise masks are applied to encoder-decoder attention at inference time, and a performance improvement is reported (Cao and Wang, 2021). + +Voita et al. (2019) observed that heads are redundant, and Clark et al. (2019) found that a head in BERT rarely attends to several consecutive tokens. Based on these, Huang et al. (2021) applies a stride pattern in the encoder-decoder attention, reducing its cost by a factor of the stride size, and this method is likely complementary to our work. + +# 6 Conclusion + +We show that the computational cost of the transformer decoder becomes more significant at inference time. Towards reducing this cost, first, we show that there is sparsity in the encoder-decoder attention that allows us to reduce the computational cost with a minimal degradation. Second, we partition the sentence-level attention score, and we augment the standard decoder by adding a neural network to approximate the attention over sentences, allowing sentence selection. We show that the summarization performance of our approach converges to that of the full attention baseline, while switching the complexity from $\mathcal{O}(MN_1N_2)$ to $\mathcal{O}(MN_1 + k_wMrN_2 + k_eN_1N_2)$ . + +# Acknowledgments + +This paper reports on research supported by ALTA institute, Cambridge Assessment English, University of Cambridge, and Cambridge International & St John's College Scholarship. Thanks to Yiting Lu for interesting discussions. Thanks to the anonymous reviewers for their helpful comments. + +# References + +Iz Beltagy, Matthew E Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150. +Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. 2015. Scheduled sampling for sequence prediction with recurrent neural 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 1171-1179. +Shuyang Cao and Lu Wang. 2021. Attention head masking for inference time content selection in abstractive summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5008-5016, Online. Association for Computational Linguistics. +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. +Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. 2019. What does BERT look at? an analysis of BERT's attention. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 276-286, Florence, Italy. Association for Computational Linguistics. +Ann Clifton, Sravana Reddy, Yongze Yu, Aasish Pappu, Rezvaneh Rezapour, Hamed Bonab, Maria Eskevich, Gareth Jones, Jussi Karlgren, Ben Carterette, and Rosie Jones. 2020. 100,000 podcasts: A spoken English document corpus. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5903-5917, Barcelona, Spain (Online). International Committee on Computational Linguistics. +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. +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. +Sebastian Gehrmann, Yuntian Deng, and Alexander Rush. 2018. Bottom-up abstractive summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4098-4109, Brussels, Belgium. 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. +Wan-Ting Hsu, Chieh-Kai Lin, Ming-Ying Lee, Kerui Min, Jing Tang, and Min Sun. 2018. A unified model for extractive and abstractive summarization using inconsistency loss. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 132-141, Melbourne, Australia. Association for Computational Linguistics. +Luyang Huang, Shuyang Cao, Nikolaus Parulian, Heng Ji, and Lu Wang. 2021. Efficient attentions for long document summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1419-1436, Online. Association for Computational Linguistics. +Rosie Jones, Ben Carterette, Ann Clifton, Maria Eskevich, Gareth J. F. Jones, Jussi Karlgren, Aasish Pappu, Sravana Reddy, and Yongze Yu. 2020. Trec 2020 podcasts track overview. In The 29th Text Retrieval Conference (TREC) notebook. +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. +Goro Kobayashi, Tatsuki Kuribayashi, Sho Yokoi, and Kentaro Inui. 2020. Attention is not only a weight: Analyzing transformers with vector norms. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7057-7075, Online. Association for Computational Linguistics. +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. Association for Computational Linguistics. +Manling Li, Lingyu Zhang, Heng Ji, and Richard J. Radke. 2019. Keep meeting summaries on topic: Abstractive multi-modal meeting summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2190-2196, Florence, Italy. Association for Computational Linguistics. +Chin-Yew Lin. 2004. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pages 74-81, Barcelona, Spain. Association for Computational Linguistics. +Potsawee Manakul and Mark Gales. 2021. Long-span summarization via local attention and content selection. 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 6026-6041, Online. Association for Computational Linguistics. +Potsawee Manakul, Mark J.F. Gales, and Linlin Wang. 2020. Abstractive Spoken Document Summarization Using Hierarchical Model with Multi-Stage Attention Diversity Optimization. In Proc. Interspeech 2020, pages 4248-4252. +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, Brussels, Belgium. Association for Computational Linguistics. +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. +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. +Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. 2020. Efficient transformers: A survey. arXiv preprint arXiv:2009.06732. + +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. +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. +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. +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144. +Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Otanon, 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 33, pages 17283-17297. Curran Associates, Inc. + +# A Reproducibility Details + +# A.1 Models + +BART/LoBART: We use the HuggingFace's implementation (Wolf et al., 2020), including BART models fine-tuned to CNNDM and XSum. We take LoBART from Manakul and Gales (2021), including LoBART(4k)+MCS fine-tuned to Podcast and arXiv. MCS is the multitask content selection system for handling the Podcast/arXiv input documents that exceed 4096 words. + +Modified Architecture: As shown in Fig. 3, the modified architecture consists of a sentence encoder and a sentence-level encoder-decoder attention. The sentence encoder, which approximates $f_{2}(.)$ in Eq. 7, is a two-layer bi-directional GRU (Cho et al., 2014) with hidden dimension of 1024. The sentence-level encoder-decoder attention has linear mapping weights $\mathbf{W}^{\mathbb{Q}}$ (query) and $\mathbf{W}^{\mathrm{K}}$ (key), and both weights have the same dimension as and are initialized from their corresponding word-level encoder-decoder attention's linear mapping weights in the base model. The total number of additional parameters is 58.8M. + +# A.2 Data + +CNNDM: We follow the standard train-valid/test split of 287,113/13,368/11,490. + +XSum: We follow the standard train-valid/test split of 204,045/11,332/11,334. + +Spotify Podcast: We follow the data processing and split in Jones et al. (2020), resulting in train-valid/test splits of 60,415/2,189/1,027. + +arXiv: We follow the standard train-valid/test split of 203,037/6,436/6,440. + +Our data processing is based on the byte-pair encoding (BPE) tokenizer same as the BART-large tokenizer, and we use the NLTK toolkit for sentence splitting. **In Fig. 2 and Fig. 4, to reduce computational cost, we use first 2,000 samples of each test set, except Podcast which contains less than 2,000 samples. + +# A.3 Training and Inference + +We use PyTorch (Paszke et al., 2019) in our experiments. All training experiments use the Adam + +
DatasetNN1MN/M
CNNDM87028.767.414.2
XSum48917.427.918.2
Podcast5727330.886.6143.9
arXiv8584237.0364.945.3
+ +Table 4: Data statistics (average over corpus). $N=$ input length, $N_{1}=$ #sentences, $M=$ summary length. + +optimizer (Kingma and Ba, 2015) with $\beta_{1} = 0.9$ , $\beta_{2} = 0.999$ , and the learning rate is: + +$$ +\mathrm {l r} = 0. 0 0 2 \times \min (\text {s t e p} ^ {- 0. 5}, \text {s t e p} \times \text {w a r m u p} ^ {- 1. 5}) +$$ + +where we use 20,000 warmup steps. In all experiments, we set batch size to 1, and gradient accumulation to 2 steps. We evaluate the training loss on the validation set every 20,000 steps, and stop the training if the validation loss does not improve 3 times. All training experiments converged within 1 epoch. All experiments were carried out in 32-bit precision on either one V100 (32GB) GPU, or one RTX 2080Ti (11GB) GPU. + +At inference time, we use the standard setting: beam search of width 4, and length penalty of 2.0 (Wu et al., 2016) for all experiments. The ROUGE (Lin, 2004) scoring tool is pyrouge. $^7$ + +# A.4 Multi-head attention + +In all of the equations and expressions in the paper, we omit the heads for simplicity. Both BART and LoBART models have 16 heads. In Fig. 1, we average $\alpha_{m,i}^{\mathrm{s}}$ over heads, before the summation. When computing an uncertainty measure such as entropy $\mathrm{H(.)}$ or KL-divergence $\mathrm{KL(.)}$ , we compute the measure for each head separately and take the average. In obtaining $\mathcal{I}_m^r$ , we average $\alpha_{m,i}^{\mathrm{s}}$ over heads, before the top- $r$ operation, i.e. all heads get assigned the same subset of sentences, but the differences are across layers and decoding timesteps. + +# A.5 KL Loss and Integrated Training + +The target $\alpha_{m,i}^{\mathbf{s}}$ is re-normalized to encourage higher sparsity as follows: + +$$ +\boldsymbol {\alpha} _ {m} ^ {\mathrm {s}} \leftarrow \operatorname {s o f t m a x} \left(\frac {\log \left(\boldsymbol {\alpha} _ {m} ^ {\mathrm {s}}\right)}{T}\right) \tag {15} +$$ + +where temperature $T$ is set to 0.5. For integrated training, we set $\lambda$ in $\mathcal{L}_{\mathrm{I}}$ to 0.2. We initialize integrated training experiments from KL-only models. + +# B Time Analysis + +For each mode in Table 1, we take 6 samples of $M$ and the average time of 100 iterations. Curve fitting yields R-squared of at least 0.994. + +Computational time as function of $M$ and $N$ is time $= c_{1} + c_{2}M + c_{3}N + c_{4}MN + c_{5}M^{2} + c_{6}N^{2}$ . The coefficients are obtained by a least-squares regression, e.g. $\mathbf{c}^{*} = (\mathbf{P}^{T}\mathbf{P})^{-1}\mathbf{P}^{T}\mathbf{t}$ where $\mathbf{P}$ is the matrix of $M, N$ associated with the coefficients, and $\mathbf{t}$ contains the time measures. We collect 30 samples of the average time of $100\mathrm{F} + \mathrm{B}$ passes, spanning $N \in [256, 1024]$ and $M \in [50, 300]$ . The normalized coefficients are: $c_{1} = 1.00$ , $c_{2} = 3.78 \times 10^{-3}$ , $c_{3} = 3.15 \times 10^{-3}$ , $c_{4} = 1.47 \times 10^{-6}$ , $c_{5} = 7.26 \times 10^{-7}$ , $c_{6} = 7.79 \times 10^{-7}$ . Because $c_{4} \approx 2c_{5}$ and $N > M$ , the enc-dec attention cost is greater than the decoder self attention cost. + +# C Sensitivity to Random Selection + +
SystemR1R2RL
Vanilla (γ = 0.0)39.0614.3236.07
LA-tuned (γ = 0.1)28.437.7224.00
LA-tuned (γ = 1.0)21.384.2217.69
+ +# D Model-free Approximation for Eq. 4 + +Since $\alpha_{m,i}^{\mathbf{s}} = \frac{1}{Z_m}\sum_{j = 1}^{J_i}\exp (\mathbf{q}_m\cdot \mathbf{k}_{i,j})$ is used to rank input sentences, the normalization term, $Z_{m}$ can be dropped. The encoder-decoder attention has $\mathcal{O}(MN_1N_2)$ complexity because $\mathbf{q}_m\cdot \mathbf{k}_{i,j}$ is computed for every $m$ and $(i,j)$ pair. Hence, if we can group $\mathbf{k}_{i,j}$ into sentences, the complexity could potentially be reduced. We try the following approximation of unnormalized $\alpha_{m,i}^{\mathbf{s}}$ : + +$$ +\begin{array}{l} \sum_ {j = 1} ^ {J _ {i}} \exp (\mathbf {q} _ {m} \cdot \mathbf {k} _ {i, j}) \\ = \sum_ {j = 1} ^ {J _ {i}} \prod_ {d = 1} ^ {D} \exp \left(q _ {m, d} k _ {i, j, d}\right) (16) \\ \approx \sum_ {j = 1} ^ {J _ {i}} \sum_ {d = 1} ^ {D} \exp \left(q _ {m, d} k _ {i, j, d}\right) (17) \\ \approx \sum_ {j = 1} ^ {J _ {i}} \sum_ {d = 1} ^ {D} \phi \left(q _ {m, d}\right) \phi \left(k _ {i, j, d}\right) (18) \\ = \phi (\mathbf {q} _ {m}) \cdot \left(\sum_ {j = 1} ^ {J _ {i}} \phi (\mathbf {k} _ {i, j})\right) (19) \\ \end{array} +$$ + +where $d = \{1,\dots,D\}$ is the hidden dimension, and $\phi(.)=\mathrm{ELU}(.)+1$ (or other form such as exp and ReLU). The model-free method reduces complexity from $\mathcal{O}(MN_1N_2)$ to $\mathcal{O}(MN_1 + k_wMrN_2 + k_eN_1N_2)$ where $k_{e}$ is now much smaller compared to the model-based approach. Based on Eq. 19, we provide model-free results in Table 6. + +Table 5: Impact of sparsity on the sensitivity to random selection based on CNNDM with $r = 5$ . + +
Selection MethodR1R2RL
Ideal (Eq.6)43.9420.8240.81
Best Model-based43.7220.4040.70
Random39.0614.3236.07
Model-free (Eq.19)40.0117.2836.95
+ +Table 6: Model-free results on CNNDM $\left( {r = 5}\right)$ . + +Our model-free approach is better than the random selection baseline, but it is significantly worse than both the ideal selection baseline and the model-based approach. The reasons for this poor performance are: (i) the approximation from (16) to (17) requires the following condition to be true: $A_{1}A_{2} > B_{1}B_{2} \rightarrow A_{1} + A_{2} > B_{1} + B_{2}$ , so it is inaccurate when the values are not in a similar range; (ii) the approximation from (17) to (18) is inaccurate for non-positive values. In conclusion, this experiment investigates an alternative challenging method, which would not require any training and would be computationally cheaper at inference time. Although the current algebra does not work well, we hope that our initial study might draw more interests into this type of model-free approach to exploit the sentence structure in seq2seq tasks such as abstractive summarization. + +# E Word-level and Sentence-level Attention Weight Plots + +Constraining the encoder-decoder attention to $r$ sentences is motivated by the observations of sentence-level attention (in Fig. 5b, 6b, 7b, 8b). Note that we average over all heads for the plots. + +For instance, Fig. 5 shows that the decoder attends particularly to input sentences #1,#2,#13 in the summary generation. Compared to Fig. 5, Fig. 6 shows a wider spread of the attention over sentences in a more abstractive task. When using LoBART, Fig. 7 and Fig. 8 show a similar trend of the sparsity to BART scenarios. These figures also explain Fig. 1a (Section 3) that $\sum_{i}^{\mathcal{T}_m^r}\alpha_{m,i}^s$ is only low/moderate because most sentences get assigned some attention weights, despite being non-salient. + +![](images/2aa0d98fa44f1bb87e2681caacfa8151b8613837f53b098f84d6cb565c1a0363.jpg) +(a) Word-Level + +![](images/4b242aa849e23799c4d32e15263196b917948fe5218053ec46e9f25bbc9ad42f.jpg) +(b) Sentence-Level $(\alpha_{m,i}^{\mathrm{s}})$ + +![](images/5b8081428f23f2d55d56cde5d18e5762efc6f4bec10941b395855325030399a0.jpg) +Figure 5: Example of BART's encoder-decoder attention evaluated on CNNDM test set. +(a) Word-Level + +![](images/d42e1a9575c2758b8e5d1ce7eb86e86b0e3af9de0635dbb4f84c1ac2ceed7cb0.jpg) +(b) Sentence-Level $(\alpha_{m,i}^{\mathrm{s}})$ + +![](images/c3c692c88770710c67b49f3dd311156e7e64bc4f2b96b2cab44c87db14783e89.jpg) +(a) Word-Level +Figure 7: Example of LoBART's encoder-decoder attention evaluated on Podcast test set. + +![](images/2cf7ce78958bab4b9dbe66ac5b6b781474566f955d667973f7b724361419ff5c.jpg) +Figure 6: Example of BART's encoder-decoder attention evaluated on XSum test set. +(b) Sentence-Level $(\alpha_{m,i}^{\mathrm{s}})$ + +![](images/f8b49cd2b3e40b1127227f9dec82be08fae82b30031516aec156f55d545e017f.jpg) +(a) Word-Level +Figure 8: Example of LoBART's encoder-decoder attention evaluated on arXiv test set. + +![](images/87fd323c6a74bae8d7d3a64372eaa4dadae5c9aa8ce3c5916100e82592c03086.jpg) +(b) Sentence-Level $(\alpha_{m,i}^{\mathrm{s}})$ \ No newline at end of file diff --git a/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/images.zip b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1668815d20f1942489debf78f102920b8d6f4019 --- /dev/null +++ b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:654ac3d2f0935e8d4ea27952a15d58f107773bd05f89b029c2cfe113b0e67033 +size 575950 diff --git a/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/layout.json b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d72715e30cb88d9da1b3b82999d7325cabd69219 --- /dev/null +++ b/sparsityandsentencestructureinencoderdecoderattentionofsummarizationsystems/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:404872c139e383f9fedc8fee16a1ea101c114e4c152c95b90fca08f64c8234ea +size 489136 diff --git a/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_content_list.json b/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8031ab6d34f3be68a042588a254739316213b877 --- /dev/null +++ b/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2df98b8646873781633b66e4ff1e61bdcb56bd0363b0e34604ac000cabcadf6 +size 56605 diff --git a/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_model.json b/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..77d791b9ab088caf39cdd62e8144fe7bbe5c8d86 --- /dev/null +++ b/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dabe55848b9def35c4264050c0e2fffbe1fe9c80bb39da5c208e1c8d2860cb77 +size 67394 diff --git a/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_origin.pdf b/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..db2a4de1aeec2e65e13bab4e651f207c144db8db --- /dev/null +++ b/speechformerreducinginformationlossindirectspeechtranslation/40bd627e-e649-499d-adba-5f5dc511ba9e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9512e6608bd95c776686d937f5b1ef3795e730cff9291852d31f4e6ae7576bc +size 507991 diff --git a/speechformerreducinginformationlossindirectspeechtranslation/full.md b/speechformerreducinginformationlossindirectspeechtranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..469a279853e57ff4d08f1a8a215999ebce56919b --- /dev/null +++ b/speechformerreducinginformationlossindirectspeechtranslation/full.md @@ -0,0 +1,184 @@ +# Speechformer: Reducing Information Loss in Direct Speech Translation + +Sara Papi $^{1,2}$ , Marco Gaido $^{1,2}$ , Matteo Negri $^{1}$ , Marco Turchi $^{1}$ $^{1}$ Fondazione Bruno Kessler + $^{2}$ University of Trento +{spapi,mgaido,negri,turchi} $@$ fbk.eu + +# Abstract + +Transformer-based models have gained increasing popularity achieving state-of-the-art performance in many research fields including speech translation. However, Transformer's quadratic complexity with respect to the input sequence length prevents its adoption as is with audio signals, which are typically represented by long sequences. Current solutions resort to an initial sub-optimal compression based on a fixed sampling of raw audio features. Therefore, potentially useful linguistic information is not accessible to higher-level layers in the architecture. To solve this issue, we propose Speechformer, an architecture that, thanks to a reduced memory usage in the attention layers, avoids the initial lossy compression and aggregates information only at a higher level according to more informed linguistic criteria. Experiments on three language pairs (en→de/es/nl) show the efficacy of our solution, with gains of up to 0.8 BLEU on the standard MuST-C corpus and of up to 4.0 BLEU in a low resource scenario. + +# 1 Introduction + +Speech-to-text translation (ST) has been traditionally approached with cascade architectures consisting of a pipeline of two sub-components (Stentiford and Steer, 1988; Waibel et al., 1991): an automatic speech recognition (ASR), which transforms the audio input into a textual representation, and a machine translation (MT) model, which projects the transcript into the target language. A more recent approach consists in directly translating speech into target text using a single model (Bérard et al., 2016; Weiss et al., 2017). This direct solution has interesting advantages (Sperber and Paulik, 2020): $i$ ) it can better exploit audio information (e.g. prosody) during the translation phase, $ii$ ) it has lower latency, and $iii$ ) it is not affected by error propagation. + +Thanks to these advantages, the initially huge performance gap with cascade systems has gradually closed (Ansari et al., 2020), motivating research towards further improvements. + +Direct ST models are fed with features extracted from the audio with high frequency (usually every 10ms). This, on average, makes the resulting input sequence of vectors $\sim 10$ times longer than the corresponding text, leading to an intrinsically redundant (i.e. long and repetitive) representation. For this reason, it is not possible to process speech data with a vanilla Transformer encoder (Vaswani et al., 2017), whose self-attention layers have quadratic memory complexity with respect to the input length. State-of-the-art architectures tackle the problem by collapsing adjacent vectors in a fixed way, i.e. by mapping a predefined number of vectors (usually 4) into a single one, either using strided convolutional layers (Bérard et al., 2018; Di Gangi et al., 2019; Wang et al., 2020a) or by stacking them (Sak et al., 2015). As a positive side effect, these length reduction solutions lower input redundancy. As a negative side effect, they disregard the variability over time of the amount of linguistic and phonetic information in audio signals (e.g. due to pauses and speaking rate variations) by giving equal weight to all features. In doing this, relevant features are penalized and considered equally important to the irrelevant ones, resulting in an information loss. + +Recently, Salesky et al. (2019) obtained considerable translation quality gains by collapsing consecutive vectors with the same phonetic content instead of compressing them in a fixed way. Zhang et al. (2020) also showed that selecting a small percentage $(\sim 16\%)$ of input time steps based on their informativeness improves ST quality. On the downside, these approaches respectively require adding a model that performs phoneme classification and a pre-trained adaptive feature selection layer on top of an ASR encoder, losing the compactness of direct solutions at the risk of error propagation. + +In direct ST, Liu et al. (2020) and Gaido et al. (2021) addressed the problem with a transcript/phoneme-based compression leveraging Connectionist Temporal Classification (CTC - Graves et al. 2006). However, since these methods are applied to the representation encoded by Transformer layers, the initial content-unaware down-sampling of the input is still required for memory reasons, at the risk of losing important information. + +To avoid initial fixed compression, we propose Speechformer: the first Transformer-based architecture that processes full audio content maintaining the original dimensions of the input sequence. Inspired by recent work on reducing the memory complexity of the attention mechanism (Wang et al., 2020b), we introduce a novel attention layer – the ConvAttention – whose memory requirements are reduced by means of convolutional layers. As the benefits of avoiding the initial lossy compression might be outweighed by the increased redundancy of the encoded audio features, we aggregate the high-level representation of the input sequence in a linguistically informed way, as in (Liu et al., 2020; Gaido et al., 2021). In other words, we collapse vectors representing the same linguistic atomic content (words, sub-words, pauses) into a single element, since they express the same linguistic information. The usage of the ConvAttention and of the linguistically motivated compression produces a considerably shorter, yet informative, sequence that fits the memory requirements of vanilla Transformer encoder layers. Experiments on three language directions (en→de/es/nl) show that the proposed architecture outperforms a state-of-the-art ST model by up to 0.8 BLEU points on the standard MuST-C corpus and obtains significantly larger gains (up to 4.0 BLEU) in a low resource setting where the amount of training data is reduced to 100 hours. + +# 2 Model + +In this section, we first introduce a novel attention layer that enables to process raw audio features without downsampling (§2.1). Then, we present an architecture that leverages this attention mechanism in the first encoder layers and reduces the redundancy of the more informative but longer resulting sequences with CTC compression (§2.2). + +# 2.1 ConvAttention layer + +State-of-the-art ST models employ convolutional neural networks to sample the feature sequence + +![](images/f0ec74c17a274b33251b7e81aa90abe43ec1a1a96a8ae76836833dd865cd3e57.jpg) +Figure 1: Attention mechanism with the proposed convolutional compression of $K$ and $V$ . + +to a lower dimension (typically by a factor of 4), enabling the use of Transformer layers otherwise impossible given their memory consumption. Outside ST, the Linformer architecture (Wang et al., 2020b) has been recently proposed to reduce the quadratic complexity of the product between the attention matrix (resulting from the product of the query $-Q$ and key $-K$ matrices) and the value $(V)$ matrix by applying a linear projection to $K$ and $V$ . These projections bring the dimension of the sequence length of $K$ and $V$ to a fixed value, yielding a linear memory complexity. However, a direct application of this architecture to ST is problematic due to the high variability in audio lengths. On one side, mapping those sequences to a fixed dimension can cause an excessive information loss, with a consequent performance drop. On the other, it poses technical issues: the linear projection matrix has size $n \times k$ , where $n$ is the maximum input length and $k$ is the fixed dimension. If the input has a length $n'$ shorter than $n$ , which is a common case due to the high variability in length of audio sequences, only the first $n'$ weights of the matrix are updated. This results in gradients of different dimensions across GPUs, leading to training failures due to inconsistencies. + +To avoid the aforementioned problems, we propose the adoption of ConvAttention (Figure 1), in which the linear projections of the Linformer architecture are substituted, both in $K$ and $V$ , with a single 1D convolutional layer. Hence, the length of the sequences used in the scaled dot-product attention depends on the stride of the convolution, a hyper-parameter we named compression factor $(\chi)$ , which controls the memory complexity of the ConvAttention. Namely, being $n$ the temporal dimension of $K$ and $V$ , the convolution output length is $\frac{n}{\chi}$ and the complexity of the ConvAttention is + +$O\left(\left(\frac{n}{\chi}\right)^{2}\right)$ , i.e. a $\frac{1}{\chi^2}$ factor lower than a vanilla Transformer self-attention. For instance, setting $\chi$ to 4 leads to the same memory consumption as standard ST models with an initial $\times 4$ subsampling (i.e. with two initial convolutional layers with stride 2). + +Notice that the output sequence length is still equal to the input sequence length as it depends on the length of $Q$ that is not modified. + +# 2.2 Speechformer + +The introduction of ConvAttention layers allows us to avoid sub-optimal fixed compressions that disregard the variability over time in the amount of audio information. However, since an encoder consisting only of ConvAttention layers does not compress the length of the original input sequence, the decoder will be fed with long and redundant sequences that are difficult to attend, leading to potential performance degradation. + +To overcome this problem, as in (Liu et al., 2020; Gaido et al., 2021), we apply a content-informed compression to high-level hidden states trained using the CTC loss (Graves et al., 2006) to represent the linguistic content. Specifically, the CTC loss produces a prediction for each input time step and then merges equal predictions for consecutive time steps. The resulting sequence is compared with the reference, which is the sequence of subwords representing the transcript of the input utterance. CTC compression, similarly to the loss computation, collapses consecutive features corresponding to the same predictions, averaging them. After this operation, the sequence is reduced to a representation dimensionally closer to its textual content, which can be processed by the original attention mechanism without the need of approximations. + +Speechformer (see Figure 2), is composed of $E_{L}$ ConvAttention layers up to a CTC compression layer, after which there are $E_{T}$ Transformer encoder layers. The $E_{L}$ ConvAttention layers are meant to learn the linguistic content of the input audio while the $E_{T}$ Transformer encoder layers are in charge of learning higher-level semantic representations, i.e. the encoder outputs, which the decoder has to convert into a text in the target language. We also maintain the two 1D convolutional layers before the ConvAttention layers but without striding, so that no sub-sampling is applied to the input. We make this choice both to keep the number of parameters comparable to the existing architectures, and to let the model learn a better representation of the + +![](images/966d54270c70265cdd73c29b3f32ba756890682284d3a63c51dbb13febb4c10a.jpg) +Figure 2: Speechformer architecture with $E_{L}$ ConvAttention Layers and $E_{T}$ Transformer Encoder Layers. + +
kernel1616884
χ168844
BLEU19.720.620.521.320.2
+ +Table 1: BLEU on MuST-C en-de dev set varying the compression factor $\chi$ and 1D convolutional kernel size. The scores are obtained without label smoothing. + +input before feeding it to the attention mechanism. + +# 3 Experimental Settings + +We experimented on three languages of MuST-C (Cattoni et al., 2021): English-German, English-Spanish, and English-Dutch. To ensure the reproducibility of our work, all training details are provided in the Appendix and the code - based on fairseq (Ott et al., 2019) - is released open source. + +Following (Wang et al., 2020b), we share the convolution parameters of the ConvAttention layers both among $K$ and $V$ and among the attention heads. We select the compression factor and the 1D convolution kernel size with a set of preliminary experiments on the en-de validation set. The compression factor $(\chi)$ is chosen among 4, 8, and 16, since 4 is the minimum value that avoids out-of-memory issues. The kernel size is set either equal to or twice as the value of $\chi$ . Table 1 shows that the combination of a compression factor of 4 and a kernel size of 8 leads to better performance compared to the other combinations. Consequently, in all our experiments we use this setting. + +We initialize the ConvAttention weights of Speechformer with those of a pre-trained ST model + +
Modelen-deen-esen-nlInference Time
devtst-COMMONdevtst-COMMONdevtst-COMMON
(Inaguma et al., 2020)-22.9-28.0-27.4-
(Wang et al., 2020a)-22.7-27.2-27.3-
Our baseline + compression22.522.831.227.924.227.21.0x
22.3-0.222.8+0.031.1-0.127.9+0.024.2+0.027.0-0.20.9x
Plain ConvAttention23.1*+0.623.2+0.431.5+0.327.7-0.224.8*+0.626.9-0.31.8x
Speechformer23.3*+0.823.6*+0.831.8*+0.628.5*+0.624.9*+0.727.7*+0.51.3x
+ +Table 2: BLEU score (average over 3 runs) on English→Dutch (en-nl), English→German (en-de), and English→Spanish (en-es) of MuST-C tst-COMMON (tst) and the dev (validation) set. The * symbol indicates statistically significant improvements over the baseline. Statistical significance is computed with a t-test (Student, 1908), whose null hypothesis is that the mean of the considered experiment is not higher than the mean of the baseline. We consider the result statistically significant if we can reject the null hypothesis with $95\%$ confidence. + +having only ConvAttention layers in the encoder, since, in the initial random state, the CTC-based compression might not properly reduce the input sequence, leading to out-of-memory issues in the following Transformer encoder layers. Notice that the pre-training does not improve performance. Indeed, Gaido et al. (2021) already showed that the encoder pre-training improves the baseline performance only without the additional CTC loss and that the results obtained by training without CTC loss and with encoder pre-training are identical to those achieved with the additional CTC loss. These findings have been confirmed in our experiments: $i$ ) initializing the encoder of the baseline with either an ASR or an ST encoder did not bring any improvement, and $ii$ ) our results are on par with those obtained with encoder pre-training and no additional CTC loss. We do not include the results with encoder pre-training of the baselines, as they do not bring any additional insight. + +# 4 Results + +We compare our proposed model to a strong baseline represented by a Transformer-based model with initial fixed sub-sampling (Wang et al., 2020a) and its baseline+compression variant that includes the average CTC compression strategy, as per (Gaido et al., 2021). We choose to also develop the second baseline to make the comparison with Speechformer fair since they both use the CTC compression strategy. Table 2 reports the results computed with SacreBLEU $^2$ (Post, 2018). For each experiment, we report the average over 3 runs to ensure that performance differences do not depend on the fluctuations of particularly good or bad runs. + +First, it can be noticed that our baseline is in line with state-of-the-art architectures trained only + +on MuST-C (Wang et al., 2020a; Inaguma et al., 2020). Second, the addition of CTC compression to the baseline model does not bring benefits. This confirms the findings of Gaido et al. (2021), who showed that applying CTC compression using transcripts produces differences in score that are not statistically significant. Speechformer, instead, results in statistically significant improvements over the baseline in all language directions, with BLEU gains ranging from 0.5 (for en-nl) to 0.8 (for ende). As the CTC compression is not helpful for the baseline, we also evaluate a model (Plain ConvAttention) whose encoder is a stack of ConvAttention layers, i.e. without vanilla Transformer-encoder layers and any form of compression. The drop in performance with respect to Speechformer varies between 0.4 and 0.8 BLEU on all language pairs, supporting our hypothesis that a non-compressed encoder output is too redundant to be effectively attended by the decoder. + +Low-Resource Settings. We suppose that the higher gains on en-de may be related to the size of the training data. Indeed, the en-de section of MuST-C used for training is the smallest one, containing $20\%$ fewer data than the en-es section and $10\%$ less than the en-nl one. Thus, we study Speechformer's performance in different data conditions by progressively reducing the amount of training data. For this analysis, we select the enes section of MuST-C as it contains the highest number of hours (478h) among the three languages, and we experiment with three subsets, respectively containing 385h (corresponding to the amount of training data for en-de), 200h, and 100h (which can be considered a limited quantity given that the number of hours is respectively less than half and one fourth of the available data). Figure 3 shows that the gains obtained by Speechformer over the baseline do not vary significantly between 385h + +and 478h (0.5 vs 0.6 BLEU). We can then conclude that the gain variation between en-de and en-es does not depend on the smaller size of the en-de training set. However, in the low resource settings (200h and 100h), the gains obtained by the Speechformer are much larger, amounting to 1.1 BLEU with 200h and 4.0 BLEU with 100h. To validate the robustness of these results, we also experimented on the en-de language pair and obtained consistent results: Speechformer outperforms the baseline by 1.5 BLEU (19.6 vs 18.1 BLEU) with 200h of training data and by 1.9 BLEU (9.7 vs 7.8 BLEU) with 100h of training data, achieving a considerable relative improvement of more than $24\%$ . Although it brings consistent and significant gains in higher resource scenarios, these experiments show that Speechformer is particularly fruitful in low-resource settings. We leave to future work the assessment of the behavior of Speechformer in unrestricted data conditions (e.g. when using large ASR corpora to generate pseudo-labelled ST training data). + +![](images/6b45f34a2d04598a4ee5e7bd7a395f0f9d9505f12835a0354f7db58097998924.jpg) +Figure 3: Architecture comparison varying the amount of en-es training data (478h, 385h, 200h, and 100h). + +Inference Time. The ConvAttention layers process the whole input sequences, which are 4 times larger than those elaborated by the baseline attention mechanism. Thereby, a slow-down at inference time is expected, especially for the Plain ConvAttention, whose encoder layers are all ConvAttention layers. The last column of Table 2 confirms that the Plain ConvAttention architecture is 1.8 times slower than the baseline, i.e. the inference time is nearly twice. Speechformer is also slower than the baseline, but the overhead amounts to only $30\%$ instead of $80\%$ . Moreover, it can be noticed that the size of the attention matrix – and therefore the corresponding computational cost – can be + +controlled in the Speechformer with the compression factor $(\chi)$ hyper-parameter. We leave to future studies the analysis of the trade-off between overall translation quality and inference time, which is usually irrelevant in offline ST, but becomes critical in simultaneous scenarios. + +Manual Analysis. Lastly, we inspected the baseline and Speechformer outputs to better understand the reason behind the improvements brought by our architecture. This qualitative analysis was conducted on a sample of 200 sentences of the ende test set – the language direction showing the largest gap between the systems (+0.8, see Table 2) – by a professional linguist with C2 German level. It emerged (see the Appendix for examples) that Speechformer tends to have better word-ordering, a typical problem arising when translating from an SVO language like English to an SOV language like German. Furthermore, Speechformer outputs display a better punctuation positioning – attributable to an improved handling of pauses and prosody – and a reduction of the number of audio misunderstandings and omissions. Together with the overall BLEU gains, these findings provide us with interesting hints about the potential of Speechformer. + +# 5 Conclusion + +In the wake of previous works showing the benefits of a content-informed compression over fixed downsampling of the audio features, we proposed Speechformer: the first ST Transformer-based model able to encode the whole raw audio features without any sub-optimal initial subsampling typical of current state-of-the-art models. Our solution is made possible by the introduction of a modified attention mechanism – the ConvAttention – that reduces the memory complexity to $O\left(\left(\frac{n}{\chi}\right)^2\right)$ . As the plain application of ConvAttention layers leads to redundant sequences, high-level hidden states are compressed with a CTC-based strategy to obtain a compact, yet informative representation that can be processed by vanilla Transformer encoder layers. Experiments on three language pairs show that Speechformer significantly outperforms a state-of-the-art ST model by 0.5-0.8 BLEU, reaching a peak of 4 BLEU points in a low resource scenario. + +# Acknowledgements + +The authors would like to thank Alina Karakanta for the support and help with the manual analysis. + +# References + +Ebrahim Ansari, Amittai Axelrod, Nguyen Bach, Ondrej Bojar, Roldano Cattoni, Fahim Dalvi, Nadir Durrani, Marcello Federico, Christian Federmann, Jiatao Gu, Fei Huang, Kevin Knight, Xutai Ma, Ajay Nagesh, Matteo Negri, Jan Niehues, Juan Pino, Elizabeth Salesky, Xing Shi, Sebastian Stüker, Marco Turchi, Alexander Waibel, and Changhan Wang. 2020. FINDINGS OF THE IWSLT 2020 EVALUATION CAMPAIGN. In Proceedings of the 17th International Conference on Spoken Language Translation, pages 1-34, Online. Association for Computational Linguistics. +Parnia Bahar, Tobias Bieschke, and Hermann Ney. 2019. A Comparative Study on End-to-end Speech to Text Translation. In Proceedings of International Workshop on Automatic Speech Recognition and Understanding (ASRU), pages 792-799, Sentosa, Singapore. +Alexandre Bérard, Laurent Besacier, Ali Can Kocabiyikoglu, and Olivier Pietquin. 2018. End-to-End Automatic Speech Translation of Audiobooks. In Proceedings of ICASSP 2018 - IEEE International Conference on Acoustics, Speech and Signal Processing, Calgary, Alberta, Canada. +Alexandre Bérard, Olivier Pietquin, Christophe Servan, and Laurent Besacier. 2016. Listen and Translate: A Proof of Concept for End-to-End Speech-to-Text Translation. In NIPS Workshop on end-to-end learning for speech and audio processing, Barcelona, Spain. +Roldano Cattoni, Mattia Antonino Di Gangi, Luisa Bentivogli, Matteo Negri, and Marco Turchi. 2021. Must-c: A multilingual corpus for end-to-end speech translation. Computer Speech & Language, 66:101155. +Mattia A. Di Gangi, Matteo Negri, Roldano Cattoni, Roberto Dessi, and Marco Turchi. 2019. Enhancing Transformer for End-to-end Speech-to-Text Translation. In Proceedings of Machine Translation Summit XVII Volume 1: Research Track, pages 21-31, Dublin, Ireland. European Association for Machine Translation. +Marco Gaido, Mauro Cettolo, Matteo Negri, and Marco Turchi. 2021. CTC-based Compression for Direct Speech Translation. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 690-696, Online. Association for Computational Linguistics. +Alex Graves, Santiago Fernández, Faustino J. 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 (ICML), pages 369-376, Pittsburgh, Pennsylvania. + +Hirofumi Inaguma, Shun Kiyono, Kevin Duh, Shigeki Karita, Nelson Yalta, Tomoki Hayashi, and Shinji Watanabe. 2020. ESPnet-ST: All-in-One Speech Translation Toolkit. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 302-311, Online. Association for Computational Linguistics. +Suyoun Kim, Takaaki Hori, and Shinji Watanabe. 2017. Joint CTC-attention based end-to-end speech recognition using multi-task learning. In Proceedings of the 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 4835-4839, New Orleans, Louisiana. +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. 2004. Statistical Significance Tests for Machine Translation Evaluation. In Proceedings of the 2004 Conference on Empirical Methods in Natural Language Processing, pages 388-395, Barcelona, Spain. Association for Computational Linguistics. +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 (Volume 1: Long Papers), pages 66-75, Melbourne, Australia. 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. +Yuchen Liu, Junnan Zhu, Jiajun Zhang, and Chengqing Zong. 2020. Bridging the Modality Gap for Speech-to-Text Translation. +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. +Daniel S. Park, William Chan, Yu Zhang, Chung-Cheng Chiu, Barret Zoph, Ekin D. Cubuk, and Quoc V. Le. 2019. SpecAugment: A Simple Data Augmentation Method for Automatic Speech Recognition. In Proceedings of Interspeech 2019, pages 2613-2617, Graz, Austria. + +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, Belgium, Brussels. Association for Computational Linguistics. +Hasim Sak, Andrew Senior, Kanishka Rao, and Françoise Beaufays. 2015. Fast and Accurate Recurrent Neural Network Acoustic Models for Speech Recognition. In Proceedings of Interspeech 2015, Dresden, Germany. +Elizabeth Salesky, Matthias Sperber, and Alan W. Black. 2019. Exploring Phoneme-Level Speech Representations for End-to-End Speech Translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1835–1841, Florence, Italy. Association for Computational Linguistics. +Matthias Sperber and Matthias Paulik. 2020. Speech translation and the end-to-end promise: Taking stock of where we are. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7409-7421, Online. Association for Computational Linguistics. +Frederick W. M. Stentiford and Martin G. Steer. 1988. Machine Translation of Speech. British Telecom Technology Journal, 6(2):116-122. +Student. 1908. The probable error of a mean. Biometrika, 6(1):1-25. +Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. 2016. Rethinking the Inception Architecture for Computer Vision. In Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2818-2826, Las Vegas, Nevada, United States. +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 Proceedings of Advances in Neural Information Processing Systems 30 (NIPS), pages 5998-6008, Long Beach, California. +Alex Waibel, Ajay N. Jain, Arthur E. McNair, Hiroaki Saito, Alexander G. Hauptmann, and Joe Tebelskis. 1991. JANUS: A Speech-to-Speech Translation System Using Connectionist and Symbolic Processing Strategies. In Proceedings of the International Conference on Acoustics, Speech and Signal Processing, ICASSP 1991, pages 793-796, Toronto, Canada. +Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, and Juan Pino. 2020a. Fairseq S2T: Fast Speech-to-Text Modeling with Fairseq. In Proceedings of the 1st Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 10th International Joint Conference on Natural Language Processing: System Demonstrations, pages 33–39, Suzhou, China. Association for Computational Linguistics. + +Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. 2020b. Linformer: Self-Attention with Linear Complexity. +Ron J. Weiss, Jan Chorowski, Navdeep Jaitly, Yonghui Wu, and Zhifeng Chen. 2017. Sequence-to-Sequence Models Can Directly Translate Foreign Speech. In Proceedings of Interspeech 2017, pages 2625-2629, Stockholm, Sweden. +Biao Zhang, Ivan Titov, Barry Haddow, and Rico Senrich. 2020. Adaptive Feature Selection for End-to-End Speech Translation. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 2533–2544, Online. Association for Computational Linguistics. +Chang-Bin Zhang, Peng-Tao Jiang, Qibin Hou, Yunchao Wei, Qi Han, Zhen Li, and Ming-Ming Cheng. 2021. Delving Deep Into Label Smoothing. IEEE Transactions on Image Processing, 30:5984-5996. + +# A Training Details + +All our models are composed by 12 encoder layers and 6 decoder layers with 8 attention heads and are trained using label smoothed cross entropy (Szegedy et al., 2016) with the auxiliary CTC loss (Kim et al., 2017; Bahar et al., 2019) and Adam optimizer (Kingma and Ba, 2015). The number of parameters is $\sim 77\mathrm{M}$ for the baseline and $\sim 79\mathrm{M}$ for the Speechformer. The CTC is computed at the 8th encoder layer and its role is to predict the source transcription (lowercased and without punctuation), as in (Liu et al., 2020). The learning rate is set to 1e-3 with an inverse square-root scheduler and 10,000 warm-up updates. Mini-batches contain up to 5,000 tokens and we update gradients every 16 mini-batches. We apply SpecAugment (Park et al., 2019) and utterance-level cepstral mean and variance normalization. We filter out samples with duration exceeding 30s. The text is segmented in sub-word units with transcript and target Sentencepiece (Kudo and Richardson, 2018) unigram language models (Kudo, 2018) with size 5,000 and 8,000 respectively. We average 7 checkpoints around the best on the validation loss. Trainings were performed with 4 GPUs NVIDIA Tesla K-80 with 12GB of RAM and lasted about 3 days. + +# B Output examples + +Table 3 provides examples of the German translations generated by the baseline and by Speechformer for four utterances of the MuST-C test set, chosen among 200 sentences manually inspected by a C2 German speaker. These sentences have + +
(a) Word ordering
Audio ReferenceIt was a way that parents could figure out which were the right public schools for their kids. +Es ging um eine Methode, mit der Eltern hersausfinden konnen, welche die richtigen öffentlichen Schulen für ihre Kinder sind.
BaselineEs war eine Möglichkeit, dass Eltern hersausfinden konnen, welche für ihre Kinder die richtige öffentliche Schule war. +It was an opportunity for the parents to find out which were for their children the right public schools. +Es war eine Methode, mit der Eltern hersausfinden konnen, welche die richtigen öffentlichen Schulen für ihre Kinder waren. +It was a method with which the parents could find out which were the right public schools for their children.
(b) Punctuation handling
Audio ReferenceSo, sir, can you help me? I need help. +Also, mein Herr, konnen Sie mir halten? Ich brauche Hilfe.
BaselineEs ist also möglich, mir zu halten. +So it is possible to help me.
SpeechformerAlso, konnen Sie mir halten? Ich habe keine Hilfe. +So can you help me? I have no help.
(c) Audio misunderstanding
Audio ReferenceYou see Aluminum was the most valuable metal on the Planet, worth more than Gold and Platinum. +Aluminium war zu dieser Zeit das wertvollste Metall auf dem Planeten, wertvoller als Gold und Platinum.
BaselineAluminium war die wertvollste Metallart auf dem Planeten, mehr als Gold und Pflanzen. +Aluminum was the most valuable type of metal on the planet, more than gold and plants.
SpeechformerAluminium war das wertvollste Metall auf dem Planeten, mehr als Gold und Platin. +Aluminum was the most valuable metal on the planet, more than gold and platinum.
(d) Omission
Audio ReferenceBut the amazing thing about cities is they're worth so much more than it costs to build them. +Aber das Erstaunliche an Städten ist, dass sie so viel mehr wert sind, als es kostet sie zu bauen.
BaselineAber das Faszinierende an Städten ist, dass es viel mehr wert ist, als es zu bauen. +But the fascinating thing about cities is that it's worth a lot more than building it.
SpeechformerAber das Erstaunliche an Städten ist, dass sie viel mehr wert sind als sie es kostet, sie zu bauen. +But the amazing thing about cities is that they are worth a lot more than it costs to build them.
+ +Table 3: Examples of translation problems $- ( a ) , ( b ) , ( c ) -$ and omissions $- ( d ) -$ that Speechformer does not suffer from while baseline does. + +been selected to highlight the specific aspects that are better handled by Speechformer. + +Example $(a)$ exhibits a wrong word ordering present in the baseline output, i.e. it anticipates "für ihre Kinder" (for their kids) with respect to "die richtigen öffentlichen Schulen" (the right public schools). Our proposed architecture, instead, translates the sentence in the correct order, making the translation easier to be read and understood. + +Example $(b)$ displays that Speechformer shows better punctuation handling, which – we hypothesize – is the result of an improved representation of prosody and pauses. In this example, for instance, our architecture is capable of detecting a question (i.e. So can you help me?) and translating it, while the baseline does not translate the input in question form and omits the last part of the audio content. Listening to the audio, we noticed a long pause after the question. We suppose that this pause led the baseline to conclude the sentence, while Speechformer managed to translate the remaining part of the utterance by going beyond that pause. + +Our architecture shows an improved encoding of audio features that is reflected in its superior + +understanding of audio content. This emerges, indeed, from example (c), where the word Platinum is correctly recognized and translated by our system, while the baseline misunderstands and translates it in another word, "Pflanzen" (plants), with a completely different meaning. The better audio understanding of Speechformer is present in example (d) as well. On the contrary, the baseline omits part of the original sentence (i.e. it costs), with a huge impact on the meaning of the resulting sentence, while Speechformer does not lose audio details and produces a complete translation. In this example, we can also notice that our system better solves pronominal resolution as it chooses sie, which follows the grammatical gender and number of Staedten (i.e. plural feminine), while the baseline uses es, which wrongly agrees with das Faszinierende (i.e. singular neuter). + +# C Effect of Label Smoothing + +Label smoothing (Szegedy et al., 2016) is a widely adopted regularization factor (Zhang et al., 2021). As such, a more complex architecture that pro + +
Modelen-deen-esen-nl
baseline21.226.225.5
+ compression21.2+0.026.0-0.225.1-0.4
Plain ConvAttention21.6+0.425.6*-0.625.6+0.1
Speechformer22.3*+1.126.7*+0.526.2*+0.7
+ +Table 4: BLEU score on three language pairs of MuST-C tst-COMMON. The * symbol indicates statistically significant improvements over the baseline computed with bootstrap resampling (Koehn, 2004) with 10,000 samples, 1,000 sample size and $95\%$ significance level. + +cesses longer and potentially more redundant inputs – like our proposed Speechformer – can benefit more from its adoption. Hence, to validate that our gains are not due to a better regularization of the models and to assess the effect of label smoothing, we run experiments using the cross entropy loss without smoothing factor. The results are reported in Table 4. Compared with the scores reported in Section 4 of the paper, we can see that label smoothing brings significant gains for all the systems (ranging from 1.5 to 2.0 BLEU points). Most importantly, the improvements of the Speechformer architecture (0.5-1.1 BLEU) are similar to those achieved with label smoothing (0.5-0.8 BLEU). The minimal difference can be explained by statistical variations of the results, considering that those obtained without label smoothing are computed on a single run. We can conclude that these results confirm the efficacy of our architecture and the validity of our experiments, showing that they are not biased by a higher regularization that might favor our solution over the baseline. \ No newline at end of file diff --git a/speechformerreducinginformationlossindirectspeechtranslation/images.zip b/speechformerreducinginformationlossindirectspeechtranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..254a4ece924ca45dd6d6b71baa8f75d29133437c --- /dev/null +++ b/speechformerreducinginformationlossindirectspeechtranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61918619f9686266db1296786ffb9f4d3074a46cf4a3a372051eb53169a6d773 +size 349032 diff --git a/speechformerreducinginformationlossindirectspeechtranslation/layout.json b/speechformerreducinginformationlossindirectspeechtranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..14b63ff1acbefbe1c1bf81ebc910641a5b61d807 --- /dev/null +++ b/speechformerreducinginformationlossindirectspeechtranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7066c89479735781ab7f3bc3d9db622d499f8c4fe5efe92ff6aba75223ea56c6 +size 245901 diff --git a/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_content_list.json b/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b4cc16f7f993faff2f5779406ce15c366633f5c6 --- /dev/null +++ b/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8093a4f7e26b3967e6c563c5f0e622b9ad064cef65ef881ad62cd73622e22867 +size 52253 diff --git a/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_model.json b/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..af219fc2fffe25f00b7966336f0d3f17b43056c1 --- /dev/null +++ b/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3661d150a01bee2e35c30d2f84cb998f449be64ab55ac5e5436b7e9855002566 +size 64662 diff --git a/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_origin.pdf b/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6fb0c624e9493569a5d423b533e570ad475d94c4 --- /dev/null +++ b/spellbertalightweightpretrainedmodelforchinesespellingcheck/f0420c72-b7f2-4e69-a4ce-947b4c2b505a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee1463d547395898e7cae0166f751d3a24e9188154937ac21731c8a904dc4ff9 +size 501696 diff --git a/spellbertalightweightpretrainedmodelforchinesespellingcheck/full.md b/spellbertalightweightpretrainedmodelforchinesespellingcheck/full.md new file mode 100644 index 0000000000000000000000000000000000000000..4da672ef7982b157eafe43d6cdc98479dbaf05d6 --- /dev/null +++ b/spellbertalightweightpretrainedmodelforchinesespellingcheck/full.md @@ -0,0 +1,219 @@ +# SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check + +Tuo Ji, Hang Yan, Xipeng Qiu* + +School of Computer Science, Fudan University + +Shanghai Key Laboratory of Intelligent Information Processing, Fudan University + +{tji19, hyan19, xpqiu}@fudan.edu.cn + +# Abstract + +Chinese Spelling Check (CSC) is to detect and correct Chinese spelling errors. Many models utilize a predefined confusion set to learn a mapping between correct characters and its visually similar or phonetically similar misuses but the mapping may be out-of-domain. To that end, we propose SpellBERT, a pretrained model with graph-based extra features and independent on confusion set. To explicitly capture the two erroneous patterns, we employ a graph neural network to introduce radical and pinyin information as visual and phonetic features. For better fusing these features with character representations, we devise masked language model alike pre-training tasks. With this feature-rich pre-training, SpellBERT with only half size of BERT can show competitive performance and make a state-of-the-art result on the OCR dataset where most of the errors are not covered by the existing confusion set + +# 1 Introduction + +Spelling Check is to detect and correct Chinese spelling errors in sentences. However, it is a nontrivial task for Chinese spelling check because of the nature of ideographic language. Chinese has a large vocabulary including at least 3,500 common characters which leads to huge search space and an unbalanced distribution of errors. + +Though hard to cover most of the misuses, their patterns could be roughly reduced to visual or phonetic errors (Chang, 1995) as shown in Figure 1. The former type of errors have similar shapes as correct ones and they are often caused by optical character recognition (OCR) or morphology-based input method. The other type of errors have similar pronunciation as original ones and they are usually caused by automatic speech recognition (ASR) or phonetic-based input method. + +Previous work (Hsieh et al., 2013; Yu and Li, 2014; Wang et al., 2019a; Cheng et al., 2020) tend + +![](images/964540ce3cf13ce19b8b4eedefb13849c81545b5175f2454e4b00021bb346976.jpg) +Figure 1: The two erroneous patterns. (a) is a phonetic error and its pinyin have overlap with the correct ones. (b) is a visual error and its radicals also have overlap + +![](images/a20b4d060ed9d2fe00c94c94d5637dcc129128d0c09875dcbe25c366320441e5.jpg) + +to employ a predefined confusion set to find and filter correction candidates. Confusion set is constructed by incorrect stats (Liu et al., 2010) and it has a mapping between visually similar pairs and phonetically similar pairs in accord with erroneous patterns. However, these models only learn a shallow mapping from confusion set and their performance is heavily dependent on the quality of confusion set. But it is hard to find an up-to-date and in-domain confusion set. + +In this paper, we devise two pre-training tasks to model the two aforementioned erroneous patterns explicitly. To model visual errors, we introduce radical features. Chinese characters can be decomposed into various components namely radical. As for phonetic errors, we employ pinyin as features which are descriptions of pronunciation. We fuse these visual and phonetic features with character representations by relational graph convolutional network (Schlichtkrull et al., 2018). Likewise masked language model in BERT (Devlin et al., 2019), we randomly replace some characters and then predict the original visual and phonetic features with false input. Our model, SpellBERT, can intrinsically learn to correct errors based on visual or phonetic patterns rather than simple mapping. On the OCR dataset, where only a few errors are covered by confusion set, we make a state-of-the-art result and this indicates that SpellBERT can generalize well without depending on confusion set. + +On resource-constrained scenarios for deployment, making a model lightweight is necessary. SpellBERT only has half size of BERT and is more efficient for these scenarios. + +In summary, SpellBERT is independent on confusion set in training and inference phase. With only half size of BERT, SpellBERT can show competitive performance and generalize well. + +# 2 Related Work + +Current methods consider CSC as sequence generation problem or sequence labeling problem. Wang et al. (2019b) introduce copy mechanism to generate corrected sequence. Bao et al. (2020) unify single-character and multi-character correction by a chunk-based generative model. + +Pretrained models (PTMs) have made a success on sequence labeling tasks (Qiu et al., 2020). Masked language model (MLM) is introduced as pre-training task to predict masked or replaced words conditioned on context. The mode of MLM is intuitively appropriate to be transformed to predict spelling errors and correct them. Significant progress has been made by power of PTM (Hong et al., 2019). Based on MLM, confusion set is applied to narrow search space for predicting correct characters. Cheng et al. (2020) constructed a graph by confusion set to help final prediction. Nguyen et al. (2020) raised an adaptable confusion set but its training process is not end-to-end. + +Ideally, CSC corpus can be infinitely constructed by replacing words based on confusion set. Wang et al. (2018) generated 270k data by OCR- and ASR-based approaches. Zhang et al. (2020) created 5 million augmented data and Li et al. (2021) created 9 million augmented data by substitution-based method. Zhang et al. (2021) corrupted input sentence by randomly replacing characters with noisy-pinyin and the new pre-training task fitted well for CSC. + +More recently, some methods also utilized phonetic and visual features in CSC. Liu et al. (2021) employed a GRU(Bahdanau et al., 2014) to encode pinyin sequence and Chinese strokes sequence as extra features. Xu et al. (2021) had similar design but they encoded pictures of characters to get visual features. Huang et al. (2021) enriched character representations by knowledge of audio and visual modalities. Our method is different from all of these work. For phonetic features, we regard pinyin as a whole but not a sequence. For visual features, we used radicals which are higher-level features than strokes. And we incorporate these extra features by graph neural network. + +# 3 Approach + +We treat CSC as a sequence labeling problem. An input sequence with $n$ characters is represented as $\mathbf{X} = \{x_{1}, x_{2}, \dots, x_{n}\}$ . Our goal is to transform it into a target sequence $\mathbf{Y} = \{y_{1}, y_{2}, \dots, y_{n}\}$ . During which, incorrect characters will be detected and corrected. Obviously, the input and output share the same vocabulary and most of the output characters can be directly copied from input. The framework of our model is shown in Figure 2. It contains three parts, i.e., a BERT-based encoder, a feature-fusing module and a component for pretraining. We will progressively elaborate our design in detail. + +# 3.1 An MLM-based Backbone + +Many attribute the success of BERT (Devlin et al., 2019) to its MLM pre-training task. BERT randomly masked or replaced some tokens and then predict the original tokens. Regarding the masked and replaced tokens as spelling errors, BERT is properly adapted to be a spelling checker. Each input character $x_{i}$ is indexed to its embedding representation $\mathbf{e}_i$ by the BERT-embedding-layer. Then $\mathbf{e}_i$ will be passed to BERT-encoder-layers to get a representation $\mathbf{h}_i$ as follows: + +$$ +\mathbf {e} _ {i} = \operatorname {B E R T E m b e d d i n g} (\mathbf {x} _ {i}), \tag {1} +$$ + +$$ +\mathbf {h} _ {i} = \operatorname {B E R T E n c o d e r} \left(\mathbf {e} _ {i}\right), \tag {2} +$$ + +where $\mathbf{e}_i, \mathbf{h}_i \in \mathbb{R}^{1 \times d}$ and $d$ is the hidden dimension. After that, the $\mathbf{h}_i$ will be computed similarities with all character embeddings to get a predicted distribution $\hat{\mathbf{y}}_i$ over vocabulary as follows: + +$$ +\hat {\mathbf {y}} _ {\mathbf {i}} = \operatorname {S o f t m a x} \left(\mathbf {h} _ {i} \mathbf {E} ^ {T}\right), \tag {3} +$$ + +where $\mathbf{E} \in \mathbb{R}^{V \times d}$ ; $\hat{\mathbf{y}}_{\mathbf{i}} \in \mathbb{R}^{1 \times V}$ and $V$ is the vocabulary size. Here $\mathbf{E}$ refers to the BERT-embedding-layer and the $\mathrm{i}_{\mathrm{th}}$ row of $\mathbf{E}$ corresponds to $\mathbf{e}_i$ in Equation 1. Finally we use the character $x_{k}$ as the correction result for $x_{i}$ whose $\mathbf{e}_k$ has the highest similarity with $\mathbf{h}_i$ . + +# 3.2 Fusing Visual and Phonetic Features + +The above backbone lacks special modeling for this task. Chinese spelling errors can be roughly classified into two patterns. Visual errors have similar shapes as correct characters while phonetic errors have similar pronunciation. Some work utilize an external confusion set that has predefined mappings between visually similar pairs and phonetically similar pairs (Yu and Li, 2014; Wang et al., + +![](images/518fc0b9ece185105bcd41be2b239e9f26af1e9057cc5c35f9c3d45f18f84fec.jpg) +Figure 2: The architecture of SpellBERT. Green denotes correct characters while red denotes errors. Pinyin and radical features are fused by graph and then passed to a 4-layer BERT. We expect the model to do MLM, pinyin prediction and radical prediction of correct characters with false input. + +2019a; Cheng et al., 2020). These models relied on confusion set to filter candidates but the confusion set might be out-of-date or out-of-domain. + +To model the two erroneous patterns, we infuse character representations $\mathbf{e}_i$ with visual and phonetic features by incorporating radical and pinyin information. Chinese characters can be decomposed into components namely radicals and visual errors often have overlap radicals with the correct character. Pinyin is a sequence of pronunciation descriptions for Chinese characters and phonetic errors often have overlap pinyin. Based on the extra features, our model can automatically learn visually similar and phonetically similar mappings. + +We employ a relational graph convolutional network (Schlichtkrull et al., 2018) short as R-GCN to infill multiple types of features into character representations $\mathbf{e}_i$ in Equation 1. We view characters as nodes and input sequence $\mathbf{X}$ can be organized as a line graph naturally. Both radicals and pinyin are viewed as nodes of graph as well. If a radical or pinyin belong to a certain character, we construct connections between them as edges. We regard these connections as different depending on the pair of nodes between them. Besides, + +we construct edges between neighboring characters because local context information is beneficial for better-incorporating pinyin and radical features. As a result, We define the following types of edges: + +- An edge between a character and a radical +- An edge between a character and a pinyin +- An edge between a character and a neighboring character within a fixed-length context +- An edge between a character and itself + +We initialize feature of character-node by character-embedding $\mathbf{e}_i$ in Euqation 1. To represent and update features of radical-node and pinyin-node, we also construct an extra embedding table which is initialized by averaging their most related character-embeddings. As shown in Figure 2, these features diffuse on a relational graph as following: + +$$ +\hat {\mathbf {e}} _ {i} = \sigma \left(\sum_ {r \in \mathcal {R}} \sum_ {j \in \mathcal {N} _ {i} ^ {r}} \frac {1}{c _ {i , r}} \mathbf {W} _ {r} \mathbf {e} _ {j} + \mathbf {W} _ {0} \mathbf {e} _ {i}\right), \tag {4} +$$ + +where $\mathbf{e}_i$ means character-embedding of $x_{i}$ and $\mathbf{e}_j$ means feature of connected node j; $r$ denotes the type of edge; $\mathcal{N}_i^r$ refers to the set of connected nodes for edge type $r$ ; $\mathbf{W}_r$ is the transformation layer of edge type $r$ and $\mathbf{c}_{i,r}$ is a problem-specific normalization constant which is set as $|\mathcal{N}_i^{\mathrm{r}}|$ here. The final $\hat{\mathbf{e}}_i$ can be viewed as character representation enhanced by radical and pinyin information. Finally, we combine enhanced representation and original character-embedding and Equation 3 can be updated as following: + +$$ +\mathbf {h} _ {i} = \operatorname {B E R T E n c o d e r} \left(\mathbf {e} _ {i} + \hat {\mathbf {e}} _ {i}\right), \tag {5} +$$ + +where $\mathbf{h}_i$ denote the final representation of each character. + +# 3.3 Enhanced Pretraining Tasks for CSC + +It has been shown that external information can be better integrated into BERT by pre-training alike tasks (Peters et al., 2019; Zhang et al., 2019; Sun et al., 2020; Ma et al., 2020). Considering the radical and pinyin features are externally added by design, we devise two more pre-training alike tasks which are radical prediction and pinyin prediction. + +In MLM, Devlin et al. (2019) randomly masked a percentage of input tokens and then predict these tokens. In radical and pinyin prediction, we randomly mask connections from characters to their radicals and pinyin and then predict the masked + +connections. Through reconstructing connections, the model can learn a better representation that contains not only contextual information but also visual and phonetic information. + +Same as MLM, we randomly choose $15\%$ of characters to process. If a character is chosen, our potential practices are shown below: + +- Keep it unchanged $10\%$ of the time. Then predict the character itself, its radicals, and its pinyin. This is to match downstream fin-tuning where each character can directly see all of its radicals and pinyin. +- Replace it with [MASK] $60\%$ of the time and mask all of its connections with a probability of $80\%$ . Then predict the masked character and the masked connections. +- Replace it with a confusing word sampled from confusion set $30\%$ of the time and mask all of its connections with a probability of $80\%$ . Then predict the original character and its connections. This is to force our model to correct characters based on false radicals and pinyin of errors. Note that we only use confusion set in this stage to construct misspellings. + +In our graph, edges have no representations and the graph is utilized only between BERT-embedding-layer and BERT-encoder-layers. So we transform the task of edge-prediction into token-classification. For each character $\mathbf{x}_i$ , we take one of its pinyin and radicals as ground-truth and negatively sample other pinyin and radicals that do not belong to the character. We use feature-embeddings of these pinyin and radicals as a classified layer to compute their similarities with $\mathbf{h}_i$ from BERT-encoder-layer in Equation 2. Related embeddings will be drawn close to each other, and unrelated embeddings will be pulled away from each other. + +# 3.4 Reducing Parameters + +Given the need of computational efficiency for deployment, it is necessary to get a lightweight model. We only use 4 layers of BERT to initialize, pre-train, and fine-tune our model and which reduces the total number of parameters from $110\mathrm{M}$ to $55\mathrm{M}$ . We also measure the inference speed of our lightweight model and the experiments result show that it has better time-efficiency compared with a 12-layer BERT. + +# 4 Experiments + +# 4.1 Pre-training Setup + +We use BERT (Devlin et al., 2019) base as initialization and only the first 4 layers are utilized. Our model is implemented by PyTorch (Paszke et al., 2019) and DGL (Wang et al., 2019c). We randomly select 1M sentences provided by Xu (2019) as pretraining corpus and pad the sentences to a max length of 128. We set the learning rate as 5e-5, batch size as 1024, and pre-train 10K steps on 4 RTX 3090 for around 2 days. + +# 4.2 Dataset and Fine-tuning Setup + +We conduct CSC experiments on three widely used datasets SIGHAN14 (Yu et al., 2014), SIGHAN15 (Tseng et al., 2015), OCR (Hong et al., 2019) and mark them as $\mathrm{csc}_{14}$ , $\mathrm{csc}_{15}$ andOCR. + +The original corpus of $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ was collected from essays written by learners of Chinese as a foreign language and it was in Traditional Chinese. Wang et al. (2019a), Zhang et al. (2020), and Nguyen et al. (2020) transformed it into Simplified Chinese and used augmented data provided by Wang et al. (2018). Because our pre-training corpus was in Simplified Chinese, we use the latter setting. We directly use the corpus provided by Cheng et al. (2020). Under this setting, the training set of $\mathrm{csc}_{14}$ , $\mathrm{csc}_{15}$ and the augmented data provided by Wang et al. (2018) are combined as a new training set. We fine-tune our model on the test set of $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ separately. + +ocr is a Simplified Chinese dataset of which the sentences are much shorter and extracted from the entertainment domain. We only use the data fromOCR to train and test and it has 4575 sentences in total. + +For different datasets, we find the following ranges of hyperparameters work well: the batch size is set to among $\{32, 64\}$ , the learning rate is set to among $\{1e-5, 2e-5, 3e-5\}$ and the number of epochs is ranging from 5 to 20. + +On $\csc_{14}$ and $\csc_{15}$ , we evaluate our model in sentence-level by the official tool (Tseng et al., 2015). And onOCR, the metric is in edit-level by a different official tool (Wu et al., 2013). + +# 4.3 Results and Analysis + +Main Results As shown in Table 1, we compare SpellBERT with recent work and a 4-layer BERT baseline. All of them are BERT-based which means that their number of parameters are at least twice + +
ModelDetection LevelCorrection Level
ocrcsc14csc15ocrcsc14csc15
PRF1PRF1PRF1PRF1PRF1PRF1
Nguyen et al. (2020) (BERT 12 layers)---82.561.670.584.571.877.6---82.160.269.484.270.276.5
Bao et al. (2020) (BERT 12 layers)77.663.369.7------46.537.941.7------
Cheng et al. (2020) (BERT 12 layers)---83.169.575.785.980.683.1---82.867.874.585.477.681.3
BERT (4 layers)67.835.246.482.659.068.885.268.976.243.222.429.582.458.068.184.866.974.8
SpellBERT (4 layers)83.560.470.183.162.071.087.573.680.066.047.755.482.961.270.487.171.578.5
w/o graph81.261.469.981.862.070.587.873.179.861.146.252.681.560.569.487.571.178.4
w/o pre-training67.636.147.181.360.569.386.470.777.851.727.636.081.059.368.586.068.075.9
+ +Table 1: Results in detection-level and correction-level. For baselines, we use their reported results. Hong et al. (2019) and Bao et al. (2020) used the Traditional Chinese corpus on $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ , and which makes their results incomparable to ours. + +
DatasetNoisesErrors covered by confusion sets
ocr test0/1000 (0%)302/1303 (23.2%)
csc14test16/1062 (1.5%)663/792 (83.7%)
csc15test10/1100 (0.9%)605/715 (84.6%)
+ +as many as ours. However, by fusing pinyin and radical features and the feature-rich pre-training, SpellBERT still has the best performance on the OCR dataset. Compared with Nguyen et al. (2020), our work has better results on both $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ . However, there is still a gap between SpellBERT and SpellGCN (Cheng et al., 2020) which means that our devised extra modules can not completely make up for the reduced size of model. + +Effectiveness of Modules We also remove graph and pre-training stage respectively to test their effectiveness. The results showed that pre-training can generally bring significant improvements on all datasets which suggests that pre-training is an effective way on CSC. The contribution of the graph mechanism is not that impressive but this makes it possible to only transfer our encoder parameters to other architectures. + +Impact of Confusion Set Notice that our improvements over previous work are more obvious onOCR than that on $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ . Firstly, there are inevitable noises when converting data into Simplified Chinese and the noisy ratio is $1.5\%$ and $0.9\%$ for $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ . The other reason is that previous work such as Nguyen et al. (2020) and Bao et al. (2020) relied on confusion set to filter candidates. $83.7\%$ and $84.6\%$ of test errors in $\mathrm{csc}_{14}$ and $\mathrm{csc}_{15}$ are covered by confusion set which is an ideal and infrequent situation. OnOCR which has much fewer errors covered by confusion set, they + +Table 2: Stats of datasets. Noises denote the noisy data when converting data to Simplified Chinese. The rightmost column refers to the number of errors covered by confusion set (Wu et al., 2013) on test data + +
DatasetAve LengthTime per SentSpeedup
Ours12-layer BERT
ocr test10.248761.58x
csc14test50.0981531.56x
csc15test30.6771191.54x
+ +Table 3: Speed comparison (ms/sentence). Preprocessing time is excluded. We set batch size as 1 and do experiments on 4 cores of a Intel(R) Xeon(R) Silver 4114T CPU following Hong et al. (2019). + +naturally performed worse. + +OnOCR, confusion set can simply cover $23.2\%$ of errors and the average length of sentences are much shorter. The confusion set can be viewed as out-of-domain onOCR. SpellBERT substantially improves the performance on this dataset which indicates that SpellBERT can generalize well on different corpus without dependence on confusion set. The ablation studies further demonstrate that our proposed modules help deal with unseen errors. + +Efficiency Analysis With only half the number of parameters of a 12-layer BERT, SpellBERT has the best space efficiency compared to BERT-based work. To verify time efficiency, we incorporate a speed measure in terms of absolute time consumption per sentence mentioned in Hong et al. (2019). Results in Table 3 indicate that SpellBERT can speed up at least 1.5 times. + +# 5 Conclusion + +In this work, we propose a lightweight pretrained model, SpellBERT, for Chinese spelling check. We incorporate pinyin and radicals as phonetic and visual features and design two pre-training tasks to encourage the pre-trained model to explicitly capture erroneous patterns. Experiments show that SpellBERT has competitive performance compared to the large pretrained models. Besides, SpellBERT can be directly used without confusion set in the fine-tuning and inference phase, which is more + +convenient to use and easier to deal with the errors uncovered by the existing confusion sets. + +# Acknowledgement + +This work was supported by the National Key Research and Development Program of China (No. 2020AAA0108702) and National Natural Science Foundation of China (No. 62022027). + +# References + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +Zuyi Bao, Chen Li, and Rui Wang. 2020. Chunk-based chinese spelling check with global optimization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, EMNLP 2020, Online Event, 16-20 November 2020, pages 2031-2040. Association for Computational Linguistics. +Chao-Huang Chang. 1995. A new approach for automatic chinese spelling correction. In Proceedings of Natural Language Processing Pacific Rim Symposium, volume 95, pages 278-283. CiteSeer. +Xingyi Cheng, Weidi Xu, Kunlong Chen, Shaohua Jiang, Feng Wang, Taifeng Wang, Wei Chu, and Yuan Qi. 2020. Spellgen: 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, ACL 2020, Online, July 5-10, 2020, pages 871-881. 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. +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@EMNLP 2019, Hong Kong, China, November 4, 2019, pages 160-169. Association for Computational Linguistics. +Yu-Ming Hsieh, Ming-Hong Bai, and Keh-Jiann Chen. 2013. Introduction to CKIP chinese spelling check system for SIGHAN bakeoff 2013 evaluation. In Proceedings of the Seventh SIGHAN Workshop on Chinese Language Processing, SIGHAN@IJCNLP + +2013, Nagoya, Japan, October 14-18, 2013, pages 59-63. Asian Federation of Natural Language Processing. +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. +Chong Li, Cenyuan Zhang, Xiaoqing 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, 23rd International Conference on Computational Linguistics, Posters Volume, 23-27 August 2010, Beijing, China, pages 739-747. Chinese Information Processing Society of China. +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. +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, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pages 39-50. International Committee on Computational Linguistics. +Minh Nguyen, Gia H. Ngo, and Nancy F. Chen. 2020. Adaptable filtering using hierarchical embeddings for chinese spell check. CoRR, abs/2008.12281. +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Köpf, 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. +Matthew E. Peters, Mark Neumann, Robert L. Logan IV, Roy Schwartz, Vidur Joshi, Sameer Singh, and Noah A. Smith. 2019. Knowledge enhanced contextual word 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 2019, Hong Kong, China, November 3-7, 2019, pages 43-54. Association for Computational Linguistics. +Xipeng Qiu, TianXiang Sun, Yige Xu, Yunfan Shao, Ning Dai, and Xuanjing Huang. 2020. Pre-trained models for natural language processing: A survey. _SCIENCE CHINA Technological Sciences_, 63(10):1872-1897. +Michael Sejr Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. 2018. Modeling relational data with graph convolutional networks. In *The Semantic Web - 15th International Conference*, ESWC 2018, Heraklion, Crete, Greece, June 3-7, 2018, Proceedings, volume 10843 of Lecture Notes in Computer Science, pages 593-607. Springer. +Tianxiang Sun, Yunfan Shao, Xipeng Qiu, Qipeng Guo, Yaru Hu, Xuanjing Huang, and Zheng Zhang. 2020. Colake: Contextualized language and knowledge embedding. In Proceedings of the 28th International Conference on Computational Linguistics, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pages 3660-3670. International Committee on Computational Linguistics. +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, SIGHAN@IJCNLP 2015, Beijing, China, July 30-31, 2015, pages 32-37. 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, Brussels, Belgium, October 31 - November 4, 2018, pages 2517-2527. Association for Computational Linguistics. +Dingmin Wang, Yi Tay, and Li Zhong. 2019a. Confusionset-guided pointer networks for Chinese spelling check. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5780-5785. +Dingmin Wang, Yi Tay, and Li Zhong. 2019b. Confusionset-guided pointer networks for chinese + +spelling check. 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 5780-5785. Association for Computational Linguistics. +Minjie Wang, Lingfan Yu, Da Zheng, Quan Gan, Yu Gai, Zihao Ye, Mufei Li, Jinjing Zhou, Qi Huang, Chao Ma, Ziyue Huang, Qipeng Guo, Hao Zhang, Haibin Lin, Junbo Zhao, Jinyang Li, Alexander J. Smola, and Zheng Zhang. 2019c. Deep graph library: Towards efficient and scalable deep learning on graphs. CoRR, abs/1909.01315. +Shih-Hung Wu, Chao-Lin Liu, and Lung-Hao Lee. 2013. Chinese spelling check evaluation at SIGHAN bake-off 2013. In Proceedings of the Seventh SIGHAN Workshop on Chinese Language Processing, SIGHAN@IJCNLP 2013, Nagoya, Japan, October 14-18, 2013, pages 35-42. Asian Federation of Natural Language Processing. +Bright Xu. 2019. Nlp chinese corpus: Large scale chinese corpus for nlp. +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. +Junjie Yu and Zhenghua Li. 2014. Chinese spelling error detection and correction based on language model, pronunciation, and shape. In Proceedings of The Third CIPS-SIGHAN Joint Conference on Chinese Language Processing, Wuhan, China, October 20-21, 2014, pages 220-223. 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, Wuhan, China, October 20-21, 2014, pages 126-132. Association for Computational Linguistics. +Ruiqing Zhang, Chao Pang, Chuanqiang Zhang, Shuo-huan 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, ACL 2020, Online, July 5-10, 2020, pages 882-890. 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 Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, pages 1441-1451. Association for Computational Linguistics. \ No newline at end of file diff --git a/spellbertalightweightpretrainedmodelforchinesespellingcheck/images.zip b/spellbertalightweightpretrainedmodelforchinesespellingcheck/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..efc82358fb1b9572a4a35378c4675099ac07d0fc --- /dev/null +++ b/spellbertalightweightpretrainedmodelforchinesespellingcheck/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43ed3a2fc496adbf9fe48fc941e71f3c5919dbd7377dda00f163097171ceab31 +size 223383 diff --git a/spellbertalightweightpretrainedmodelforchinesespellingcheck/layout.json b/spellbertalightweightpretrainedmodelforchinesespellingcheck/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..3fb45013fb58cd11542c4a28bf0770b1ec23ca53 --- /dev/null +++ b/spellbertalightweightpretrainedmodelforchinesespellingcheck/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbb81df53a6f14bbad4447dd5552497f3eabb01e33d38169d690e78b46598521 +size 262221 diff --git a/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_content_list.json b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a4fcbcd07079dfbf821b9db08b35a845107bd6f9 --- /dev/null +++ b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2fb0e08ed5f4703b7c30530d3395cdca5fb4c61d706c4d7342a52d7bc8ae0f92 +size 103822 diff --git a/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_model.json b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_model.json new file mode 100644 index 0000000000000000000000000000000000000000..db8ec736c350a9be77d45a6cb22cdcbfe68199e2 --- /dev/null +++ b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:671d413837e784938cb3fe951e69d8ab4d619b9eeec67c9c958f4adc2847d8e0 +size 127528 diff --git a/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_origin.pdf b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..79534d445547d013a569e4b5ad040aa9867c7d7a --- /dev/null +++ b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/44c1324a-af57-40d0-b544-4b6b3ed17ca3_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b291161ed66d3e85fa6195df89ff19e24fd77efcdaa73dd8d8a7caa37be79bf0 +size 15921518 diff --git a/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/full.md b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2f32ace38cefb0d42583185df0e923c4c2241ff8 --- /dev/null +++ b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/full.md @@ -0,0 +1,449 @@ +# Stepmothers are mean and academics are pretentious: What do pretrained language models learn about you? + +Rochelle Choenni + +University of Amsterdam + +r.m.v.k.choenni@uva.nl + +Ekaterina Shutova + +University of Amsterdam + +e.shutova@uva.nl + +Robert van Rooij + +University of Amsterdam + +r.a.m.vanrooij@uva.nl + +# Abstract + +Warning: this paper contains content that may be offensive or upsetting. + +In this paper, we investigate what types of stereotypical information are captured by pretrained language models. We present the first dataset comprising stereotypical attributes of a range of social groups and propose a method to elicit stereotypes encoded by pretrained language models in an unsupervised fashion. Moreover, we link the emergent stereotypes to their manifestation as basic emotions as a means to study their emotional effects in a more generalized manner. To demonstrate how our methods can be used to analyze emotion and stereotype shifts due to linguistic experience, we use fine-tuning on news sources as a case study. Our experiments expose how attitudes towards different social groups vary across models and how quickly emotions and stereotypes can shift at the fine-tuning stage. + +# 1 Introduction + +Pretraining strategies for large-scale language models (LMs) require unsupervised training on large amounts of human generated text data. While highly successful, these methods come at the cost of interpretability as it has become increasingly unclear what relationships they capture. Yet, as their presence in society increases, so does the importance of recognising the role they play in perpetuating social biases. In this regard, Bolukbasi et al. (2016) first discovered that contextualized word representations reflect gender biases captured in the training data. What followed was a suite of studies that aimed to quantify and mitigate the effect of harmful social biases in word (Caliskan et al., 2017) and sentence encoders (May et al., 2019). Despite these studies, it has remained difficult to define what constitutes "bias", with most work focusing on "gender bias" (Manela et al., 2021; Sun et al., 2019) or "racial bias" (Davidson et al., 2019; + +Sap et al., 2019). More broadly, biases in the models can comprise a wide range of harmful behaviors that may affect different social groups for various reasons (Blodgett et al., 2020). + +In this work, we take a different focus and study stereotypes that emerge within pretrained LMs instead. While bias is a personal preference that can be harmful when the tendency interferes with the ability to be impartial, stereotypes can be defined as a preconceived idea that (incorrectly) attributes general characteristics to all members of a group. While the two concepts are closely related i.e., stereotypes can evoke new biases or reinforce existing ones, stereotypical thinking appears to be a crucial part of human cognition that often emerges implicitly (Hinton, 2017). Hinton (2017) argued that implicit stereotypical associations are established through Bayesian principles, where the experience of their prevalence in the world of the perceiver causes the association. Thus, as stereotypical associations are not solely reflections of cognitive bias but also stem from real data, we suspect that our models, like human individuals, pick up on these associations. This is particularly true given that their knowledge is largely considered to be a reflection of the data they are trained on. Yet, while we consider stereotypical thinking to be a natural side-effect of learning, it is still important to be aware of the stereotypes that models encode. Psychology studies show that beliefs about social groups are transmitted and shaped through language (Maass, 1999; Beukeboom and Burgers, 2019). Thus, specific lexical choices in downstream applications not only reflect the model's attitude towards groups but may also influence the audience's reaction to it, thereby inadvertently propagating the stereotypes they capture (Park et al., 2020). + +Studies focused on measuring stereotypes in pretrained models have thus far taken supervised approaches, relying on human knowledge of common stereotypes about (a smaller set of) social groups + +(Nadeem et al., 2020; Nangia et al., 2020). This, however, bears a few disadvantages: (1) due to the implicit nature of stereotypes, human defined examples can only expose a subset of popular stereotypes, but will omit those that human annotators are unaware of (e.g. models might encode stereotypes that are not as prevalent in the real world); (2) stereotypes vary considerably across cultures (Dong et al., 2019), meaning that the stereotypes tested for will heavily depend on the annotator's cultural frame of reference; (3) stereotypes constantly evolve, making supervised methods difficult to maintain in practice. Therefore, similar to Field and Tsvetkov (2020), we advocate the need for implicit approaches to expose and quantify bias and stereotypes in pretrained models. + +We present the first dataset of stereotypical attributes of a wide range of social groups, comprising $\sim 2\mathrm{K}$ attributes in total. Furthermore, we propose a stereotype elicitation method that enables the retrieval of salient attributes of social groups encoded by state-of-the-art LMs in an unsupervised manner. We use this method to test the extent to which models encode the human stereotypes captured in our dataset. Moreover, we are the first to demonstrate how training data at the fine-tuning stage can directly affect stereotypical associations within the models. In addition, we propose a complementary method to study stereotypes in a more generalized way through the use of emotion profiles, and systematically compare the emerging emotion profiles for different social groups across models. We find that all models vary considerably in the information they encode, with some models being overall more negatively biased while others are mostly positive instead. Yet, in contrast to previous work, this study is not meant to advocate the need for debiasing. Instead, it is meant to expose varying implicit stereotypes that different models incorporate and to bring awareness to how quickly attitudes towards groups change based on contextual differences in the training data used both at the pretraining and fine-tuning stage. + +# 2 Related work + +Previous work on stereotypes While studies that explicitly focus on stereotypes have remained limited in NLP, several works on bias touch upon this topic (Blodgett et al., 2020). This includes, for instance, studying specific phenomena such as the infamous 'Angry Black Woman' stereotype and the 'double bind' (Heilman et al., 2004) theory (Kir + +itchenko and Mohammad, 2018; May et al., 2019; Tan and Celis, 2019), or relating model predictions to gender stereotype lexicons (Field and Tsvetkov, 2020). To the best of our knowledge, Nadeem et al. (2020); Nangia et al. (2020) and Manela et al. (2021) are the first to explicitly study stereotypes in pretrained sentence encoders. While Manela et al. (2021) focus on gender stereotypes using the Winobias dataset (Zhao et al., 2018), the other works propose new crowdsourced datasets (i.e. StereoSet and Crowspair) with stereotypes that cover a wide range of social groups. All datasets, however, have a similar set-up: they contain pairs of sentences of which one is more stereotypical than the other. Working in the language modeling framework, they evaluated whether the model "prefers" the stereotypical sentence over the anti-stereotypical one. In contrast, we propose a different experimental setup and introduce a new dataset that leverages search engines' autocomplete suggestions for the acquisition of explicit stereotypical attributes. Instead of indirectly uncovering stereotypes through comparison, our elicitation method directly retrieves salient attributes encoded in the models. Our technique is inspired by Kurita et al. (2019), but while they measure the LM probability for completing sentences with the pronouns she and he specifically, we study the top $k$ salient attributes without posing any restrictions on what these could be. Moreover, we are the first to include both monolingual and multilingual models in our analysis. + +Stereotype-driven emotions Stereotypes are constantly changing and identifying negative ones in particular, is an inherently normative process. While some stereotypes clearly imply disrespect (e.g., women are incompetent), others emerge from excessive competence instead (e.g., Asians are good at math). Moreover, stereotypical content is heavily influenced by the social pressures of society at the time. Cuddy et al. (2009) argue that no stereotype remains stable and predictable from theoretical principles. Hence, many social psychologists have abandoned the study of stereotype content to focus on systematic principles that generalize across different specific instances of stereotypes instead, presumably making them more stable over time and place (Cuddy et al., 2009; Mackie et al., 2000; Weiner, 1993). Similarly, we explore a more robust approach to uncovering stereotypes in pretrained LMs by studying how stereotypes are more generally manifested as varying emotion profiles in + +
Search queryCategorySocial groupStereotypical attributesSearch engine
Why are black people soraceblack peoplefast, athletic, hated, angry, loudYahoo
Why are british people soracebritish peoplepolite, pale, tall, reserved, coldDuckDuckGo
Why are californians solifestylecaliforniansentitled, rich, flaky, backstabbymultiple
Why are comedians soprofessioncomediansfunny, sad, intelligent, depressedGoogle
Why are millennials soagemillennialsfragile, nostalgic, lonely, brokeGoogle
Why is Norway socountryNorwayhealthy, wealthy, happy, richmultiple
Why are conservatives sopoliticalconservativesangry, controlling, racistYahoo
Why are mortons soreligionmormonsmisunderstood, rich, successful, nicemultiple
+ +Table 1: A few (random) examples of stereotypical attributes sampled from the dataset. Note that the number of attributes vary as we do not retrieve the same number for each social group per search engine. + +the models. Previous works show that groups evoke different emotional profiles (Cottrell and Neuberg, 2005; Tapias et al., 2007; Mackie et al., 2000), and a variety of theories link particular intergroup relations to distinct stereotype-driven emotions such as disgust and anger (Harris and Fiske, 2006, 2009). + +# 3 Stereotypes from search engines + +Retrieving human stereotypes in an implicit manner can be useful as people are likely to give more politically correct answers when asked for stereotypes explicitly. Questions we ask to search engines are often done in the comfort of our own homes, making them likely to reflect true stereotypes that are out there in the real world (Stephens-Davidowitz, 2018). When feeding search engines queries that already imply a stereotype about a specific social group, the suggested completions are often salient (i.e. stereotypical) attributes of that particular group e.g., search query: 'Why are Asian parents so' $\rightarrow$ completion: 'strict'. As the auto-complete suggestions are based on popular human generated queries, we exploit this property for the acquisition of stereotypical attributes. + +Social groups We use 382 social groups which we divide into 9 categories: age (11), gender (26), profession (115), race (99), country (73), religion (10), political (9), sexuality (12) and lifestyle (19). See Appendix C for the full lists of social groups per category. The social groups include, but are not limited to, the ones used by Nadeem et al. (2020) who collected Wikidata relation triples to automatically retrieve target terms. + +Templates To increase coverage, we design 5 slightly varying templates to retrieve autocomplete suggestions for. For groups pertaining to people we use the templates: + +- 'Why are [TGT] so [ATTR]?' +- 'What makes [TGT] so [ATTR]?' +How come [TGT] are so [ATTR]? + +- 'Why are [TGT] always so [ATTR]?' +- 'Why are all [TGT] so [ATTR]? + +For countries we use: + +- 'Why is [TGT] so [ATTR]?' +- 'What makes [TGT] so [ATTR]?' +- 'How come [TGT] is so [ATTR]?' +- 'Why is [TGT] always so [ATTR]?' +- 'Why are all people in [TGT] so [ATTR]?' + +where [TGT] are social groups for which we search stereotypes and [ATTR] is the salient attribute with which the search engine completes the sequence. We tested other (longer and more elaborate) templates but we found that they did not produce many autocomplete suggestions. In fact, we believe that the above queries are so successful precisely because of their simplicity, given that people are likely to keep search queries concise. + +Search engines Due to Google's hate speech filtering system the autocomblection feature is disabled for frequently targeted groups e.g. black people, Jewish people and members of the LGBTQ+ community. Thus, we retrieve autocompactee suggestions from 3 search engines: Google, Yahoo and DuckDuckGo. In many cases, identical completions were given by multiple search engines. We sort these duplicate samples under the category 'multiple engines'. We find that most negative (offensive) stereotypes are retrieved from Yahoo. + +Pre-processing We clean up the dataset manually, using the following procedure: + +1. Remove noisy completions that do not result in a grammatically correct sentence e.g. non adjectives. +2. Remove specific trend-sensitive references: e.g. to video games 'why are asians so good at league of legends'. +3. Remove neutral statements not indicative of stereotypes e.g. 'why are [TGT] so called'. +4. We filter out completions consisting of mul + +tiple words.1 Yet, when possible, the input is altered such that only the key term has to be predicted by the model e.g., 'Why are russians so $x$ ,where $\mathrm{x} =$ good at playing chess $\rightarrow$ 'Why are russians so good at $x$ , $\mathrm{x} =$ chess. + +The final dataset contains $\sim 2\mathrm{K}$ stereotypes about 274 social groups. The stereotypes are distributed across categories as follows - profession: 713, race: 412, country: 396, gender: 198, age: 171, lifestyle: 123, political: 50, religion: 36. None of the search engines produce stereotypical autocomplete suggestions for members of the LGBTQ+ community. In Table 1 we provide some examples from the dataset. See Appendix B for more details on the data acquisition and search engines. The full code and dataset are publicly available. + +# 4 Correlating human stereotypes with salient attributes in pretrained models + +To test for human stereotypes, we propose a stereotype elicitation method that is inspired by cloze testing, a technique that stems from psycholinguistics. Using our method we retrieve salient attributes from the model in an unsupervised manner and compute recall scores over the stereotypes captured in our search engine dataset. + +Pretrained models We study different types of pretrained LMs of which 3 are monolingual and 2 multilingual: BERT (Devlin et al., 2019) uncased trained on the BooksCorpus dataset (Zhu et al., 2015) and English Wikipedia; RoBERTa (Liu et al., 2019), the optimized version of BERT that is in addition trained on data from CommonCrawl News (Nagel, 2016), OpenTextCorpus (Gokaslan and Cohen, 2019) and STORIES (Trinh and Le, 2018); BART, a denoising autoencoder (Lewis et al., 2020) that while using a different architecture and pretraining strategy from RoBERTa, uses the same training data. Moreover, we use mBERT, that apart from being trained on Wikipedia in multiple languages, is identical to BERT. We use the uncased version that supports 102 languages. Similarly, XLM-R is the multilingual variant of RoBERTa (Conneau et al., 2020) that is trained on cleaned CommonCrawl data (Wenzek et al., 2020) and + +supports 100 languages. We include both versions of a model (i.e. Base and Large) if available. Appendix A provides more details on the models. + +Table 2: Ranking: 'why are old people so bad with'. +Prior Post + +
1. memory1. memory
2. math2. alcohol
3. money3. technology
4. children4. dates
+ +Stereotype elicitation method For each sample in our dataset we feed the model the template sentence and replace [ATTR] with the [MASK] token. We then retrieve the top $k = 200$ model predictions for the MASK token, and test how many of the stereotypes found by the search engines are also encoded in the LMs. We adapt the method from Kurita et al. (2019) to rank the top $k$ returned model outputs based on their typicality for the respective social group. We quantify typicality by computing the log probability of the model probability for the predicted completion corrected for by the prior probability of the completion e.g.: + +$$ +P _ {\text {p o s t}} (y = \text {s t r i c t} | \text {W h y a r e p a r e n t s} y?) \tag {1} +$$ + +$$ +P _ {p r i o r} (y = \text {s t r i c t} | \text {W h y a r e [ M A S K ] s o} y?) \tag {2} +$$ + +$$ +p = \log \left(P _ {\text {p o s t}} / P _ {\text {p r i o r}}\right) \tag {3} +$$ + +i.e., measuring association between the words by computing the chance of completing the template with 'strict' given 'parents' corrected by the prior chance of 'strict' given any other group. Note that Eq. 3 has been well-established as a measure for stereotypicality in research from both social psychology (McCauley et al., 1980) and economics (Bordalo et al., 2016). After re-ranking by typicality, we evaluate how many of the stereotypes are correctly retrieved by the model through recall@ $k$ for each of the 8 target categories. + +Results Figure 1 shows the recall@ $k$ scores per model separated by category, showcasing the ability to directly retrieve stereotypical attributes of social groups using our elicitation method. While models capture the human stereotypes to similar extents, results vary when comparing across categories with most models obtaining the highest recall for country stereotypes. Multilingual models obtain relatively low scores when recalling stereotypical attributes pertaining to age, gender and political groups. Yet, XLMR-L is scoring relatively high on stereotypical profession and race attributes. + +![](images/65a7099b266191cb1a82c7a79eaee5182648975c73c35c23f41335ef66b4b10c.jpg) + +![](images/ae807d06cdce0e6631c3657dd62612608a8b414d8284485be641dda4d82e7df0.jpg) + +![](images/ed504a7417a4f92f5f3eeb3d301bf7c62ed20882e679889d5d393ecc24035795.jpg) + +![](images/ac399f3b8ac8efb4acea00a1fdf0fd2fc14c1909a0146cad3443171c3887c537.jpg) + +![](images/5c055e6123ae8a2d76966bbeb92af5f31e619ccb2498a144065fdbcdead89147.jpg) +Figure 1: Recall@k scores for recalling the human-defined stereotypes captured in our dataset using our stereotype elicitation method on various pretrained LMs. + +![](images/9d7bcd97343fa8e50997b30d223749969b22343aa2d63fb00d7f9da1a138354a.jpg) + +![](images/f5cb47806597e93eaaa9d8f81c44534c486f6d175c454e53372f9784b96f08ae.jpg) + +![](images/67e73b97ef6e6e4957d94cb0cf7ee8c75aebb60b2daf66a47ac5a974421f36ed.jpg) + +The suboptimal performance of multilingual models could be explained in different ways. For instance, as multilingual models are known to suffer from negative interference (Wang et al., 2020), their quality on individual languages is lower compared to monolingual models, due to limited model capacity. This could result in a loss of stereotypical information. Alternatively, multilingual models are trained on more culturally diverse data, thus conflicting information could counteract within the model with stereotypes from different languages dampening each other's effect. Cultural differences might also be more pronounced when it comes to e.g. age and gender, whilst profession and race stereotypes might be established more universally. + +# 5 Quantifying emotion towards different social groups + +To study stereotypes through emotion, we draw inspiration from psychology studies showing that stereotypes evoke distinct emotions based on different types of perceived threats (Cottrell and Neuberg, 2005) or perceived social status and competitiveness of the targeted group (Fiske, 1998). For instance, Cottrell and Neuberg (2005) show that both feminists and African Americans elicit anger, but while the former group is perceived as a threat to social values, the latter is perceived as a threat to property instead. Thus, the stereotypes that underlie the emotion are likely different. Whilst strong emotions are not evidence of stereotypes per se, they do suggest the powerful effects of subtle biases captured in the model. Thus, the study into emotion profiles provides us with a good starting point to identify which stereotypes associated with + +the social groups evoke those emotions. To this end, we (1) build emotion profiles for social groups in the models and (2) retrieve stereotypes about the groups that most strongly elicit emotions. + +Model predictions To measure the emotions encoded by the model, we feed the model the 5 stereotype eliciting templates for each social group and retrieve the top 200 predictions for the [MASK] token (1000 in total). When taking the 1000 salient attributes retrieved from the 5 templates, we see that there are many overlapping predictions, hence we are left with only approx. between 300-350 unique attributes per social group. This indicates that the returned model predictions are robust with regard to the different templates. + +Emotion scoring For each group, we score the predicted set of stereotypical attributes $W_{TGT}$ using the NRC emotion lexicon (Mohammad and Turney, 2013) that contains $\sim 14\mathrm{K}$ English words that are manually annotated with Ekman's eight basic emotions (fear, joy, anticipation, trust, surprise, sadness, anger, and disgust) (Ekman, 1999) and two sentiments (negative and positive). These emotions are considered basic as they are thought to be shaped by natural selection to address survival-related problems, which is often denoted as a driving factor for stereotyping (Cottrell and Neuberg, 2005). We use the annotations that consist of a binary value (i.e. 0 or 1) for each of the emotion categories; words can have multiple underlying emotions (e.g. selfish is annotated with 'negative', 'anger' and 'disgust') or none at all (e.g. vocal scores 0 on all categories). We find that the coverage for the salient attributes in the NRC lexicon is $\approx 70 - 75\%$ per group. + +We score groups by counting the frequencies with which the predicted attributes $W_{TGT}$ are associated with the emotions and sentiments. For each group, we remove attributes from $W_{TGT}$ that are not covered in the lexicon. Thus, we do not extract emotion scores for the exact same number of attributes per group (number of unique attributes and coverage in the lexicon vary). Thus, we normalize scores per group by the number of words for which we are able to retrieve emotion scores ( $\approx 210 - 250$ per group). The score of an emotion-group pair is computed as follows: + +$$ +\mathrm {s} _ {e m o} (\mathrm {T G T}) = \sum_ {i = w} ^ {| W _ {T G T} |} \mathrm {N R C} _ {e m o} (i) / \left(| W _ {T G T} |\right) \tag {4} +$$ + +We then define emotion vectors $\hat{v} \in \mathcal{R}^{10}$ for each group $TGT$ : $\hat{v}_{TGT} = [s_{\text{fear}}, s_{\text{joy}}, s_{\text{sadness}}, s_{\text{trust}}]$ . + +$s_{surprise}, s_{anticipation}, s_{disgust}, s_{anger}, s_{negative}, s_{positive}]$ , which we use as a representation for the emotion profiles within the model. + +Analysis Figure 2, provides examples of the emotion profiles encoded for a diverse set of social groups to demonstrate how these profiles allow us to expose stereotypes. For instance, we see that in RoBERTa-B religious people and liberals are primarily associated with attributes that underlie anger. Towards homosexuals, the same amount of anger is accompanied by disgust and fear as well. As a result, we can detect distinct salient attributes that contribute to these emotions e.g.: Christians are intense, misguided and perverse, liberals are phony, mad and rabid, whilst homosexuals are dirty, bad, filthy, appalling, gross and indecent. The finding that homosexuals elicit relatively much disgust can be confirmed by studies on humans as well (Cottrell and Neuberg, 2005). Similarly, we find that Greece and Puerto Rico elicit relatively much fear and sadness in RoBERTa-B. Whereas Puerto Rico is turbulent, battered, armed, precarious and haunted, for Greece we find attributes such as failing, crumbling, inefficient, stagnant and paralyzed. + +Emotion profiles elicited in BART-B differ considerably, showcasing how vastly sentiments vary across models. In particular, we see that overall the evoked emotion responses are weaker. Moreover, we detect relative differences such as liberals being more negatively associated than homosexuals, encoding attributes such as cowardly, greedy and hypocritical. We also find that BART-B encodes more positive associations e.g., committed, + +![](images/e12189707dd8cd16c1568b8f3a7eb6836cc4c5e5908e2a7d7b4ec30f766aad11.jpg) +Figure 2: Examples of emotion profiles for a diverse set of social groups from RoBERTa-B and BART-B. + +reliable, noble and responsible contributing to trust for husbands. Interestingly, all multilingual models encode vastly more positive attributes for all social groups (see Appendix D). We expect that this might be an artefact of the training data, but leave further investigation of this for future work. + +Comparison across models We systematically compare the emotion profiles elicited by the social groups across different models by adapting the Representational Similarity Analysis (RSA) from Kriegeskorte et al. (2008). We opted for this method as it takes the relative relations between groups within the same model into account. This is particularly important as we have seen that some models are overall more negatively or positively biased. Yet, when it comes to bias and stereotypicality, we are less interested in absolute differences across models, but rather in how emotions differ towards groups in relation to the other groups. First, the representational similarity within each model is defined using a similarity measure to construct a representational similarity matrix (RSM). We define a similarity vector $\hat{w}_{TGT}$ for a social group such that every element $\hat{w}_{ij}$ of the vector is determined by the cosine similarity between $\hat{v}_i$ , where $i = \mathrm{TGT}$ , and the vector $\hat{v}_j$ for the j-th group in the list. The RSM is then defined as the symmetric matrix consisting of all similarity vectors. The resulting matrices are then compared across models by computing the Spearman correlation $(\rho)$ between the similarity vectors corresponding to the emotion profiles for a group in a model $a$ and $b$ . To express the similarity between the two models we take the mean correlation over all social groups in our list. + +Results Computing RSA over all categories combined, shows us that RoBERTa-B and BART-B ob + +![](images/04c2599dbd81a25127d0222db02fab2d5c67972cb6923e7736fd280bcedea5bd.jpg) +Figure 3: Correlations in emotion profiles for gender and age groups across news sources (BERT-B). + +![](images/57d51ec756693a07882be925f74d9aa7f80159c769a8c290cc60afd7aa7b7924.jpg) +Figure 4: Effect on recall@k when fine-tuning BERT-B on 10, 25, 50 and $100\%$ of the data + +tain the highest correlation $(\rho = 0.44)$ . While using different architectures and pretraining strategies, the models rely on the same training data. Yet, we included base and large versions of models in our study and find that these models show little to no correlation (see Appendix E, Fig.10). This is surprising, as they are pretrained on the same data and tasks as their base versions (but contain more model parameters e.g. through additional layers). This shows how complex the process is in which associations are established and provides strong evidence that other modelling decisions, apart from training data, contribute to what models learn about groups. Thus, carefully controlling training content can not fully eliminate the need to analyze models w.r.t. the stereotypes that they might propagate. + +# 6 Stereotype shifts during fine-tuning + +Many debiasing studies intervene at the data level e.g., by augmenting imbalanced datasets (Manela et al., 2021; Webster et al., 2018; Dixon et al., 2018; Zhao et al., 2018) or reducing annotator bias (Sap et al., 2019). These methods are, however, dependent on the dataset, domain, or task, making new mitigation needed when transferring to a new setup (Jin et al., 2020). This raises the question of how emotion profiles and stereotypes are established through language use, and how they might shift due to new linguistic experience at the fine-tuning stage. We take U.S. news sources from across the political spectrum as a case study, as media outlets are known to be biased (Baron, 2006). By revealing stereotypes learned as an effect of fine-tuning on a specific source, we can trace the newly learned stereotypes back to the respective source. + +We rely on the political bias categorisation of news sources from the AllSides $^{3}$ media bias rating website. These ratings are retrieved using multiple + +![](images/e47b946b65969ef75cfb060ea1a507eb9b01b717f470c8fc862b018605d18f97.jpg) + +![](images/1253f5f0da0b6436d09d4e08851f70a2cbacd870870d9733d6b09c96d74b4b99.jpg) + +![](images/4f57ae6ad9d7e41f411f58b98eca979f3f17813765b5676e4ed06cdf67d8be8d.jpg) +Figure 5: Decrease in Spearman correlation $(\Delta \rho)$ after fine-tuning the pretrained models compared to no fine-tuning $(\Delta \rho = 1)$ (no correlation left: $\Delta \rho = -1$ ). We show results for models trained on varying proportions of the data. Results are averaged over categories and standard deviations are indicated by error bars. + +methods, including editorial reviews, blind bias surveys, and third party research. Based on these ratings we select the following sources: New Yorker (far left), The Guardian (left), Reuters (center), FOX News (right) and Breitbart (far right). From each news source we take 4354 articles from the All-The-News $^{4}$ dataset that contains articles from 27 American Publications collected between 2013 and early 2020. We fine-tune the 5 base models $^{5}$ on these news sources using the MLM objective for only 1 training epoch with a learning rate of 5e-5 and a batch size of 8 using the HuggingFace library (Wolf et al., 2020). We then quantify the emotion shift after fine-tuning using RSA. + +Results We find that fine-tuning on news sources can directly alter the encoded stereotypes. For instance, for $k = 25$ , fine-tuning BERT-B on Reuters informs the model that Croatia is good at sports and Russia is good at hacking, at the same time, associations such as Pakistan is bad at football, Romania is good at gymnastics and South Africa at + +![](images/ccc742cc3af34de5ef47522013c1e178689eb807e2d0baf1f3f03c46e699465e.jpg) +Figure 6: A few interesting examples of emotional profiles for a diverse set of social group after fine-tuning RoBERTa-B for only 1 training epoch on articles from Guardian, Reuters and FOX news respectively. + +![](images/629cd3f95e74c13d6f08c73d784ea055552322a40a6d33f595872fb36eeab2f8.jpg) +Figure 7: Stereotypical attribute shifts when finetuning RoBERTa-B on New Yorker (left) and FOX news (right). Removed attributes are red and those added green. Attributes that persisted are grey. + +rugby are lost. Moreover, from fine-tuning on both Breitbart and FOX news the association emerges that black women are violent, while this is not the case when fine-tuning on the other sources. + +In fact, Guardian and Breitbart are the only news sources that result in the encoding of the salient attribute racist for White Americans. We find that such shifts are already visible after training on as little as $25\%$ of the original data $(\sim 1K$ articles). When comparing to human stereotypes, we find that fine-tuning on Reuters decreases the overall recall scores (see Figure 4). Although New Yorker exhibits a similar trend, fine-tuning on the other sources have little effect on the number of stereotypes recalled from the dataset. As Reuters has a + +center bias rating i.e., it does not predictably favor either end of the political spectrum, we speculate that large amounts of more nuanced data helps transmit fewer stereotypes. + +Figure 5 shows the decrease in correlation between the emotion profiles from pretrained BERT-B and BERT-B fine-tuned on different proportions of the data. Interestingly, fine-tuning on less articles does not automatically result in smaller changes to the models. In fact, in many cases, the amount of relative change in emotion profiles is heavily dependent on the social category as indicated by the error bars. This is not unexpected as news sources might propagate stronger opinions about specific categories. Moreover, we find that emotions towards different social categories cannot always be distinguished by the political bias of the source. Figure 3, shows how news sources compare to each other w.r.t. different social categories, exposing that e.g. Guardian and FOX news show lower correlation on gender than on age. + +Computing correlation between all pretrained and fine-tuned models, we find that emotion profiles are prone to change irrespective of model or news source (see Appendix E). In Figure 6, we showcase the effect of fine-tuning from the model that exhibits the lowest change in correlation, i.e. RoBERTa-B, to highlight how quickly emotions shift. We find that while Reuters results in weaker emotional responses, Guardian elicits stronger negative emotions than FOX news e.g. towards conservatives and academics. Yet, while both sources result in anger towards similar groups, for FOX news anger is more often accompanied with fear while for Guardian this seems to more strongly stems from disgust (e.g. see Christians and Iraq). + +Lastly, Figure 7 shows specific stereotype shifts found on the top 15 predictions per template. We + +illustrate the salient attributes that are removed, added and remained constant after fine-tuning. For instance, the role of news media in shaping public opinion about police has received much attention in the wake of the growing polarization over high-profile incidents (Intravia et al., 2018; Graziano, 2019). We find clear evidence of this polarization as fine-tuning on New Yorker results in attributes such as cold, unreliable, deadly and inept, yet, fine-tuning on FOX news yields positive associations such as polite, loyal, cautious and exceptional. In addition, we find evidence for other stark contrasts such as the model picking up on sexist (e.g. women are not interesting and equal but late, insecure and entitled) and racist stereotypes (e.g. black people are not misunderstood and powerful, but bitter, rude and stubborn) after fine-tuning on FOX news. + +# 7 Conclusion + +We present the first dataset containing stereotypical attributes of a range of social groups. Importantly, our data acquisition technique enables the inexpensive retrieval of similar datasets in the future, enabling comparative analysis on stereotype shifts over time. Additionally, our proposed methods could inspire future work on analyzing the effect of training data content, and simultaneously contribute to the field of social psychology by providing a testbed for studies on how stereotypes emerge from linguistic experience. To this end, we have shown that our methods can be used to identify stereotypes evoked during fine-tuning by taking news sources as a case study. Moreover, we have exposed how quickly stereotypes and emotions shift based on training data content, and linked stereotypes to their manifestations as emotions to quantify and compare attitudes towards groups within LMs. We plan to extent our approach to more languages in future work to collect different, more culturally dependent, stereotypes as well. + +# 8 Ethical consideration + +The examples given in the paper can be considered offensive but are in no way a reflection of the authors' own values and beliefs and should not be taken as such. Moreover, it is important to note that for the fine-tuning experiments only a few interesting examples were studied and showcased. Hence, more thorough research should be conducted before drawing any hard conclusions about the news papers and the stereotypes they propagate. In ad + +dition, our data acquisition process is completely automated and did not require the help from human subjects. While the stereotypes we retrieve stem from real humans, the data we collect is publicly available and completely anonymous as the specific stereotypical attributes and/or search queries can not be traced back to individual users. + +# References + +David P Baron. 2006. Persistent media bias. Journal of Public Economics, 90(1-2):1-36. +Camiel J Beukeboom and Christian Burgers. 2019. How stereotypes are shared through language: a review and introduction of the social categories and stereotypes communication (scsc) framework. Review of Communication Research, 7:1-37. +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. +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, pages 4356-4364. +Pedro Bordalo, Katherine Coffman, Nicola Gennaioli, and Andrei Shleifer. 2016. Stereotypes. The Quarterly Journal of Economics, 131(4):1753-1794. +Aylin Caliskan, Joanna J Bryson, and Arvind Narayanan. 2017. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183-186. +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. +Catherine A Cottrell and Steven L Neuberg. 2005. Different emotional reactions to different groups: a sociofunctional threat-based approach to prejudice". Journal of personality and social psychology, 88(5):770. +Amy JC Cuddy, Susan T Fiske, Virginia SY Kwan, Peter Glick, Stephanie Demoulin, Jacques-Philippe Leyens, Michael Harris Bond, Jean-Claude Croizet, Naomi Ellemers, Ed Sleebos, et al. 2009. Stereotype content model across cultures: Towards universal similarities and some differences. British Journal of Social Psychology, 48(1):1-33. + +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. +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. +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. +MeiXing Dong, David Jurgens, Carmen Banea, and Rada Mihalcea. 2019. Perceptions of social roles across cultures. In International Conference on Social Informatics, pages 157-172. Springer. +Paul Ekman. 1999. Basic emotions. Handbook of Cognition and Emotion, pages 45-60. +Anjalie Field and Yulia Tsvetkov. 2020. Unsupervised discovery of implicit gender bias. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 596-608. +Susan T Fiske. 1998. Stereotyping, prejudice, and discrimination. The handbook of social psychology, 2(4):357-411. +Aaron Gokaslan and Vanya Cohen. 2019. Openwebtext corpus. https://skylion007.github.io/OpenWebTextCorpus/. +Lisa M Graziano. 2019. News media and perceptions of police: a state-of-the-art-review. Policing: An International Journal. +Lasana T Harris and Susan T Fiske. 2006. Dehumanizing the lowest of the low: Neuroimaging responses to extreme out-groups. *Psychological science*, 17(10):847-853. +Lasana T Harris and Susan T Fiske. 2009. Social neuroscience evidence for dehumanised perception. *European review of social psychology*, 20(1):192-231. +Madeline E Heilman, Aaron S Wallen, Daniella Fuchs, and Melinda M Tamkins. 2004. Penalties for success: reactions to women who succeed at male gender-typed tasks. Journal of applied psychology, 89(3):416. +Perry Hinton. 2017. Implicit stereotypes and the predictive brain: cognition and culture in "biased" person perception. *Palgrave Communications*, 3(1):1-9. + +Jonathan Intravia, Kevin T Wolff, and Alex R Piquero. 2018. Investigating the effects of media consumption on attitudes toward police legitimacy. Deviant Behavior, 39(8):963-980. +Xisen Jin, Francesco Barbieri, Brendan Kennedy, Aida Mostafazadeh Davani, Leonardo Neves, and Xiang Ren. 2020. On transferability of bias mitigation effects in language model fine-tuning. arXiv preprint arXiv:2010.12864. +Svetlana Kiritchenko and Saif Mohammad. 2018. Examining gender and race bias in two hundred sentiment analysis systems. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pages 43-53. +Nikolaus Kriegeskorte, Marieke Mur, and Peter A Bandettini. 2008. Representational similarity analysis connecting the branches of systems neuroscience. Frontiers in systems neuroscience, 2:4. +Keita Kurita, Nidhi Vyas, Ayush Pareek, Alan W Black, and Yulia Tsvetkov. 2019. Measuring bias in contextualized word representations. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pages 166-172. +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. +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. +Anne Maass. 1999. Linguistic intergroup bias: Stereotype perpetuation through language. In Advances in experimental social psychology, volume 31, pages 79-121. Elsevier. +Diane M Mackie, Thierry Devos, and Eliot R Smith. 2000. Intergroup emotions: Explaining offensive action tendencies in an intergroup context. Journal of personality and social psychology, 79(4):602. +Daniel de Vassimon Manela, David Errington, Thomas Fisher, Boris van Breugel, and Pasquale Minervini. 2021. Stereotype and skew: Quantifying gender bias in pre-trained and fine-tuned language models. arXiv preprint arXiv:2101.09688. +Chandler May, Alex Wang, Shikha Bordia, Samuel Bowman, and Rachel Rudinger. 2019. On measuring social biases in sentence encoders. 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 622-628. + +Clark McCauley, Christopher L Stitt, and Mary Segal. 1980. Stereotyping: From prejudice to prediction. Psychological Bulletin, 87(1):195. +Saif M Mohammad and Peter D Turney. 2013. Nrc emotion lexicon. National Research Council, Canada, 2. +Moin Nadeem, Anna Bethke, and Siva Reddy. 2020. Stereoset: Measuring stereotypical bias in pretrained language models. arXiv preprint arXiv:2004.09456. +Sebastian Nagel. 2016. Cc-news dataset. https://commoncrawl.org/2016/10/news-dataset-available/. +Nikita Nangia, Clara Vania, Rasika Bhalerao, and Samuel Bowman. 2020. Crows-pairs: A challenge dataset for measuring social biases in masked language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1953-1967. +Chan Young Park, Xinru Yan, Anjalie Field, and Yulia Tsvetkov. 2020. Multilingual contextual affective analysis of lgbt people portrayals in wikipedia. arXiv preprint arXiv:2010.10820. +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. +Seth Stephens-Davidowitz. 2018. Everybody Lies: What the internet can tell us about who we really are. In Bloomsbury Publishing Plc. +Tony Sun, Andrew Gaut, Shirlyn Tang, Yuxin Huang, Mai ElSherief, Jieyu Zhao, Diba Mirza, Elizabeth Belding, Kai-Wei Chang, and William Yang Wang. 2019. Mitigating gender bias in natural language processing: Literature review. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1630-1640. +Yi Chern Tan and L Elisa Celis. 2019. Assessing social and intersectional biases in contextualized word representations. arXiv preprint arXiv:1911.01485. +Molly Parker Tapias, Jack Glaser, Dacher Keltner, Kristen Vasquez, and Thomas Wickens. 2007. Emotion and prejudice: Specific emotions toward outgroups. Group Processes & Intergroup Relations, 10(1):27-39. +Trieu H Trinh and Quoc V Le. 2018. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847. +Zirui Wang, Zachary C Lipton, and Yulia Tsvetkov. 2020. On negative interference in multilingual language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4438-4450. + +Kellie Webster, Marta Recasens, Vera Axelrod, and Jason Baldridge. 2018. Mind the gap: A balanced corpus of gendered ambiguous pronouns. Transactions of the Association for Computational Linguistics, 6:605-617. +Bernard Weiner. 1993. On sin versus sickness: A theory of perceived responsibility and social motivation. American psychologist, 48(9):957. +Guillaume Wenzek, Marie-Anne Lachaux, Alexis Conneau, Vishrav Chaudhary, Francisco Guzmán, Armand Joulin, and Édouard Grave. 2020. Ccnet: Extracting high quality monolingual datasets from web crawl data. In Proceedings of The 12th Language Resources and Evaluation Conference, pages 4003-4012. +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. +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. +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. + +# A Pretrained model details + +
ModeltokenizationLdimHparamsVDtask#lgs
BERT-BWordPiece1276812110M30K16GBMLM+NSP1
BERT-LWordPiece24102416336M30K16GBMLM+NSP1
RoBERTa-BBPE1276812125M50K160GBMLM1
RoBERTa-LBPE24102416335M50K160GBMLM1
BART-BBPE1276816139M50K160GBDenoising1
BART-LBPE24102416406M50K160GBDenoising1
mBERTWordPiece1276812168M110K-MLM+NSP102
XLMR-BSentencePiece127688270M250K2.5TBMLM100
XLMR-LSentencePiece24102416550M250K2.5TBMLM100
+ +Table 3: Summary statistics of the model architectures: tokenization method, number of layers $L$ , hidden state dimensionality $dim$ , number of attention heads $H$ , number of model parameters $params$ , vocabulary size $V$ , training data size $D$ , pretraining tasks, and number of languages used $\# lgs$ . + +# B Data acquisition + +For the collection of autocomplete suggestions we rely on the free publicly available API's from the respective engines using the following base url's: + +- Google: http://suggestqueries.google.com/complete/search +- Yahoo: http://sugg.search.yahoo.net/sg +- DuckDuckGo: https://duckduckgo.com/ac + +All search engine suggestions are automatically generated by an algorithm without human involvement. These suggestions are supposed to be based on factors like popularity and similarity. We enter the search queries anonymously such that the resulting suggestions are mainly based on common queries from other people's search histories. Unfortunately, however, exact details about the workings of the algorithms are not publicly available, but an extensive explanation of Google's search predictions can be found here: Google's documentation on autocomplete suggestions. Moreover, Figure B illustrates the contribution of each search engine to the datasets. We see that while each search engine relies on a different algorithm, in many cases the engines predict similar stereotypical attributes regardless. Moreover, the dataset was constructed during the period January-May 2021. However, given that the algorithms behind these engines are constantly evolving, it is not guaranteed that the same approach will yield identical results in the future. We will make the dataset and corresponding code available upon publication. + +![](images/23e6211b0d863bea57225ad312ceac31cee260dc0f8fbea0a40d32471d9c045f.jpg) +Figure 8: Distribution of the contribution of each search engine to the final dataset. + +# C Lists of social groups per category + +# Age (11) + +"elders", "kids", "millenials", "teens", "boomers", "old people" + +"old women", "children", "teenagers", "daughters", "sons" + +# Gender (25) + +"girls,"women", "men", "females", "males", "boys" + +"boyfriends", "girlfriends", "stepmothers", "stepfathers", "ladies", "gentlemen" + +"brothers", "sisters", "mothers", "fathers", "grandfathers", ""grandmothers + +"wives", "husbands", "brides", "grooms", "schoolgirls", "schoolboys" + +"mommies", "daddies" + +# Race (99) + +"Asians", "Americans", "Europeans", "Jews", "Indians", "Russians", "Africans", "Black people" + +"Mexicans", "Whites" "Blacks", "White people", "Germans", "blondes", "blonde girls", "Arabs" + +"White Americans", "Black Americans" "Hispanics", "Native Americans", "Black men", "White men" + +"Asian women", "Asian men" Black women", "the Dutch", "Irish people", "Irish men", "White women" + +"Indian men", "Indian women", "Chinese men", "Chinese women", "Japanese women", "Japanese men" + +"Indian parents", "Asian parents", "White parents", "Black parents", "Black fathers", "Latinas", "Latinos" + +"Latin people", "Brazilian women", "Asian kids", "Black kids", "White kids", "African Americans" + +"Nigerians", "Ethiopians", "Ukrainians", "Sudanese people", "Afghans", "Iraqis", "Hispanic + +"Hispanic women", "Italians", "Italian men", "Italian women", "Somalis", "Iranian people", "Iranians" + +"Australians", "Australian men", "Australian women", "Aussies", "Ghanaians", "Swedes", "Finns" + +"Venezuelans", "Moroccans", "Syrians", "Pakistanis", "British people", "French people", "Greeks" + +"Indonesians", "Vietnamese people", "Romanians", "Ecuadorians", "Norwegians", "Nepalis", "Scots" + +"Bengalis", "Polish people", "Taiwanese people", "Albanians", "Colombians", "Egyptians", "Koreans" + +"Persian people", "Portuguese men", "Portuguese women", "Turkish people", "Austrians" + +"South Africans", "Dutch people", "Chileans", "Lebanese people" + +# Countries (73) + +"Ethiopia", "Europe", "Ukraine", "Sudan", "Afghanistan", "Iraq", "Yemen", "Russia", "Italy", "Somalia" + +"Iran", "Venezuela", "Oman", "Syria", "China", "India", "Britain", "France", "Greece", "Scotland" + +"Paraguay", "Brazil", "Africa", "Jordan", "Indonesia", "Vietnam", "Pakistan", "Romania, Ecuador" + +"Mexico", "Puerto Rico", "Cameroon", "Kenya", "Liberia", "Sierra Leon", "Qatar", "Syria", "Kenya" + +"Saudi Arabia", "Lebanon", "South Africa", "Korea", "Singapore", "Germany", "Ireland", "Morocco" + +"Turkey", "Laos", "Bangladesh", "Guatemala", "Ghana", "Nepal", "Albania", "Spain", "Sweden" + +"Argentina", "Chile", "Taiwan", "Finland", "Australia", "Egypt", "Peru", "Poland", "Columbia", "Bolivia" + +"Japan", "Norway", "Cape Verde", "Portugal", "Austria", "the Netherlands" + +"Croatia", "Malta", "Belgium" + +# Profession (115) + +"students", "politicians", "doctors", "business men", "librarians", "artists", "professors", "priests" + +"bosses", "police", "police officers", "soldiers", "scientists", "physicians", "cashiers" "housekeepers" + +"teachers", "janitors", "models", "actresses", "pilots", "strippers" "brokers", "hairdressers", "bartenders" + +"diplomats", "receptionists", "realtors", "mathematicians", "barbers", "coaches", "business people" + +"construction workers", "managers", "accountants", "commanders", "firefighters", "movers", "attorneys" + +"Bakers", "athletes", "dancers", "carpenters", "mechanics", "handymen", "musicians", "detectives" + +"entrepreneurs", "opera singers", "chiefs", "lawyers", "software developers", "farmers", "writers" + +"real-estate developers", "butchers", "electricians", "prosecutors", "bankers", "cooks", "plumbers" + +"football players", "boxers", "chess players", "swimmers", "tennis players", "supervisors", "attendants" + +"producers", "researchers", "economists", "physicists", "psychologists", "sales people", "assistants" + +"engineers", "comedians", "painters", "civil servants", "guitarists", "linguists", "laborers", "historians" + +"chemists", "pensioners", "performing artists", "singers", "secretaries", "auditors", "counselors" + +"dentists", "analysts", "nurses", "waiters", "authors", "architects", "academics", "directors", "illustrators" + +"clerks", "photographers", "cleaners", "composers", "pharmacists", "sociologists", "journalists" + +"guards", "actors", "midwives", "sheriffs", "editors", "designers", "judges", "poets", "maids" + +# Religion (10) + +"Religious people", "Muslims", "Christians", "Hindus", "atheists", "Buddhists" + +"Catholics", "Protestants", "Sikhs", "Mormons" + +# Political (9) + +"immigrants", "conservatives", "liberals", "trump supporters", "voters", "communists" "capitalists", "populists", "socialists" + +# Sexuality (12) + +"gay people", "lesbians", "queer people", "transgenders", "homosexuals", "pansexual people" "queers", "faggots", "bisexual people", "asexual people", "crossdressers", "fags" + +# Lifestyle (19) + +"hipsters", "nerds", "rednecks", "homeless people", "feminists", "rich people", "poor people", "criminals" +"frats", "frat boys", "sorority girls", "hippies", "geeks", "goths", "punks", "Californians" +"celebrities", "redheads", "gingers" + +# D Emotion profiles from multilingual models + +![](images/7423d65ca8489ff34e9351cb1515577b2b0ae3bea28f134a94b6ca8da55fdcc4.jpg) +Figure 9: Examples of emotion profiles for the multilingual models. It showcases that these models are much more positive about all social groups in comparison to the monolingual models. Whereas we observed that monolingual models primarily encode negative associations for most groups, associations encoded within the multilingual models are more balanced between positive and negative sentiments. + +![](images/1dc920819a70cca37734bac6908237ed65b7a8bedb6f0608f7332d2d8daa9ac8.jpg) + +![](images/0af712399ba89b6f412b8d52149804b94e84f0165652fbe45c1da33be4e22644.jpg) + +# E Additional quantitative results of systematic shifts in emotion profiles across models + +![](images/f472d4b91b3b636fa0e4c3e5bb3c3d973a5edc146ac25db0fb741edff3ecfbad.jpg) +Figure 10: Spearman correlation between each pair of models computed over all social groups. This figure illustrates that there is fairly little correlation between any of the models when it comes to the emotion profiles that they capture. + +
ΔρSourceReligionProfessionLifestyleSexualityRaceGenderCountryAgePolitical
BERT-BNewYorker-.56-.34-.25-.23-.39-.47-.47-.43-.72
Guardian-.49-.34-.08-.23-.37-.31-.43-.31-.49
Reuters-.71-.53-.43-.65-.53-.63-.69-.60-.54
FOX news-.46-.30-.16-.22-.35-.30-.44-.33-.51
BreitBart-.39-.25-.11-.21-.33-.23-.40-.34-.66
RoBERTa-BNewYorker-.20-.22-.20-.29-.21-.24-.16-.08-.38
Guardian-.19-.20-.19-.20-.22-.18-.16-.13-.24
Reuters-.25-.32-.33-.21-.33-.49-.37-.24-.40
FOX news-.10-.18-.14-.37-.16-.12-.16-.25-.25
BreitBart-.15-.23-.21-.41-.18-.27-.22-.18-.43
BART-BNewYorker-.56-.48-.40-.60-.44-.55-.43-.48-.49
Guardian-.49-.48-.32-.41-.37-.50-.47-.67-.33
Reuters-.43-.51-.45-.51-.53-.54-.54-.70-.29
FOX news-.27-.50-.32-.44-.37-.44-.42-.65-.50
BreitBart-.37-.48-.42-.35-.37-.51-.44-.56-.50
mBERTNewYorker-.58-.64-.33-.44-.64-.63-.80-.59-.38
Guardian-.58-.49-.30-.50-.63-.72-.77-.53-.37
Reuters-.50-.56-.29-.46-.37-.59-.85-.33-.42
FOX news-.35-.64-.36-.54-.68-.71-.71-.49-.60
BreitBart-.39-.66-.36-.43-.51-.61-.75-.40-.55
XLMR-BNewYorker-.44-.76-.45-.66-.61-.86-.66-.72-.58
Guardian-.52-.72-.49-.46-.68-.83-.53-.63-.38
Reuters-.53-.74-.69-.55-.67-.73-.53-.69-.57
FOX news-.40-.71-.47-.57-.58-.69-.51-.69-.30
BreitBart-.60-.76-.47-.56-.75-.79-.60-.65-.51
+ +Table 4: Emotion shifts after fine-tuning for 1 training epoch on $\pm$ 4.5K articles from the respective news sources. We quantify shift as the decrease in similarity after fine-tuning, i.e. change in averaged Spearman correlation $(\Delta \rho)$ , between the pretrained and fine-tuned model respectively. If the emotion profiles do no change $\rho = 1$ and thus $\Delta \rho = 0$ , on the other hand, if no correlation remains after fine-tuning $\Delta \rho = -1$ . Biggest changes are indicated by bold letters. \ No newline at end of file diff --git a/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/images.zip b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..59d4d202718489d6176de8041f0d690796176737 --- /dev/null +++ b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f8cadbd11690c3f1f99e3c118f4b26fc59db8dae3c3289137d9765276678627 +size 849631 diff --git a/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/layout.json b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a8b7d82412198db79668e3c099d8afb9475d6f32 --- /dev/null +++ b/stepmothersaremeanandacademicsarepretentiouswhatdopretrainedlanguagemodelslearnaboutyou/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9e822b638d5a56c3d39e6b302db8c6d4ece1606f7ac42fef9aeb0361d020bfe +size 466455 diff --git a/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_content_list.json b/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..606ddf8758257dd7959a4eda893cedf05430e5db --- /dev/null +++ b/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea7877ae56161bf268c026ba4a800f565739df4cadfc3c1fd485748278ef9cff +size 176122 diff --git a/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_model.json b/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6e2d346d6420219b0eb335df6f4907cac86eaec5 --- /dev/null +++ b/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b434ac95003d942e1c69037dd2e8ac0981be1039f61bb59e330c10a3f5fb2e7f +size 258404 diff --git a/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_origin.pdf b/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..abcb2c6ded0004ace56a448fe837fb322015ee6e --- /dev/null +++ b/streamhoverlivestreamtranscriptsummarizationandannotation/567a4cdd-e5c2-410d-88cc-055139968eb5_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a3a15c3a4f9f4a5af63618bbb7ef5418d8804e493f2cd1940987cb95acd8f31 +size 2841944 diff --git a/streamhoverlivestreamtranscriptsummarizationandannotation/full.md b/streamhoverlivestreamtranscriptsummarizationandannotation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..46d7789df5faae510bf60c647f14e18c2514c00f --- /dev/null +++ b/streamhoverlivestreamtranscriptsummarizationandannotation/full.md @@ -0,0 +1,984 @@ +# StreamHover: Livestream Transcript Summarization and Annotation + +Sangwoo Cho, $^{\dagger}$ Franck Dernoncourt, $^{\ddagger}$ Tim Ganter, $^{\ddagger}$ Trung Bui, $^{\ddagger}$ Nedim Lipka, $^{\ddagger}$ Walter Chang, $^{\ddagger}$ Hailin Jin, $^{\ddagger}$ Jonathan Brandt, $^{\ddagger}$ Hassan Foroosh, $^{\dagger}$ Fei Liu $^{\dagger}$ + +†University of Central Florida ‡Adobe Research + +swcho@knights.ucf.edu {foroosh, feiliu}@cs.ucf.edu {dernonco,timganter,bui,lipka,wachang,hljin,jbrandt}@adobe.com + +# Abstract + +With the explosive growth of livestream broadcasting, there is an urgent need for new summarization technology that enables us to create a preview of streamed content and tap into this wealth of knowledge. However, the problem is nontrivial due to the informal nature of spoken language. Further, there has been a shortage of annotated datasets that are necessary for transcript summarization. In this paper, we present StreamHover, a framework for annotating and summarizing livestream transcripts. With a total of over 500 hours of videos annotated with both extractive and abstractive summaries, our benchmark dataset is significantly larger than currently existing annotated corpora. We explore a neural extractive summarization model that leverages vector-quantized variational autoencoder to learn latent vector representations of spoken utterances and identify salient utterances from the transcripts to form summaries. We show that our model generalizes better and improves performance over strong baselines. The results of this study provide an avenue for future research to improve summarization solutions for efficient browsing of livestreams. + +# 1 Introduction + +One of the most powerful communication mediums is livestreaming. New platforms such as YouTube Live, Twitch, Instagram Live and TikTok encompass a variety of topics, ranging from video games to social media to professional sports. We are particularly interested in livestreams that are distinguished by three characteristics: Excessive length, the recordings could last from several minutes to several hours; Verbal communication, the use of natural language is the primary means of communication, in contrast to gestures or facial expressions; Informal nature, the streamers' language is mostly informal and unplanned, unlike news broadcasts. Without an effective mechanism to summarize such streamed content, livestreaming platforms may not fully meet the needs of their customers. + +![](images/28593c9ecbb905f3852a6f85bead147b0e77a4ed5efb24d95294f83af5e5abf2.jpg) +Figure 1: An example of streamed content on Behance, a streaming platform for artists and designers to showcase creative work related to Adobe Photoshop, Illustrator, Fresco, UI/UX, photography and more. TOP: The videos are each 27 minutes long. BOTTOM: One video is being broadcast live, the other is $>2$ hours long. + +Our goal in this work is to create a text preview of the streamed content. When a user hovers over the thumbnail or scrolls past a video, they are shown a preview of the content. We present a dataset of over 500 hours of video footage, which were streamed live on a social media platform (behance.net) created to showcase and discover creative work. Figure 1 shows an example of the streams, where the artists showcase the use of Adobe Photoshop and Illustrator in designing holiday cards and posters. It is necessary to point out that video analysis is not suitable here, as the video only mirrors the artists' screen content. As a first step towards automatic creation of a text preview, we focus on identifying salient utterances to produce an extract from the livestream transcript. + +We make use of vector-quantized variational autoencoders (VQ-VAE; van den Oord et al., 2017) to identify salient utterances. The model has been applied successfully to opinion summarization that learns in-domain sentence representations (Angelidis et al., 2021), which is essential for adaptation of general-domain models. We refrain from using sequential methods for utterance selection. First, + +it is difficult to scale up sequential prediction to process transcripts that exceed the maximum allowed length, even with models that handle long text (Beltagy et al., 2020; Zhao et al., 2020). Second, sequential methods (Narayan et al., 2018b; Xiao and Carenini, 2019) may not give enough flexibility to select salient utterances on-the-fly when content is being streamed live, thus they are unsuitable for our case. + +There has been a shortage of annotated datasets that are necessary for livestream transcript summarization. We build a browser-based user interface for summary annotation that provides to the annotators a clip of the livestream recording alongside a synchronized display of the transcript. The interface allows annotators to conveniently label summary utterances and write an abstractive summary using their own words (Figure 3). With a total of 500 hours of annotated video footage, our dataset is notably larger than existing annotated corpora for transcript summarization (Janin et al., 2003; Carletta et al., 2006). We compare our summarization approach with strong baselines on the dataset and shed light on the task of livestream transcript summarization. Our contributions are as follows. + +- We create a detailed annotation interface and new benchmark dataset for automatic summarization of livestream transcripts. An informative preview of streamed content is of crucial importance to users when considering whether to hit play. +- We present StreamHover, a unsupervised model based on VQ-VAE to identify salient utterances from livestream transcripts to form preview summaries. We evaluate the method across multiple dimensions and discuss its strengths and weaknesses. Empirical results show that our method outperforms strong summarization baselines. $^{1}$ + +# 2 Related Work + +Closed captions are often provided onscreen, turning streaming videos into text on an unprecedented scale (Besik, 2020). However, there are very few summarization studies that attempt to generate text previews of streaming videos to help users browse or refind information that has been watched before. Neural text summarizers have focused primarily on written text, including news articles, reviews, scientific papers and book chapters (See et al., 2017; Tan + +07:35 + +OK. It looks like we are live. How is everyone today good morning Good afternoon good evening? Wherever you are in the world my name is Jason Levine and for today's brief live stream go to be talking about a topic which to be honest. I didn't think I'd revisit again seeing as I've got some archive videos on this. But in the last week alone, I had probably 3 or 4 different customers on YouTube and a couple more on Twitter and even if you on Facebook asked me how the heck do you burn an audio CD in Adobe audition? + +08:10 + +And specifically what else do you need to do to make sure that you know everything is right when you're burning it to CD so that's what I thought I would take the opportunity to do today, so as always. We are coming to you live on Facebook YouTube be hands and Twitter Periscope, so we've got our live interactive chat. Thank you so much for joining as always, I will of course, be checking the chats at the end of the broadcast, but we got it just really it's a couple of quick things to cover here? What is up Catherine Lacoste. An it's a really simple process but there's definitely a few things that you need to be aware of the need to know. + +Figure 2: A transcript snippet from "How to Create an Audio CD in Adobe Audition." Most utterances are off-topic, except for the one marked in blue, suggesting the information density of livestream transcripts is low. + +et al., 2017; Chen and Bansal, 2018; Narayan et al., 2018a; Gehrmann et al., 2018; Cohan et al., 2018; Liu and Lapata, 2019; Fabbri et al., 2019; Bražinskas et al., 2020; Ladhak et al., 2020; Song et al., 2021). Despite their success, it remains unclear as to if and how the summarizers can be extended to spoken text, whose utterances may have very low information density. + +It is crucial to identify salient content from transcripts where a substantial number of utterances are devoted to informal chit-chats in an attempt to connect with the audience (Figure 2). We investigate extractive rather than abstractive approaches as the latter are prone to generate hallucinated content that does not exist in the source text (Cao et al., 2017; Kryscinski et al., 2019; Lebanonff et al., 2019; Maynez et al., 2020). The problem could be exacerbated by ungrammatical spoken utterances and transcription errors. Instead, we consider VQ-VAE, an unsupervised representation learning technique (van den Oord et al., 2017; Jin et al., 2020; Angelidis et al., 2021) for content extraction. Unsupervised training of the VQ-VAE model and its inference could potentially be performed at the same time, allowing important utterances to be extracted from a transcript segment on-the-fly during streaming, without interrupting the learning process. It is also easier to tailor the model to specific domains compared to contemporary extractive methods (Yasunaga et al., 2017; Dong et al., 2018; Xu and Durrett, 2019; Wang et al., 2020). + +Our work contributes to a refined understanding of transcript summarization, which is understudied relative to its importance and potential. The transcripts may be obtained from channels such as movies and TVs (Papalampidi et al., 2020; Chen et al., 2021), interviews (Zhu et al., 2021), multi-party meetings (Murray and Carenini, 2008; Wang and Cardie, 2013; Li et al., 2019b; Koay et al., 2020, 2021; Zhong et al., 2021), telephone speech (Kafle and Huenerfauth, 2018) and more. The main thrust distinguishing our work with others is the combination of a benchmark summarization dataset, novel summarization methods and a challenging new domain where salient content is scattered throughout the transcript and mixed with substantial chit-chats. We do not make use of video event detection or multi-modal fusion (Zhu et al., 2018; Palaskar et al., 2019; Li et al., 2020) as little information could be gleaned from videos that mirror the artists' desktop. Instead, we focus on generating short descriptions from transcripts and leave for future work cross-modality research. We describe our data annotation process in the following section. + +# 3 Our Dataset + +We aim to create a large and representative corpus containing transcripts and summaries of streamed videos. We explore a leading social media platform (Behavior.net) supported by Adobe Creative Cloud that features livestreams of creative work by artists and designers. The website boasts over 10 million users, who watch artists and designers livestream when they create. Our data are extracted from this website, containing a large quantity of streamed videos (>5,000), the length of which ranges from minutes to several hours. The streamers' language is unplanned, instead of rehearsed as that of TED talks (Hernandez et al., 2018). + +We obtain a total of 5,398 streamed videos. The metadata of a video includes its ID, duration, title, a short description and the transcript. Automatic transcription was provided by Microsoft Automatic Speech Recognition which helps make videos accessible to a wide audience. Each transcript contains a set of segments, each corresponds to about 30 seconds of audio. Each segment contains a set of utterances. Figure 2 shows an example of the segments and utterances. The offset of the segment + +![](images/9eb0d1ff0b6bdd3f75ac8b52609a8011f0ae4a6b4265e636002fce08b2bb4ce8.jpg) +VIEW INSTRUCTIONS + +Task A) Select sentences that best summarize a 5 minute transcript. Please do NOT select chit-chat or greetings as summary sentences. + +A little too many. But okay if they are good sentences. + +Task B) Write a summary based on the selected sentences. A minimum length of 100 characters is required. Characters written: 163 + +Maddy talks about digital painting photo studies. The references are two fairytale themed images. The second image is a woman sitting in a field holding a branch. + +# Selected Sentences + +[ "We're going to be doing some digital painting photo studies, but we have a little bit of a theme today which I hope you're going to like.", "I was lot of searching for some references for us to do photo studies of, and I found a couple that have like a nice cohesive theme.", "So the first one is this one right here, which I've had for awhile and wanted to paint.", "And another one is this woman sitting in a field holding a branch, and this one is really pretty too." ] + +Selected Sentence Numbers [7, 8, 11, 12] + +Figure 3: An example of our browser-based annotation interface. It includes a clip of the streamed video alongside a display of the transcript (omitted for space). The streamer talks about Digital Painting with Maddy Bellwoar to create fairytale themed images. The annotators are asked to write a concise summary of this clip using their own words (Task A) and identify summary utterances (Task B). + +indicates the number of minutes since the beginning of the recording. + +When a user hovers over the thumbnail or scrolls past a video, we expect a textual summary to give a glimpse of the verbal content. This view of summarization leads us to annotate salient content across the video in an equally detailed manner. It naturally avoids lead bias that is ubiquitous in news (Grenander et al., 2019). We segment a video into 5-minute clips and annotate each clip for summary-worthy content. A clip contains an average of 51 utterances and 460 words. Due to time and budget constraints, we select 370 streamed video for summary annotation. Table 1 provides a detailed comparison of our annotated corpus with previous datasets, including Switchboard (Godfrey et al., 1992), ICSI (Janin et al., 2003) and AMI (Carletta et al., 2006) that contain both transcripts and human-annotated ex + +
DatasetTypeDurationExtr.Abst.
SwitchboardTelephone300 HrsNo†No
ICSIMeeting75 HrsYesYes
AMIMeeting100 HrsYesYes
StreamHoverLivestream500 HrsYesYes
+ +Table 1: A comparison of the transcript summarization datasets with manually annotated extractive/abstractive summaries. "Yes/No" indicate a summary type is available or not. $\dagger$ suggests only small pilot summary annotations are available for the Switchboard dataset (Penn and Zhu, 2008). With a total duration of over 500 hours, our dataset is notably larger than similar datasets. + +tractive/abstractive summaries. With a combined duration of 500 hours, our dataset is substantially larger than previously released datasets. + +We recruit 12 workers from Upwork.com and validate their language skills for summary annotation. Upwork is a freelancing platform that allows us to reach out to workers directly to ensure our instructions are fully understood. Each worker is asked to write a concise summary for a given clip using their own words (Task A) and identify summary utterances (Task B) using the graphical user interface (Figure 3), which shows a clip of the streamed video alongside a synchronized display of the transcript. Additionally, our guidelines suggest a good summary of Task A should have at least 100 characters and that of Task B should have between 50 and 80 words ( $\sim 15\%$ compression). As is the case with meeting summaries (Janin et al., 2003), a clip is annotated by a single worker owing to an expensive annotation process. The worker can also identify a clip to be chitchat, in which case it will not be annotated for summaries. + +Table 2 shows our dataset statistics. On average, a human abstract contains 3 sentences (36 words) and a human annotated extract contains 5.5 utterances (80 words). Moreover, summary utterances constitute $8.9\%$ and $8.6\%$ of all utterances in terms of number and duration. We study inter-annotator agreement by inviting three workers to each annotate 8 hours of video that contains a total of 96 clips. Using 10-second intervals as measuring units, the Fleiss' Kappa on identifying summary utterances is 0.13. We note that the score is within the range of what is normally found in annotating speech transcripts for extractive summaries $(0.1\sim 0.3)$ ; Marge + +
The Bēhance Corpus
Total number of annotated videos370
Total annotated duration in hours500
Total number of utterances331,928
Average number of utterances in a clip61.23
Average duration of utterances in seconds3.04
Average number of words in an utterance9.48
Total number of annotated clips6,003
Total number of chitchat clips582
Total number of human annotators12
Avg. # of (sentences) words in a human abstract(3.0) 36
Avg. # of (utterances) words in a human extract(5.5) 80
Percentage of duration of summary utterances8.57%
+ +Table 2: Statistics of our dataset. + +et al., 2010), as annotating spoken text is a highly challenging task. We find that annotators tend to perceive the same region as salient but they may disagree as to which utterances should be included in the summary due to veracity of spoken text. We refer the reader to (Artstein and Poesio, 2008) for interpretations and improvements to IAA. + +# 4 Summarization + +Let $\mathcal{X}$ denote a sequence of spoken utterances from a segment of the transcript. Our summarizer aims to extract a subset of utterances $\mathcal{Y} \subset \mathcal{X}$ that convey the essential content of the input. We experiment with an unsupervised summarizer that leverages vector-quantized variational autoencoders (VQVAE; van den Oord et al., 2017) to learn utterance representations and identifies summary utterances. The method was explored for opinion summarization (Angelidis et al., 2021) and machine translation (Prato et al., 2020). We are interested in using the method to account for domain characteristics of livestreams, which showcase new and creative work of artists and designers on their use of Photoshop, Illustrator, and other tools. + +VQ-VAE is a powerful framework for learning latent variable models using deep neural networks. It learns discrete vector representations for an utterance, which is then used to categorize the utterance along various dimensions. E.g., "Good morning Hi Everybody" suggests a greeting and opens up a dialogue; "I had probably 3 or 4 different customers on YouTube and ... on Facebook asked me how the heck do you burn an audio CD in Adobe Audition" engages the audience and introduces the + +![](images/39dcd2a9e93e832667c17c7effe4226068cca61b12929de9eb1dfb3b0e9c99af.jpg) +Figure 4: Our summarizer embeds an input utterance using BERT, transforms BERT's semantic space to a set of latent codes, then reconstructs the utterance using the code embeddings. We identify summary utterances as those associated with prominent latent codes/topics. The model is trained using a dictionary learning algorithm for code embeddings (E) and backpropagation with a straight-through estimator for model parameters $\theta$ , $\varphi$ and $\phi$ . + +main topic. The VQ-VAE method groups utterances based on their discrete representations and selects salient utterances to form a summary. + +We employ an embedding function $\mathsf{Embed}_{\theta}(\cdot)$ to map an input utterance $x$ into a semantically meaningful space. The space is subsequently discretized according to a codebook. To achieve this, we prefix $x$ with a [CLS] token and append a [SEP] token, pass it into a BERT model, then obtain the vector corresponding to [CLS] as a pooled representation of the utterance, denoted by $\mathbf{h}\in \mathbb{R}^{H}$ (Eq. (1)). We use a ConvEncoder $\varphi (\cdot)$ with a set of $D$ filters to convolve the input $\mathbf{h}$ . The output is a sequence of feature vectors $[\mathbf{q}_1,\dots ,\mathbf{q}_H]$ where $\mathbf{q}_i\in \mathbb{R}^D$ (Eq. (2)). We define a codebook $\mathbf{E} = [\mathbf{e}_1,\dots ,\mathbf{e}_K]$ , where $K$ is the number of latent codes and $\mathbf{e}_k\in \mathbb{R}^D$ is the $k$ -th code embedding. The $i$ -th feature $\mathbf{q}_i$ is assigned to the latent code $z_{i}$ whose embedding $\mathbf{e}_{z_i}$ has the minimum Euclidean distance with it (Eq. (3)). Our method essentially discretizes the $H$ -dimensional semantic space by producing latent codes $\{z_i\}_{i = 1}^H$ , one for each dimension of the semantic space. + +$$ +\mathbf {h} = \operatorname {E m b e d} _ {\theta} (x) \in \mathbb {R} ^ {H} \tag {1} +$$ + +$$ +[ \mathbf {q} _ {1}, \dots , \mathbf {q} _ {H} ] = \operatorname {C o n v E n c o d e r} _ {\varphi} (\mathbf {h}), \mathbf {q} _ {i} \in \mathbb {R} ^ {D} \tag {2} +$$ + +$$ +z _ {i} = \underset {k} {\arg \max } - \| \mathbf {q} _ {i} - \mathbf {e} _ {k} \| _ {2}, i \in [ H ] \tag {3} +$$ + +With the latent code embeddings $[\mathbf{e}_{z_1},\dots ,\mathbf{e}_{z_H}]$ we seek to reconstruct the input utterance, which is achieved by generating a dense vector $\widetilde{\mathbf{h}}$ using a ConvDecoder $\varphi (\cdot)$ (Eq.4)). $\widetilde{\mathbf{h}}$ is then fed to a Transformer decoder to reconstruct the original utterance $\widetilde{x}$ (Eq.5). In this process, the code embeddings serve as "topic vectors" that group dimensions of the semantic space into clusters relevant to the application domain. Our model parameters include those used by the BERT encoder and Transformer decoder $(\theta$ and $\phi$ ), the convolutional encoder and + +decoder that use tied parameters $(\varphi)$ , and embeddings of the codebook $\mathbf{E}$ . + +$$ +\widetilde {\mathbf {h}} = \operatorname {C o n v D e c o d e r} _ {\varphi} \left(\left[ \mathbf {e} _ {z _ {1}}, \dots , \mathbf {e} _ {z _ {H}} \right]\right) \in \mathbb {R} ^ {H} \tag {4} +$$ + +$$ +\widetilde {x} = \operatorname {G e n e r a t e} _ {\phi} (\widetilde {\mathbf {h}}) \tag {5} +$$ + +We next describe the loss function used to learn these parameters. The loss function of our model comprises of three parts, including a cross-entropy term between the original and reconstructed utterance $\mathsf{XEnt}(x, \widetilde{x})$ that optimizes the BERT embedder $\theta$ , Transformer generator $\phi$ , and convolutional encoder and decoder $\varphi$ , as shown in Figure 4. The gradients will, however, bypass the latent code embeddings due to the straight-through estimator (Bengio et al., 2013). To learn code embeddings in an end-to-end manner, we use a dictionary learning algorithm (van den Oord et al., 2017) that moves code embeddings $\mathbf{e}_{z_i}$ towards feature vectors $\mathbf{q}_i$ by minimizing the $l_2$ -distance between the two vectors $\| \mathbf{e}_{z_i} - \mathsf{sg}(\mathbf{q}_i) \|_2^2$ , where $\mathsf{sg}(\cdot)$ is a stop-gradient operator that constrains its operand to be a non-updated constant during backpropagation, i.e., it stops $\mathbf{q}_i$ from being updated. As illustrated in Eq. (6), we additionally apply a commitment loss to encourage the feature vector $\mathbf{q}_i$ to commit to a code embedding. $\| \mathsf{sg}(\mathbf{e}_{z_i}) - \mathbf{q}_i \|_2^2$ prevents $\mathbf{q}_i$ from deviating too much from the code embedding $\mathbf{e}_{z_i}$ . This loss term is associated with a coefficient $\beta \in [0,1]$ . + +$$ +\begin{array}{l} \mathcal {L} (\theta) = \mathrm {X E n t} (x, \widetilde {x}) + \sum_ {i} \| \mathbf {e} _ {z _ {i}} - \operatorname {s g} (\mathbf {q} _ {i}) \| _ {2} ^ {2} \\ + \beta \sum_ {i} \| \operatorname {s g} \left(\mathbf {e} _ {z _ {i}}\right) - \mathbf {q} _ {i} \| _ {2} ^ {2} \tag {6} \\ \end{array} +$$ + +At test time, we define summary utterances as those associated with prominent latent codes/topics. Given a set of $N$ utterances, we obtain latent codes from the $n$ -th utterance using Eq. (3), denoted by $\{z_i^{(n)}\}_{i = 1}^H$ . This gives a total of $N\times H$ codes from which we find prominent ones. They are denoted by + +$\mathcal{P}$ which contains a set of most frequently occurring codes. A score $S(x_{n})$ is assigned to utterance $x_{n}$ that computes how often it is associated with those prominent codes $\mathcal{P}$ . In Eq. (7), $\sum_{i=1}^{H} \mathbb{1}[z_i^{(n)} = k]$ indicates the number of times the $n$ -th utterance is assigned to code $k$ , where $k$ belongs to $\mathcal{P}$ . Finally, we extract $K$ highest-scoring utterances to form an extractive summary of the input. + +$$ +\mathcal {S} (x _ {n}) = \sum_ {k \in \mathcal {P}} \sum_ {i = 1} ^ {H} \mathbb {1} [ z _ {i} ^ {(n)} = k ] \qquad (7) +$$ + +Our method draws on the convolutional encoder and decoder to transform BERT's semantic space to map each dimension to a latent code. The summary selection process is deterministic and our encoder takes full advantage of a large, pre-trained model to produce initial utterance representations. This design sets our method apart from that of Angelidis et al. (2021). Moreover, the method has the potential for modelling topic transitions between utterances to improve summarization of livestreams, which we leave for future work. + +# 5 Experiments + +Dataset. Finding salient content from livestream transcripts is a "needle-in-the-haystack" problem. Our summarization dataset contains a total of 370 videos split into short clips of 5 minutes each. The annotators manually annotated 5,421 clips ( $\sim$ 451 hours) with extractive and abstractive summaries. 582 clips ( $\sim$ 49 hours) are removed because they are identified to contain only chit-chats. The dataset is divided into training, validation and test splits: + +- 3,884 clips (320 videos / 323 hours) in training, +- 728 clips (25 videos / 61 hours) in validation, +- 809 clips (25 videos / 67 hours) in test split. + +We call our summarizer "StreamHover." When a user hovers their mouse over a video's timeline, a summary preview is shown and keeps updating. As a first attempt, StreamHover focuses on extracting salient utterances from individual clips instead of whole streams to encourage selected utterances to be mostly evenly distributed across the stream. When the content is provided live, the stream can be divided into short clips and our algorithm consumes one clip at a time to produce summaries on-the-fly. It is important to note that extracting summary utterances remains challenging even for modern neural summarizers. E.g., Kedzie et al. (2018) reveal that summarizers may not effectively identify summary content without a dependency on intentional + +lead bias in news writing. Our setting is challenging as not only are there few utterances deemed to be summary-worthy but such utterances can occur anywhere in a video clip. + +Baselines. We compare StreamHover with state-of-the-art extractive and abstractive summarizers. The abstractive summarizers generate an abstract from the transcript of a clip without tuning. These include BART-large, BART-large-cnn (Lewis et al., 2020) and T5 (Raffel et al., 2020), which are some of the strongest performing neural abstractive summarizers that are pre-trained on language modeling and summarization tasks. + +The unsupervised extractive summarizers extract salient utterances from a clip. LexRank (Erkan and Radev, 2004) and TextRank (Mihalcea and Tarau, 2004) are graph-based models that extract relevant sentences based on eigenvector centrality. SumBasic (Vanderwende et al., 2007) assigns higher scores to sentences containing frequently occurring content words. We further compare to a novel unsupervised graph-based summarization method for speech transcripts: FluCovRank (Shang et al., 2018) groups utterances into clusters, generates an abstractive sentence from each cluster, then selects the best elements from abstractive sentences under a budget constraint. Finally, we compare our approach with the Quantized Transformer (Angelidis et al., 2021), which uses a clustering interpretation of the quantized space and two-step sampling algorithm to extract summary sentences from reviews. + +Settings. We use pretrained BERT-BASE as our embedder $\mathsf{Embed}_{\theta}(\cdot)$ . The model has 12 layers, 12 heads per layer and a hidden size $(H)$ of 768. A 6-layer Transformer decoder is used as the generator $\mathsf{Generate}_{\phi}(\cdot)$ to reconstruct the original utterance. The model has 8 heads per layer, a hidden size of 768, and randomly initialized parameters. The convolutional encoder and decoder use a kernel size of 3. Because our embedder is pretrained and the remaining parameters are not, we divide them into two groups $\mathcal{E} = \{\theta\}$ and $\mathcal{R} = \{\phi, \varphi\}$ , then apply separate training schedules. Following Liu and Lapata (2019) we use two Adam optimizers: + +$$ +\begin{array}{l} l r _ {\mathcal {E}} = \widetilde {l r} _ {\mathcal {E}} \cdot \min (\operatorname {s t e p} ^ {- 0. 5}, \operatorname {s t e p} \cdot \operatorname {w a r m u p} _ {\mathcal {E}} ^ {- 1. 5}), \\ l r _ {\mathcal {R}} = \widetilde {l r} _ {\mathcal {R}} \cdot \min (\operatorname {s t e p} ^ {- 0. 5}, \operatorname {s t e p} \cdot \operatorname {w a r m u p} _ {\mathcal {R}} ^ {- 1. 5}) \\ \end{array} +$$ + +where the learning rate for the embedder $\widetilde{lr}_{\varepsilon} = 7e^{-4}$ + +
System3-Sentence Output4-Sentence Output5-Sentence Output
P (%)R (%)F (%)#WrdsP (%)R (%)F (%)#WrdsP (%)R (%)F (%)#Wrds
LEAD-N18.839.5712.538.5318.6312.6114.7751.3518.7115.7616.8264.04
SumBasic8.324.155.4529.448.475.616.6339.978.837.447.9251.54
QuantizedTran10.4013.3511.0780.0910.4417.6712.60104.6610.5821.8613.72128.35
LexRank23.9412.1415.8659.5123.3415.9618.5777.3323.4720.0321.1994.43
TextRank30.4515.3720.1073.3528.1818.9222.2492.4627.0022.5924.17110.42
StreamHover36.1818.2123.8788.0434.8623.2927.52113.4033.9228.4230.47137.02
+ +Table 3: Classification performance of extractive summarizers on identifying ground-truth summary utterances. + +
SystemR-1R-2R-L#Wrds
AbstractBART-large22.988.3515.04123.05
BART-large-cnn23.038.0316.6243.13
T5-large24.208.5517.5650.98
FluCovRank25.2910.9316.2850.00
ExtractLEAD-524.659.5417.5964.04
SumBasic23.155.5714.7651.54
QuantizedTran23.907.9015.37128.35
LexRank26.1410.1818.2494.43
TextRank25.9411.4418.89110.42
StreamHover25.6212.7019.33137.02
Oracle (Extract)43.4230.5837.99110.51
+ +Table 4: Results of extractive and abstractive summarizers evaluated by ROUGE. Extractive summarizers generate a 5-utterance summary for each clip. Oracle contains ground-truth summary utterances. StreamHover achieves the highest scores on R-2 and R-L. + +
SystemFluencyInforma.Overall
HumanFluCovRank-0.95-0.93-0.97
LexRank0.250.110.17
BART-large0.280.310.28
StreamHover0.420.520.52
+ +Table 5: Results of human evaluation regarding fluency, informativeness and the overall quality of system summaries using Best-Worst Scaling. + +is smaller than that of the rest params $\widetilde{lr}_{\mathcal{R}} = 4e^{-2}$ . Its warmup period is longer: $\mathrm{warmup}_{\mathcal{E}} = 3,000$ for the embedder and $\mathrm{warmup}_{\mathcal{R}} = 1,500$ for the rest. It allows the pretrained embedder to be updated in a slower pace until other model parameters start to generate accurate gradients. + +All of our models are trained for 30 epochs on dual NVIDIA V100 GPUs with gradient accumulation every ten steps. We experiment with different numbers of filters, $D = \{64, \underline{100}, 128\}$ , for the convolutional encoder and decoder. The number of latent codes are varied in $K = \{512, \underline{1024}, 2048\}$ . The coefficient $\beta$ used for commitment loss is set to 0.25 (Eq. (6)). These hyperparameters are tuned on the validation set. We keep only utterances that contain $>5$ words in consideration. The final training set contains 168,111 utterances. + +![](images/9a2edd15d63f230063d4360b28b679a2a3b55d75a38da538e4779ff7484f8df2.jpg) +Figure 5: The proportion of times a system is selected as the "Best." FluCovRank is omitted as it is $< 1\%$ . + +# 5.1 Results + +In Table 3, we analyze the performance of extractive summarizers on identifying ground-truth summary utterances and report their precision, recall and $F_{1}$ -measure scores. We vary the length of their output to yield {3, 4, 5}-utterance summaries. In comparison, a ground-truth extract contains 5.5 utterances. The Lead-N baseline selects the first N utterances of a clip. It gives low scores because our data do not present strong lead bias as that of news articles. We find that StreamHover consistently outperforms other summarization systems across all lengths. Its length, when measured by number of words, is comparable to that of LexRank and TextRank. The highest $F_{1}$ score of $30.47\%$ is achieved when StreamHover generates a 5-utterance summary for each 5-minute clip. This amounts to rendering one utterance per one-minute segment when a user scrolls past the video. + +In Table 4, we compare extractive and abstractive summarizers and report ROUGE scores (Lin, 2004) that measure content overlap between system and reference summaries. We use human abstracts as the reference. All extractive summarizers produce 5-utterance summaries and Oracle Extract contains ground-truth utterances. It places an upper bound on the performance of extractive summarizers. We observe that StreamHover yields the highest scores on both R-2 and R-L metrics. + +# FluCovRank + +- top left bottom / cloud studies today / find links to their original posts / hey jennifer saw the images / love the top left and bottom / info tab and i uploaded / colors are beautiful but im partial through colorful sky scenes / pretty large about 4000 by 4000 pixels / photo studies of today / moment + +# LexRank + +- I hope you guys are having a good day so far. +- So I'm going to be painting from these images and these beautiful photos are from various photographers. +- Those yeah well top right also is like very Contra high contrast that tends to like grab my attention when I look at the sheet but I would say top left and bottom right give me the most like happy feels. +- So yeah, if you guys want to grab the reference images, you can find them in the stream description below the individual images... + +# BART-Large + +- Hello good morning everybody welcome to the stream. I hope you guys are having a good day so far. Is there a lot of buffering or are we doing alright? I got a little message that there was some connectivity issue. For a moment there, so I hope I hope it's OK. Yeah, I'll just keep going. So yeah, if you guys want to grab the reference images, you can find them in the stream description below the individual images... + +# Quantized Transformer + +- Good to see you were going to be doing cloud studies today. +- The stream in the description. +- One of them is from Morguefile, One is from unsplash, well, two are from Unsplash and one is from pixels there a little bit from all over the place, but you can find the photographers below if you'd like. +- Hey Jennifer, saw the images. +- Let's see top left, bottom right... + +# StreamHover (Ours) + +- So if anybody is interested in joining in, if you want to work on some skies for your landscapes for future landscapes, this is what we're going to be doing. +- One of them is from Morguefile, One is from unsplash, well, two are from Unsplash and one is from pixels there a little bit from all over the place, but you can find the photographers below if you'd like. +- Those yeah well top right also is like very Contra high contrast that tends to like grab my attention when I look at the sheet but I would say top left and bottom right give me the most like happy feels. + +- So yeah, if you guys want to grab the reference images, you can find them in the stream description below the individual images... + +Table 6: Example system summaries for Digital Painting Studies with Maddy Bellwoar-Clouds. The BART summary is fluent but its content lacks specificity, as is the case for LexRank. The summary segments selected by FluCovRank are ungrammatical. StreamHover identifies on-topic and informative utterances related to digital painting. Their relevant spans of text are manually underlined for readability. + +We show example system summaries in Table 6. The abstractive summaries generated by BARTLarge are fluent but their content lacks specificity, so are the summaries produced by LexRank and Quantized Transformer. Particularly, QT does not seem to perform well on this task despite that the model has been retrained on livestream transcripts. We believe this is partly because words and phrases tend to repeat themselves in review documents, and while spoken utterances are verbose, there is little repetition found in the transcripts. We observe that summary segments selected by FluCovRank are ontopic but they are ungrammatical and difficult to + +# Utterances + +# C1 C2 C3 + +0 Hello good morning everybody welcome high foster highly art. + +# 1 Hi Lisa, welcome everyone. + +2 I hope you guys are having a good day so far. +3 Good to see you were going to be doing cloud studies today. +4 So if anybody is interested in joining in, if you want to work on some skies for your landscapes for future landscapes, this is what we're going to be doing. + +# 5 Photo studies of today. + +6 So I'm going to be painting from these images and these beautiful photos are from various photographers. + +7 You can find links to their original posts below. + +8 The stream in the description. + +9 One of them is from Morguefile, One is from unsplash, well, two are from Unsplash and one is from pixels there a little bit from all over the place, but you can find the photographers below if you'd like. + +0 Hey Jennifer, saw the images. + +1 I really love the top left and bottom right. + +2 The colors are beautiful but I'm partial through colorful Sky scenes. + +# 3 Yeah, I totally agree. + +4 Let's see top left, bottom right. +5 Those yeah well top right also is like very Contra high contrast that tends to like grab my attention when I look at the sheet but I would say top left and bottom right give me the most like happy feels. + +Table 7: A snippet from Digital Painting Studies with Maddy Bellwoar-Clouds. We show the most prominent latent codes and their representative utterances ('X'). Human annotated summary utterances are colored gray and ultra-short utterances are crossed out. + +interpret without context. In contrast, StreamHover can identify on-topic and informative utterances related to digital painting. We provide more examples in the supplementary materials. + +In Table 7, we study the most prominent latent codes (C1-3) and their associated utterances. We define representative utterances as those frequently assigned to these codes (Eq. (3)). We observe that C1 usually contains a skewed number of utterances that are commonly seen in the data and not representative of the input; C2 contains lengthy but not necessarily summary-worthy utterances. In our experiments, we exclude C1/C2 before performing grid search on all codes to find the set of prominent codes: we use $\mathcal{P} = 50$ tuned on the valid set which is effective in helping identify summary utterances.[9] + +We conduct a human evaluation to assess how StreamHover compares to strong extractive and abstractive baselines. They are (a) LexRank (Erkan and Radev, 2004), (b) FluCovRank (Shang et al., 2018) and (c) BART-Large (Lewis et al., 2020); the latter two are abstractive systems. Each evaluator is shown a video clip with a synchronized display of the transcript followed by four system summaries, shown in random order to remove any positional + +bias. The evaluator is asked to select the best and worst of the summaries according to each of these criteria: Fluency/Coherence: is the summary well-presented, grammatically correct and easy to read? Informativeness: does the summary provide useful information about the video clip? Overall Quality: is the summary of good quality considering both content and linguistic aspects? + +We randomly sample 100 clips from the test set. Each clip and its summaries are judged by five evaluators that we recruit from Amazon mechanical turk. Table 5 shows the performance of all systems measured by Best-Worst Scaling (Kiritchenko and Mohammad, 2016), where the score of a system is computed as the percentage of times it was selected as the best minus the worst. The range of scores is [-1,1]. Figure 5 shows how frequently a system is chosen to produce the "best summary." We observe that StreamHover achieves an overall score of 0.52 and it is selected as the best summary in over half of the times. + +# 6 Conclusion + +We present StreamHover, a new framework for annotating and summarizing livestream transcripts. Our dataset contains over 500 hours of videos annotated with extractive and abstractive summaries. We explored an extractive method leveraging VQVAE to identify salient summary utterances and obtained strong results. Future work includes boosting summarization solutions to provide users a concentrated overview of streamed content. + +# References + +Stefanos Angelidis, Reinald Kim Amplayo, Yoshihiko Suhara, Xiaolan Wang, and Mirella Lapata. 2021. Extractive opinion summarization in quantized transformer spaces. Transactions of the Association for Computational Linguistics (TACL). +Ron Artstein and Massimo Poesio. 2008. Survey article: Inter-coder agreement for computational linguistics. Computational Linguistics. +Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. +Yoshua Bengio, Nicholas Léonard, and Aaron Courville. 2013. Estimating or propagating gradients through stochastic neurons for conditional computation. + +Levent Besik. 2020. Google named a leader in the Gartner 2020 magic quadrant for cloud AI developer services. In https://cloud.google.com/blog/products/ai-machine-learning/google-named-leader-gartner-2020-magic-quadrant-cloud-ai-developer-services. +Arthur Bražinskas, Mirella Lapata, and Ivan Titov. 2020. Few-shot learning for opinion summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4119-4135, Online. Association for Computational Linguistics. +Ziqiang Cao, Furu Wei, Wenjie Li, and Sujian Li. 2017. Faithful to the original: Fact aware neural abstractive summarization. CoRR, abs/1711.04434. +Jean Carletta, Simone Ashby, Sebastien Bourban, Mike Flynn, Mael Guillemot, Thomas Hain, Jaroslav Kadlec, Vasilis Karaiskos, Wessel Kraaij, Melissa Kronenthal, Guillaume Lathoud, Mike Lincoln, Agnes Lisowska, Iain McCowan, Wilfried Post, Dennis Reidsma, and Pierre Wellner. 2006. The ami meeting corpus: A pre-announcement. In Machine Learning for Multimodal Interaction, pages 28-39, Berlin, Heidelberg. Springer Berlin Heidelberg. +Mingda Chen, Zewei Chu, Sam Wiseman, and Kevin Gimpel. 2021. Summscreen: A dataset for abstractive screenplay summarization. CoRR, abs/2104.07091. +Yen-Chun Chen and Mohit Bansal. 2018. Fast abstractive summarization with reinforce-selected sentence rewriting. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 675-686, Melbourne, Australia. Association for Computational Linguistics. +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. +Yue Dong, Yikang Shen, Eric Crawford, Herke van Hoof, and Jackie Chi Kit Cheung. 2018. BanditSum: Extractive summarization as a contextual bandit. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3739-3748, Brussels, Belgium. 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. + +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. +Sebastian Gehrmann, Yuntian Deng, and Alexander Rush. 2018. Bottom-up abstractive summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4098-4109, Brussels, Belgium. Association for Computational Linguistics. +J. J. Godfrey, E. C. Holliman, and J. McDaniel. 1992. Switchboard: telephone speech corpus for research and development. In [Proceedings] ICASSP-92: 1992 IEEE International Conference on Acoustics, Speech, and Signal Processing, volume 1, pages 517-520 vol.1. +Matt Grenander, Yue Dong, Jackie Chi Kit Cheung, and Annie Louis. 2019. Countering the effects of lead bias in news summarization via multi-stage training and auxiliary losses. 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 6019-6024, Hong Kong, China. Association for Computational Linguistics. +François Hernandez, Vincent Nguyen, Sahar Ghannay, Natalia Tomashenko, and Yannick Esteve. 2018. Ted-lium 3: Twice as much data and corpus repartition for experiments on speaker adaptation. Lecture Notes in Computer Science, page 198-208. +A. Janin, D. Baron, J. Edwards, D. Ellis, D. Gelbart, N. Morgan, B. Peskin, T. Pfau, E. Shriberg, A. Stolcke, and C. Wooters. 2003. The icsi meeting corpus. In 2003 IEEE International Conference on Acoustics, Speech, and Signal Processing, 2003. Proceedings (ICASSP '03), volume 1, pages I-I. +Shuning Jin, Sam Wiseman, Karl Stratos, and Karen Livescu. 2020. Discrete latent variable representations for low-resource text classification. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4831-4842, Online. Association for Computational Linguistics. +Sushant Kafle and Matt Huenerfauth. 2018. A corpus for modeling word importance in spoken dialogue transcripts. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Miyazaki, Japan. European Language Resources Association (ELRA). +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. + +Svetlana Kiritchenko and Saif M. Mohammad. 2016. Capturing reliable fine-grained sentiment associations by crowdsourcing and best-worst scaling. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 811-817, San Diego, California. Association for Computational Linguistics. +Jia Jin Koay, Alexander Roustai, Xiaojin Dai, Dillon Burns, Alec Kerrigan, and Fei Liu. 2020. How domain terminology affects meeting summarization performance. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5689-5695, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Jia Jin Koay, Alexander Roustai, Xiaojin Dai, and Fei Liu. 2021. A sliding-window approach to automatic creation of meeting minutes. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Student Research Workshop, pages 68-75, Online. +Wojciech Kryscinski, Nitish Shirish Keskar, Bryan McCann, Caiming Xiong, and Richard Socher. 2019. Neural text summarization: A critical evaluation. 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 540-551, Hong Kong, China. Association for Computational Linguistics. +Faisal Ladhak, Bryan Li, Yaser Al-Onaizan, and Kathleen McKeown. 2020. Exploring content selection in summarization of novel chapters. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5043-5054, Online. Association for Computational Linguistics. +Logan Lebanoff, John Muchovej, Franck Dernoncourt, Doo Soon Kim, Seokhwan Kim, Walter Chang, and Fei Liu. 2019. Analyzing sentence fusion in abstractive summarization. In Proceedings of the 2nd Workshop on New Frontiers in Summarization, pages 104-110, Hong Kong, China. Association for Computational Linguistics. +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. Association for Computational Linguistics. +Bohan Li, Junxian He, Graham Neubig, Taylor Berg-Kirkpatrick, and Yiming Yang. 2019a. A surprisingly effective fix for deep latent variable modeling of 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 3603-3614, Hong Kong, China. Association for Computational Linguistics. +Manling Li, Lingyu Zhang, Heng Ji, and Richard J. Radke. 2019b. Keep meeting summaries on topic: Abstractive multi-modal meeting summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2190-2196, Florence, Italy. Association for Computational Linguistics. +Mingzhe Li, Xiuying Chen, Shen Gao, Zhangming Chan, Dongyan Zhao, and Rui Yan. 2020. VMSMO: Learning to generate multimodal summary for videobased news articles. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9360-9369, 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, Barcelona, Spain. Association for Computational Linguistics. +Feifan Liu and Yang Liu. 2008. Correlation between ROUGE and human evaluation of extractive meeting summaries. In Proceedings of ACL-08: HLT, Short Papers, pages 201-204, Columbus, Ohio. Association for Computational Linguistics. +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. +Matthew Marge, Satanjeev Banerjee, and Alexander Rudnicky. 2010. Using the Amazon Mechanical Turk to transcribe and annotate meeting speech for extractive summarization. In Proceedings of the NAACL HLT 2010 Workshop on Creating Speech and Language Data with Amazon's Mechanical Turk, pages 99-107, Los Angeles. Association for Computational Linguistics. +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. +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. +Gabriel Murray and Giuseppe Carenini. 2008. Summarizing spoken and written conversations. In Proceedings of the 2008 Conference on Empirical Meth + +ods in Natural Language Processing, pages 773-782, Honolulu, Hawaii. Association for Computational Linguistics. +Shashi Narayan, Shay B. Cohen, and Mirella Lapata. 2018a. 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, Brussels, Belgium. Association for Computational Linguistics. +Shashi Narayan, Shay B. Cohen, and Mirella Lapata. 2018b. Ranking sentences for extractive summarization with reinforcement learning. 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 1747-1759, New Orleans, Louisiana. Association for Computational Linguistics. +Shruti Palaskar, Jindrich Libovický, Spandana Gella, and Florian Metze. 2019. Multimodal abstractive summarization for how2 videos. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6587-6596, Florence, Italy. Association for Computational Linguistics. +Pinelopi Papalampidi, Frank Keller, Lea Frermann, and Mirella Lapata. 2020. Screenplay summarization using latent narrative structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1920-1933, Online. Association for Computational Linguistics. +Gerald Penn and Xiaodan Zhu. 2008. A critical reassessment of evaluation baselines for speech summarization. In Proceedings of ACL-08: HLT, pages 470-478, Columbus, Ohio. Association for Computational Linguistics. +Gabriele Prato, Ella Charlaix, and Mehdi Rezagholizadeh. 2020. Fully quantized transformer for machine translation. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1-14, Online. 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(140):1-67. +Abigail See, Peter J. Liu, and Christopher D. Manning. 2017. Get to the point: Summarization with pointer-generator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1073-1083, Vancouver, Canada. Association for Computational Linguistics. +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. +Guokan Shang, Wensi Ding, Zekun Zhang, Antoine Tixier, Polykarpos Meladianos, Michalis Vazirgiannis, and Jean-Pierre Lorre. 2018. Unsupervised abstractive meeting summarization with multisentence compression and budgeted submodular maximization. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 664-674, Melbourne, Australia. Association for Computational Linguistics. +Kaiqiang Song, Bingqing Wang, Zhe Feng, and Fei Liu. 2021. A new approach to overgenerating and scoring abstractive summaries. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1392-1404, Online. +Jiwei Tan, Xiaojun Wan, and Jianguo Xiao. 2017. Abstractive document summarization with a graph-based attentional neural model. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1171-1181, Vancouver, Canada. Association for Computational Linguistics. +Aaron van den Oord, Oriol Vinyals, and koray kavukcuoglu. 2017. Neural discrete representation learning. In Advances in Neural Information Processing Systems, volume 30, pages 6306-6315. Curran Associates, Inc. +Lucy Vanderwende, Hisami Suzuki, Chris Brockett, and Ani Nenkova. 2007. Beyond SumBasic: Task-focused summarization with sentence simplification and lexical expansion. Information Processing and Management, 43(6):1606-1618. +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. +Lu Wang and Claire Cardie. 2013. Domain-independent abstract generation for focused meeting summarization. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics, pages 1395-1405, Sofia, Bulgaria. +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 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. +Wen Xiao and Giuseppe Carenini. 2019. Extractive summarization of long documents by combining global and local context. 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 3011-3021, Hong Kong, China. Association for Computational Linguistics. +Jiacheng Xu and Greg Durrett. 2019. Neural extractive text summarization with syntactic compression. 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 3292-3303, Hong Kong, China. Association for Computational Linguistics. +Michihiro Yasunaga, Rui Zhang, Kshitijh Meelu, Ayush Pareek, Krishnan Srinivasan, and Dragomir Radev. 2017. Graph-based neural multi-document summarization. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pages 452-462, Vancouver, Canada. Association for Computational Linguistics. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2020. *Bertscore: Evaluating text generation with bert*. +Chen Zhao, Chenyan Xiong, Corby Rosset, Xia Song, Paul Bennett, and Saurabh Tiwary. 2020. Transformer-xh: Multi-evidence reasoning with extra hop attention. In International Conference on Learning Representations. +Ming Zhong, Da Yin, Tao Yu, Ahmad Zaidi, Mutethia Mutuma, Rahul Jha, Ahmed Hassan Awadallah, Asli Celikyilmaz, Yang Liu, Xipeng Qiu, and Dragomir Radev. 2021. QMSum: A new benchmark for query-based multi-domain meeting summarization. In Proceedings of the North American Chapter of the Association for Computational Linguistics (NAACL). +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, Online. +Junnan Zhu, Haoran Li, Tianshang Liu, Yu Zhou, Ji-jun Zhang, and Chengqing Zong. 2018. MSMO: Multimodal summarization with multimodal output. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4154-4164, Brussels, Belgium. Association for Computational Linguistics. + +# A Behance Dataset + +We collect a total of 5,398 streamed videos from *Behance*. net. Some streamers opt-out of the transcription service provided by Microsoft Automatic Speech Recognition, so transcripts are not available for these videos. We create a list of domain keywords by finding 50 most frequently appearing words from video titles (stopwords are excluded). Examples include 'fresco', 'adobe', 'photoshop', 'illustration', 'art', 'painting', 'drawing', 'illustrator', 'character', 'design.' The keywords are used to select videos for human annotation. 2,360 videos have transcripts available and contain at least one of our domain keywords in their titles. These videos are split into clips of 5-minute each. Some clips contain little or no verbal content. We thus remove clips that contain very few words ( $\leq$ 333 words) or utterances ( $\leq$ 38 utterances). These thresholds are determined using the average values of all clips. Videos with less than 5 valid clips are also removed from consideration. This preprocessing step gives 6,003 clips from 381 videos. During annotation, our annotators find 582 clips to contain only chitchats, suggesting that these clips are uninformative. 11 videos contain only chit-chat clips, they are subsequently removed from the dataset, yielding a total of 5,421 clips from 370 videos that are split into train, validation and test sets. + +# B Baseline Summarizers + +Our neural abstractive baselines include pre-trained BART-large (Lewis et al., 2020), BART-large-cnn, and T5-large (Raffel et al., 2020). We follow the HuggingFace implementation (Wolf et al., 2020). Utterances that are longer than 5 words are concatenated into a flat sequence, which is used as the input to each summarizer. The model parameters include: the maximum and minimum summary lengths are 150 and 15 tokens, respectively. We use a beam size of 5 with early stopping. The length penalty is 1.0. "norepeat_ngram_size" is set to 3, such that a trigram cannot occur more than once in the summary. + +Our extractive baselines include LexRank (Erkan and Radev, 2004), TextRank (Mihalcea and Tauru, 2004), and SumBasic (Vanderwende et al., 2007). They are implemented using the Sumy library where we adopt the default text parser and stemmer. Our unsupervised summarizer for speech transcript summarization (Shang et al., 2018) uses the following settings: we report the FluCovRank + +scores. The number of components used in LSA is 25. The number of utterance communities is 35. The number of clusters is 6, with a scaling factor of 1.3 and lambda of 0.4. The size of the summary is set to 50 words. + +# C Example Summaries + +We show example summaries generated by different summarizers: FluConvRank (Shang et al., 2018), LexRank (Erkan and Radev, 2004), BARTlarge (Lewis et al., 2020) and StreamHover. We also show the top-3 most prominent latent codes and their associated utterances. We choose 5 representative utterances for each code that are most frequently assigned to this code. We observe that C1 utterances are frequently seen in the data (chitchats) and not representative of the input. C2 is associated with lengthy but not necessarily summary-worthy utterances. C3 utterances are both comprehensive and contain diverse information. In our experiments, we exclude C1/C2 before performing grid search on all codes to find the set of prominent codes. It allows us to effectively identify summary utterances without biasing towards the lengthy ones. + +# FluCovRank + +- digital painting today / 3 hours minimum / explain my painting process / starbucks florida cup / really really cheerful scene / prob hey welcome hi kumar / canvas sizes 3000 by 2000 pixels / sore throat so todays stream might be a tiny bit shorter / otherwise just sit back and relax and enjoy the painting / find + +# LexRank + +- If you guys are interested in painting along with me or doing a little sketch or whatever, you have time for your always welcome to my reference. +- Is what I have planned to work on this if I'm feeling good, we might go on or do another painting, but I'm drinking some tea with honey and I have to kind of be careful with my voice a little bit talking so much, but I'm otherwise I'm good. +- So again, that's where you can find my references below in the stream description. +- You guys are welcome to paint along if you're interested in doing that. +- I've lived in a few different states, but where I spent most of my life was in Florida so. + +# BART-Large + +- Good afternoon, good evening, good morning, good day, good afternoon, how are you? Good morning, hi Mohammed, hi kumar, hi muhammad, hi hi kumar, hi hello hi hi Mohammed. I hope you've had a good day so far. I'm doing pretty good pro to be honest. I have a little bit of a sore throat, so today's stream might be a tiny bit shorter than some of the others. It's still going to be around 3 hours minimum. Is what I have planned to work on this if I'm feeling good, we might go on or do another painting, but I'm drinking some tea with honey and I have to kind of + +# Quantized Transformer + +- We're going to be doing some digital painting today. +- As usual, I'm going to be working from this photo as a reference. +- I hope you're all doing well. +- Image is below in the stream description and above the chat. +- It's still going to be around 3 hours minimum. +- Is what I have planned to work on this if I'm feeling good, we might go on or do another painting, but I'm drinking some tea with honey and I have to kind of be careful with my voice a little bit talking so much, but I'm otherwise I'm good. +Um prob hey welcome Hi Kumar. +- You guys are welcome to paint along if you're interested in doing that. +I hope it's going to be good. +- My canvas sizes 3000 by 2000 pixels. + +# StreamHover (Ours) + +- It's like a little cafe table in Spain, with some dappled lighting coming through these trees. +- I really like the pattern of light on the building over here, and the just overall feeling the different colors. +- If you guys are interested in painting along with me or doing a little sketch or whatever, you have time for your always welcome to my reference. +- Is what I have planned to work on this if I'm feeling good, we might go on or do another painting, but I'm drinking some tea with honey and I have to kind of be careful with my voice a little bit talking so much, but I'm otherwise I'm good. +- I am using pure ref to put the little reference image up here so we can see a thumbnail view of it while we're painting. + +Table 8: Example system summaries from Digital Painting with Maddy Bellwoar. BART summary is fluent but its content lacks specificity, as is the case for LexRank. Summary segments selected by FluCovRank are ungrammatical. StreamHover identifies on-topic and informative utterances related to digital painting. + +# Utterances + +# C1 C2 C3 + +0 Hi-everybody, good morning. + +1 Good afternoon, good evening whatever time it is for you. +2. Thanks for being here. + +3 Hi Fernando Allison, Welcome. + +4 I hope you've had a good day so far. + +5 I hope you've all been well. + +6 If I haven't seen you since last week, I hope you had a good weekend. + +7 We're going to be doing some digital painting today. + +8 As usual, I'm going to be working from this photo as a reference. + +9 I think it's really beautiful. + +0 It's like a little cafe table in Spain, with some dappled lighting coming through these trees. + +1 I really like the pattern of light on the building over here, and the just overall feeling the different colors. + +2 the Blues and pinks and yellows on the wall here. + +3 It's really, really cheerful scene. + +4 Hi Mohammed, high pro, how are you? + +5 I hope you're all doing well. + +6 If you guys are interested in painting along with me or doing a little sketch or whatever, you have time for your always welcome to my reference. + +7 Image is below in the stream description and above the chat. + +8 Also, if you check the info panel it should be there as well so this photo is from Unsplash. + +9 You can find a link to the original post from the photographer below. + +# 20 The stream. + +21 I'm doing pretty good pro to be honest. + +22 I have a little bit of a sore throat, so today's stream might be a tiny bit shorter than some of the others. + +23 It's still going to be around 3 hours minimum. + +24 Is what I have planned to work on this if I'm feeling good, we might go on or do another painting, but I'm drinking some tea with honey and I have to kind of be careful with my voice a little bit talking so much, but I'm otherwise I'm good. + +25 Um prob hey welcome Hi Kumar. + +26 So again, that's where you can find my references below in the stream description. + +27 You guys are welcome to paint along if you're interested in doing that. + +28 Otherwise, just sit back and relax and enjoy the painting. + +29 I'll try to do a nice job with this one. + +30 I hope it's going to be good. + +31 I really like the reference so. + +# 32 Hi Dante. + +33 So I'm going to explain my painting process as we go through here. +34 And if you guys have any questions you can let me know. +35 I am using pure ref to put the little reference image up here so we can see a thumbnail view of it while we're painting. +36 My canvas sizes 3000 by 2000 pixels. +37 If you're curious. +38 Yes, I'm using a different Cup today. +39 This is my Starbucks Florida Cup. +40 Maybe more information than you need, but yeah, so I'm I grew up in Florida. +I've lived in a few different states, but where I spent most of my life was in Florida so. +42 I don't live there now. + +Table 9: A transcript snippet from Digital Painting with Maddy Bellwoar. We show the most prominent latent codes and their representative utterances ('X'). Human annotated summary utterances are colored gray and ultra-short utterances are crossed out. + +# FluCovRank + +- view is created by them stitching images / maps years was a fitness studio yeah / image stitching just has some weird that happens team / oh if you want to share a link for map crunch / leave so weird parts / hope achieve that feeling of the water is really moving / yeah its + +# LexRank + +- So I'm going to start to work on the foreground now and this is going to be tricky, so this is one of the things that made me choose to paint this reference. +- The rushing water in the foreground kind of coming towards us and the ripples that it creates an the little bubbles and all that kind of stuff. +- Sometimes the image stitching just has some weird stuff that happens, Oh team. +- Oh, if you want to share a link for map crunch. +- Alright that should work this time. + +# BART-Large + +- Trying to figure out those relationships near the end or like when you're trying to like if you're going to try to get the one or like if the one is like if I'm working on the one I'm going to do it's like if it's not working. I'm ready for some dog like with half his body has been overlapped by a boat. Yeah, it's always really satisfying the color combination in these kind of desert scenes, the nice blue Sky and like the Warm Reds and oranges. It's like you get the extra bonus of like some purple thrown in there and that's just perfect. You know, I've seen people like riding camels and stuff, he's taking pictures + +# Quantized Transformer + +- So I hope I can achieve that feeling of the water is really moving there. +- You have to click the share button and then copy the link that is there if you copy the link from the URL above it's not going to send the right image. +- So what you can do is click right here where it says share and then copy this. +- OK, so these so right now, I'm just going to start with a darker shadows. +- Of where I see the ripples. +- Alright that should work this time. +- You know where some of the really, really fantastic ones come from. +- But people will be on the boat on foot. +- Maps years was a fitness studio, yeah, there's all kinds of stuff. +I've painted with references with stuff like that. + +# StreamHover (Ours) + +- So I'm going to start to work on the foreground now and this is going to be tricky, so this is one of the things that made me choose to paint this reference. +- The rushing water in the foreground kind of coming towards us and the ripples that it creates an the little bubbles and all that kind of stuff. +- Yeah, it's always really satisfying the color combination in these kind of desert scenes, the nice blue Sky and like the Warm Reds and oranges. + +- I'm ready for some dog like with half his body has been overlapped by a boat. +- People are in a car traveling there, you get a lot of side of the road like kind of bland images, but then you also get like the most amazing pictures and people also upload images and stuff, I think that might be. + +Table 10: Example system summaries from Virtual Plein Air Landscape Painting. The BART summary is fluent but its content lacks specificity, as is the case for LexRank. The summary segments selected by FluCovRank are ungrammatical. StreamHover identifies on-topic and informative summary utterances. + +# Utterances + +# C1 C2 C3 + +0 Trying to figure out those relationships near the end or like force them if they're not working. +1 So I'm going to start to work on the foreground now and this is going to be tricky, so this is one of the things that made me choose to paint this reference. +2 'cause I wanted to figure out how to paint this kind of situa- tion. +3 The rushing water in the foreground kind of coming towards us and the ripples that it creates an the little bubbles and all that kind of stuff. +4 So I hope I can achieve that feeling of the water is really $\square$ $\square$ $\square$ moving there. +5 Might give some inspiration alright let's see got an artstation $\square$ $\square$ $\square$ link. +6 Oh, cool. 7 Good- vibes good vibes. +8 Other desert desert scene. $\square$ $\square$ $\square$ +9 Yeah, it's always really satisfying the color combination in these kind of desert scenes, the nice blue Sky and like the Warm Reds and oranges. +10 I like the one I'm working on 2 'cause. +It's like you get the extra bonus of like some purple thrown in there and that's just perfect. +12 For me. 13 Yeah, that's cool thanks. +14 Team I says, I was looking for a nice location on map French and I found this alright. +15 I'm ready for some dog like with half his body has been overlapped by a boat. +16 Sometimes the image stitching just has some weird stuff that happens, Oh team. +17 Oh, if you want to share a link for map crunch. +18 You have to click the share button and then copy the link +that is there if you copy the link from the URL above it's not going to send the right image. +19 So what you can do is click right here where it says share $\square$ $\square$ $\square$ and then copy this. +20 And then that will be the right one, 'cause I think it sent the wrong one from you. +21 Yeah. 22 Alright cool. +23 Will get back to painting? +24 OK, so these so right now, I'm just going to start with a $\square$ $\square$ $\square$ darker shadows. +25 Of where I see the ripples. +26 I'm not worried about putting like every ripple in the right spot. +27 But we couldn't get the overall feel this. +28 Some more Brown here. 29 Alright that should work this time. +30 What's wrong with that picture? +31 Does actually seems nice? +32 I don't see anything wrong with that landscape Timo? +33 When you when you're using map crunch you're going to $\square$ $\times$ $\square$ get a lot of like side of the road road views because you know if you think about where the car is going. +34 Order fact that it's your in the Google Maps. +□ □ □ +35 People are in a car traveling there, you get a lot of side of the road like kind of bland images, but then you also get like the most amazing pictures and people also upload images and stuff, I think that might be. +36 You know where some of the really, really fantastic ones come from. +37 But people will be on the boat on foot. +38 You know, I've seen people like riding camels and stuff, he's taking pictures for Google. +39 Maps years was a fitness studio, yeah, there's all kinds of stuff. +40 Yeah, but sometimes you get something weird because the 3D or the 360 Panorama. +41 View is created by them stitching images together. +42 So, sometimes you have weird situations where stuff over-laps. + +Table 11: A snippet from Virtual Plein Air Landscape Painting. We show the most prominent latent codes and their representative utterances ('X'). Human annotated summary utterances are colored gray and ultra-short utterances are crossed out. + +# FluCovRank + +- drawing diesel letters / surface pen 4 i have the 3 / latest song version of the surface / pin so i got a surface pen / uhm this pan to check / avoid these artifacts in astana / file ready an complete im just listening / early in octber 20th 19th / bump on phone so yeah + +# LexRank + +- Thank you for sticking around wanna show you some real cool stuff, not right there. +- Bump on Phone so yeah, that's the wrong letter, but let's go. +- But I thought we fresco does not have good, um Palm rejection and so when you using the pen and drawing whether you're on the iPad or surface. +- We go come on come here pin so I got a Surface Pen here. + +- Pan's had details that were missing right now, I'm using the vector pen the vector brushes are in. + +# BART-Large + +- Thank you for sticking around wanna show you some real cool stuff, not right there. I'm on the Surface Pro. That's the latest song version of the surface. It just came out early in October 20th 19th. The app and it's working it's a work in progress OK is constantly being updated with the features and bugs. They sent me umh this pan to check out. Pan's had details that were missing right now, I'm using the vector pen the vector brushes are in. So I'm doing this little dots and what happens is we on with Adobe fresco is there. But I thought we fresco does not have good, um Palm rejection and so when you using the + +# Quantized Transformer + +- I do have my Surface Pen somewhere it's up there. +I'm on the Surface Pro. +- That's the latest song version of the surface. +- You end up with all these little artifacts that when your Palm lays on the screen. +- And so as I was drawing diesel letters. +- I got to the point where. +- I just cannot avoid these artifacts in Astana kept them. +- I need to do some of these lines here is geared is closeout all. +- If this doesn't have a pain +- Just did good thing is I have extra pants, not only do I have all here's one, not only do I have extra pants. +- OK, here, we go ever it is yeah, some of these. + +# StreamHover (Ours) + +- It's gotta stay and the same letter so they was the letter C and I'm just using my hands my fingers. +- The app and it's working it's a work in progress OK is constantly being updated with the features and bugs. +- But I thought we fresco does not have good, um Palm rejection and so when you using the pen and drawing whether you're on the iPad or surface. +- I kept them in the drawing and now they are part of the look of each of these letters, which is crazy. +- Just did good thing is I have extra pants, not only do I have all here's one, not only do I have extra pants. + +Table 12: Example system summaries from Creating ABC Childrens Book Art on Adobe Fresco and Adobe Illustrator Part 18. BART summary is fluent but its content lacks specificity, as is the case for LexRank. Summary segments selected by FluCovRank are ungrammatical. StreamHover identifies on-topic and informative summary utterances. + +# Utterances + +# C1 C2 C3 + +0 Thank you for sticking around wanna show you some real cool stuff, not right there. + +1 It's gotta stay and the same letter so they was the letter C $\square$ X $\square$ and I'm just using my hands my fingers. +2 I do have my Surface Pen somewhere it's up there. +3 I'm on the Surface Pro. +47 5 That's the latest song version of the surface. 6 It just came out early in October 20th 19th. +7 I know that in a few days were gonna be in 2020, which is why I want to have. +8 This file ready an complete I'm just listening. 9 Bump on Phone so yeah, that's the wrong letter, but let's go. + +# 10 It's just he gone. + +11 So I'm doing this little dots and what happens is we on with □ □ □ Adobe fresco is there. +12 It doesn't do a good job. +13 The app and it's working it's a work in progress OK is constantly being updated with the features and bugs. +14 But I thought we fresco does not have good, um Palm rejection and so when you using the pen and drawing whether you're on the iPad or surface. +15 You end up with all these little artifacts that when your Palm lays on the screen. +16 And so as I was drawing diesel letters. +17 I got to the point where. $\boxed{\mathbf{X}}$ $\boxed{\square}$ 18 I just cannot avoid these artifacts in Astana kept them. $\boxed{\square}$ $\boxed{\square}$ +19 I kept them in the drawing and now they are part of the look of each of these letters, which is crazy. +20 And then there's some of these letters that don't have detail like this one. +21 So now I am going to use my pen there. +22 We go come on come here pin so I got a Surface Pen here. +23 Anthony my glasses. 24 But the lightless terrible OK here we go let me. +25 I need to do some of these lines here is geared is closeout all. +26 Define. $\square \square \square$ 27 If this doesn't have a pain. +28 Come on, it does have a pen. +29 Usually. 30 I guess the battery. 31 Just did good thing is I have extra pants, not only do I have all here's one, not only do I have extra pants. +32 There we go. 33 I am I have the Surface Pen 4 I have the 3. +34 I have □ □ □ +35 I also have other pins with other brands like the Wacom, the bamboo adanet and this other. +36 Pam brand. 37 They sent me umh this pan to check out. +38 They mean the company. $\square$ $\square$ $\square$ +39 At the Renaissance so it's pretty cool. $\times$ $\square$ $\square$ +40 OK, here, we go ever it is yeah, some of these. $\square$ $\square$ $\square$ +41 Pan's had details that were missing right now, I'm using the vector pen the vector brushes are in. +42 There we go. 43 I'm try not to yell but I know I can hear. 44 Just a big bounce in my voice and Missy Volume. +45 OK, so now we're back we're back 'cause I could hear the sound an it was very loud. +46 I'm sorry I already have a loud voice. + +Table 13: A transcript snippet from Creating ABC Childrens Book Art on Adobe Fresco and Adobe Illustrator Part 18. We show the most prominent latent codes and their representative utterances ('X'). Human annotated summary utterances are colored gray and ultra-short utterances are crossed out. + +# FluCovRank + +- learning process proceed / draw this out and post it where people / sit down an just trying to draw a picture / spent like 3 hours / alot like ill draw something like old man i want to draw / consistently draw this character and erase and restart and you cant necessarily / practice will + +# LexRank + +- The practice will do a lot more for you than drawing a picture. +- You might get one picture that might turn out really cool and you can post it and stuff like that, but if you work on your practice and you get that practice the way that you want it, you can use that practice forever for more than one picture. +- You stop trying to make the picture and get back to practice. +- So if there's things that you need to practice and stuff like that, you stand to gain a lot more from that practice then. +- Sit down an just trying to draw a picture. + +# BART-Large + +- I do I like to do more practice in anything. Practices gives me this feel that I've never had when I was younger. You know, of course, everybody will tell you. You might get one picture that might turn out really cool and you can post it and stuff like that, but if you work on your practice and you get that practice the way that you want it, you can use that practice forever for more than one picture. So that's generally would always tell myself when I'm drawing, and I'm like. Oh crap, here I go again. I should draw this into a picture and then I end up skipping practice to save whatever I'm doing as a picture so that I can. Just 'cause + +# Quantized Transformer + +- Trying to make a picture, right? +- And then I'm like OK alright I gotta I gotta center myself You know I gotta always gotta check myself every now and again or back that was kind of how it wasn't back then but now I don't really like to draw pictures. +- I do I like to do more practice in anything. +- You sit up and you put on like references for the superhero be in movies or something like that. +- You pull up references on whatever social media or wherever you get your images from. +- Whereas if you were just trying to practice, you would realize that all of that stuff that you're about to throw away or disregard was actually what you were actually searching for. + +# StreamHover (Ours) + +- Doesn't matter what styles you draw, so don't overly complicated by like Oh my God, you know now you could draw it. +- I used to do that a lot when I was younger where I would do something and be like holy crap, didn't think that would come out that way. +- And then I'm like OK alright I gotta I gotta center myself You know I gotta always gotta check myself every now and again or back that was kind of how it wasn't back then but now I don't really like to draw pictures. +- They don't see it happening until it's too late where it's like. Oh Man, I could totally practice this right now, or I could Draw Something Super Duper cool, you know, a piece of fan art or something like that. +- You're going to struggle with for a couple of days or couple minutes and then figure out you can't draw it or you have a hard time drawing it and then just giving up. + +Table 14: Example system summaries from Call me Derek: Value Study. The BART summary is fluent but its content lacks specificity, as is the case for LexRank. Summary segments selected by FluCovRank are ungrammatical. StreamHover identifies on-topic and informative summary utterances. + +# Utterances + +# C1 C2 C3 + +0 And then once I get my general OK this is what the hairstyle is gonna be right here. + +1 I definitely want to condom mark the flow. +2 Well, I'll do that later. + +3 And now I just kind of relax and just. + +4 Draw hairstyles as long as there as long as his long hair. + +5 Doesn't matter what styles you draw, so don't overly complicated by like Oh my God, you know now you could draw it. + +# 6 Now you can draw. + +# 7. Fases and stuff. + +8 If you want, I try not to draw too much of the face. +9 Just 'cause I don't want to. +10 I don't want to get caught up in that thing that I always do where when I'm drawing a face or I'm doing practice. +11 I always do that thing where it's like holy crap you know this is a really good face. +12 I should draw this into a picture and then I end up skipping practice to save whatever I'm doing as a picture so that I can. + +# 13 You know? + +14 Posted on Instagram or something like that. +I used to do that a lot when I was younger where I would do something and be like holy crap, didn't think that would come out that way. +16 I don't want to waste this in practice. + +17-21 ... + +22 You might get one picture that might turn out really cool and you can post it and stuff like that, but if you work on your practice and you get that practice the way that you want it, you can use that practice forever for more than one picture. +23 So that's generally would always tell myself when I'm drawing, and I'm like. + +24 Oh crap, here I go again. + +25 Trying to make a picture, right? + +26 You stop trying to make the picture and get back to practice. + +27 And then I'm like OK alright I gotta I gotta center myself. You know I gotta always gotta check myself every now and again or back that was kind of how it wasn't back then but now I don't really like to draw pictures. + +28 I do I like to do more practice in anything. + +29 Practices gives me this feel that I've never had when I was younger. + +30 When I was younger, which is so eager to get people to see my work that I wasn't necessarily thinking about the overall count, their overall. + +31 Affect that, we're going to have on. + +# 32 My learning process proceed. + +33 And it had a big big, big big like effect on it took me longer to learn stuff because when you sit down you feel like you don't want to do anything unless you're actually drawing something to show off, which is something you don't necessarily want to get caught up in, which happens a lot of people they don't. + +35-36 ... + +37 Get way more out of practice because practice is more focused on getting you better at art where doing a picture or whatever is cool, but it's more focused on showing off what you can do or what you already know. + +38 So if there's things that you need to practice and stuff like that, you stand to gain a lot more from that practice then. + +# 39 You know? + +40 Sit down an just trying to draw a picture. +41 You're going to struggle with for a couple of days or couple minutes and then figure out you can't draw it or you have a hard time drawing it and then just giving up. +42 Which is something that would happen alot like I'll Draw Something like old man, you know I want to draw this. +43 Superhero, I've had a problem with drawing the superhero forever, but today is going to be the day I'm going to nail it. + +# □□□ + +# + +# □□□ + +# X□□ + +# # + +# # + +# # + +# + +# # + +# # + +# # + +# # + +# □□□ + +# + +# # + +# + +# # + +# + +# + +# □□□ + +# # + +# # + +# # + +# # + +# □□□ + +# # + +# # + +# + +# + +# # + +# # + +# # + +# □□□ + +# # + +# # + +# + +# + +# □□□ + +# □□□ + +# # + +# + +# # + +# # + +# # + +# $\left( {x - 1}\right) \left( {x + 3}\right) = 0$ + +# # + +# # + +# + +# + +# # + +# + +# # + +# # + +# # + +# + +# + +# # + +# + +# # + +Table 15: A transcript snippet from Call me Derek: Value Study. We show the most prominent latent codes and their representative utterances ('X'). Human annotated summary utterances are colored gray and ultra-short utterances are crossed out. + +# FluCovRank + +- people start off always drawing characters / favorite characters from sailor moon / mohammed roller show / yeah people are different or personalities / example prefer environment designed the character design and even though i like looking at character art by prefer to make environments / advice with a grain of salt / people specialized the + +# LexRank + +- Some people like to have things mixed up all the time where they get bored and other people find that one thing they like and never tire of it. +- Or what I meant is that some people start off always drawing characters, for example like they just from. +- An anyway, some artists just like for example, love drawing characters and always draw them and never get into environments, and they go on and become a good working concepts are it could work in visual development as a character artist who knows what. +- Just because someone specializes, it doesn't necessarily mean that they like tried all the other things first. +- Some people sort of specialized the whole time just because that was their preference, you know. + +# BART-Large + +- I really works good to see you. Yeah, people are different or personalities. What might work for them isn't necessarily right right for you for any number of reasons, like what David said just from person to person, those preferences can be really different. I for example, prefer environment designed the character design, and even though I like looking at character art by prefer to make environments, and that's not. I think that's why you have to take advice with a grain of salt like. See I do think people do though Omar, like maybe maybe you're not relating to it 'cause it's just not what your preferences are but. Definitely, I think it's important to seek out advice from professional artists and from people + +# Quantized Transformer + +- It's about what you like doing. +- I really works good to see you. +- A specialist most of the time is someone with more experience. +- I mean I like for example, I started drawing in like when I was a kid and when I was in middle school and high school was drawn. +- Just because someone specializes, it doesn't necessarily mean that they like tried all the other things first. +This was the first study. +- We're doing cloud studies for part of the art club were doing clouds in different scenarios, this time different. +- This was the second one. +- See I do think people do though Omar, like maybe maybe you're not relating to it 'cause it's just not what your preferences are but. +- All thanks claires you thank you. +So I do hope that it helps. + +# StreamHover (Ours) + +- Some people like to have things mixed up all the time where they get bored and other people find that one thing they like and never tire of it. +- An anyway, some artists just like for example, love drawing characters and always draw them and never get into environments, and they go on and become a good working concepts are it could work in visual development as a character artist who knows what. +- We're doing cloud studies for part of the art club were doing clouds in different scenarios, this time different. +- See I do think people do though Omar, like maybe maybe you're not relating to it 'cause it's just not what your preferences are but. +- I for example, prefer environment designed the character design, and even though I like looking at character art by prefer to make environments, and that's not. + +Table 16: Example system summaries for Digital Painting Studies with Maddy Bellwoar-Clouds. The BART summary is fluent but its content lacks specificity, as is the case for LexRank. The summary segments selected by FluCovRank are ungrammatical. StreamHover identifies on-topic and informative summary utterances. + +# Utterances + +# C1 C2 C3 + +1 David says, I also think if you were a person who really likes doing all sorts of different things, you wouldn't be happiness. +2 Specialist role. +3 Yeah, people are different or personalities. +4 Some people like to have things mixed up all the time where they get bored and other people find that one thing they like and never tire of it. +5 And it really depends. +6 It really depends. + +8 Definitely, I think it's important to seek out advice from professional artists and from people that have sort of gone down the path that you're trying to go down. +9 That's going to make things easier for you, but you know, take the advice with a grain of salt because. + +0Pence Maybe I'll wait on that. +7 I think that's why you have to take advice with a grain of salt like. +10 What might work for them isn't necessarily right right for you for any number of reasons, like what David said just from person to person, those preferences can be really different. +11 Exactly Pablo is at the end of the day. +12 It's about what you like doing. +13 Alright, I'm gonna grab a little more textured brush again. +14 I'm kind of going back and forth with harder brushes and textured brushes. +15 I really works good to see you. +16 It's not about that. +17 A specialist most of the time is someone with more experience. +18 That's why he's a specialist. +19 Oh, I understand your thoughts on that. +20 I would agree for the most part, but I guess the part I would disagree on is that. +21 Or what I meant is that some people start off always drawing characters, for example like they just from. +22 I mean I like for example, I started drawing in like when I was a kid and when I was in middle school and high school was drawn. +23 All my favorite characters from Sailor Moon and all that kind of stuff. +24 An anyway, some artists just like for example, love drawing characters and always draw them and never get into environments, and they go on and become a good working concepts are it could work in visual development as a character artist who knows what. +25 Just because someone specializes, it doesn't necessarily mean that they like tried all the other things first. +26 Maybe they did. +27 It's possible they did, but I don't think that it has to be that you have to do everything before you specialize. +28 Some people sort of specialized the whole time just because that was their preference, you know. +29 From the beginning. +30 If anybody is just coming in. +31 Mohammed roller, I can show you what we did so far. +32 This was the first study. +33 We're doing cloud studies for part of the art club were doing clouds in different scenarios, this time different. +34 Like lightings, different times of day. +35 This was the second one. +36 And: +37 This is what we're working on right now. +38 See I do think people do though Omar, like maybe maybe you're not relating to it 'cause it's just not what your preferences are but. +39 I for example, prefer environment designed the character design, and even though I like looking at character art by prefer to make environments, and that's not. +40 You know, that's just my preference. +41 All thanks claires you thank you. + +Table 17: A snippet from Digital Painting Studies with Maddy Bellwoar-Clouds. We show the most prominent latent codes and their representative utterances ('X'). Human annotated summary utterances are colored gray and ultra-short utterances are crossed out. \ No newline at end of file diff --git a/streamhoverlivestreamtranscriptsummarizationandannotation/images.zip b/streamhoverlivestreamtranscriptsummarizationandannotation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3af8b0347b7edf7039d285d826d8011535e45d4b --- /dev/null +++ b/streamhoverlivestreamtranscriptsummarizationandannotation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e93c951e3f893e39bab964366983da715623ca336741de7effd6c762ab32bdf +size 393579 diff --git a/streamhoverlivestreamtranscriptsummarizationandannotation/layout.json b/streamhoverlivestreamtranscriptsummarizationandannotation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..db44a1954033390efd0562d26fae316e67f80423 --- /dev/null +++ b/streamhoverlivestreamtranscriptsummarizationandannotation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b25cbd16f239e3260e7c13d546affe64d7771294e44ff8b828741aaee235c64c +size 1062562 diff --git a/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_content_list.json b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..51d91049f47f7c91f417720d41fbcd2a755da8bf --- /dev/null +++ b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2756e25cc8182908ac87de2a82ff5b90337e0ca043e7c0aefe551b524bc44866 +size 102836 diff --git a/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_model.json b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_model.json new file mode 100644 index 0000000000000000000000000000000000000000..62633a26dec894598d54e6ba442dddcdb6bf948c --- /dev/null +++ b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0198d1f8b6e94278cb7d5b39904dacfd9ab67100caf6b82289852bd1f0e7adf8 +size 124617 diff --git a/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_origin.pdf b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bb8eb6b928e457de90fbe550dbb7b8aa8b17c27a --- /dev/null +++ b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/60239455-0ce1-4f40-815d-3ae4d008a185_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fe2c1e33ae5804a952c1d3cff676a6ac6f13f4793fbb50730f05b4325461ce2 +size 546202 diff --git a/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/full.md b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b058acb847c2e92d45f892a581fa0fc503e697f1 --- /dev/null +++ b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/full.md @@ -0,0 +1,397 @@ +# Structural Adapters in Pretrained Language Models for AMR-to-Text Generation + +Leonardo F. R. Ribeiro†, Yue Zhang‡ and Iryna Gurevych† + +†Ubiquitous Knowledge Processing Lab, Technical University of Darmstadt ‡School of Engineering, Westlake University ribeiro@aiphes.tu-darmstadt.de + +# Abstract + +Pretrained language models (PLM) have recently advanced graph-to-text generation, where the input graph is linearized into a sequence and fed into the PLM to obtain its representation. However, efficiently encoding the graph structure in PLMs is challenging because such models were pretrained on natural language, and modeling structured data may lead to catastrophic forgetting of distributional knowledge. In this paper, we propose STRUCTADAPT, an adapter method to encode graph structure into PLMs. Contrary to prior work, STRUCTADAPT effectively models interactions among the nodes based on the graph connectivity, only training graph structure-aware adapter parameters. In this way, we incorporate task-specific knowledge while maintaining the topological structure of the graph. We empirically show the benefits of explicitly encoding graph structure into PLMs using STRUCTADAPT, outperforming the state of the art on two AMR-to-text datasets, training only $5.1\%$ of the PLM parameters. $^{1}$ + +# 1 Introduction + +Data-to-text tasks aim to generate meaningful and coherent natural language text that faithfully conveys structured data. Some examples of structured information include tables (Parikh et al., 2020), Knowledge Graphs (KGs) (Gardent et al., 2017; Vougiouklis et al., 2018) and Abstract Meaning Representation (AMR) (Banarescu et al., 2013). In this work, we focus on AMR-to-text generation where the goal is to generate a fluent and grammatical sentence that is faithful to a given AMR graph (See Figure 1a). AMR is a semantic formalism that has received much research interest (Song et al., 2018; Guo et al., 2019; Ribeiro et al., 2019; Opitz et al., 2020, 2021; Fu et al., 2021) and has been shown to benefit downstream tasks + +![](images/33cc8f565aa038a9e20b545646f90e7a636a997e8a24e50ea2b033554cfb6c9f.jpg) +Figure 1: (a) AMR for the sentence More power to her for her achievements. While in (b) the pretrained model gets as input the graph linearization, in (c) it additionally receives the graph connectivity information. + +such as text summarization (Liao et al., 2018) and machine translation (Song et al., 2019). Both statistical (Flanigan et al., 2016; Pourdamghani et al., 2016) and neural methods (Bai et al., 2020; Cai and Lam, 2020) have been investigated for AMR-to-text generation, and dominant methods make use of Graph Neural Networks (GNNs) (Kipf and Welling, 2017) or Transformers (Vaswani et al., 2017) for representing the input graph. + +Pretrained language models (PLMs) (Devlin et al., 2019; Liu et al., 2020; Radford et al., 2019; Lewis et al., 2020) have been shown useful as a general text representation method, giving much improved results on a wide range of tasks (Wang et al., 2018, 2019). However, they cannot be directly leveraged to benefit AMR-to-text generation, and more generally graph-to-text generation, due to the structural nature of the input. One solution is to transform the structured input into a se + +quence, which can be directly fed into PLMs (See Figure 1b). Recent studies (Mager et al., 2020; Harkous et al., 2020; Ribeiro et al., 2020a, 2021) transform AMRs into sequences by top-down linearization (Konstas et al., 2017). It has been shown that such linearized graph representation can be used to fine-tune a PLM and improve graph-to-text generation performances (Kale, 2020). + +The above methods, however, suffer from two salient limitations. First, linearized graph structures are different in nature from natural language. As a result, knowledge from large-scale pretraining intuitively cannot be fully transferred, and finetuning a sentence representation using linearized graphs can lead to catastrophic forgetting of such distributional knowledge (Goodfellow et al., 2014; Kirkpatrick et al., 2017). Second, a linearized representation weakens structural information in the original graphs by diluting the explicit connectivity information (i.e., which nodes are connected to each other), and PLMs must infer how edge connections are specified in the sequence. This fact was also observed by Song et al. (2018), Beck et al. (2018) and Ribeiro et al. (2019), who show that GNN encoders outperform sequential encoders for AMR-to-text generation without pretraining. + +To mitigate the issues, we aim to explicitly encode the graph data into a PLM without contaminating its original distributional knowledge. To this end, we propose STRUCTADAPT, a novel structure-aware adapter that effectively allows leveraging the input graph structure into PLMs (See Figure 1c). The main idea is to add layer-wise modules, which extract information from the pretrained layers and make use of it in a graph-structure encoding. As shown in Figure 2, STRUCTADAPT employs a graph convolution in order to learn representations built upon the graph connectivity over the PLM encoder. Because STRUCTADAPT is added to each encoder layer, deep integration of linguistic knowledge and graph knowledge can be achieved. During finetuning, only the adapter parameters are trained, whereas the PLM parameters remain unchanged, in contrast to previous methods based on the graph linearizations that fine-tune all model parameters. + +Empirically we show that STRUCTADAPT significantly outperforms linearized fine-tuning baselines and naive sequential adapters (Houlsby et al., 2019). Moreover, STRUCTADAPT is more robust to different graph linearizations, better treats reentrancies (nodes with more than one entering edge) and long- + +range node dependencies. Our proposed models, based on STRUCTADAPT, surpass the current state of the art on LDC2017T10 and LDC2020T02 datasets by up to 3.1 BLEU points, training only $5.1\%$ of the original PLM parameters. + +# 2 Related Work + +Fine-tuning for Graph-to-text Generation. While previous approaches (Song et al., 2018; Ribeiro et al., 2019; Cai and Lam, 2020; Schmitt et al., 2021; Zhang et al., 2020b) have shown that explicitly encoding the graph structure is beneficial, fine-tuning PLMs on linearized structured data has established a new level of performance in data-to-text generation (Nan et al., 2021; Kale, 2020; Ribeiro et al., 2021). Our work can be seen as integrating the advantage of both graph structure encoding and PLMs, using a novel adapter module. + +Mager et al. (2020) employ cycle consistency to improve the adequacy of generated texts from AMRs using GPT-2 (Radford et al., 2019), whereas Harkous et al. (2020) train a classifier to rank candidate generations based on the semantic fidelity. Ribeiro et al. (2020a) investigate encoder-decoder PLMs for graph-to-text generation, and show that task-specific pretraining can lead to notable improvements and that PLMs benefit much more from the graph structure of AMRs than of KGs. Hoyle et al. (2021) explore the extent to which PLMs are invariant to graph linearization, finding that models trained on canonical linearizations fail to generalize to meaning-preserving alternatives. Compared to this line of work, which tunes all PLM parameters, our method obtains a further $19\mathrm{x}$ reduction in task-specific parameters, tuning only $5.1\%$ of the parameters while achieving state-of-the-art performance, being more robust to permutations of the graph representation and better encoding larger graphs. + +Lightweight Fine-tuning. Recently, different approaches have emerged as an alternative training strategy in order to avoid fine-tuning all parameters of a PLM. Zhang et al. (2019) train a lightweight "side" network that is fused with the pretrained model via summation. Li and Liang (2021) propose to prepend a trainable continuous prefix as an alternative to adapters, maintaining comparable performance in data-to-text tasks using fewer trained parameters. Liu et al. (2021) develop a method to automatically search prompts in the continuous space and evaluate it in few-shot NLU tasks. Ham- + +bardzumyan et al. (2021) propose adversarial reprogramming attempts to learn task-specific word embeddings to customize the language model for the downstream task. + +Adapter-based approaches (Houlsby et al., 2019; Rebuffi et al., 2017; Lauscher et al., 2020; Pfeiffer et al., 2020a, 2021) introduce a small number of task specific parameters, keeping the underlying pretrained model fixed. Pfeiffer et al. (2020b) propose an adapter method to arbitrary tasks and languages by learning modular language and task representations. The above works are related to STRUCTADAPT as it trains much fewer parameters, but also different because they do not explicitly encode the input structure, whereas STRUCTADAPT directly aims to encode it. + +# 3 Graph-to-Text Model + +Let $\mathcal{G}_0 = (\mathcal{V}_0, \mathcal{E}_0, \mathcal{R}_0)$ denote a rooted and directed AMR graph with a node set $\mathcal{V}_0$ and labeled edges $(u, r, v) \in \mathcal{E}_0$ , where $u, v \in \mathcal{V}_0$ and $r \in \mathcal{R}_0$ is a relation type. An example of an AMR graph and its corresponding sentence is shown in Figure 1a. + +# 3.1 Encoder-Decoder Architecture + +Consider a conditional generation task where the input is a context $x$ and the output $y = \langle y_1, \ldots, y_{|y|} \rangle$ is a sequence of tokens. In AMR-to-text generation, the context $x$ is the AMR graph and $y$ is the sentence that describes the AMR graph in natural language. + +Let $p_{\phi}(y \mid x)$ denote a PLM parametrized by $\phi$ , where $x$ is encoded by a bidirectional encoder, and the decoder predicts $y$ autoregressively, conditioned on the encoded $x$ and its left context. We focus on PLMs based on the Transformer encoder-decoder architecture (Vaswani et al., 2017), as they are suitable for conditional text generation. We define $x = \mathrm{LIN}(\mathcal{G}_0)$ , where LIN is a function that linearizes $\mathcal{G}_0$ into a sequence of tokens. Following Damonte and Cohen (2019), as shown in Figure 1b, we linearize the AMR into a sequence of nodes and edges using the depth-first traversal of the canonical human-created AMR. In a nutshell, the hidden representation $\mathbf{h}_i^l \in \mathbb{R}^d$ , for all $x_i \in x$ , is computed by the encoder layer $l$ , where $d$ is the hidden dimension. The decoder hidden representation $\hat{\mathbf{h}}_i^l \in \mathbb{R}^d$ is computed by the layer $l$ of the + +![](images/ebfe324148cfd0bbfc1be31ec635ed61edff75d42925e0a74691c8a946da5014.jpg) + +![](images/4fb2cfe3caaf6378143b71d1a385ac29b8a2863fbb8123239b048bbc843bdf7a.jpg) + +![](images/480ea998e5afc3c92edb0dbc90f5a8919937a48970dfac95b64ffe18417a3fc5.jpg) +Figure 2: Integration of the adapter modules with the (a) encoder and (b) decoder layers of the Transformer; layer normalization and residual connections are omitted for clarification. (c) ADAPT with two feed-forwards layers. (d) STRUCTADAPT encodes the graph structure using a graph convolutional layer. + +![](images/2c6960fab62864fc852f5c4491d8c193431d7b170a342eca748a76d4b39902d1.jpg) + +autoregressive decoder at time step $i$ . + +# 3.2 Fine-tuning + +The model is initialized with pretrained parameters $\phi$ (e.g. using T5, Raffel et al., 2019) and fine-tuned to optimize the following log-likelihood objective over each gold instance $(x,y)$ : + +$$ +\max _ {\phi} \log p _ {\phi} (y \mid x) = \sum_ {i = 1} ^ {| y |} \log p _ {\phi} \left(y _ {i} \mid y _ {1: i - 1}, x\right). \tag {1} +$$ + +# 3.3 Baseline Adapter + +We employ an adapter module after the feedforward sub-layer of each layer on both encoder (Figure 2a) and decoder (Figure 2b) of the PLM. We modify the adapter architecture from Houlsby et al. (2019), computing the adapter representation at each layer $l$ , given the encoder layer representation $\mathbf{h}_i^l$ (or $\hat{\mathbf{h}}_i^l$ in the decoder), as follows: + +$$ +\hat {\mathbf {z}} _ {i} = \mathbf {W} _ {o} ^ {l} \left(\sigma \left(\mathbf {W} _ {p} ^ {l} \sqcup \mathbb {N} \left(\mathbf {h} _ {i} ^ {l}\right)\right)\right) + \mathbf {h} _ {i} ^ {l}, \tag {2} +$$ + +where $\sigma$ is the activation function and $\mathsf{LN}(\cdot)$ denotes layer normalization. $\mathbf{W}_o^l\in \mathbb{R}^{d\times m}$ and $\mathbf{W}_p^l\in$ $\mathbb{R}^{m\times d}$ are adapter parameters, and $m$ is the hidden dimension of the adapter. Figure 2c illustrates the baseline adapter module, which we call ADAPT. + +Training. Let the set of adapters' parameters for the encoder and decoder layers be parametrized by $\theta$ . The training objective is the same as Equation (1), but the set of trainable parameters changes: the PLM parameters $\phi$ are frozen and the adapter parameters $\theta$ are the only trainable parameters. In contrast to fine-tuning, adapters substantially reduce the number of trainable parameters that are used to adapt the PLM to the downstream task. + +# 3.4 Limitation + +Intuitively, the connection between nodes in the input graph can influence the encoding of $x$ by guiding what to extract from $x$ in order to generate $y$ . Note that in both fine-tuning and ADAPT approaches, the self-attention mechanisms of the encoder layers treat the sequence of nodes and edges $x$ essentially as a fully connected graph, greatly diluting the original graph structure. In this way, the model has to retrieve the original connectivity of the graph from $x$ . For example, the AMR linearization in Figure 1b has two mentions of the node she, and the model should capture that both mentions belong to the same node in the original graph. + +# 4 Structural Adapter + +We propose STRUCTADAPT, a lightweight alternative to injecting structural inductive bias into PLMs. + +We first describe the intuition in §4.1 and define our method formally in §4.3. + +# 4.1 Intuition + +Injecting graph structural bias into graph-to-text models trained from scratch improves the performance compared to linearized approaches (Damonte and Cohen, 2019; Ribeiro et al., 2019). However, it is not straightforward how to effectively model the input graph structure when fine-tuning PLMs, which usually are pretrained using natural language and not structured data. + +Our key idea is modeling the graph connectivity in the encoder utilizing an adapter module, using information flows between adjacent nodes in a message-passing update, employing a graph convolution (see Figure 2d). In this way, the graph structure substantially impacts the node representations, better encoding the input graph without impacting the knowledge learned during pretraining. This can + +![](images/0f5b942777a47e880d565cdf4fd2c766bef44f1c23bce654c95d056066f8fa2d.jpg) + +![](images/f2174b44f4a539edb6767f34594fa20a7e4782317e0d4c49dbbd6e24fcbe6cfd.jpg) +e) + +![](images/91edcfec3c16816f4d4a5146d12692ea611d5497f1b95a17db9d20609d1d335e.jpg) + +![](images/b6db01c468f03df20809b569983189bbd2f8efda56409058a2e4d41fdb5ff5e6.jpg) +Figure 3: An example of (a) an AMR graph structure, (b) its unlabeled version and three different subword representations: (c) rep1, (d) rep2 and (e) rep3. + +![](images/60776b1bef424dac43f9ee06f8c8e92e9ac807f3d63bf9c08ede133f596ad359.jpg) + +lead to more efficient and better AMR-to-text generation as we will show in §5 and §6. Moreover, different adapters for distinct graph domains can be used with the same PLM, yielding a high degree of parameter sharing for graph-to-text tasks. + +# 4.2 Graph Representation + +We convert each $\mathcal{G}_0$ into a bipartite graph $\mathcal{G}_1 = (\mathcal{V}_1, \mathcal{E}_1)$ , replacing each labeled edge $(u, r, v) \in \mathcal{E}_0$ with two unlabeled edges $e_1 = (u, r)$ and $e_2 = (r, v)$ . Similar to Beck et al. (2018), this process converts the graph into its unlabeled version. Figure 3 shows an (a) AMR subgraph and (b) its unlabeled representation. + +Note that PLMs typically use a vocabulary with subword units (Sennrich et al., 2016). This presents a challenge in how to represent such a graph using subword tokens. Inspired by Ribeiro et al. (2020b), we transform each $\mathcal{G}_1$ into a new token graph $\mathcal{G} = (\mathcal{V},\mathcal{E})$ , where each token of a node in $\mathcal{V}_1$ becomes a node $v\in \mathcal{V}$ . We convert each edge $(u_{1},v_{1})\in \mathcal{E}_{1}$ into a set of edges and connect every token of $u_{1}$ to every token of $v_{1}$ . That is, an edge $(u,v)$ will belong to $\mathcal{E}$ if and only if there exists an edge $(u_1,v_1)\in \mathcal{E}_1$ such that $u\in u_{1}$ and $v\in v_{1}$ , where $u_{1}$ and $v_{1}$ are seen as sets of tokens. Figure 3c shows an example of the token graph. + +# 4.3 Method + +STRUCTADAPT employs a two-layer architecture in order to re-purpose the PLM for the graph-to-text task using a small number of new parameters. Formally, for each node $v \in \mathcal{V}$ , given the hidden representation $\mathbf{h}_v^l$ from the encoder layer $l$ , STRUCTADAPT computes: + +$$ +\begin{array}{l} \mathbf {g} _ {v} ^ {l} = \operatorname {G r a p h C o n v} _ {l} (\mathsf {L N} \left(\mathbf {h} _ {v} ^ {l}\right), \{\mathsf {L N} \left(\mathbf {h} _ {u} ^ {l}\right): u \in \mathcal {N} (v) \}) \\ \mathbf {z} _ {v} ^ {l} = \mathbf {W} _ {e} ^ {l} \sigma \left(\mathbf {g} _ {v} ^ {l}\right) + \mathbf {h} _ {v} ^ {l}, \end{array} \tag {3} +$$ + +where $\mathcal{N}(v)$ is the immediate neighborhood of $v$ in $\mathcal{G}$ . GraphConv $_l(\cdot)$ is the graph convolution that computes the node representation based on the local neighborhood of $v$ , and $\mathbf{W}_e^l \in \mathbb{R}^{d \times m}$ is a parameter. Figure 2d illustrates STRUCTADAPT. + +Graph Convolution. The graph convolutional layer allows exploration of distinct strategies for neighborhood aggregation in order to model structural information of the input graph. Different GNN architectures (Velickovic et al., 2018; Xu et al., 2019) can be employed as the graph convolution. Moreover, in this way, we avoid changing the self-attention mechanism of the current pretrained encoder, allowing to also capture global information based on the pretrained knowledge. + +Our graph convolution is based on the Graph Convolutional Network (GCN) proposed by Kipf and Welling (2017). At each layer $l$ , we compute the representation of a node $v \in \mathcal{V}$ as follows: + +$$ +\mathbf {g} _ {v} ^ {l} = \sum_ {u \in \mathcal {N} (v)} \frac {1}{\sqrt {d _ {v} d _ {u}}} \mathbf {W} _ {g} ^ {l} \mathbf {h} _ {u} ^ {l}, \tag {4} +$$ + +where $\mathcal{N}(v)$ is a set of nodes with incoming edges to $v$ and $v$ itself, $d_v$ is the degree of $v$ , and $\mathbf{W}_g^l \in \mathbb{R}^{m \times d}$ is a parameter. + +We also consider the variant relational GCN (RGCN) (Schlichtkrull et al., 2018) as graph convolution. RGCN allows capturing the reverse edge direction so that we can consider the differences in the incoming and outgoing relations, which has shown to be beneficial (Beck et al., 2018). In particular, the node representation is computed as: + +$$ +\mathbf {g} _ {v} ^ {l} = \sum_ {r \in \mathcal {R}} \sum_ {u \in \mathcal {N} _ {r} (v)} \frac {1}{| \mathcal {N} _ {r} (v) |} \mathbf {W} _ {r} ^ {l} \mathbf {h} _ {u} ^ {l}, \tag {5} +$$ + +where $\mathcal{R}$ denotes the set of relations, i.e., the edge types default and reverse, $\mathcal{N}_r(v)$ denotes the set of neighbors under relation $r\in \mathcal{R}$ , and $\mathbf{W}_r^l\in \mathbb{R}^{m\times d}$ encodes the edge type between the nodes $u$ and $v$ . + +Note that $\mathbf{STRUCTADAPT}$ computes the refined structural node representation $\mathbf{z}_v^l$ based on the local node context, using as input the global representation $\mathbf{h}_v^l$ generated by the current PLM encoder layer. In this way, the model is able to capture both the global context based on the PLM linguistic knowledge and the local context based on the graph knowledge. Finally, we employ ADAPT into the decoder in order to adapt the language model to the graph-to-text task. + +
BLEUchrF++MBERT
Mager et al. (2020)33.063.9--
Zhang et al. (2020b)33.663.2--
Harkous et al. (2020)37.7---
Hoyle et al. (2021)44.9-76.54-
Ribeiro et al. (2020a)45.872.5--
+ +
T5base
FINE-TUNE38.3±0.368.6±0.177.8±0.395.5±0.1
FT-TOP2(14.8%)29.9±0.163.0±0.174.1±0.294.4±0.2
FT-Bottom2(14.8%)35.9±0.367.0±0.276.9±0.195.3±0.1
ADAPT(8.5%)38.7±0.469.2±0.278.3±0.195.6±0.1
STRUCTADAPT-GCN(2.1%)39.0±0.369.1±0.278.4±0.295.7±0.2
STRUCTADAPT-GCN(8.5%)41.0±0.570.0±0.278.4±0.195.7±0.1
STRUCTADAPT-RGCN(6.3%)44.0±0.371.2±0.279.4±0.195.9±0.2
+ +
T5large
FINE-TUNE41.2±0.570.2±0.278.0±0.195.8±0.2
FT-TOP2(7.9%)28.8±0.461.8±0.573.9±0.294.1±0.2
FT-Bottom2(7.9%)37.6±0.368.0±0.277.2±0.295.5±0.1
ADAPT(6.8%)42.9±0.371.6±0.278.9±0.196.1±0.1
STRUCTADAPT-GCN(1.7%)44.1±0.471.8±0.379.1±0.196.1±0.2
STRUCTADAPT-GCN(6.8%)45.8±0.272.5±0.179.3±0.296.2±0.1
STRUCTADAPT-RGCN(5.1%)46.6±0.372.9±0.279.6±0.196.3±0.1
+ +Table 1: Results on the LDC2017T10 test set. Mean (±s.d.) over 4 seeds. + +# 5 Experiments + +Our models are initialized with pre-trained T5 (Raffel et al., 2019), but our approach can be combined with other PLMs such as BART (Lewis et al., 2020). Our implementation is based on Hugging Face Transformer models (Wolf et al., 2019). We use $\mathrm{T}5_{\mathrm{base}}$ for all experiments and report results with $\mathrm{T}5_{\mathrm{large}}$ for the test sets. We use the Adam optimizer (Kingma and Ba, 2015) and employ a linearly decreasing learning rate schedule without warm-up. BLEU is used for the stopping criterion. Following recent work (Mager et al., 2020; Zhang et al., 2020b), we evaluate our proposed models on LDC2017T10 and LDC2020T02 corpora. + +Evaluation. We evaluate the results with BLEU (Papineni et al., 2002) and $\mathrm{chrF}++$ (Popovic, 2015) metrics. We also report the meaning $(\mathcal{M})$ component of the $\mathcal{MF}$ -score (Opitz and Frank, 2021), which measures how well the source AMR graph can be reconstructed from the generated sentence. We use BERTScore (Zhang et al., 2020a) allowing a semantic evaluation that depends less on the surface forms. Finally, we also perform a human evaluation ( $\S 5.2$ ). + +# 5.1 Main Results + +We compare STRUCTADAPT with four methods: finetuning (FINE-TUNE), fine-tuning only the top or bottom 2 layers (FT-TOP2, FT-BOTTM2) and ADAPT. All + +
BLEUchrF++MBERT
Zhang et al. (2020b)34.363.7--
Bevilacqua et al. (2021)44.972.9--
T5large
FINE-TUNE41.6±0.670.4±0.578.5±0.296.0±0.1
FT-TOP2(7.9%)33.4±0.563.5±0.373.4±0.494.3±0.1
FT-Bottom2(7.9%)38.2±0.268.3±0.178.1±0.295.6±0.1
ADAPT(6.8%)43.0±0.271.3±0.279.3±0.196.2±0.1
STRUCTADAPT-GCN(1.7%)46.2±0.271.8±0.279.4±0.396.0±0.2
STRUCTADAPT-GCN(6.8%)47.1±0.472.5±0.179.7±0.296.2±0.1
STRUCTADAPT-RGCN(5.1%)48.0±0.273.2±0.180.1±0.396.3±0.1
+ +models use the same graph linearization generated by the depth-first traversal. We also report recent state-of-the-art results on both datasets. Tables 1 and 2 show the results. + +We find that training only $5.1\%$ task-specific parameters, STRUCTADAPT-RGCN achieves a BLEU score of 46.6 in LDC2017T10, substantially improving over FINE-TUNE and other lightweight baselines (ADAPT, FT-TOP2, FT-BOTTM2), and outperforming Ribeiro et al. (2020a) and Hoyle et al. (2021) which fine-tune T5 updating significantly more parameters. STRUCTADAPT also achieves state-of-the-art performance on LDC2020T02, considerably improving over Bevilacqua et al. (2021), which implicitly models the graph structure information using linearization techniques. + +In general, STRUCTADAPT is better than ADAPT when training the same number of parameters, and slightly better even when training only $1.7\%$ of the parameters for both datasets. This highlights that the gains not only come from using an adapter architecture, but from considering the graph connectivity. STRUCTADAPT-RGCN is more effective than STRUCTADAPT-GCN using fewer parameters, demonstrating that considering reverse relations is advantageous. ADAPT is consistently better than FINETUNE, agreeing with our intuition of catastrophic forgetting when fine-tuning. Interestingly, in contrast to popular strategies that focus on upper layers in fine-tuning (Howard and Ruder, 2018; Houlsby et al., 2019; Li and Liang, 2021), FT-BOTTM2's performance is better than FT-TOP2's, suggesting that lower layers have a significant impact in adapting the PLM to structured data. + +Different from our work, both Mager et al. (2020) and Ribeiro et al. (2020a) use the PENMAN notation which makes the input much longer (containing more tokens), and demonstrate that this representation is able to achieve strong results – this is orthogonal to our STRUCTADAPT representation and + +Table 2: Results on the LDC2020T02 test set. + +
Graph SizeADAPTSTRUCTADAPT-RGCN
All5.6A6.1B
01-306.1A6.2A
31-605.4A5.4A
>605.2A6.2B
+ +Table 3: Meaning similarity obtained in the human evaluation. The ranking was determined by Mann-Whitney tests with $p < 0.05$ . Difference between systems which have a letter in common is not statistically significant. + +can be incorporated in future work. + +Overall, the results indicate that explicitly considering the graph structure using an adapter mechanism is effective for AMR-to-text generation, significantly reducing the number of trained parameters while improving generation quality. + +# 5.2 Human Evaluation + +To further assess the quality of the generated texts by the adapter-based models in LDC2020T02, we conduct a human evaluation via crowdsourcing using Amazon Mechanical Turk. We follow previous work (Ribeiro et al., 2019; Castro Ferreira et al., 2019) and evaluate the meaning similarity, i.e., how close in meaning is the generated text to the reference sentence.7 We divide the datapoints into 3 different sets by the graph size, i.e., the number of nodes, after converting edges into nodes (cf. §4.2). This setting allows us to evaluate the performance of the models based on the complexity of the AMR graph. + +We randomly select 100 generated texts for each set and each model (total of 600), which annotators then rate on a 1-7 Likert scale. For each text we collect scores from 3 annotators and use MACE (Hovy et al., 2013), a Bayesian model that incorporates the reliability of individual workers, to merge sentence-level labels. Table 3 shows that STRUCTADAPT improves the meaning similarity over ADAPT with statistically significant margins $(p < 0.05)$ . Note that the gains mainly come from datapoints with $>60$ nodes, indicating that STRUCTADAPT is better when encoding larger graphs. + +# 5.3 Detailed Discussion + +Parameter/Performance Trade-off. We investigate how the number of parameters affects the models. A higher hidden dimensionality means more + +![](images/4be338531f8b0b97ad3ad5ed88bd680ba96c83dec6e6580be1cb2e6e1e5df82e.jpg) +Figure 4: (a) Impact (measure with BLEU) of the number of parameters in the LDC2017T10 dev set. (b) Performance in the LDC2017T10 test set when experimenting with different amounts of training data. + +trainable parameters, and smaller adapters introduce fewer parameters at a possible cost to performance. That is, the adapter size controls the parameter efficiency. Figure 4a shows the effect of the number of trained parameters in the performance measured using BLEU. Each point in the ADAPT and STRUCTADAPT curves represents a hidden dimension in the range [8, 16, . . ., 2048]. STRUCTADAPT-GCN is consistently better than ADAPT over all model capacities, even though both approaches train the same number of parameters. STRUCTADAPT-RGCN achieves similar performance than FINE-TUNE when training only $0.8\%$ of the parameters whereas ADAPT achieves similar performance to $8.5\%$ , demonstrating the effectiveness of injecting the graph structure into the PLM. + +Low-data Setting. Previous work (Li and Liang, 2021) has shown that lightweight fine-tuning has an advantage in some generation tasks when the training size is smaller. Therefore, we investigate how STRUCTADAPT behaves in a low-data setting. We subsample the LDC2017T10 training set to analyze different smaller training sets. For each size, we sample 5 different datasets and average over 2 training random seeds. Thus, we average over 10 models to get an estimate for each low-data setting. Figure 4b shows the results. First note that both adapter-based approaches improve over FINETUNE. When training with only 1000 datapoints, STRUCTADAPT outperforms FINETUNE by 8.2 BLEU points. Also note that the gap between ADAPT and FINETUNE decreases when the size of the training set increases. In general, STRUCTADAPT outperforms FINETUNE and ADAPT in low-resource scenarios by 7.3 and 4.8 BLEU points on average, respectively, whereas requiring much fewer trained parameters + +![](images/b299aa5c3eda5b8ef3428908f0c8997561ac7e9c42a0049b96e1dfb5921704c9.jpg) + +
REFERENCE: Me and my son's father have been broken up since August.
FINE-TUNE-2000: I've broken up with my son and father since August.
FINE-TUNE: I've been with my son's father since August.
STRUCTADAPT-2000: Since August 8 I have broken up with my son's father.
STRUCTADAPT: I've been breaking up with my son's father since August.
+ +Table 4: An example of an AMR graph and generated sentences by different models trained on full data and on a low-data setting with 2000 datapoints. + +than FINE-TUNE and fewer number of parameters than ADAPT. + +Case Study. We perform a case study to provide a better understanding of the STRUCTADAPT's performance. Table 4 shows an AMR graph in PENMAN notation containing reentrancies (marked in bold) and sentences generated by FINE-TUNE and STRUCTADAPT trained on the LDC2017T10 full training set and in a low-data setting where the models are trained with 2000 data points. FINE-TUNE fails in generating a sentence with the correct concept break-up whereas STRUCTADAPT correctly generates a sentence that describes the input graph. The incorrect verb tense is due to lack of tense information in AMR. FINE-TUNE-2000 mixes the semantic relation between $I$ and $son$ (i.e., mistranslation of the edges in the graph) whereas STRUCTADAPT-2000 generates a correct sentence (except by generating the number 8). Overall, STRUCTADAPT produces a more accurate text output than FINE-TUNE by generating correct pronouns and mentions when control verbs and reentrancies are involved, in both full and low-data scenarios. + +Model Variations. In Table 5, we report an ablation study on the impact of distinct adapter components, using adapters only in the encoder or decoder. We evaluate different architecture configurations keeping the same number of parameters for a fair comparison. We find that only training adapters in + +
BLEUBERT
FINE-TUNE38.595.6
ADAPT ONLY ENC38.595.7
ADAPT ONLY DEC11.690.3
ADAPT ENC + DEC38.695.6
STRUCTADAPT-GCN ONLY ENC40.395.9
STRUCTADAPT-GCN ENC + DEC41.796.0
+ +the decoder is not sufficient for a good performance, even having the same number of parameters. This suggests that adapting the PLM encoder to handle graph structures is key in AMR-to-text tasks. Interestingly, the model that only employs STRUCTADAPT in the encoder (i.e., no ADAPT is used in the decoder) has a better performance (+1.7 BLEU) than using ADAPT in both encoder and decoder, highlighting STRUCTADAPT's strong graph encoding abilities. Finally, the best performance is achieved when we employ STRUCTADAPT in the encoder and ADAPT in the decoder, reaching 41.7 BLEU points. + +# 6 Graph Representation Evaluation + +In this section, we explore how different graph properties impact the models' abilities to encode the input graph structure. + +# 6.1 Impact of the Graph Representation + +Inspired by Damonte and Cohen (2019), we investigate two different approaches when linearizing the AMR: (i) only nodes have explicit representations, whereas edge relations are represented by the adapter parameters using the RGCN;[10] and (ii) the sequence of nodes and edges using depth-first traversal of the graph. + +We also propose and evaluate three different graph structures based on subwords (cf. §4.2): rep1: for each edge, we connect every token from the source node to every token of the target node; rep2: we connect the last token of the source node to the first token of the target node and connect the tokens of a node sequentially; rep3: we connect the first token of the source node to the first token of the target node and connect the token of a node sequentially. Figure 3 shows an example of the three representations for an AMR graph structure. + +Table 5: Impact of the adapter modules in the encoder or decoder in the LDC2017T10 dev set. All adapter-based models have the same number of parameters. + +
LinearizationGraph RepresentationBLEUBERT
(i) only nodesrep139.195.8
rep238.595.6
rep338.995.7
(ii) nodes and edgesrep141.796.0
rep240.495.8
rep340.895.9
complete graph39.495.8
+ +Table 6: Performance on the LDC2017T10 dev set when using different graph representation strategies. + +Additionally, we also investigate a fully connected graph structure (complete graph), that is, similarly to the self-attention mechanism in Transformers, all nodes and edges are connected. + +As shown in Table 6, explicitly considering nodes and edges in the graph linearization is beneficial. This approach has the advantage of allowing the model to handle new edge relations during inference, as they are not encoded as model parameters. Note that the complete graph representation has relatively inferior performance, again demonstrating the advantage of explicitly encoding the input graph connectivity. + +Finally, we observe that the best configuration is using nodes and edges with $rep1$ (see an example in Figure 3c). We believe that this is because $rep1$ allows direct interactions between all source and target tokens, making all token representations of an AMR node directly influenced by the neighbouring tokens. + +# 6.2 Robustness to Graph Linearization + +A critical advantage of modeling the graph structure is to be less dependent on linearization strategies because the graph connectivity is invariant to the graph linearization. We thus are interested in measuring the impact of the graph linearization in the models. + +Following Hoyle et al. (2021), we investigate three different graph linearizations: (i) CANON: the original order of the canonical human-created linearizations in AMR corpora; (ii) RECONF: the order from the canonical graph linearization is ignored, except for the top node;[11] and (iii) RANDOM: constructs a linearization from a random node in the graph, disregarding all order information from the canonical format, but it remains a valid traversal of the graph. All linearizations are converted to a + +
CANONRECONFRANDOM
FINE-TUNE38.035.631.3
ADAPT+0.9+0.8+0.9
STRUCTADAPT-RGCN+4.1+3.6+5.9
+ +sequence of node and edge labels using depth-first traversal and used for both training and evaluation. Examples of such graph linearizations are shown in Appendix C. + +Table 7 presents the results. Note that while RECONF has a negative impact on all models, STRUCTADAPT has the best performance. ADAPT has similar performance gains over FINE-TUNE in all graph linearizations. Finally, note that for RANDOM, there is a drastic performance drop in FINE-TUNE and the gap between STRUCTADAPT and FINE-TUNE is widest $(+5.9$ BLEU), demonstrating that explicitly encoding the graph structure is beneficial and that STRUCTADAPT is much less impacted by different graph linearizations. + +# 6.3 Graph Properties + +Table 8 shows the effects of the graph size, graph diameter and reentrancies in the performance. First, note that the BLEU scores decrease as the graph size increases since larger graphs often are more complex. The performance gap between STRUCTADAPT and FINE-TUNE becomes larger for relatively larger graphs, showing that STRUCTADAPT is able to better encode complex graphs. As ADAPT is not aware of the graph connectivity, it has much worse scores compared to STRUCTADAPT, especially for larger graphs. + +It is expected that the benefit of the STRUCTADAPT will be more evident for AMR graphs containing larger diameter as the encoder is aware of the input graph structure. As seen in Table 8, similarly to the graph size, the scores decrease as the graph diameter increases. STRUCTADAPT achieves a clear improvement when handling graphs with $\geq 20$ diameter, with a improvement of $+4.2$ BLEU points over FINE-TUNE. + +Previous work (Damonte and Cohen, 2019; Szubert et al., 2020) showed that reentrancies (nodes with multiple parents) pose difficulties in encoding AMRs correctly. Because STRUCTADAPT is the only approach to model reentrancies explicitly, we expect it to deal better with these structures. The + +Table 7: Differences, with respect to FINE-TUNE, in the BLEU score of the LDC2017T10 test set as a function of different graph linearizations. + +
graph size1-3031-60>60
# datapoints548537286
FINE-TUNE40.637.338.1
ADAPT+0.5+1.4+1.1
STRUCTADAPT-RGCN+2.3+4.0+4.6
graph diameter1-1011-20>20
# datapoints384769218
FINE-TUNE43.337.638.5
ADAPT-0.1+1.7+0.3
STRUCTADAPT-RGCN+0.5+4.3+4.2
# reentrancies01-34-20
# datapoints61966488
FINE-TUNE42.938.031.3
ADAPT+0.2+1.7+0.8
STRUCTADAPT-RGCN+3.4+4.4+4.4
+ +Table 8: Differences, with respect to FINE-TUNE, in the BLEU score of the LDC2017T10 test set as a function of the graph size, graph diameter and number of reentrancies. + +gap between StractADAPT and the other models is widest for examples with more reentrancies, confirming our hypothesis. In particular, when graphs contain $\geq 4$ reentrancies, StractADAPT has an improvement of $+3.6$ BLEU points compared to ADAPT. + +# 7 Conclusion + +We presented STRUCTADAPT, a novel adapter architecture to explicitly model graph structures into pretrained language models, providing an extensive evaluation of our approach and showing that it achieves state-of-the-art results on two AMR-to-text benchmarks, training much fewer parameters. We also found that STRUCTADAPT is more effective when encoding complex graphs, when trained on fewer datapoints, and is more robust to different graph linearizations and reentries. In future work, we plan to consider other graph-to-text tasks, such as those based on Knowledge Graphs. + +# Acknowledgments + +We thank our anonymous reviewers for their thoughtful comments. We also would like to thank Jonas Pfeiffer, Jorge Cardona, Juri Opitz, Kevin Stowe, Thy Tran, Tilman Beck and Tim Baumgartner for their feedback on this work. This work has been supported by the German Research Foundation (DFG) as part of the Research Training Group "Adaptive Preparation of Information form Heterogeneous Sources" (AIPHES, GRK 1994/1) and as part of the DFG funded project UKP-SQuARE with the number GU 798/29-1. + +# References + +Xuefeng Bai, Linfeng Song, and Yue Zhang. 2020. Online back-parsing for AMR-to-text generation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1206-1219, Online. Association for Computational Linguistics. +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. +Daniel Beck, Gholamreza Haffari, and Trevor Cohn. 2018. Graph-to-sequence learning using gated graph neural networks. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 273-283, Melbourne, Australia. Association for Computational Linguistics. +Michele Bevilacqua, Rexhina Blloshmi, and Roberto Navigli. 2021. One spring to rule them both: Symmetric amr semantic parsing and generation without a complex pipeline. Proceedings of the AAAI Conference on Artificial Intelligence, 35(14):12564-12573. +Deng Cai and Wai Lam. 2020. Graph transformer for graph-to-sequence learning. Proceedings of the AAAI Conference on Artificial Intelligence, 34(05):7464-7471. +Thiago Castro Ferreira, Chris van der Lee, Emiel van Miltenburg, and Emiel Krahmer. 2019. Neural data-to-text generation: A comparison between pipeline and end-to-end architectures. 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 552-562, Hong Kong, China. Association for Computational Linguistics. +Marco Damonte and Shay B. Cohen. 2019. Structural neural encoders for AMR-to-text generation. 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 3649-3658, Minneapolis, Minnesota. 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. +Jeffrey Flanigan, Chris Dyer, Noah A. Smith, and Jaime Carbonell. 2016. Generation from Abstract Meaning Representation using tree transducers. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 731-739, San Diego, California. Association for Computational Linguistics. +Qiankun Fu, Linfeng Song, Wenyu Du, and Yue Zhang. 2021. End-to-end AMR corefence resolution. 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 4204-4214, Online. Association for Computational Linguistics. +Claire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. 2017. The WebNLG challenge: Generating text from RDF data. In Proceedings of the 10th International Conference on Natural Language Generation, pages 124-133, Santiago de Compostela, Spain. Association for Computational Linguistics. +Ian J. Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. 2014. An empirical investigation of catastrophic forgetting in gradient-based neural networks. In Proceedings of International Conference on Learning Representations (ICLR). +Zhijiang Guo, Yan Zhang, Zhiyang Teng, and Wei Lu. 2019. Densely connected graph convolutional networks for graph-to-sequence learning. Transactions of the Association for Computational Linguistics, 7:297-312. +Karen Hambardzumyan, Hrant Khachatrian, and Jonathan May. 2021. WARP: Word-level Adversarial ReProgramming. 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 4921-4933, Online. Association for Computational Linguistics. +Hamza Harkous, Isabel Groves, and Amir Saffari. 2020. Have your text and use it too! end-to-end neural data-to-text generation with semantic fidelity. In Proceedings of the 28th International Conference on Computational Linguistics, pages 2410-2424, Barcelona, Spain (Online). International Committee on Computational Linguistics. +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 the 36th International Conference on Machine Learning, volume 97 of Proceedings + +of Machine Learning Research, pages 2790-2799. +PMLR. +Dirk Hovy, Taylor Berg-Kirkpatrick, Ashish Vaswani, and Eduard Hovy. 2013. Learning whom to trust with MACE. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1120-1130, Atlanta, Georgia. Association for Computational Linguistics. +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. +Alexander Miserlis Hoyle, Ana Marasovic, and Noah A. Smith. 2021. Promoting graph awareness in linearized graph-to-text generation. In *Findings of the Association for Computational Linguistics: ACL-IJCNLP* 2021, pages 944–956, Online. Association for Computational Linguistics. +Mihir Kale. 2020. Text-to-text pre-training for data-to-text tasks. arXiv e-prints. +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. +Thomas N. Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. +James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. 2017. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114(13):3521-3526. +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. +Anne Lauscher, Olga Majewska, Leonardo F. R. Ribeiro, Iryna Gurevych, Nikolai Rozanov, and Goran Glavaš. 2020. Common sense or world knowledge? investigating adapter-based knowledge injection into pretrained transformers. In Proceedings of Deep Learning Inside Out (DeeLIO): The First Workshop on Knowledge Extraction and Integration for Deep Learning Architectures, pages 43-49, Online. Association for Computational Linguistics. + +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. Association for Computational Linguistics. +Xiang Lisa Li and Percy Liang. 2021. Prefix-tuning: Optimizing continuous prompts for 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 4582-4597, Online. Association for Computational Linguistics. +Kexin Liao, Logan Lebanoff, and Fei Liu. 2018. Abstract Meaning Representation for multi-document summarization. In Proceedings of the 27th International Conference on Computational Linguistics, pages 1178-1190, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. 2021. GPT understands, too. CoRR, abs/2103.10385. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2020. Roberta: A robustly optimized bert pretraining approach. arXiv e-prints. +Manuel Mager, Ramón Fernandez Astudillo, Tahira Naseem, Md Arafat Sultan, Young-Suk Lee, Radu Florian, and Salim Roukos. 2020. GPT-too: A language-model-first approach for AMR-to-text generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1846-1852, Online. Association for Computational Linguistics. +Linyong Nan, Dragomir Radev, Rui Zhang, Amrit Rau, Abhinand Sivaprasad, Chiachun Hsieh, Xiangru Tang, Aadit Vyas, Neha Verma, Pranav Krishna, Yangxiaokang Liu, Nadia Irwanto, Jessica Pan, Faiaz Rahman, Ahmad Zaidi, Mutethia M tuma, Yasin Tarabar, Ankit Gupta, Tao Yu, Yi Chern Tan, Xi Victoria Lin, Caiming Xiong, Richard Socher, and Nazneen Fatema Rajani. 2021. DART: Open-domain structured data record to text generation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 432-447, Online. Association for Computational Linguistics. +Juri Opitz, Angel Daza, and Anette Frank. 2021. Weisfeiler-leman in the bamboo: Novel amr graph metrics and a benchmark for amr graph similarity. Transactions of the Association for Computational Linguistics. + +Juri Opitz and Anette Frank. 2021. Towards a decomposable metric for explainable evaluation of text generation from AMR. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 1504-1518, Online. Association for Computational Linguistics. +Juri Opitz, Letitia Parcalabescu, and Anette Frank. 2020. AMR similarity metrics from principles. Transactions of the Association for Computational Linguistics, 8:522-538. +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. +Ankur Parikh, Xuezhi Wang, Sebastian Gehrmann, Manaal Faruqui, Bhuwan Dhingra, Diyi Yang, and Dipanjan Das. 2020. ToTTo: A controlled table-to-text generation dataset. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1173-1186, Online. Association for Computational Linguistics. +Jonas Pfeiffer, Aishwarya Kamath, Andreas Rückle, Kyunghyun Cho, and Iryna Gurevych. 2021. AdapterFusion: Non-Destructive Task Composition for Transfer Learning. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics (EACL), Online. Association for Computational Linguistics. +Jonas Pfeiffer, Andreas Rückle, Clifton Poth, Aishwarya Kamath, Ivan Vulic, Sebastian Ruder, Kyunghyun Cho, and Iryna Gurevych. 2020a. AdapterHub: A framework for adapting transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 46-54, Online. Association for Computational Linguistics. +Jonas Pfeiffer, Ivan Vulic, Iryna Gurevych, and Sebastian Ruder. 2020b. MAD-X: An Adapter-Based Framework for Multi-Task Cross-Linguual Transfer. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7654–7673, Online. Association for Computational Linguistics. +Maja Popovic. 2015. *chrF: character n-gram F-score* for automatic MT evaluation. In *Proceedings of the Tenth Workshop on Statistical Machine Translation*, pages 392–395, Lisbon, Portugal. Association for Computational Linguistics. +Nima Pourdamghani, Kevin Knight, and Ulf Hermjakob. 2016. Generating English from Abstract Meaning Representations. In Proceedings of the 9th International Natural Language Generation conference, pages 21-25, Edinburgh, UK. Association for Computational Linguistics. + +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. In Technical report, OpenAI. +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 e-prints. +Sylvestre-Alvise Rebuffi, Hakan Bilen, and Andrea Vedaldi. 2017. Learning multiple visual domains with residual adapters. In Advances in Neural Information Processing Systems, volume 30, pages 506-516. Curran Associates, Inc. +Leonardo F. R. Ribeiro, Claire Gardent, and Iryna Gurevych. 2019. Enhancing AMR-to-text generation with dual graph 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 3183-3194, Hong Kong, China. Association for Computational Linguistics. +Leonardo F. R. Ribeiro, Jonas Pfeiffer, Yue Zhang, and Iryna Gurevych. 2021. Smelting gold and silver for improved multilingual amr-to-text generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Punta Cana, November 7-11, 2021. +Leonardo F. R. Ribeiro, Martin Schmitt, Hinrich Schütze, and Iryna Gurevych. 2020a. Investigating pretrained language models for graph-to-text generation. arXiv e-prints. +Leonardo F. R. Ribeiro, Yue Zhang, Claire Gardent, and Iryna Gurevych. 2020b. Modeling global and local node contexts for text generation from knowledge graphs. Transactions of the Association for Computational Linguistics, 8:589-604. +Michael Sejr Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. 2018. Modeling relational data with graph convolutional networks. In ESWC 2018, Heraklion, Crete, Greece, June 3-7, 2018, Proceedings, pages 593-607. +Martin Schmitt, Leonardo F. R. Ribeiro, Philipp Dufter, Iryna Gurevych, and Hinrich Schütze. 2021. Modeling graph structure via relative position for text generation from knowledge graphs. In Proceedings of the Fifteenth Workshop on Graph-Based Methods for Natural Language Processing (TextGraphs-15), pages 10-21, Mexico City, Mexico. 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. +Linfeng Song, Daniel Gildea, Yue Zhang, Zhiguo Wang, and Jinsong Su. 2019. Semantic neural machine translation using amr. Transactions of the Association for Computational Linguistics, 7:19-31. +Linfeng Song, Yue Zhang, Zhiguo Wang, and Daniel Gildea. 2018. A graph-to-sequence model for AMR-to-text generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1616-1626, Melbourne, Australia. Association for Computational Linguistics. +Ida Szubert, Marco Damonte, Shay B. Cohen, and Mark Steedman. 2020. The role of reentrancies in Abstract Meaning Representation parsing. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 2198-2207, 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 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 5998-6008. Curran Associates, Inc. +Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. 2018. Graph attention networks. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. +Pavlos Vougiouklis, Hady Elsahar, Lucie-Aimée Kaffee, Christophe Gravier, Frédérique Laforest, Jonathon Hare, and Elena Simperl. 2018. Neural wikipedian: Generating textual summaries from knowledge base triples. Journal of Web Semantics, 52-53:1 - 15. +Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. 2019. Superglue: A stickier benchmark for general-purpose language understanding systems. In H. Wallach, H. Larochelle, A. Beygelzimer, F. Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 3266-3280. +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. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funpowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. +Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. 2019. How powerful are graph neural networks? In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. +Jeffrey O. Zhang, Alexander Sax, Amir Zamir, Leonidas J. Guibas, and Jitendra Malik. 2019. Sidetuning: Network adaptation via additive side networks. arXiv e-prints. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2020a. *Bertscore: Evaluating text generation with BERT.* In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. +Yan Zhang, Zhijiang Guo, Zhiyang Teng, Wei Lu, Shay B. Cohen, Zuozhu Liu, and Lidong Bing. 2020b. Lightweight, dynamic graph convolutional networks for AMR-to-text generation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 2162-2172, Online. Association for Computational Linguistics. + +# Appendices + +In this supplementary material, we detail experiments' settings and additional information about the human evaluation and graph representations. + +# A Details of Models and Hyperparameters + +The experiments were executed using the version 3.3.1 of the transformers library released by Hugging Face (Wolf et al., 2019). In Table 9, we report the hyperparameters used to train the models presented in this paper. We train until the development set BLEU has not improved for 5 epochs. + +
learning ratebatch sizebeam search size
FINE-TUNE3e-0545
FT-TOP21e-0445
FT-Bottom21e-0445
ADAPT1e-0445
STRUCTADAPT1e-0445
+ +# B Details on the Human Evaluation + +The human evaluation was conducted via Amazon Mechanical Turk. We randomly select 100 generated texts for each of the 3 sets and each adapter model (ADAPT, STRUCTADAPT-GCN), with a total of 600 texts to be evaluated. The annotators then rate the meaning similarity on a 1-7 Likert scale. For each text, we collect scores from 3 annotators. We use MACE (Hovy et al., 2013) to further improve upon these raw answers by unsupervised estimation of worker trustworthiness and subsequent recovery of the most likely score. Models are ranked according to the mean of sentence-level scores. We defined a filter for all our evaluations, allowing to participate only workers who have more than 5000 HITs approved and with an acceptance rate of $95\%$ or higher. The task took workers a median time of 1.6 minutes per pair of sentences. We apply a quality control step filtering workers who do not score some faked and known sentences properly or did the experiment in a very short time. + +# C Example of Graph Linearizations + +In Table 10, we present three different linearizations for the same AMR graph and its corresponding reference sentence. Figure 5 shows the two possible graphs that are represented by the linearizations. In particular, Figure 5a shows a graph that is represented by CANON and RECONF linearizations + +and Figure 5b shows a graph that is represented by RANDOM. Note that whereas the linearizations can greatly differ from each other, the graph structure for all linearizations remains very similar. + +![](images/f45a499d592b34c84bb146bb1f291386090037e036a77693284b098d314cd5cd.jpg) +Figure 5: Two AMR graphs with the same meaning. + +![](images/91114d48f33b99d792df5f8afde1b37acefb3f379ac34b60dcb867bce4f00473.jpg) + +Table 9: Hyperparameter settings for our methods. + +
CANON
(s / subsidize-01 +:ARG1 (u / utility +:poss (s2 / she) +:mod (a / all)))
RECONF
(s / subsidize-01 +:ARG1 (u / utility +:mod (a / all) +:poss (s2 / she)))
RANDOM
(s2 / she +:poss-of (u / utility +:ARG1-of (s / subsidize-01) +:mod (a / all)))
SENTENCE: Her utilities are all subsidized.
+ +Table 10: Different linearizations for an AMR graph. \ No newline at end of file diff --git a/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/images.zip b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a8f8e7322a70c0248fb18df8e881f77f2d33d70a --- /dev/null +++ b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f041651dcea2d9cc2a5cfa68f5ae3f06ccb2c44d4be1d1d4d6f916e8ad788cce +size 533900 diff --git a/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/layout.json b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..41b6fb79ecb683e4b12dd4928605a989b8620a69 --- /dev/null +++ b/structuraladaptersinpretrainedlanguagemodelsforamrtotextgeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26bd6b12f14ec7356ff43c91797b9620a6e7ce689feeacf0504219ab8974a06f +size 491691 diff --git a/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_content_list.json b/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..941123e7adf8bb87792207c464b30c09e4357469 --- /dev/null +++ b/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a03db2f7400babe2a820d4aef38412b6781c2c04f5d41eacb1ed0d284609969a +size 89839 diff --git a/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_model.json b/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f3c7afc07439aab44e810307845ad912042dc881 --- /dev/null +++ b/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e613578537dfb0441cdff096ba3d21f087695acea21de0661c12bf8038e522c1 +size 106639 diff --git a/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_origin.pdf b/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..86c27691d5ae71dee8907aa4bdb1975b767a3671 --- /dev/null +++ b/structureaugmentedkeyphrasegeneration/a84709dc-2ac9-4d1e-af8a-6d224578dfa8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ef4326dc1c031d5cefbab3c48968940d82deeb42ebbb3307fcb8bd35ecae129 +size 393517 diff --git a/structureaugmentedkeyphrasegeneration/full.md b/structureaugmentedkeyphrasegeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..cad79bd39cd193a203c7f0d60c46e04ed7a9dac7 --- /dev/null +++ b/structureaugmentedkeyphrasegeneration/full.md @@ -0,0 +1,370 @@ +# Structure-Augmented Keyphrase Generation + +Jihyuk Kim + +Yonsei University + +jihyukkim@yonsei.ac.kr + +Seungtaek Choi + +Yonsei University + +hist0613@yonsei.ac.kr + +Myeongho Jeong + +Yonsei University + +wag9611@yonsei.ac.kr + +Seung-won Hwang* + +Seoul National University + +seungwonh@snu.ac.kr + +# Abstract + +This paper studies the keyphrase generation (KG) task for scenarios where structure plays an important role. For example, a scientific publication consists of a short title and a long body, where the title can be used for de-emphasizing unimportant details in the body. Similarly, for short social media posts (e.g., tweets), scarce context can be augmented from titles, though often missing. Our contribution is generating/augmenting structure then encoding these information, using existing keyphrases of other documents, complementing missing/incomplete titles. Specifically, we first extend the given document with related but absent keyphrases from existing keyphrases, to augment missing contexts (generating structure), and then, build a graph of keyphrases and the given document, to obtain structure-aware representation of the augmented text (encoding structure). Our empirical results validate that our proposed structure augmentation and structure-aware encoding can improve KG for both scenarios, outperforming the state-of-the-art1. + +# 1 Introduction + +Keyphrases not only help human readers to gain immediate insights about a given document, but also make documents queryable, e.g., by hashtagging social posts with predicted keyphrases. Among keyphrase tasks, we focus on tasks that allow words that are not present in the given document, which often be called absent words, to be keyphrases, as the input document can be often context-scarce: Many potentially relevant keyphrases are missing in the given document, since the keyphrase can be expressed in terms different from those present in the document (i.e., vocabulary mismatch). + +Our goal is to generate keyphrases that are likely to be words absent from the document, especially + +
FieldText
TitleMethods to tell if a question can be answered from a paragraph
Question... Is there any existing research in telling whether or not a question is answerable? ... +... +... I considered textual entailment, but it doesn’t seem to be exactly what I’m looking for ...
Existing Keyphrases..., “natural language processing”, “formal languages”, ...
Gold Keyphrases“question answering”, “natural language processing”
+ +Table 1: An example of a social Q&A post consisting of a title and the main body question: We present gold keyphrases labeled by the user, and existing keyphrases labeled for other related posts. **Bold-face** words can indicate the topic of the post. + +in the following scenarios: (a) scientific publications with diverse vocabularies, or (b) short social posts, where we found that, from public and real-life datasets we used in our evaluation, $37\%$ of keyphrases in scientific publications, $67\%$ of hashtags, on average, in social media posts are absent in the given document. Thus, we formulate our problem as keyphrase generation (KG) (Meng et al., 2017) of predicting keyphrases, including absent words as well as present words, adopting encoder-decoder architecture. + +A recent trend is leveraging document structure for KG (Chen et al., 2019b), where metadata in documents, e.g., document title, clarifies the meaning of documents (Kim et al., 2021). For illustration, Table 1 shows a social Q&A post consisting of title (the first row) and main body question (the second row), where we need to predict gold keyphrases "question answering" and "natural language processing" (the last row). The concise title enables readers to focus on important parts of the main question (bold-face words), while ignoring details. However, titles often exclude meaningful keyphrases (e.g., "natural language processing" in Table 1) due to their inherent length limitation, and + +making matters worse, titles may not exist at all in some social media posts (e.g., tweets). + +Our contribution is to construct a structured document $\mathcal{X}^{+}$ , even when the structure is not given, by leveraging observed keyphrases from other documents in the training dataset, to improve both encoding and decoding. For encoding, keyphrases can be used to emphasize relevant parts in $\mathcal{X}$ , similarly done with the title. For decoding, the keyphrases can augment vocabulary, e.g., "natural language processing", from which the decoder can copy words. We stress that our work is designed to work for both closed and open set scenarios, represented by social and scientific document scenario respectively, with the following distinctions: + +- Closed set: Hashtags in social media posts are frequently reused (i.e., keyphrases can be copied from observed keyphrases from the training set for decoding). +- Open set: A significant amount of keyphrases of scientific publications (about $20\%$ in our target scenario) have never been observed in the training dataset (i.e., keyphrases candidate set is open-ended). + +Our proposed solution is two-phased: The first phase, to construct a structured document $\mathcal{X}^+$ , augments the given document $\mathcal{X}$ by retrieving relevant keyphrases $\mathcal{R}$ from existing keyphrases in the training dataset. Then, the second phase follows, to encode structure-aware representations on $\mathcal{X}^+$ . We use graph representation to effectively integrate $\mathcal{X}$ and $\mathcal{R}$ , where the graph can be flexibly designed depending on closed/open set scenarios. + +Our empirical results validate that generating and encoding document structures significantly improve performance, outperforming the state-of-the-art, for both social and scientific documents. + +# 2 Related Work + +We briefly explain our target task of KG and introduce our distinction of leveraging structures. + +Observing words in the document is a crucial signal for keyphrase tasks, especially for keyphrase extraction (KE) requiring keyphrases to appear in the given document. In contrast, we focus on KG, as our target scenarios require not having such restrictions. KG, to generate absent words, is often modeled as neural encoder-decoder architecture (Sutskever et al., 2014), which generates the keyphrase sequence given the input document (Meng et al., 2017). KG approaches can be + +further categorized into two settings: one-to-one (O2O) and one-to-seq (O2S) (Yuan et al., 2020; Ye et al., 2021). In O2O, a model is trained to generate a single keyphrase for each document, and then, for evaluation, the model generates multiple keyphrases using beam search decoding with a large beam size (e.g., 200). On the other hand, in O2S, a model is trained to generate multiple keyphrases where multiple keyphrases for each document are concatenated into a single sequence with a predefined delimiter. Our model follows O2O, as O2O is known to be better for predicting absent keyphrases (Meng et al., 2021) and as absent keyphrases are frequently observed in our target scenario with scarce context. The distinction of our proposal for KG is to leverage structures in documents, to improve both encoder and decoder. + +Structures in documents are essential sources of prediction signals (Kim et al., 2021). For example, for a scientific publication consisting of a title and the main body, the structured document enjoys the complementary strength of the two fields: While the main body contains many keywords (i.e., high recall), title, though much shorter, concisely describes the main focus of the paper (i.e., high precision). To leverage such structure, TGNet (Chen et al., 2019b) uses the title to guide the encoder to accurately capture core contents. However, the given title is observed to be often insufficient due to length limitation (Li et al., 2010), which we consistently observed in our evaluations. + +As a further extreme, short social media posts may not have titles. Furthermore, because of the length limitation (e.g., 140 character tweets), most keywords may not appear in the given post (i.e., low recall). In such scenarios, one can construct structured posts, to augment posts with missing keywords. For example, TAKG (Wang et al., 2019) utilizes topic modeling, where topics shared across other documents enable the encoder to leverage contexts observed in other related posts. However, a small, fixed number of topics (e.g., 15 or 30) are limited in differentiating diverse documents with similar topics. + +Our distinction is overcoming incomplete or missing structure, by generating a virtual structure from existing keyphrases (keyphrases in the train set), from which we "retrieve" terms that can serve as titles or topics for encoding. KG-KE-KR (Chen et al., 2019a) similarly leverages keyphrase retrieval, but they do not use this for structure-aware + +encoding and use only for decoding. In contrast, we jointly contextualize the given document and the retrieved keyphrases, to allow both fields to exchange contexts from each other. We empirically validate that our proposed structure-augmented encoding significantly boosts performance. + +# 3 Approach + +Given a document $\mathcal{X} = \{x_i\}_{i=1}^{N_{\mathcal{X}}}$ with $N_{\mathcal{X}}$ unique words, KG models aim to output a set of target keyphrases, which can be implemented using encoder-decoder architecture. We train a model to predict a single keyphrase, then, for inference, we generate multiple keyphrases using beam search decoding. We denote a single keyphrase with length $T$ by $\mathcal{Y} = [y_1, \ldots, y_T]$ . + +In the following sections, we first describe a baseline encoding targeting plain text $\mathcal{X}$ (§3.1), and then, we explain our distinction of generating structure (§3.2.1) and encoding structure (§3.2.2). + +In this section, we do not consider pre-existing title $\mathcal{T}$ , but our framework straightforwardly extends for such titles, as we later discuss in §4.4.1. + +# 3.1 Baseline: Plain Text Encoding + +Targeting plain texts, a novel graph-based encoder was proposed in DivGraphPointer (Sun et al., 2019), outperforming sequence-based encodings such as GRU (Cho et al., 2014) or LSTM (Hochreiter and Schmidhuber, 1997). + +For graph construction, a fully connected graph is used, where nodes are unique words in $\mathcal{X}$ . For edges, two adjacency matrices $\overleftarrow{\mathbf{A}}_{ij}^{\mathcal{X}}$ and $\overrightarrow{\mathbf{A}}_{ij}^{\mathcal{X}}$ , using position-based proximity, are obtained for forward and backward direction respectively: + +$$ +\begin{array}{l} \overset {\prime} {\mathbf {A}} _ {i j} ^ {\mathcal {X}} = \sum_ {p _ {i} ^ {\mathcal {X}}} \sum_ {p _ {j} ^ {\mathcal {X}}} m a x ((p _ {i} ^ {\mathcal {X}} - p _ {j} ^ {\mathcal {X}}) ^ {- 1}, 0) \\ \overrightarrow {\mathbf {A}} _ {i j} ^ {\mathcal {X}} = \sum_ {p _ {i} ^ {\mathcal {X}}} \sum_ {p _ {j} ^ {\mathcal {X}}} \max \left(\left(p _ {j} ^ {\mathcal {X}} - p _ {i} ^ {\mathcal {X}}\right) ^ {- 1}, 0\right), \tag {1} \\ \end{array} +$$ + +where $p_{[i / j]}^{\mathcal{X}}\in \mathcal{P}(x_{[i / j]})$ is a position offset of a unique word $x_{[i / j]}$ in $\mathcal{X}$ . + +Given the graph, to contextualize node representations, Graph Convolutional Network (GCN) (Kipf and Welling, 2017) is adopted. We denote the number of stacked graph convolution layers by $L$ , the number of node features by $D$ , and contextualized representations of nodes for $l$ -th layer by $\mathbf{H}_l^{\mathcal{X}} \in \mathbb{R}^{N_{\mathcal{X}} \times D}$ where $\mathbf{H}_1^{\mathcal{X}}$ is obtained from a word embedding matrix. As comprehensive notations, we denote learnable parameters by + +$\mathbf{v}$ for vector and $\mathbf{W}$ for matrix, with different super/subscripts. + +Starting from $\mathbf{H}_1^{\mathcal{X}}$ , context vectors $\mathbf{C}_l^{\mathcal{X}} \in \mathbb{R}^{N_{\mathcal{X}} \times D}$ are gathered from neighbor nodes using graph convolution, then combined with $\mathbf{H}_l^{\mathcal{X}}$ to produce $\mathbf{H}_{l+1}^{\mathcal{X}}$ (Dauphin et al., 2017): + +$$ +\begin{array}{l} \mathbf {C} _ {l} ^ {\chi} = \overleftarrow {\mathbf {A}} ^ {\chi} \mathbf {H} _ {l} ^ {\chi} \overrightarrow {\mathbf {W}} _ {l} ^ {\chi} + \overrightarrow {\mathbf {A}} ^ {\chi} \mathbf {H} _ {l} ^ {\chi} \overrightarrow {\mathbf {W}} _ {l} ^ {\chi} \tag {2} \\ + \mathbf {H} _ {l} ^ {\boldsymbol {\chi}} \tilde {\mathbf {W}} _ {l} ^ {\boldsymbol {\chi}} \\ \end{array} +$$ + +$$ +\mathbf {H} _ {l + 1} ^ {\mathcal {X}} = \mathbf {H} _ {l} ^ {\mathcal {X}} + \mathbf {C} _ {l} ^ {\mathcal {X}} \times \sigma \left(\mathbf {G} _ {l} ^ {\mathcal {X}}\right), \tag {3} +$$ + +where $\sigma$ denotes sigmoid function, and $\stackrel{\leftrightarrow}{\hat{\mathbf{A}}}^{\mathcal{X}}$ , $\stackrel{\rightarrow}{\hat{\mathbf{A}}}^{\mathcal{X}}$ are normalized matrices with eigenvalues close to 1 for stable training (Kipf and Welling, 2017). In Eq (3), residual addition is employed with $\mathbf{G}_l^{\mathcal{X}} \in \mathbb{R}^{N_{\mathcal{X}} \times D}$ , which helps gradient back-propagation through deep layers (He et al., 2016; Dauphin et al., 2017). $\mathbf{G}_l^{\mathcal{X}}$ is obtained in the same way to $\mathbf{C}_l^{\mathcal{X}}$ in Eq (2) but with different learnable parameters. + +We adopt the same graph construction and GCN contextualization, for encoding $\mathcal{X}$ . Built upon the GCN encoder, our distinction is to generate and encode structure for $\mathcal{X}$ . + +# 3.2 Proposed: Structure-Augmented KG + +Beyond plain text, we aim to leverage structures in documents. Though leveraging the title-body structure in scientific publications has been shown effective (Chen et al., 2019b), the given titles are often found to be incomplete because of limited length (Li et al., 2010), or unavailable (e.g., tweets). + +Our goal is, given incomplete or missing structure, to generate and encode structures, to replace missing titles or complement incomplete titles. + +# 3.2.1 Generating Structure + +To generate structured document $\mathcal{X}^+$ , we leverage existing keyphrases of other documents, specifically similar documents to $\mathcal{X}$ , by adopting an assumption that similar documents tend to have similar keyphrases. Specifically, for each keyphrase $r$ in the training dataset, we first collect supporting documents, having $r$ as one of the ground-truth keyphrases, then concatenate them as a single document, denoted by $\mathcal{S}_r$ , and use $\mathcal{S}_r$ to index $r$ . We then use BM25 search (Robertson and Walker, 1994) with $\mathcal{X}$ as a query, to retrieve top- $K$ relevant keyphrases $\mathcal{R} = [r_1, \dots, r_K]^2$ . Finally, we extend $\mathcal{X}$ with $\mathcal{R}$ , to construct a structured document $\mathcal{X}^+$ . + +![](images/9e4be0e665fafaf04c7e4201681dda33b8677a65652532ec982716ba5c46429c.jpg) +Figure 1: Overall approach: Red-colored words or phrases are texts included in decoded keyphrases. Black edges and blue edges are proximity between nodes, obtained from $\mathcal{X}$ and $\mathcal{R}$ respectively, where the thickness indicates the degree of relatedness between nodes. To construct an integrated graph for social posts, we connect two graphs (from $\mathcal{X}$ and $\mathcal{R}$ ), using green edges, and for scientific articles, we construct a multigraph with two types of edges (for $\mathcal{X}$ and $\mathcal{R}$ ), by merging nodes having the same words, depicted by green nodes. + +Having relevant keyphrases $\mathcal{R}$ enhances both encoding and decoding phases, as described next. + +# 3.2.2 Encoding Structure + +Once we augment $\mathcal{X}$ with $\mathcal{R}$ , our next step is to integrate $\mathcal{X}$ and $\mathcal{R}$ into $\mathcal{X}^+$ , and jointly contextualize contents in $\mathcal{X}^+$ by exchanging contexts between the two fields. + +For effective integration, we represent $\mathcal{X}^+$ as an integrated graph, that can be flexibly designed, based on the following principle: A pair of two highly related nodes should be connected by an edge or merged into a single node, while unrelated nodes should be separated from each other. + +For encoding $\mathcal{X}$ , we adopt the GCN contextualization, described in §3.1. On the other hand, for $\mathcal{R}$ , graphs are differently encoded for open- and closed-set scenarios, as below. + +- Closed set $\mathcal{V}$ : Keyphrases in $\mathcal{R}$ are likely to be reused for the target keyphrases $\mathcal{V}$ , where keyphrase in $\mathcal{R}$ is assigned as a node. The keyphrase can be copied as $\mathcal{V}$ based on the node representation. +- Open set $\mathcal{V}$ : Keyphrases may not be reused, such that words in $\mathcal{R}$ should be combined with other words to generate novel keyphrases, for which we assign the node with a keyword in $\mathcal{R}$ . + +In the following two sections, we introduce our Graph-based Structured Document Encoder, or + +GSEnc, specifically for closed (§3.2.3) and open set $\mathcal{V}$ (§3.2.4) respectively. + +# 3.2.3 GSEnc for closed set $\mathcal{V}$ + +Targeting closed set keyphrases, we jointly contextualize word nodes from $\mathcal{X}$ and keyphrase nodes from $\mathcal{R}$ , by building a graph each, then generate connecting edges between the two for propagating contexts across graphs. + +Constructing and encoding graph for $\mathcal{X}$ follow §3.1. On the other hand, for $\mathcal{R}$ , we set a single phrase node for each keyphrase, instead of multiple word nodes, to enable a decoder to copy the keyphrase as-is based on the node features. For edge construction, instead of position-based proximity in Eq (1) which is not available for keyphrase nodes, we adopt co-occurrence-based proximity, as frequently co-occurred keyphrases tend to have similar topics3. Specifically, we compute adjacency matrix $\mathbf{A}^{\mathcal{R}}$ as conditional probabilities based on co-occurrence between keyphrases, then, contexts are gathered using graph convolution, similar to Eq (2). + +$$ +\mathbf {A} _ {j k} ^ {\mathcal {R}} = p \left(r _ {k} \mid r _ {j}\right) \tag {4} +$$ + +$$ +\mathbf {C} _ {l} ^ {\mathcal {R}} = \hat {\mathbf {A}} ^ {\mathcal {R}} \mathbf {H} _ {l} ^ {\mathcal {R}} \hat {\mathbf {W}} _ {l} ^ {\mathcal {R}} + \mathbf {H} _ {l} ^ {\mathcal {R}} \tilde {\mathbf {W}} _ {l} ^ {\mathcal {R}}, \tag {5} +$$ + +where $\mathbf{H}_l^{\mathcal{R}}\in \mathbb{R}^{K\times D}$ is node features for $\mathcal{R}$ in $l$ -th layer, $p(r_k|r_j)$ is the probability that $r_k$ co + +occurs given $r_j$ , which is computed using the training dataset, and $\hat{\mathbf{A}}^{\mathcal{R}}$ is normalized matrix from $\mathbf{A}^{\mathcal{R}}$ , as in $\hat{\mathbf{A}}^{\mathcal{X}}$ from $\mathbf{A}^{\mathcal{X}}$ . + +We now discuss how to connect the two graphs for $\mathcal{X}$ and $\mathcal{R}$ (green edges in Figure1). For such connection, we are inspired by connecting query (keyphrase in our case) and document, using relevance feedbacks, such as clicks on matching query-document pair. As we have no such feedback between each keyphrase $r_j \in \mathcal{R}$ and $\mathcal{X}$ , we can adopt zero-shot query log synthesis (Ma et al., 2021), by using pseudo-relevance feedback (Rocchio, 1971): We treat supporting documents $S_{r_j}$ as feedback documents with pseudo-relevance to $r_j$ , to connect $r_j$ with $\mathcal{X}$ using top- $M$ overlapped words, denoted by $S_{r_j}^*$ , between $S_{r_j}$ and $\mathcal{X}$ . For selecting top- $M$ , an unsupervised signal frequently used is tfidf, to favor words appearing frequently in $S_{r_j}$ (i.e., representative words) but infrequently in other documents (i.e., discriminative words) (Xu and Croft, 2017). Alternatively, query generators can be supervised as a separate task, requiring additional training data, so we adopt the former. + +Given $S_{r_j}^*$ , we construct an edge between $x_i$ and $r_j$ , if and only if $x_i$ is included in $S_{r_j}^*$ , then we enable the encoder to estimate a proper edge weight $\overleftrightarrow{\mathbf{A}}_{ij}$ , using graph attention network (Veličković et al., 2018) $^4$ , such that only relevant contexts are exchanged between $\mathcal{X}$ and $\mathcal{R}$ . + +$$ +\overleftrightarrow {\mathbf {A}} _ {i j} = f \left(\overleftrightarrow {\mathbf {v}} ^ {\top} \left[ \overleftrightarrow {\mathbf {W}} \mathbf {H} _ {i, l} ^ {\mathcal {X}} \right| \left| \overleftrightarrow {\mathbf {W}} \mathbf {H} _ {j, l} ^ {\mathcal {R}} \right]\right) \tag {6} +$$ + +$$ +\mathbf {C} _ {l} ^ {\mathcal {X} \rightarrow \mathcal {R}} = \operatorname {s o f t m a x} \left(\stackrel {\leftrightarrow} {\mathbf {A}} ^ {\top}\right) \stackrel {\leftrightarrow} {\mathbf {W}} \mathbf {H} _ {l} ^ {\mathcal {X}} \in \mathbb {R} ^ {K \times D} \tag {7} +$$ + +$$ +\mathbf {C} _ {l} ^ {\mathcal {R} \rightarrow \mathcal {X}} = \operatorname {s o f t m a x} (\overleftrightarrow {\mathbf {A}}) \overleftrightarrow {\mathbf {W}} \mathbf {H} _ {l} ^ {\mathcal {R}} \in \mathbb {R} ^ {N _ {\mathcal {X}} \times D}, \tag {8} +$$ + +where $f(\cdot)$ is LeakyReLU nonlinearity (Maas et al., 2013), and $\lvert\lvert\rvert$ denotes concatenation. In addition, we further leverage pseudo-relevance feedbacks, to augment contexts of $r_j$ , by using $\mathcal{S}_{r_j}$ to initialize node features for $r_j$ : $\mathbf{H}_{1,j}^{\mathcal{R}} = \mathbf{E}^\top f(\mathcal{S}_{r_j}) \in \mathbb{R}^D$ , where $\mathbf{E}$ is a trainable word embedding matrix, and $f$ weighs each word in $\mathcal{S}_{r_j}$ . For $f$ , we adopt tfidf5. + +Finally, we add all gathered contexts and com + +bine these with $\mathbf{H}_l^{[\mathcal{X} / \mathcal{R}]}$ , similar to Eq (3). + +$$ +\begin{array}{l} \mathbf {H} _ {l + 1} ^ {\mathcal {X}} = \mathbf {H} _ {l} ^ {\mathcal {X}} + \mathbf {C} _ {l} ^ {\mathcal {X}} \times \sigma (\mathbf {G} _ {l} ^ {\mathcal {X}}) \\ + \mathbf {C} _ {l} ^ {\mathcal {R} \rightarrow \mathcal {X}} \times \sigma \left(\mathbf {G} _ {l} ^ {\mathcal {R} \rightarrow \mathcal {X}}\right) \\ \end{array} +$$ + +$$ +\begin{array}{l} \mathbf {H} _ {l + 1} ^ {\mathcal {R}} = \mathbf {H} _ {l} ^ {\mathcal {R}} + \mathbf {C} _ {l} ^ {\mathcal {R}} \times \sigma (\mathbf {G} _ {l} ^ {\mathcal {R}}) \\ + \mathbf {C} _ {l} ^ {\mathcal {X} \rightarrow \mathcal {R}} \times \sigma (\mathbf {G} _ {l} ^ {\mathcal {X} \rightarrow \mathcal {R}}), \\ \end{array} +$$ + +where the $\mathbf{G}\mathbf{s}$ are obtained in the same way to Cs but with different learnable parameters. + +# 3.2.4 GSEnc for open set $\mathcal{V}$ + +Targeting open set keyphrases, we jointly contextualize word nodes from both $\mathcal{X}$ and $\mathcal{R}$ . + +Since nodes for $\mathcal{X}$ and $\mathcal{R}$ have the same granularity (i.e., word-level nodes), instead of connecting two graphs (for $\mathcal{X}$ and $\mathcal{R}$ ) using edges, we construct a single integrated graph, by merging a node for $\mathcal{X}$ and a node for $\mathcal{R}$ whenever the two nodes correspond to the same word (green nodes in Figure1). Such integration enables contexts scattered across the two fields to be effectively gathered into the merged node, from which other nodes connected to the merged node also can exchange their contexts with each other through the merged node. Though sharing nodes, we use separate edges for $\mathcal{X}$ and $\mathcal{R}$ , for structure-aware encoding. That is, the merged graph becomes a multigraph; we connect a pair of nodes with two types of edges (black edges for $\mathcal{X}$ and blue edges for $\mathcal{R}$ in Figure1). We denote the contextualized features for nodes on the merged graph, including nodes from both $\mathcal{X}$ and $\mathcal{R}$ , by $\mathbf{H}_l^{\mathcal{X}^+_{\mathrm{merged}}}$ . + +As in Eq (2), using graph convolution and the two types of edges, we aggregate neighbor contexts from $\mathcal{X}$ and $\mathcal{R}$ , into $\mathbf{C}_l^{\mathcal{X}_{\mathrm{merged}}}$ and $\mathbf{C}_l^{\mathcal{R}_{\mathrm{merged}}}$ respectively, while obtaining $\mathbf{G}_l^{\mathcal{X}_{\mathrm{merged}}}, \mathbf{G}_l^{\mathcal{R}_{\mathrm{merged}}}$ similarly. For adjacency matrix for keywords in $\mathcal{R}$ , we use position-based proximity between two keywords within each keyphrase in $\mathcal{R}$ , as in Eq (1). Then, we combine both contexts to update $\mathbf{H}_l^{\mathcal{X}_{\mathrm{merged}}^{+}}$ . + +$$ +\begin{array}{l} \mathbf {H} _ {l + 1} ^ {\mathcal {X} _ {\text {m e r g e d}} ^ {+}} = \mathbf {H} _ {l} ^ {\mathcal {X} _ {\text {m e r g e d}} ^ {+}} \\ + \mathbf {C} _ {l} ^ {\mathcal {X} _ {\text {m e r g e d}}} \times \sigma \left(\mathbf {G} _ {l} ^ {\mathcal {X} _ {\text {m e r g e d}}}\right) \tag {11} \\ + \mathbf {C} _ {l} ^ {\mathcal {R} _ {\mathrm {m e r g e d}}} \times \sigma (\mathbf {G} _ {l} ^ {\mathcal {R} _ {\mathrm {m e r g e d}}}). \\ \end{array} +$$ + +Given the contextualized node features at the last GCN layer, such as $(\mathbf{H}_L^{\mathcal{X}},\mathbf{H}_L^{\mathcal{R}})$ or $\mathbf{H}_L^{\mathcal{X}^+}$ , for closed set $\mathcal{V}$ or open set $\mathcal{V}$ respectively, we feed the features into the decoder, to generate keyphrases. + +# 3.3 Decoder + +The goal of the decoder is to generate a target keyphrase $\mathcal{V} = [y_1,\dots ,y_T]$ with length $T$ , based on the contextualized features on $\mathcal{X}^+$ from the encoder. While standard KG models either copy words from $\mathcal{X}$ or generate words from the predefined vocabulary $\mathcal{V}$ , we have $\mathcal{R}$ as an additional source, which provides valid keyphrase candidates already used for similar documents. To leverage $\mathcal{R}$ for decoding, depending on the application, we allow the decoder to copy either (a) keyphrases (closed set $\mathcal{V}$ ) or (b) words (open set $\mathcal{V}$ ), from $\mathcal{R}$ . + +(a) Closed set $\mathcal{V}$ : copying keyphrases In social media posts, a few keyphrases (e.g., trending hashtags) cover most of the potential target keyphrases. Thus, when $\mathcal{V}$ is included in $\mathcal{R}$ , copying a keyphrase (e.g., "natural language processing" in Figure 1) from $\mathcal{R}$ makes efficient decoding. + +To copy relevant keyphrases, we compute relevance score $\phi_j$ of each $r_j \in \mathcal{R}$ to $\mathcal{X}$ , using inner product between $\mathbf{H}_{L,j}^{\mathcal{R}}$ and the summarized features for $\mathcal{X}$ , denoted by $\tilde{\mathbf{h}}^{\mathcal{X}}$ : + +$$ +\phi_ {j} = \mathbf {H} _ {L, j} ^ {\mathcal {R}} ^ {\top} \tilde {\mathbf {h}} ^ {\mathcal {X}}, \tilde {\mathbf {h}} ^ {\mathcal {X}} = \sum_ {i = 1} ^ {N _ {\mathcal {X}}} \alpha_ {i} \mathbf {H} _ {L, i} ^ {\mathcal {X}} \tag {12} +$$ + +$$ +\alpha_ {i} = \operatorname {s o f t m a x} _ {i} \left(\mathbf {v} _ {\text {p o o l}} ^ {\top} \tanh \left(\mathbf {W} _ {\text {p o o l}} \mathbf {H} _ {L, i} ^ {\mathcal {X}}\right)\right). \tag {13} +$$ + +Given $\{\phi_j\}_{j = 1}^K$ , we copy top-ranked keyphrases among $\mathcal{R}$ , regarding $\{\phi_j\}_{j = 1}^K$ . For training, we use mean square error (MSE) as the objective function: $\mathcal{L}_{\mathrm{MSE}} = \sum_{j = 1}^{K}||\phi_{j} - \phi_{j}^{*}||_{2}^{2}$ where $\phi_j^* = 1$ if $r_j = \mathcal{V}$ and $\phi_j^* = 0$ otherwise. + +(b) Open set $\mathcal{V}$ : copying keywords On the other hand, in scientific publications, copying a word from $\mathcal{R}$ (e.g., "element", "method" in Figure 1) enables the decoder to generate novel keyphrases (e.g., "energetic Galerkin boundary element method"), by combining the word with words from the other two sources (e.g., "energetic Galerkin" from $\mathcal{X}$ ). + +We adopt a single layer GRU decoder equipped with copy mechanism (See et al., 2017). For simplicity, we denote $\mathbf{H}_L^{\chi_{\mathrm{merged}}^+}$ by $\mathbf{H}$ and the number of nodes in the merged graph by $N$ . For $t$ -th word (i.e., $y_{t}$ ) decoding, copy scores $p_t^{\mathrm{copy}}$ are computed using attention: $p_{t,k}^{\mathrm{copy}} = \mathrm{softmax}(\mathbf{v}_1^\top \mathbf{W}_1[\mathbf{H}_k||\mathbf{o}_t])$ , + +where $\mathbf{o}_t$ denotes the decoder hidden state. However, $p_t^{\mathrm{copy}}$ only covers $y_{t}$ present in $\mathcal{X}^{+}$ . To predict arbitrary $y_{t}$ using $\nu$ , generation scores $p_t^{\mathrm{gen}}$ are computed by $p_t^{\mathrm{gen}} = \mathrm{softmax}(\mathbf{E}_{\mathcal{V}}(\mathbf{W}_2[\hat{\mathbf{h}}_t||\mathbf{o}_t])$ , where $\mathbf{E}_{\mathcal{V}}\in \mathbb{R}^{|\mathcal{V}|\times D}$ is a learnable word embedding matrix for $\nu$ , and $\hat{\mathbf{h}}_t$ ( $= \sum_{k = 1}^{N}p_{t,k}^{\mathrm{copy}}\mathbf{H}_k$ ) summarizes relevant contexts from $\mathcal{X}^{+}$ , using $p_t^{\mathrm{copy}}$ as relevance scores. The final score $p_t^{\mathrm{final}}$ is computed as a combination of the two scores using a gate value $z_{t}$ : $p_t^{\mathrm{final}} = p_t^{\mathrm{copy}}\times z_t + p_t^{\mathrm{gen}}\times (1 - z_t)$ , and $z_{t} = \sigma (\mathbf{v}_{3}^{\top}[\hat{\mathbf{h}}_{t}||\mathbf{o}_{t}])$ . Once $y_{t}$ is decoded according to $p_t^{\mathrm{final}}$ , we update the decoder hidden state $\mathbf{o}_t$ : $\mathbf{o}_{t + 1} = \mathrm{GRU}(\mathbf{y}_t,\mathbf{o}_t)$ , where $\mathbf{y}_t\in \mathbb{R}^D$ is the feature vector for the decoded token $y_{t}$ . + +For $\mathbf{y}_t$ , previous work uses a word embedding matrix. However, when $y_t$ is a rare word, which is often replaced by "[UNK]" symbol, $\mathbf{y}_t$ from the embedding matrix contains little information on the word. We thus leverage structure-aware representation $\mathbf{H}$ , to capture the meaning of $y_t$ based on the contexts within $\mathcal{X}^+$ . Specifically, when $y_t$ is copied from $\mathcal{X}^+$ , similar to $p_t^{\mathrm{final}}$ , we compute $\mathbf{y}_t$ as combination of $\mathbf{H}$ and $\mathbf{E}_{\mathcal{V}}$ from $\mathcal{X}^+$ and $\mathcal{V}$ respectively: $\mathbf{y}_t = \mathbf{H}_{y_t \in \mathcal{X}^+} \times z_t + \mathbf{E}_{y_t \in \mathcal{V}} \times (1 - z_t)$ , where $\mathbf{H}_{y_t \in \mathcal{X}^+}$ , $\mathbf{E}_{y_t \in \mathcal{V}}$ are corresponding vectors for $y_t$ from $\mathbf{H}$ and $\mathbf{E}_{\mathcal{V}}$ respectively. + +Following convention (Meng et al., 2017), to predict multiple keyphrases, we use beam search with beam size 200, and then use top-ranked keyphrases as final predictions. For training, we use cross entropy loss on $y_{t}$ as the objective function. + +# 4 Experiment + +# 4.1 Dataset + +
Dataset# of D# of unique KP# of KP per D% of abs KP
Twitter44K4K1.1371.4
Weibo46K2K1.0675.7
SE49K12K2.4354.3
KP20k510K670K2.9436.7
+ +Table 2: Statistics for three social datasets and a scientific publication dataset. "D" and "KP" are short for document and keyphrases respectively. "abs KP" denotes absent keyphrases. SE denotes StackExchange. + +We conducted experiments on social media posts and scientific publication, with missing or incomplete structures. We present statistics on the datasets in Table 2. + +For social media posts, we used three public datasets including not only microblog posts such + +as Twitter and Weibo, but also a Q&A platform such as StackExchange (Wang et al., 2019). In the Twitter and Weibo datasets, user-assigned hashtags are treated as keyphrases of a corresponding post. Hashtags in the middle of a post were treated as present keyphrases, and hashtags either before or after a post were treated as absent keyphrases and are removed from the post. For the StackExchange dataset, a given document is a question, and keyphrases are manually annotated by users. Different from microblogs, for each question, there is a title and a description such that the given document is a concatenation of the title and the description for the question. For training and evaluation, document-keyphrase pairs are partitioned into train, validation, and test splits consisting of $80\%$ , $10\%$ , and $10\%$ of the entire data respectively. + +As in (Wang et al., 2019), we adopted macroaveraged F1@k and mean average precision (mAP) as evaluation metrics. To compute F1@k, we count the number of correct keyphrases among the top-k predictions (denoted by hit@k), then, precision and recall are computed as hit@k divided by the number of predictions (i.e., k) and the number of gold keyphrases respectively. We report F1@1/3 for Twitter/Weibo and F1@3/5 for StackExchange considering the average number of keyphrases in datasets (1.13, 1.06, and 2.43 respectively). For all datasets, we report mAP over the top-5 predictions. + +For scientific publication, we use KP20k dataset (Meng et al., 2017). Since the original dataset includes duplicates between train/test documents, we use a preprocessed dataset without duplicates, released by (Chen et al., 2019a) $^{8}$ . The dataset has 510K, 20K, 20K documents for train, validation, and test datasets respectively. As in the baselines, we use F1@5/10 as evaluation metrics. + +For all datasets, following (Meng et al., 2017), we applied stemming using Porter Stemmer (Porter, 1980) as preprocessing, where duplicate keyphrases were removed after stemming. + +# 4.2 Baselines + +We compared our models with previous state-of-the-art KG baselines as well as KE baselines. + +For KE baselines, we use TextRank (Mihalcea and Tarau, 2004) and TF-IDF which are the most + +popular unsupervised keyword ranking models, and a neural sequence tagging model (Zhang et al., 2016) (denoted by Seq-Tag) that predicts keyphrase spans within the given document. + +For KG baselines, we use CopyRNN (Meng et al., 2017) and CorrRNN (Chen et al., 2018) in common for both social media posts and scientific publication. CopyRNN adopts standard encoder-decoder architecture with copy mechanism. CorrRNN exploits correlation between keyphrases to predict diverse keyphrases. We compare our proposed model with the previous state-of-the-art baselines, including TAKG (Wang et al., 2019) for social media post datasets, that augments contexts of the given posts using topic modeling, and KG-KEKR-M (Chen et al., 2019a) for KP20k, that uses the retrieved keyphrases $\mathcal{R}$ to provide the decoder with additional contexts. Note that, different from ours, KG-KE-KR-M separately encodes $\mathcal{X}$ and $\mathcal{R}$ , thus do not enjoy structure-aware representations. + +To validate the effectiveness of joint contextualization of $\mathcal{X}$ and $\mathcal{R}$ on the graph, we also conduct an ablation study, where we compare our proposed model to the ablation model that separately encodes the graph for $\mathcal{X}$ and the graph for $\mathcal{R}$ (denoted by w/o integration). For social media posts, we exclude all edges between $\mathcal{X}$ and $\mathcal{R}$ (green edges in Figure 1). For scientific publication, we separately encode two graphs (each for $\mathcal{X}$ or $\mathcal{R}$ ) instead of a merged multigraph. The ablation model is similar to KG-KE-KR-M that also separately encodes $\mathcal{X}$ and $\mathcal{R}$ , while differing in the encoder (graph encoder, instead of sequence encoder). + +# 4.3 Implementation Details + +For fair comparisons, we use the same hyperparameters and training strategy to the baselines, such as the size of the predefined vocabulary $\mathcal{V}$ , batch size of 64, Adam optimizer (Kingma and Ba, 2015) with 0.001 initial learning rate, and gradient clipping (Pascanu et al., 2013) with 1.0 threshold. + +As exceptions, we set the best value for $D$ , $L$ , $K$ , and $M$ , based on validation performance. The best $D$ , among $\{150,300\}$ , was 300 for all datasets. The best $L$ , among $\{2,3,4,5\}$ , was 2 for social datasets and 3 for KP20k. The best $K$ , among $\{10,20,30,40,50\}$ , was 20/20/30, for Twitter/Weibo/StackExchange respectively. Because of the larger number of keyphrases per document in StackExchange (2.43) than Twitter (1.13) and Weibo (1.06), $K$ should be larger in StackEx + +
ModelSocial media postScientific articles
TwitterWeiboStackExchangeKP20k
F1@1F1@3mAPF1@1F1@3mAPF1@3F1@5mAPF1@5F1@10
KE baselines
TF-IDF1.21.11.91.91.52.513.512.712.68.711.3
TextRank1.71.91.90.20.50.66.08.34.815.113.2
Seq-Tag22.8312.3222.4316.329.0116.5317.61612.81219.013--
KG w/o structure
CopyRNN36.61126.8543.11232.0322.7238.0131.5327.4233.5130.6127.30
CorrRNN35.0826.1441.6531.6722.2537.5830.9327.0232.9629.1226.42
KG-KE-KR-M---------31.7028.20
KG w/ structure
TAKG (topic)38.5327.8045.1235.0324.4241.3433.4229.2135.51--
TGNet (title)------32.0327.8334.1431.4328.13
KG w/ structure (ours)
GSEnc (keyphrase)38.8728.1245.5642.8629.5350.0435.2330.9237.8332.9329.02
w/o integration36.8427.0543.3238.6427.0345.7333.2329.3235.5231.9327.92
+ +Table 3: Keyphrase prediction performance. Bold-face indicates the best performance with significance $(p < 0.05$ using Student's paired t-test). We report average performance with standard deviation with different random seeds of 5 runs (e.g., $29.4_{1}$ indicates $29.4\pm 0.1$ ). + +change. For fair comparison with KG-KE-KR-M that uses the retrieved keyphrases, we used the same $\mathcal{R}$ used in KG-KE-KR-M, for KP20k. For $M$ for social media posts (§3.2.3), we search the best value among $\{10, 25, 50, 100\}$ . The best $M$ was 50 for both Twitter and Weibo, while it was 25 for StackExchange. Since documents are longer in StackExchange (88 words on average) than Twitter (20) and Weibo (33) with length limitation, smaller $M$ makes more conservative edge construction. + +Our experiments were conducted using a single GeForce RTX 2080Ti NVIDIA GPU. We used Pytorch (Paszke et al., 2019) for implementation. + +# 4.4 Evaluation + +In this section, we confirm the effectiveness of structures in documents for KG, and validate the superiority of the proposed structure over other structures. Results are shown in Table 3. + +Since large portion of ground-truth keyphrases are absent keyphrases (i.e., context-scarce $\mathcal{X}$ ), KE models show significantly worse performances compared to KG models, on both datasets. + +Among KG models, structures in document significantly improve performances, for both datasets, where TAKG with latent topics and TGNet with title significantly outperform the other KG models without structures, except KG-KE-KR-M on KP20k. However, both a small number of latent topics and short titles have limited information. In contrast, by retrieving relevant keyphrases from existing keyphrases, we augment the given document with sufficient topical information. As a result, GSEnc outperforms all baselines, except TAKG on + +Twitter with comparable performance. + +For social datasets, in addition to having superior or comparable performance over baselines, our proposed model, by avoiding sequential decoding, requires much lower computational costs than other KG models. Regarding computational efficiency, our model can process each text in about $22\mathrm{ms}$ (21 ms for retrieving $\mathcal{R}$ and less than 1 ms for the rest) while other KG approaches consume about $90~\mathrm{ms}$ . + +Meanwhile, we stress that it is important to jointly contextualize $\mathcal{X}$ and $\mathcal{R}$ , to enjoy mutual benefits between them; we found that performance significantly decrease on all datasets, when we separately encode them (w/o integration in Table 3). + +4.4.1 Integrating $\mathcal{R}$ with given titles + +
ModelInputKP20kSE
F1@3F1@5
TGNetX+T31.432.0
GSEnc (ours)X+R32.935.4
X+R+T32.936.3
+ +Table 4: Evaluation results using different structures: SE denotes for StackExchange dataset. + +When titles are available, we can use $\mathcal{R}$ , to complement concise, but incomplete titles (high precision, low recall), by providing missing terms in the title (increasing recall). In this section, we explain how to integrate $\mathcal{R}$ and title (denoted by $\mathcal{T}$ ), for better structured documents, and evaluate the effectiveness of such integration. We use KP20k and StackExchange datasets where titles of documents are written by the authors of the documents. + +Since the title words are already represented as nodes in $\mathcal{X}$ , we can simply add another edge type, + +as similarly done in §3.2.4, to make three types of edges for the same node pair: edges from $\mathcal{X}$ , $\mathcal{R}$ , and the given title respectively. As in edges for $\mathcal{X}$ , we use position-based proximity between title words, for edge weights. Given the title edges, we use contexts gathered from the title, to update contextualized representations, similar to Eq (3,9). The results are shown in Table 4. + +We observe that $\mathcal{R}$ is more representative in KP20k than StackExchange, where the F1 accuracy of $\mathcal{R}$ on gold keywords was 22.3 and 11.5, for KP20k and StackExchange respectively. This can be explained by the document length difference: When $\mathcal{R}$ is less relevant, for shorter documents in StackExchange, titles with high precision capture relevant keyphrases in $\mathcal{R}$ , such that $\mathcal{X} + \mathcal{R} + \mathcal{T}$ outperforms $\mathcal{X} + \mathcal{R}$ , while $\mathcal{X} + \mathcal{R}$ is sufficiently accurate, otherwise. Our proposed approach, by leveraging both fields, work well in both cases, outperforming TGNet that uses only title structure. + +# 4.4.2 Future work + +
Model (Input)ID testOOD test
KP20kInspec
CopyRNN(X)30.625.1
GSEnc(X+R)32.924.4
+ +Table 5: Different effects of leveraging $\mathcal{R}$ , for in-distribution (ID) and out-of-distribution (OOD) test datasets. We present F1@5 performance of CopyRNN and GSEnc (ours), that uses $\mathcal{X}$ and $\mathcal{X} + \mathcal{R}$ as inputs, respectively. + +Leveraging existing keyphrases in train set is specifically effective when test distribution is similar to the train distribution, i.e., in-distribution test set, as we validated in our experiments. On the other hand, for out-of-distribution test set, where train/test distributions are different from each other, existing keyphrases may not be helpful. We empirically tested different effects of leveraging $\mathcal{R}$ by training models using KP20k training dataset and evaluating the models on KP20k test set (in-distribution) and Inspec (Hulth, 2003) test set (out-of-distribution). While, in KP20k datasets, keyphrases are labeled by authors of documents, keyphrases in Inspec are labeled by third-party annotators. In Table 5, we can observe that $\mathcal{R}$ does not improve on out-of-distribution test set, while showing significant improvements on indistribution test set. + +To overcome, as a future work, our retriever can be extended to use external sources such as + +open-domain knowledge graphs (Shi et al., 2017) or Wikipedia texts (Yu and Ng, 2018), that generalize well to out-of-distribution data. However, such external sources will be less effective than internal sources (e.g., existing keyphrases), when most of target documents are in-distribution documents. We will explore effective integration strategies between internal/external sources, to enjoy complementary strengths of those, for better performance on both in-distribution and out-of-distribution documents. + +# 5 Conclusion + +We studied the problem of KG for scientific text and social posts, representing context-scarce scenarios with open and closed keyphrase set, respectively. Our work is two-phased, for augmenting and encoding missing/incomplete structure. Empirical evaluation results validate that our proposed model outperforms the state-of-the-art in both problems. + +# Acknowledgments + +This work is supported by IITP grants (ITRC, 2021-2020-0-01789, 2021-2016-0-00464) and SNU AI Graduate School Program (2021-0-01343). + +# References + +Jun Chen, Xiaoming Zhang, Yu Wu, Zhao Yan, and Zhoujun Li. 2018. Keyphrase generation with correlation constraints. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4057-4066, Brussels, Belgium. Association for Computational Linguistics. +Wang Chen, Hou Pong Chan, Piji Li, Lidong Bing, and Irwin King. 2019a. An integrated approach for keyphrase generation via exploring the power of retrieval and extraction. 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 2846-2856, Minneapolis, Minnesota. Association for Computational Linguistics. +Wang Chen, Yifan Gao, Jiani Zhang, Irwin King, and Michael R Lyu. 2019b. Title-guided encoding for keyphrase generation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6268-6275. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gul- cehre, 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. +Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. 2017. Language modeling with gated convolutional networks. In International conference on machine learning, pages 933-941. +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. +Anette Hulth. 2003. Improved automatic keyword extraction given more linguistic knowledge. In Proceedings of the 2003 conference on Empirical methods in natural language processing, pages 216-223. +Jihyuk Kim, Young-In Song, and Seung-won Hwang. 2021. Web document encoding for structure-aware keyphrase extraction. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 1823-1827. +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. +Thomas N. Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +Decong Li, Sujian Li, Wenjie Li, Wei Wang, and Weiguang Qu. 2010. A semi-supervised key phrase extraction approach: learning from title phrases through a document semantic network. In Proceedings of the ACL 2010 conference short papers, pages 296-300. +Jimmy Lin, Xueguang Ma, Sheng-Chieh Lin, Jheng-Hong Yang, Ronak Pradeep, and Rodrigo Nogueira. 2021. Pyserini: An easy-to-use python toolkit to support replicable in research with sparse and dense representations. arXiv preprint arXiv:2102.10073. +Ji Ma, Ivan Korotkov, Yinfei Yang, Keith Hall, and Ryan McDonald. 2021. Zero-shot neural passage retrieval via domain-targeted synthetic question generation. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 1075-1088. + +Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. 2013. Rectifier nonlinearities improve neural network acoustic models. In Proc. icml, volume 30, page 3. Citeseer. +Rui Meng, Xingdi Yuan, Tong Wang, Sanqiang Zhao, Adam Trischler, and Daqing He. 2021. An empirical study on neural keyphrase generation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4985-5007, Online. Association for Computational Linguistics. +Rui Meng, Sanqiang Zhao, Shuguang Han, Daqing He, Peter Brusilovsky, and Yu Chi. 2017. Deep keyphrase generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 582-592, Vancouver, Canada. 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. +Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. 2013. On the difficulty of training recurrent neural networks. In Proceedings of the 30th International Conference on International Conference on Machine Learning - Volume 28, ICML'13, page III-1310-III-1318. JMLR.org. +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 H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 8024-8035. Curran Associates, Inc. +Martin F Porter. 1980. An algorithm for suffix stripping. Program. +Stephen E Robertson and Steve Walker. 1994. Some simple effective approximations to the 2-poisson model for probabilistic weighted retrieval. In SI-GIR'94, pages 232-241. Springer. +Joseph Rocchio. 1971. Relevance feedback in information retrieval. The Smart retrieval system-experiments in automatic document processing, pages 313-323. +Abigail See, Peter J. Liu, and Christopher D. Manning. 2017. Get to the point: Summarization with pointer-generator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational + +Linguistics (Volume 1: Long Papers), pages 1073-1083, Vancouver, Canada. Association for Computational Linguistics. +Wei Shi, Weiguo Zheng, Jeffrey Xu Yu, Hong Cheng, and Lei Zou. 2017. Keyphrase extraction using knowledge graphs. Data Science and Engineering, 2(4):275-288. +Zhiqing Sun, Jian Tang, Pan Du, Zhi-Hong Deng, and Jian-Yun Nie. 2019. Divgraphpointer: A graph pointer network for extracting diverse keyphrases. In Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 755-764. +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. +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2018. Graph attention networks. In International Conference on Learning Representations. +Yue Wang, Jing Li, Hou Pong Chan, Irwin King, Michael R. Lyu, and Shuming Shi. 2019. Topi- aware neural keyphrase generation for social media language. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2516-2526, Florence, Italy. Association for Computational Linguistics. +Jinxi Xu and W Bruce Croft. 2017. Query expansion using local and global document analysis. In Acm SIGIR forum, volume 51, pages 168-175. ACM New York, NY, USA. +Jiacheng Ye, Tao Gui, Yichao Luo, Yige Xu, and Qi Zhang. 2021. One2Set: Generating diverse keyphrases as a set. 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 4598-4608, Online. Association for Computational Linguistics. +Yang Yu and Vincent Ng. 2018. Wikirank: Improving keyphrase extraction based on background knowledge. arXiv preprint arXiv:1803.09000. +Xingdi Yuan, Tong Wang, Rui Meng, Khushboo Thaker, Peter Brusilovsky, Daqing He, and Adam Trischler. 2020. One size does not fit all: Generating and evaluating variable number of keyphrases. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7961-7975, Online. Association for Computational Linguistics. +Qi Zhang, Yang Wang, Yeyun Gong, and Xuanjing Huang. 2016. Keyphrase extraction using deep recurrent neural networks on twitter. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 836-845, + +Austin, Texas. Association for Computational Linguistics. \ No newline at end of file diff --git a/structureaugmentedkeyphrasegeneration/images.zip b/structureaugmentedkeyphrasegeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a0a7e513e6368c8c3a9bc9f6c679b543369bdcc4 --- /dev/null +++ b/structureaugmentedkeyphrasegeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:572bf259531d20e70583de00e93d4e62f092445873a9b62290523696f7b22d29 +size 419155 diff --git a/structureaugmentedkeyphrasegeneration/layout.json b/structureaugmentedkeyphrasegeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..27eb885627ec9d849cdc89f96f7960860f69b8aa --- /dev/null +++ b/structureaugmentedkeyphrasegeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8dc92e937b1d655811e48ba07829a752ff9a41c6bddef193e9c65c828f141eed +size 585116 diff --git a/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_content_list.json b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..991d4064d582212cc41cb381f556b772d257352b --- /dev/null +++ b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6c1a70013d8e507eeb3802be90ea4ed7d2a42be8b35675f56019773cd0b4f7a +size 85052 diff --git a/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_model.json b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_model.json new file mode 100644 index 0000000000000000000000000000000000000000..31c8bf40bca7fb7b43b3faf23b9aed5c60c18a5a --- /dev/null +++ b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f80cdd4b379109fcb42f1b59180a939b72ee4a37dfdc1466f0fc7a5f009ee980 +size 101172 diff --git a/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_origin.pdf b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..38fb98c541ff15e1f22fa838a8394880faded951 --- /dev/null +++ b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/8ee69b83-999f-4f47-a84f-559768ef01eb_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f2f1a0b03091b94d11dbfe7cc63269acb0198278f258f4b845291ced60c0571 +size 342301 diff --git a/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/full.md b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..bfbed35fc03792f035f56c3edabb8d25f4cfa7e5 --- /dev/null +++ b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/full.md @@ -0,0 +1,270 @@ +# Structure-aware Fine-tuning of Sequence-to-sequence Transformers for Transition-based AMR Parsing + +Jiawei Zhou\* Tahira Naseem\* Ramón Fernandez Astudillo\* Young-Suk Lee\* Radu Florian\* Salim Roukos\* + +$^{\text{a}}$ Harvard University $^{\text{b}}$ IBM Research + +$\spadesuit$ jzhou02@g.harvard.edu $\diamond$ ramon ASTUDillo@ibm.com + +$\diamondsuit$ {tnaseem, ysuklee, raduf, roukos}@us.ibm.com + +# Abstract + +Predicting linearized Abstract Meaning Representation (AMR) graphs using pre-trained sequence-to-sequence Transformer models has recently led to large improvements on AMR parsing benchmarks. These parsers are simple and avoid explicit modeling of structure but lack desirable properties such as graph well-formedness guarantees or built-in graph-sentence alignments. In this work we explore the integration of general pre-trained sequence-to-sequence language models and a structure-aware transition-based approach. We depart from a pointer-based transition system and propose a simplified transition set, designed to better exploit pre-trained language models for structured fine-tuning. We also explore modeling the parser state within the pre-trained encoder-decoder architecture and different vocabulary strategies for the same purpose. We provide a detailed comparison with recent progress in AMR parsing and show that the proposed parser retains the desirable properties of previous transition-based approaches, while being simpler and reaching the new parsing state of the art for AMR 2.0, without the need for graph re-categorization. + +# 1 Introduction + +The task of Abstract Meaning Representation (AMR) parsing translates a natural sentence into a rooted directed acyclic graph capturing the semantics of the sentence, with nodes representing concepts and edges representing their relations (Banarescu et al., 2013). Recent works utilizing pretrained encoder-decoder language models show great improvements in AMR parsing results (Xu et al., 2020; Bevilacqua et al., 2021). These approaches avoid explicit modeling of the graph structure. Instead, they directly predict the linearized AMR graph treated as free text. While the use of pre-trained Transformer encoders is widely extended in AMR parsing, the use of pre-trained + +Transformer decoders is recent and has shown to be very effective, maintaining current state-of-the-art results (Bevilacqua et al., 2021). + +These approaches however lack certain desirable properties. There are no structural guarantees of graph well-formedness, i.e. the model may predict strings that can not be decoded into valid graphs, and post-processing is required. Furthermore, predicting AMR linearizations ignores the implicit alignments between graph nodes and words, which provide a strong inductive bias and are useful for downstream AMR applications (Mitra and Baral, 2016; Liu et al., 2018; Vlachos et al., 2018; Kapanipathi et al., 2021; Naseem et al., 2021). + +On the other hand, transition-based AMR parsers (Wang et al., 2015; Ballesteros and Al-Onaizan, 2017a; Astudillo et al., 2020; Zhou et al., 2021) operate over the tokens of the input sentence, generating the graph incrementally. They implicitly model graph structural constraints through transitions and yield alignments by construction, thus guaranteeing graph well-formedness.1 However, it remains unclear whether explicit modeling of structure is still beneficial for AMR parsing in the presence of powerful pre-trained language models and their strong free text generation abilities. + +In this work, we integrate pre-trained sequence-to-sequence (seq-to-seq) language models with the transition-based approach for AMR parsing, and explore to what degree they are complementary. To fully utilize the generation power of the pre-trained language models, we propose a transition system with a small set of basic actions – a generalization of the action-pointer transition system of Zhou et al. (2021). We use BART (Lewis et al., 2019) as our pre-trained language model, since it has shown significant improvements in linearized AMR generation (Bevilacqua et al., 2021). Unlike previous approaches that directly fine-tune the model with + +linearized graphs, we modify the model structure to work with our transition system, and encode parser states in BART's attention mechanism (Astudillo et al., 2020; Zhou et al., 2021). We also explore different vocabulary strategies for action generation. These changes convert the pre-trained BART to a transition-based parser where graph constraints and alignments are internalized. + +We provide a detailed comparison with top-performing AMR parsers and perform ablation experiments showing that our proposed transition system and BART modifications are both necessary to achieve strong performance. Although BART has great language generation capacity, it still benefits from parser state encoding with hard attention, and can efficiently learn structural output. Our model establishes a new state of the art for AMR 2.0 while maintaining graph well-formedness guarantees and producing built-in alignments. + +# 2 Intricacies of AMR Parsers + +A frequent complaint about AMR parsers is that they involve combining many different techniques and hand-crafted rules, resulting in complex pipelines that are hard to analyze and generalize poorly. This situation has notably improved in the past few years but there are still two main sources of complexity present in almost all recent parsers: graph re-categorization and subgraph actions. + +Graph re-categorization (Wang and Xue, 2017; Lyu and Titov, 2018; Zhang et al., 2019a) normalizes the graph prior to learning. This includes joining certain subgraphs such as entities, dates and other constructs into single nodes, removing special types of nodes like polarity and normalizing propbank names. An example of common normalizations is displayed in Figure 1. Training and decoding of models using this technique happens in this re-categorized space. Re-categorized graphs are expanded to normal valid AMR graphs in a post-processing stage. The type and number of subgraphs normalized vary across implementations, but most high performing approaches (Cai and Lam, 2020; Bevilacqua et al., 2021) utilize the re-categorization described in Appendix A.1 of Zhang et al. (2019a). This version requires of an external Named Entity Recognition (NER) system to anonymize named entities, both at train time and test time. It also makes use of look-up tables for nominalizations (e.g. English to England) and other hand-crafted rules. Graph re-categorization + +![](images/e8ae29453f4351b6d0b9e6739e12019d060ef69d46fef47b608d8d046f74afbb.jpg) +Figure 1: AMR graph of the sentence I have no opinion on the New York Mets. Examples of subgraphs for entity anonymization, collapsing of verbalized nouns and removal of the polarity node and edge. + +has been criticised for its lack of generalization to new domains, such as biomedical domain or even the AMR 3.0 corpus (Bevilacqua et al., 2021). Recent top performing systems e.g. Cai and Lam (2020); Bevilacqua et al. (2021) also provide results without re-categorization, but this is shown to hurt performance notably on the AMR 2.0 corpus. + +Subgraph actions (Ballesteros and Al-Onaizan, 2017b) are used in transition-based systems and play a role similar to re-categorization. Instead of normalizing and reverting, transition-based parsers apply a subgraph action that generates an entire subgraph at once. This subgraph action coincides with many of the subgraphs collapsed in re-categorization. Subgraph actions bring however fewer external dependencies, since the parser learns to segment and identify subgraphs during training. They still suffer however from data sparsity since some subgraphs appear very few times. As in re-categorization, subgraph actions also make use of lookup tables for nominalization and similar constructs that hinder generalization. Furthermore, they create the problem of unattachable nodes. This was addressed in Zhou et al. (2021) by ignoring subgraphs for a set of heuristically determined cases. Subgraph actions have been used in all transition-based AMR systems (Naseem et al., 2019; Astudillo et al., 2020; Zhou et al., 2021). + +Aside from NER, past AMR parsers have other external dependencies such as POS taggers (Zhang et al., 2019a; Cai and Lam, 2020) and lemmatizers (Cai and Lam, 2020; Naseem et al., 2019; Astudillo et al., 2020). + +![](images/b736dd95187b0fd86f2ec3ccd3f22f2f919bf970fc3ca799c12fc871744f9fae.jpg) +Figure 2: From top to bottom: graph (solid lines), sentence (source), addressable action positions and action sequence (target) for the sentence Employees liked their Boston trip, aligned (dotted lines) to its AMR graph. Arc-creating actions are displayed vertically due to space constraints. Words are repeated in grey to indicate the word under cursor for each action. The node Boston in dotted box is created by copying the token under cursor via COPY action at position 13. LA(1,ARG0) creates a left arc with label ARG0 from the top concept like-01 to the concept person at position 1. For the concept trip-03, LA(1,ARG0) is a co-reference (re-entrancy) to the concept person. + +# 3 A Simplified Transition System + +In this section we propose a transition system for AMR parsing designed with two objectives: maximize the use of strong pre-trained decoders such as BART, and minimize the complexity and dependencies of the transition system compared to previous approaches. Similarly to Zhou et al. (2021), we scan the sentence from left to right and use a token cursor to point to a source token at each step. Parser actions can either shift the cursor one token forward or generate any number of nodes and edges while the cursor points to the same token. The proposed set of actions is as follows: + +SHIFT moves token cursor one word to the right. + + creates node of name . + +COPY creates node where the node name is the token under the current cursor position. + +LA(j,LBL) creates an arc with label LBL from the last generated node to the node generated at the $j_{th}$ transition step. + +$\mathbf{RA}(\mathbf{j}, \mathbf{LBL})$ same as LA but with arc direction reversed. + +ROOT declares the last predicted node as the root. + +Unlike previous transition-based approaches, we do not use a reserved action, such as PRED (Zhou et al., 2021) or CONFIRM (Ballesteros and Al + +Onaizan, 2017b), to predict nodes; instead we directly use the node name as the action symbol generating that node. This opens the possibility of utilizing BART's target side pre-trained vocabulary. We avoid using any copy actions that involve copying from lemmatizer outputs or lookup tables. Our COPY action is limited to copying the lower cased word. We also eliminate the use of SUBGRAPH (Zhou et al., 2021) or ENTITY (Ballesteros and Al-Onaizan, 2017b) actions producing multiple connected nodes simultaneously, as well as MERGE action creating spans of words. In previous approaches these actions were derived from alignments or hand-crafted. They thus did not cover all possible cases limiting the scalability of the approach. Finally, we discard the REDUCE action previously used to delete a source token. The effect can be achieved by simply using SHIFT without performing any other action. Figure 2 shows an example sentence with an action sequence and the corresponding graph. This can be compared with the handling of verbalization and named entities in Figure 1. + +To train a parser with a transition system, we need an action sequence for each training sentence that will produce the gold graph when executed. This action sequence then serves as the target for seq-to-seq models. A simple rule-based oracle algorithm creates these ground-truth sequences given + +a sentence, its AMR graph and node-to-word alignments. At each step, the oracle tries the following possibilities in the order of listing and performs the first one that applies: + +1. Create next gold arc between last created node and previously created nodes; +2. Create next gold node aligned to token under cursor; +3. If not at sentence end, SHIFT source cursor; +4. Finish oracle. + +If possible, nodes are generated by COPY and otherwise with actions. Arcs are generated with LA and RA, connecting the nodes closer to the current node before the ones that are farther away. Note that the arcs are created by pointing to positions in the action history, where a graph node is represented by the action that creates it, following Zhou et al. (2021). Multiple nodes can be generated at a single source word before the cursor is moved by SHIFT. When multiple nodes are aligned to the same token, these nodes are generated in a predetermined topological order of graph traversal, interleaved by edge creation actions. ROOT is applied as soon as the root node is generated. + +The above oracle circumvents the problem of unattachable nodes by avoiding the use of subgraph actions. This implies that the oracle will always produce a unique action sequence that fully recovers the gold graph as long as every node in the graph is aligned to some token. To guarantee that all nodes are aligned, we improve upon the alignment system from Naseem et al. (2019); Astudillo et al. (2020), which aligns a large majority, but not all AMR nodes.3 In order to do this, we apply a heuristic based on graph proximity to maintain local correspondences between graph nodes and sentence words. If a node is not aligned, we copy the alignment from its first child node, if existing, and otherwise the alignment from its first parent node. For example, in Figure 2 if the node person was not provided with an alignment, our oracle would have assigned it to the aligned token of its child node employ-01. This is a recursive procedure – as long as there are some alignments to start with and the ground-truth graph is connected, all the nodes will get aligned. + +Our proposed transition system makes better use of BART pre-trained decoder compared to previous transition-based approaches (see Section 6) while greatly simplifying the transition set. It also naturally produces node-to-word alignments via source token cursor in the meantime. + +# 4 Parsing Model + +We build our model on top of the pre-trained seq-to-seq Transformer, BART (Lewis et al., 2019). We modify its architecture to incorporate a pointer network and internalize parser states induced by our transition system, and fine-tune for sentence-to-action generation. + +# 4.1 Structure-aware Architecture + +We adopt similar modifications on the Transformer architecture as in Zhou et al. (2021) since our transition system is based on the same action-pointer mechanism. The modifications do not introduce new modules or extra parameters, which naturally fit our need to adapt BART into a transition-based parser with internal graph well-formedness. + +In particular, the target actions are factored into two parts: bare action symbols (containing labels when presented) and pointer values for edges. We use the BART standard output for the former, and a pointer network for the latter. As the pointing happens on the actions history, essentially a self-attention mechanism, we re-purpose one decoder self-attention head as the pointer network. It is supervised with additional cross entropy loss during fine-tuning and decoded for building graph edges at inference. + +We encode the monotonic action-source alignments induced by the parser state with hard attention, i.e. by masking some decoder cross-attention heads to only focus on aligned words. Since BART processes source sentences with subwords, we apply an additional average pooling layer on top of its encoder to return states of original source words, used for the decoder layers for our hard attention. At last, as the possible valid actions are constrained with transition rules and states at every step, we restrict the decoder output space via hard masking of the BART final softmax layer. For simplicity, we do not incorporate the GNN-style (Li et al., 2019) step-wise decoder graph embedding technique in Zhou et al. (2021) as their gain was shown to be modest. + +# 4.2 Action Generation + +According to how we treat the target-side vocabulary for action generation, we propose two variations of the model. The first one is to use a completely separate vocabulary for target actions, where the decoder input side and output side use stand-alone embeddings for actions, separate from the pre-trained BART subword embeddings. We denote this setup as our sep-voc model (abbreviated as StructBART-S). + +However, this might not fully utilize the power of the pre-trained BART since it is an encoder-decoder model with a single vocabulary and all embeddings shared. Although our generation targets are action symbols, the node generating actions are closely related to natural words in their surface forms, which are what BART was pre-trained on. Therefore, we propose a second variation where we use a joint vocabulary for both the source tokens and target actions. Naively relying on the original BART subword vocabulary would end up splitting action symbols blindly, which is not desired as the structures such as alignments and edge pointers would be disrupted. Inspired by Bevilacqua et al. (2021), we add frequent node-creating actions to the vocabulary, in order to capture common AMR concepts intact, and split the remaining concepts with BART subword vocabulary. Non-node-creating actions such as SHIFT and COPY are added as-is to the BART vocabulary. + +In this setup, a single node string can potentially be generated with multiple steps; we modify the arc transitions to always point to the beginning position of a node string for attachment. With joint vocabulary setup, the model could learn to generate unseen nodes with BART's subword vocabulary, eliminating potential out-of-vocabulary problems. We refer to this setup as our joint-voc model (abbreviated as StructBART-J). + +# 4.3 Training and Inference + +We load the pre-trained BART parameters except for the standalone vocabulary embeddings for sep-voc model and the extended embeddings for the joint-voc model. We then fine-tune the model with the updated structure-aware architectures on sentence-action pairs with addition of pointer loss. + +For decoding, we use similar constrained beam + +search algorithm as in Zhou et al. (2021), but with our own transition set and rules. We run a state machine on the side to get parser states used by the model. Note that for our joint-voc model, we only allow subword split for node () actions. As our fine-tuned model is already structure-aware, the graph well-formedness is always guaranteed and no post-processing is needed to return valid graphs, unlike Xu et al. (2020); Bevilacqua et al. (2021). The only post-processing we use is to add wikification nodes as used in all previous parsers. $^5$ + +# 5 Experimental Setup + +Datasets We evaluate our models on 3 AMR benchmark datasets, namely AMR 1.0 (LDC2014T12), AMR 2.0 (LDC2017T10), and AMR 3.0 (LDC2020T02). They have around 10K, 37K, and 56K sentence-AMR pairs for training, respectively. Both AMR 2.0 and AMR 3.0 have wikification nodes but AMR 1.0 does not. + +Evaluation We assess our models with SMATCH (F1) scores $^{7}$ (Cai and Knight, 2013). We also report the fine-grained evaluation metrics (Damonte et al., 2016) to further investigate different aspects of parsing results, such as concept identification, entity recognition, re-entrancies, etc. + +Model Configuration We follow the original BART configuration (Lewis et al., 2019) and code. We use the large model configuration as default, and also the base model for ablation studies. The pointer network is always tied with one head of the decoder top layer, and the pointer loss is added to the model cross-entropy loss with 1:1 ratio for training. Transition alignments are used to mask cross-attention in 2 heads of all decoder layers. For sep-voc model, we build separate embedding matrices for target actions from the training data for decoder input and output space. For joint-voc model, we add new embedding vectors for non-node action symbols and node action strings with a default minimum frequency of 5 (only accounts for about one third of all nodes due to sparsity). + +
IDModelPre-trained ModelCollapse SubgraphExternal DependencyExtra DataTrain Align.SMATCH F1 (%)
POSNERLemm.AMR 1.0AMR 2.0AMR 3.0
1Naseem et al. (2019)BERTS.A.✓✓-75.5-
2Zhang et al. (2019a)BERTG.R.✓✓70.2 ±0.176.3 ±0.1-
3Zhang et al. (2019b)BERTG.R.✓✓71.3 ±0.177.0 ±0.1-
4Cai and Lam (2020)BERT✓✓✓74.078.7-
5Cai and Lam (2020)BERTG.R.✓✓✓75.480.2-
6Astudillo et al. (2020)RoBERTaS.A.✓✓76.9 ±0.180.2 ±0.0-
7Lyu et al. (2020)RoBERTaG.R.✓✓--75.8
8Bevilacqua et al. (2021)BART†-83.883.0
9Bevilacqua et al. (2021)BART†G.R.✓-84.580.2
10Zhou et al. (2021)RoBERTaS.A.✓✓78.3 ±0.181.7 ±0.180.3 ±0.1
11Xu et al. (2020)Custom†4M-81.4-
12Lee et al. (2020)RoBERTaS.A.✓85K✓78.2 ±0.181.3 ±0.0-
13Bevilacqua et al. (2021)BART†200K-84.383.0
14Zhou et al. (2021)RoBERTaS.A.✓70K✓-82.6 ±0.1-
15StructBART-SBART†✓81.6 ±0.184.0 ±0.182.3 ±0.0
16StructBART-JBART†✓81.7 ±0.284.2 ±0.182.0 ±0.0
17StructBART-SBART†47K✓--82.7 ±0.1
18StructBART-JBART†47K✓-84.7 ±0.182.6 ±0.1
19StructBART-S ensem.BART†47K✓--83.1
20StructBART-J ensem.BART†47K✓-84.9-
+ +Table 1: SMATCH (%) scores on AMR 1.0, 2.0, and 3.0 test data, associated with each model's dependency on various resources. 1-10/11-14: previous models without/with extra data; 15-18: our models (-S/-J for separate/joint vocabularies for source and target); 19-20: our models with ensemble decoding. Symbols indicate: G.R. - graph re-categorization, S.A. - subgraph action used in transition-based parsers (both detailed in Section 2), POS - part of speech tagger, NER - named entity recognizer, Lemm. - lemmatizer, Align. - alignments (only used at training time). $\dagger$ indicates fine-tuning on top of pre-trained model. All models rely on a external wikification method (omitted). Our results are average of 3 runs with different random seeds. We also report standard deviation and provide ensemble results for the 3 seed combination. + +
IDModelSMATCHUnlabelNoWSDConceptsNERNegationWiki.Re-entrancySRL
1Naseem et al. (2019)75.58076868367805672
4Cai and Lam (2020)78.781.579.288.187.166.181.363.874.5
6Astudillo et al. (2020)80.284.280.788.187.564.578.870.378.2
8Bevilacqua et al. (2021)83.886.184.490.290.674.484.470.879.6
10Zhou et al. (2021)81.885.582.388.788.569.778.871.180.8
15StructBART-S84.187.584.490.492.271.079.673.983.0
16StructBART-J84.387.984.790.692.172.580.874.383.4
+ +Table 2: Fine-grained F1 scores on the AMR 2.0 test set, among models that do not use extra silver data and graph re-categorization. The model IDs are matched with those in Table 1 for detailed model features. We report results with our single best model (selected on development data) for fair comparison. + +Implementation Details Our models are trained with Adam optimizer with batch size 2048 tokens and gradient accumulation of 4 steps. Learning rate is $1\mathrm{e} - 4$ with 4000 warm-up steps using the inverse-sqrt scheduling scheme (Vaswani et al., 2017). The hyper-parameters are fixed and not tuned for different models and datasets, as we found results are not sensitive within small ranges. We train sep-voc models for 100 epochs and joint-voc models for 40 epochs as the latter is found to converge faster. The best 5 checkpoints based on development set SMATCH from greedy decoding are averaged, and + +default beam size of 10 is used for decoding for our final parsing scores. We implement our model with the FAIRSEQ toolkit (Ott et al., 2019). More details can be found in the Appendix. + +# 6 Results + +Main Results We present parsing performances of our model (StructBART) in comparison with previous approaches in Table 1. For each model, we also list its features such as utilization of pre + +
Transition SystemFeaturesModel Results on AMR 2.0Model Results on AMR 3.0
#BaseActionsDistantEdgesSpecialSubgraphAPT*(Zhou et al., 2021)StructBARTsep-vocAPT*(Zhou et al., 2021)StructBARTsep-voc
Astudillo et al. (2020)12SWAPmerge----
Zhou et al. (2021)10pointermerge81.5 ±0.183.4 ±0.179.8 ±0.181.6 ±0.0
Ours6pointerno81.6 ±0.184.0 ±0.179.6 ±0.082.3 ±0.1
+ +Table 3: Transition system comparison, including their effects on different parsing models. * we adopt the cited model without graph structure embedding to compare and run on our proposed oracle. + +
Transition SystemAvg. #actionsOracle SMATCH
Astudillo et al. (2020)76.298.0
Zhou et al. (2021)41.698.9
Ours45.699.9
+ +Table 4: Average action sequence length and oracle coverage on AMR 2.0 training data from different transition systems. Average source sentence length is 18.9. + +trained language models and graph simplification methods such as re-categorization. This gives a comprehensive overview of how systems compare in terms of complexity aside from performance. + +All recent systems rely on pre-trained language models, either as fixed features or through finetuning. The pre-trained BART is particularly beneficial due to its encoder-decoder structure. Among all the models, the graph linearization models (Xuet al., 2020; Bevilacqua et al., 2021) have the least number of extra dependencies when not using graph re-categorization. Our model only requires aligned training data, a trait common to all transition-based approaches. This bears the advantage of producing reliable alignments at decoding time, which are useful for downstream tasks and as explanation of the graph constructing process. + +Both our sep-voc and joint-voc model variations work well on all datasets. Without using extra silver data, our model achieves the SMATCH score of $84.2 \pm 0.1$ on AMR 2.0, which is the same as the previous best model (Bevilacqua et al., 2021) with 200K silver data. With the input of only 47K silver data (consisting of $\sim 20\mathrm{K}$ example sentences of propbank frames and randomly selected $\sim 27\mathrm{K}$ SQuAD-2.0 context sentences), we achieve the highest score of $84.7 \pm 0.1$ for AMR 2.0. We also attain the high score of $81.7 \pm 0.2$ on the smallest AMR 1.0 benchmark, and the second best score of $82.7 \pm 0.1$ on the largest AMR 3.0 benchmark. Ensemble of the 3 models from the silver training further improves the performances to 84.9 for AMR + +# 2.0 and 83.1 for AMR 3.0. + +Fine-grained Results We further examine the fine-grained parsing results on AMR 2.0 in Table 2. We compare models not relying on extra data nor graph re-categorization since silver data sets differ across methods, and re-categorization comes with limitations outlined in Section 2. Our models achieve the highest scores across most of the categories, except for negation and wikification. The former may be due to alignment errors and the latter is solved as a separate post-processing step independent of the parser. Compared with the closely related model from Bevilacqua et al. (2021) which also fine-tunes BART but directly on linearized graphs, we achieve significant gains on re-entrancy and SRL (:ARG-I arcs), proving our model generate AMR graphs more faithful to their topological structures. + +# 7 Analysis + +Transition System Table 3 and Table 4 compare different transition systems used by recent transition-based AMR parsers with strong performances. Our proposed system has the smallest set of base actions, utilizes the action-side pointer mechanism for flexible edge creation as in Zhou et al. (2021), but does not rely on special treatment of certain subgraphs such as named entities and dates. This results in slightly longer action sequences compared to Zhou et al. (2021), but with almost $100\%$ coverage11 (Table 4). Our transition system and oracle can always find action sequences with full recovery of the original AMR graph, regardless of graph topology and alignments. + +To assess whether our proposed transition system helps integration with pre-trained BART, we train both the APT model from Zhou et al. (2021) and our sep-voc model on the transition system of + +
Model VariationSMATCH (%)
sep-vocjoint-voc
Ours (hard attention)84.0 ±0.184.2 ±0.1
No align. modeling83.5 ±0.083.4 ±0.2
Align. soft supervision82.9 ±0.083.0 ±0.0
Align. add src emb.83.9 ±0.084.1 ±0.0
No COPY action83.1 ±0.184.1 ±0.0
+ +Zhou et al. (2021) and the one introduced in this work (Table 3 last 4 columns). The APT model, based on fixed RoBERTa features, does not benefit from the proposed transition system. However, our proposed model gains 0.6 on AMR 2.0 and 0.7 on AMR 3.0. This confirms the hypothesis that the proposed transitions are better able to exploit BART's powerful language generation ability. + +Structural Alignment Modeling In Table 5, we evaluate the effects of our structural modeling of parser states within BART during fine-tuning. Action-source alignments are natural byproduct of the parser state, providing structural information of where and how to generate the next graph component. Our default use of hard attention to encode such alignments works the best. We explore two other strategies for modeling alignments. One is to supervise cross-attention distributions for the same heads with inferred alignments during training, inspired by Strubell et al. (2018). The other is to directly add the aligned source contextual embeddings from the encoder top layer to the decoder input at every generation step. The former hurts the model performance, indicating the model is unable to learn the underlying transition logic to infer correct alignments, while the latter does equally well as our default model. These results justify the modeling of structural constraints, even when finetuning strong pre-trained models such as BART. + +We also ablate the use of COPY action in our transition system. The sep-voc model suffers but the joint-voc model is not affected. Without COPY action, the joint-voc model would rely more on BART's pre-trained subword embeddings to split node concepts more frequently, while the sep-vocab model would need to learn to generate more rare concepts from scratch. This indicates that BART's strong generation power is fully used to tackle concept sparsity problems with its subwords. + +![](images/b1a4794ac56a8dbde0fb47048371dd530fb82fddc126d3e7c064f28b9bdc0766.jpg) +Figure 3: Effect of special AMR node names added to the BART vocabulary in joint-voc model on AMR 2.0 dataset. Remaining AMR concepts are split and generated with BART subwords and sense numbers. + +Table 5: Ablation study of structure modeling with transition alignments. Results are on AMR 2.0 test data. + +
#Model InitializationSMATCH (%)
src embencoderdecodertgt embBaseLarge
171.272.7
2✓✓71.772.8
3✓✓✓81.482.8
4✓✓✓69.29.5*
5✓71.272.8
6✓✓80.982.5
7✓✓✓82.283.9
8✓✓✓✓82.784.1
9freeze BART src emb82.684.0
10freeze BART src emb + encoder80.981.8
+ +Table 6: Effects of pre-trained BART parameters. Results are with our sep-voc model on AMR 2.0 data. * failed to converge with a range of hyper-parameters. + +Special Nodes in Joint-Voc In Figure 3, we show the joint-voc model performance with different sized (joint) vocabularies. The vocabulary size is controlled by specifying the minimum frequency of occurrence needed for an AMR concept to be added to the vocabulary. For instance, when the minimum frequency is 1, all 12475 AMR concepts from the training data are added onto the BART vocabulary. The number of added concepts decreases as we increase the minimum frequency threshold. On model performance side, we only observe $\pm 0.2$ score variations resulting from vocabulary expansion. More interestingly, the model can work equally well when no special concepts are added to the BART vocabulary (minimum node frequency is $\infty$ ) – where all the node names are split and generated with BART subword tokens. Although our default setup uses frequency threshold of 5 in joint-voc expansion, following Bevilacqua et al. (2021), it seems unnecessary in terms of achieving good performance. This highlights the efficacy of utilizing the pre-trained BART's lan + +guage generation power for AMR concepts even with relatively small annotated training datasets. + +Pre-trained Parameters We study the contribution of different pre-trained BART components in Table 6. With our sep-voc model, we decompose the whole seq-to-seq Transformer into four components for BART initialization, i.e. the source embedding (mapped with BART shared embedding), encoder, decoder, and the separate target embedding (initialized with the average subword embeddings from BART shared embedding). We run both the StructBART base model and the StructBART large model with different combinations of parameter initialization, on the top part of Table 6. We can see that a randomly initialized model of the same size (#1) performs badly. There is an accumulative effect of BART initialization in helping the model performance, except that BART decoder can not work alone well without its encoder (#4). The encoder gives the largest performance gains (#3 vs. #2, #6 vs. #5) of about 10 points. Adding the decoder further gives around 1.4 points on top (#7 vs. #6), justifying its importance as well. + +We also experiment with freezing BART parameters during training in the bottom part of Table 6. Our results of freezing the BART encoder are on similar levels of previous best RoBERTa feature based models, which is behind the full fine-tuning. Overall, full initialization from BART with structure-aware fine-tuning (#8) works the best. + +# 8 Related Work + +Using seq-to-seq to predict linearized graph sequences for parsing was proposed in Vinyals et al. (2015) and is currently a very extended approach (Van Noord and Bos, 2017; Ge et al., 2019; Rongali et al., 2020). However, it is only recently with the rise of pre-trained Transformer decoders, that these techniques have become dominant in semantic parsing. Xu et al. (2020) proposed custom multi-task pre-training and fine-tuning approach for conventional Transformer models (Vaswani et al., 2017). The massively pre-trained transformer BART (Lewis et al., 2019) was used for executable semantic parsing in Chen et al. (2020) and AMR parsing in Bevilacqua et al. (2021). The importance of strongly pre-trained decoders seems also justified as BART gains popularity in various semantic generation tasks (Chen et al., 2020; Shi et al., 2020). Our work aims at capitalizing on the outstanding performance shown by BART, while + +providing a more structured approach that guarantees well-formed graphs and yields other desirable sub-products such as alignments. We show that this is not only possible but also attains state-of-the-art parsing results without graph re-categorization. Our analysis also shows that contrary to Xu et al. (2020), vocabulary sharing is not necessary for strong performance for our structural fine-tuning. + +Encoding of the parser state into neural parsers has been undertaken in various works, including seq-to-seq RNN models (Liu and Zhang, 2017; Zhang et al., 2017; Buys and Blunsom, 2017), encoder-only Transformers (Ahmad et al., 2019), seq-to-seq Transformers (Astudillo et al., 2020; Zhou et al., 2021) and pre-trained language models (Qian et al., 2021). Here we explore the application of these approaches to pre-trained seq-to-seq Transformers. Borrowing ideas from Zhou et al. (2021), we encode alignment states into the pre-trained BART attention mechanism, and re-purpose its self-attention as a pointer network. We also rely on a minimal set of actions targeted to utilize BART's generation with desirable guarantees, such as no unattachable nodes and full recovery of all graphs. We are the first to explore transition-based parsing applied on fine-tuning strongly pre-trained seq-to-seq models, and we demonstrate that parser state encoding is still important for performance, even when implemented inside of a powerful pre-trained decoder such as BART. + +# 9 Conclusion + +We explore the integration of pre-trained sequence-to-sequence language models and transition-based approaches for AMR parsing, with the purpose of retaining the high performance of the former and structural advantages of the latter. We show that both approaches are complementary, establishing the new state of the art for AMR 2.0. Our results indicate that instead of simply converting the structured data into unstructured sequences to fit the need of the pre-trained model, it is possible to effectively re-purpose a generic pre-trained model to a structure-aware one achieving strong performance. Similar principles can be applied to adapt other powerful pre-trained models such as T5 (Raffel et al., 2019) and GPT-2 (Radford et al., 2019) for structured data predictions. It is worth exploring thoroughly the pros and cons of introducing structure to the model compared to removing structure from the data (linearization) in various scenarios. + +# References + +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 the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2440-2452, Minneapolis, Minnesota. Association for Computational Linguistics. +Ramon Fernandez Astudillo, Miguel Ballesteros, Tahira Naseem, Austin Blodgett, and Radu Florian. 2020. Transition-based parsing with stack-transformers. arXiv preprint arXiv:2010.10669. +Miguel Ballesteros and Yaser Al-Onaizan. 2017a. AMR parsing using stack-LSTMs. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1269-1275, Copenhagen, Denmark. Association for Computational Linguistics. +Miguel Ballesteros and Yaser Al-Onaizan. 2017b. Amr parsing using stack-lstms. arXiv preprint arXiv:1707.07755. +Laura Banarescu, Claire Bonial, Shu Cai, Madalina Georgescu, Kira Griffitht, 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. +Michele Bevilacqua, Rexhina Blloshmi, and Roberto Navigli. 2021. One spring to rule them both: Symmetric amr semantic parsing and generation without a complex pipeline. +Jan Buys and Phil Blunsom. 2017. Robust incremental neural semantic graph parsing. arXiv preprint arXiv:1704.07092. +Deng Cai and Wai Lam. 2020. AMR parsing via graph- sequence iterative inference. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1290-1301, Online. 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. +Xilun Chen, Asish Ghoshal, Yashar Mehdad, Luke Zettlemoyer, and Sonal Gupta. 2020. Low-resource domain adaptation for compositional task-oriented semantic parsing. arXiv preprint arXiv:2010.03546. +Marco Damonte, Shay B Cohen, and Giorgio Satta. 2016. An incremental parser for abstract meaning representation. arXiv preprint arXiv:1608.06111. + +DongLai Ge, Junhui Li, Muhua Zhu, and Shoushan Li. 2019. Modeling source syntax and semantics for neural amr parsing. In *IJCAI*, pages 4975-4981. +Pavan Kapanipathi, Ibrahim Abdelaziz, Srinivas Ravishankar, Salim Roukos, Alexander Gray, Ramón Fernández Astudillo, Maria Chang, Cristina Cornelio, Saswati Dana, Achille Fokoue, Dinesh Garg, Alfio Gliozzo, Sairam Gurajada, Hima Karanam, Naweed Khan, Dinesh Khandelwal, Young-Suk Lee, Yunyao Li, Francois Luus, Ndivhuwo Makondo, Nandana Mihindukulasooriya, Tahira Naseem, Sumit Neelam, Lucian Popa, Revanth Gangi Reddy, Ryan Riegel, Gaetano Rossiello, Udit Sharma, G P Shrivatsa Bhargav, and Mo Yu. 2021. Leveraging Abstract Meaning Representation for knowledge base question answering. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 3884-3894, Online. Association for Computational Linguistics. +Young-Suk Lee, Ramon Fernandez Astudillo, Tahira Naseem, Revanth Gangi Reddy, Radu Florian, and Salim Roukos. 2020. Pushing the limits of amr parsing with self-learning. arXiv preprint arXiv:2010.10673. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2019. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461. +Michael Lingzhi Li, Meng Dong, Jiawei Zhou, and Alexander M Rush. 2019. A hierarchy of graph neural networks based on learnable local features. arXiv preprint arXiv:1911.05256. +Fei Liu, Jeffrey Flanigan, Sam Thomson, Norman Sadeh, and Noah A Smith. 2018. Toward abstractive summarization using semantic representations. arXiv preprint arXiv:1805.10399. +Jiangming Liu and Yue Zhang. 2017. Encoder-decoder shift-reduce syntactic parsing. In Proceedings of the 15th International Conference on Parsing Technologies, pages 105-114, Pisa, Italy. Association for Computational Linguistics. +Chunchuan Lyu, Shay B Cohen, and Ivan Titov. 2020. A differentiable relaxation of graph segmentation and alignment for amr parsing. arXiv preprint arXiv:2010.12676. +Chunchuan Lyu and Ivan Titov. 2018. AMR parsing as graph prediction with latent alignment. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 397-407, Melbourne, Australia. Association for Computational Linguistics. +Arindam Mitra and Chitta Baral. 2016. Addressing a question answering challenge by combining statistical methods with inductive rule learning and reasoning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30. + +Tahira Naseem, Srinivas Ravishankar, Nandana Mihindukulasooriya, Ibrahim Abdelaziz, Young-Suk Lee, Pavan Kapanipathi, Salim Roukos, Alfio Gliozzo, and Alexander Gray. 2021. A semantics-aware transformer model of relation linking for knowledge base question answering. ACL. +Tahira Naseem, Abhishek Shah, Hui Wan, Radu Florian, Salim Roukos, and Miguel Ballesteros. 2019. Rewarding Smatch: Transition-based AMR parsing with reinforcement learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4586-4592, Florence, Italy. Association for Computational Linguistics. +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. arXiv preprint arXiv:1904.01038. +Peng Qian, Tahira Naseem, Roger Levy, and Ramón Fernandez Astudillo. 2021. Structural guidance for transformer language 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 1: Long Papers), pages 3735-3745, Online. Association for Computational Linguistics. +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. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683. +Subendhu Rongali, Luca Soldaini, Emilio Monti, and Wael Hamza. 2020. Don't parse, generate! a sequence to sequence architecture for task-oriented semantic parsing. In Proceedings of The Web Conference 2020, pages 2962-2968. +Peng Shi, Patrick Ng, Zhiguo Wang, Henghui Zhu, Alexander Hanbo Li, Jun Wang, Cicero Nogueira dos Santos, and Bing Xiang. 2020. Learning contextual representations for semantic parsing with generation-augmented pre-training. arXiv preprint arXiv:2012.10309. +Emma Strubell, Patrick Verga, Daniel Andor, David Weiss, and Andrew McCallum. 2018. Linguistically-informed self-attention for semantic role labeling. arXiv preprint arXiv:1804.08199. +Rik Van Noord and Johan Bos. 2017. Neural semantic parsing by character-based translation: Experiments with abstract meaning representations. arXiv preprint arXiv:1705.09980. + +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, Łukasz Kaiser, Terry Koo, Slav Petrov, Ilya Sutskever, and Geoffrey Hinton. 2015. Grammar as a foreign language. In Advances in neural information processing systems, pages 2773-2781. +Andreas Vlachos et al. 2018. Guided neural language generation for abstractive summarization using abstract meaning representation. arXiv preprint arXiv:1808.09160. +Chuan Wang and Nianwen Xue. 2017. Getting the most out of amr parsing. In Proceedings of the 2017 conference on empirical methods in natural language processing, pages 1257-1268. +Chuan Wang, Nianwen Xue, and Sameer Pradhan. 2015. A transition-based algorithm for amr parsing. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 366-375. +Dongqin Xu, Junhui Li, Muhua Zhu, Min Zhang, and Guodong Zhou. 2020. Improving amr parsing with sequence-to-sequence pre-training. arXiv preprint arXiv:2010.01771. +Sheng Zhang, Xutai Ma, Kevin Duh, and Benjamin Van Durme. 2019a. Amr parsing as sequence-to-graph transduction. arXiv preprint arXiv:1905.08704. +Sheng Zhang, Xutai Ma, Kevin Duh, and Benjamin Van Durme. 2019b. Broad-coverage semantic parsing as transduction. 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 3784–3796, Hong Kong, China. Association for Computational Linguistics. +Zhirui Zhang, Shujie Liu, Mu Li, Ming Zhou, and Enhong Chen. 2017. Stack-based multi-layer attention for transition-based dependency parsing. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1677-1682, Copenhagen, Denmark. Association for Computational Linguistics. +Jiawei Zhou, Tahira Naseem, Ramón Fernandez Astudillo, and Radu Florian. 2021. Amr parsing with action-pointer transformer. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5585-5598, Online. Association for Computational Linguistics. + +# A Dataset Statistics + +We list the dataset sizes of AMR benchmarks in Table 7. The sizes increase with the release version number. AMR 2.0 is the most used by far. AMR 2.0 shares the same set of sentences for development and test data with AMR 1.0, but with revised annotations and wikification links. AMR 3.0 is released most recently, which is under-explored. + +Our silver data originate from two sources. First, we use $\sim 20\mathrm{K}$ example sentences ( $\sim 386\mathrm{K}$ tokens) from the propbank frames included in the AMR 3.0 distribution. Second, we use randomly selected $\sim 27\mathrm{K}$ sentences ( $\sim 620\mathrm{K}$ tokens) from SQuAD 2.0 context sentences available from https://rajpurkar.github.io/SQuAD-explorer/. + +
Data SplitAMR 1.0AMR 2.0AMR 3.0
Training10,31236,52155,635
Development1,3681,3681,722
Test1.3711.3711,898
+ +# B Details of Model Structures and Number of Parameters + +In Table 8, we list the detailed model configuration and number of parameters of the official pre-trained BART models. Our fine-tuned StructBART is with different action vocabulary strategies which builds additional embedding vectors for certain action symbols. The numbers vary from training dataset. We list the detailed number of parameters of our fine-tuned model in Table 9. The fine-tuned model only increases about $3\% - 8\%$ more parameters for sep-voc model and $0.4\% - 1\%$ more parameters for joint-voc model. + +# C Implementation Details + +We use the Adam optimizer with $\beta_{1} = 0.9$ and $\beta_{2} = 0.98$ . Batch size is set to 2048 maximum number of tokens, and gradient is accumulated over 4 steps. The learning rate schedule is the same as Vaswani et al. (2017), where we use the maximum learning rate of $1\mathrm{e} - 4$ with 4000 warm-up steps. Dropout of rate 0.2 and label smoothing of rate 0.01 are used. These hyperparameters are fixed and not tuned for different models and datasets, as we found results are not + +Table 7: Number of sentence-AMR instances in the AMR benchmark datasets. + +
ConfigurationBART BaseBART Large
Encoder layers612
Heads per layer1216
Hidden size7681024
FFN size30724096
Size of vocab51201*50265
Size of emb. matrix39,322,36851,471,360
#parameters trained140,139,266406,291,458
+ +Table 8: Original model configurations of pre-trained BART from FAIRSEQ (https://github.com/pytorch/fairseq/tree/v0.10.2/examples/bart). The embeddings for source, decoder input and output are all shared and thus the same (not counted as extra in training parameters). *vocabulary for the base model is larger due to additional paddings at the end, but effective vocabulary symbols are the same as the large model. + +
ModelParam.AMR 1.0AMR 2.0AMR 3.0
sep-vocSrc vocab size502655026550265
Tgt vocab size69761275216180
#param. trained420,578,304432,407,552439,436,288
joint-vocjoint vocab size519215348754388
#param. trained407,987,200409,590,784410,517,504
+ +Table 9: Model parameters of our StructBART (large model). The sizes differ based on the target side vocabulary, which is dependent on different training data. Addition of silver training data adds only a fraction of the parameters to the benchmark datasets. + +sensitive within small ranges. Without silver data, we train sep-voc models for 100 (AMR 1.0 & 2.0) or 120 (AMR 3.0) epochs and joint-voc models for 40 epochs as the latter is found to converge faster. The best 5 (AMR 1.0 & 2.0) or 10 (AMR 3.0) checkpoints among the last 40/30 epochs are selected based on development set SMATCH from greedy decoding and averaged over the model parameters as our final model. With the 50K silver data, we train both sep-voc and joint-voc models for 20 epochs and select the best 10 checkpoints for model parameter averaging. We use a default beam size of 10 for decoding for our final parsing scores. Our models are implemented with the FAIRSEQ toolkit (Ott et al., 2019), trained and tested on a single Nvidia Tesla V100 GPU with 32GB memory. We use fp16 mixed precision training whenever possible, with which training a large model on AMR 2.0 takes about 10 hours for sep-vocab models and 7 hours for joint-vocab models, and the time varies proportionally with data size for other datasets and with silver data. \ No newline at end of file diff --git a/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/images.zip b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7392f776559798055e80433df6ef68a86ed9877e --- /dev/null +++ b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:418c49393c16e2e8fb5a435c5af01b1c6d40df138fe5fb24fda88e26f4213ad5 +size 444482 diff --git a/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/layout.json b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e1fed305297ac5bd73aba7cf9df0a558da74427c --- /dev/null +++ b/structureawarefinetuningofsequencetosequencetransformersfortransitionbasedamrparsing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07279f83561fc57ff653ec3b248354a964deb6caf9d800e4139e3ecceaffdf5d +size 315847 diff --git a/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_content_list.json b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..00d2cd977cb16b0587039de93a568eec44dc7687 --- /dev/null +++ b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cab4b3780b7e1043b40b59dec9dd74860e60f8eb7aee91f7bbab459f72531843 +size 120323 diff --git a/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_model.json b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8dd20b1040266afaac1f91156e540a39a1308ec1 --- /dev/null +++ b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:243d3613df3adeb71e2c0333bc9f2f4aabe85747a1211700deb0a8472562862b +size 138408 diff --git a/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_origin.pdf b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c51e8cbda608f9fe9fb2b0d60ca8bb50acd90890 --- /dev/null +++ b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/bdb13c27-8873-4c32-91c4-a17e9907e78f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10084ddadac39c92d8636934b78e0101133653c2e4c6cd480e6a11f94f702293 +size 1040153 diff --git a/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/full.md b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/full.md new file mode 100644 index 0000000000000000000000000000000000000000..cf84f270efe0011e96ac87d05d91c4f3a50b98ae --- /dev/null +++ b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/full.md @@ -0,0 +1,528 @@ +# Structured Context and High-Coverage Grammar for Conversational Question Answering over Knowledge Graphs + +Pierre Marion* + +Sorbonne Université, CNRS + +Laboratoire de Probabilités, Statistique et Modélisation, LPSM + +F-75005, Paris, France + +pierre.marion@sorbonne-universite.fr + +# Pawel Krzysztof Nowak and Francesco Piccinno + +Google Research + +{pawelnow,piccinno}@google.com + +# Abstract + +We tackle the problem of weakly-supervised conversational Question Answering over large Knowledge Graphs using a neural semantic parsing approach. We introduce a new Logical Form (LF) grammar that can model a wide range of queries on the graph while remaining sufficiently simple to generate supervision data efficiently. Our Transformer-based model takes a JSON-like structure as input, allowing us to easily incorporate both Knowledge Graph and conversational contexts. This structured input is transformed to lists of embeddings and then fed to standard attention layers. We validate our approach, both in terms of grammar coverage and LF execution accuracy, on two publicly available datasets, CSQA and ConvQuestions, both grounded in Wikidata. On CSQA, our approach increases the coverage from $80\%$ to $96.2\%$ , and the LF execution accuracy from $70.6\%$ to $75.6\%$ , with respect to previous state-of-the-art results. On ConvQuestions, we achieve competitive results with respect to the state-of-the-art. + +# 1 Introduction + +Graphs are a common abstraction of real-world data. Large-scale knowledge bases can be represented as directed labeled graphs, where entities correspond to nodes and subject-predicate-object triplets are encoded by labeled edges. These so-called Knowledge Graphs (KGs) are used both in open knowledge projects (YAGO, Wikidata) and in the industry (Yahoo, Google, Microsoft, etc.). A prominent task on KGs is factual conversational Question Answering (Conversational KG-QA) and + +it has spurred interest recently, in particular due to the development of AI-driven personal assistants. + +The Conversational KG-QA task involves difficulties of different nature: entity disambiguation, long tails of predicates (Saha et al., 2018), conversational nature of the interaction. The topology of the underlying graph is also problematic. Not only can KGs be huge (up to several billion entities), they also exhibit hub entities with a large number of neighbors. + +A recent prominent approach has been to cast the problem as neural semantic parsing (Jia and Liang, 2016; Dong and Lapata, 2016, 2018; Shen et al., 2019). In this setting, a semantic parsing model learns to map a natural language question to a logical form (LF), i.e. a tree of operators over the KG. These operators belong to some grammar, either standard like SPARQL or ad-hoc. The logical form is then evaluated over the KG to produce the candidate answer. In the weak supervision training setup, the true logical form is not available, but only the answer utterance is (as well as annotated entities in some cases, see Section 5.4). Hence the training data is not given but it is instead generated, in the format of (question, logical form) pairs. We refer to this data as silver data or silver LFs, as opposed to unknown gold ground truth. + +However, this approach has two main issues. First, the silver data generation step is a complex and often resource-intensive task. The standard procedure employs a Breadth-First Search (BFS) exploration (Guo et al., 2018; Shen et al., 2019), but this simple strategy is prone to failure, especially when naively implemented, for questions that are mapped to nested LFs. This reduces the coverage, i.e. the percentage of training questions associated + +to a Logical Form. Shen et al. (2020) proposes to add a neural component for picking the best operator, in order to reduce the computational cost of this task, however complicating the model. Cao et al. (2020) proposes a two-step semantic parser: the question is first paraphrased into a "canonical utterance", which is then mapped to a LF. This approach simplifies the LF generation by separating it from the language understanding task. + +Second, most of the semantic parsing models do not leverage much of the underlying KG structure to predict the LF, as in Dong and Lapata (2016); Guo et al. (2018). Yet, this contextual graph information is rich (Tong et al., 2019), and graph-based models leveraging this information yield promising results for KG-QA tasks (Vakulenko et al., 2019; Christmann et al., 2019). However these alternative approaches to semantic parsing, that rely on node classification, have their inherent limitations, as they handle less naturally certain queries (see Appendix C.3) and their output is less interpretable. This motivates the desire for semantic parsing models that can make use of the KG context. + +Approach and contributions We design a new grammar, which can model a large range of queries on the KG, yet is simple enough for BFS to work well. We obtain a high coverage on two KG-QA datasets. On CSQA (Saha et al., 2018), we achieve a coverage of $96\%$ , a $16\%$ improvement over the baseline (Shen et al., 2020). On ConvQuestions (Christmann et al., 2019), a dataset with a large variety of queries, we reach a coverage of $86\%$ . + +To leverage the rich information contained in the underlying KG, we propose a semantic parsing model that uses the KG contextual data in addition to the utterances. Different options could be considered for the KG context, e.g. lists of relevant entities, annotated with metadata or pre-trained entity embeddings that are graph-aware (Zhang et al., 2020). The problem is that this information does not come as unstructured textual data, which is common for language models, but is structured. + +To enable the use of context together with a strong language model, we propose the Object-Aware Transformer (OAT) model, which can take as input structured data in a JSON-like format. The model then transforms the structured input into embeddings, before feeding them into standard Transformer layers. With this approach, we improve the overall execution accuracy on CSQA by $5.0\%$ compared to a strong baseline (Shen et al., 2019). On + +ConvQuestions, we improve the precision by $4.7\%$ compared to Christmann et al. (2019). + +# 2 Related work + +Neural semantic parsing Our work falls within the neural semantic parsing approaches for Knowledge-Based QA (Dong and Lapata, 2016; Liang et al., 2017; Dong and Lapata, 2018; Guo et al., 2019b; Hwang et al., 2019). The more specific task of conversational KG-QA has been the focus of recent work. Guo et al. (2018) introduces D2A, a neural symbolic model with memory augmentation. This model has been extended by S2A+MAML (Guo et al., 2019a) with a meta-learning strategy to account for context, and by D2A+ES (Shen et al., 2020) with a neural component to improve BFS. Saha et al. (2019) proposes a Reinforcement Learning model to benefit from denser supervision signals. Finally, Shen et al. (2019) introduces MaSP, a multi-task model that performs both entity linking and semantic parsing, with the hope of reducing erroneous entity linking (see Appendix C.2 for a comparison with our setup). Recently, Plepi et al. (2021) extended the latter in CARTON. They first predict the LF using a Transformer architecture, then specify the KG items using pointer networks. This work was further extended in Kacupaj et al. (2021), which includes a graph attention network to exploit correlations between entities and predicates. Another related contemporaneous work is Thirukovalluru et al. (2021), where the decoder is informed with entity embeddings coming from KG random walks. + +Learning on Knowledge Graphs Classical graph learning techniques can be applied to the specific case of KGs. In Convex (Christmann et al., 2019), at each turn, a subgraph is expanded by matching the utterance with neighboring entities. Then a candidate answer is found by a node classifier. Other methods include unsupervised message passing (Vakulenko et al., 2019). However, these approaches lack strong NLP components. Other directions include learning differentiable operators over a KG (Cohen et al., 2019), or applying Graph Neural Networks (Kipf and Welling, 2017; Hamilton et al., 2017) (GNNs) to the KG, which has been done for entity classification and link prediction tasks (Schlichtkrull et al., 2018). GNNs have also been used to model relationships between utterances and entities (Shaw et al., 2019). + +Structured Input for neural models Our approach of using JSON-like input falls in the line of computing neural embeddings out of structured inputs. Tai et al. (2015) introduced Tree-LSTM for computing tree embeddings bottom-up. It has then been applied for many tasks, including computer program translation (Chen et al., 2018), semantic tree structure learning (such as JSON or XML) (Woof and Chen, 2020) and supervised KGQA tasks (Tong et al., 2019; Zafar et al., 2019; Athreya et al., 2021). In the latter context, TreeLSTM is used to model the syntactic structure of the question. Other related approaches include tree transformer (Harer et al., 2019) and tree attention (Ahmed et al., 2019). Syntactic structures were also modeled as graphs (Xu et al., 2018; Li et al., 2020). Specific positional embeddings can also be used to encode structures (Shiv and Quirk, 2019; Herzig et al., 2020). + +# 3 A grammar for KG exploration + +Several previous KG-QA works were based on the grammar from D2A (Guo et al., 2018). We also take inspiration from their grammar, but redesign it to model a wider range of queries. By defining more generic operators, we achieve this without increasing the number of operators nor the average depth of LFs. Section 3.4 presents a comparison. + +# 3.1 Definitions + +An entity (e.g. Marie Curie) is a node in the KG. Two entities can be related through a directed labeled edge called a property (e.g. award received). A property can also relate an entity to a value, which can be a date, a boolean, a quantity or a string. Entities and properties have several attributes, prominently a name and an integer ID. The membership property is treated separately; it relates a member entity (e.g. Marie Curie) to a class entity (e.g. human being). + +The objects we will consider in the following are entities, properties, classes, and values. The grammar consists of a list of operators that take objects or sets of objects as arguments. A Logical Form is a binary expression tree of operators. + +In several places, we perform Named Entity Linking (NEL), i.e. mapping an utterance to a list of KG objects. Section 5.4 details how this is done. + +Table 1 lists the operators we use, grouped in five categories. Most of them are straightforward, except meta-operators, which we explain next. + +# 3.2 Meta-operators + +Meta-operators are useful for questions such as: Which musical instrument is played by the maximum number of persons?. To answer this question, we first compute the set of all musical instruments in the KG. For each entity in this set, we then follow the property played by, producing a set of people who play that instrument. Finally, we compute the max cardinality of all these sets and return the associated instrument. + +The corresponding LF is the following: + +```txt +$\mathrm{argmax}$ cardinality( follow_property( for_each( members(musical instrument), ), played by))) +``` + +for_each creates a parallel computation over each entity in its argument, which can be terminated by three operators (arg, argmax and argmin). We refer to Appendix B.1 for details. + +# 3.3 Silver LF generation + +To generate silver LFs, we explore the space of LFs with a BFS strategy, similarly to Guo et al. (2018); Shen et al. (2019). More precisely, to initialize the exploration, we perform NEL to find relevant entities, values and classes that appear in the question. LFs of depth 0 simply return an annotated object. Then, assume that LFs of depth less or equal to $n$ have been generated and we want to generate those of depth $n + 1$ . We loop through all possible operators; for each operator, we choose each of its arguments among the already-generated LFs. This algorithm brings two challenges, as highlighted in Shen et al. (2020): computational cost and spurious LFs. We refer to Appendix B.2 for implementation details that mitigate these difficulties. + +# 3.4 Comparison with D2A (Guo et al., 2018) + +Section 5.5 shows that our grammar achieves higher coverage with a similar average LF depth. A more thorough quantitative comparison is delicate, as it would require reimplementing D2A within our framework, which is beyond the scope of this paper. On a qualitative basis, we use more elementary types: in addition to theirs, we introduce set of classes, strings and set of values (which can be strings, numerals or booleans). We use eight less operators than D2A; among our oper + +
CategoryNameSignatureDescription
Graph operatorsfollow_property(SE, P) → SEReturns the entities which are linked by prop- erty P to at least one element of SE.
follow_backward(SE, P) → SEReturns the entities which are linked by prop- erty P from at least one element of SE.
get_value(SE, P) → SVReturns the values which are linked by prop- erty P to at least one element of SE.
Numerical operatorsmax, minSV → SVReturns the max (resp. min) value from SV.
greater Than, +equals, +lesser Than(SV, V) → SVFilters SV to keep values strictly greater than +(resp. equal to, strictly lesser than) V.
cardinalitySE → VReturns the cardinality of SE.
Set operatorsis_in(a: SE, b: SE) → SVReturns a boolean set: for each entity in a, the +mask equals True if the entity is in b.
get_firstSE → SEReturns the first entity from SE.
union, intersect, +difference(SE,SE) → SEReturns the union (resp. intersection, differ- +ence) of input sets.
Class +operatorsmembersSC → SEReturns the members of classes in SC.
keep(SE,SC) → SEFilters SE to keep the members of SC.
Meta- +operatorsfor_eachSE → SEInitializes a parallel computation over all en- +tities in the input set.
argSV → SE or +SE → SEEnds a parallel computation by returning all +entities that gave a non-empty result.
argmax, argminSV → SEEnds a parallel computation by returning all +entities that gave the max (resp. min) value.
+ +Table 1: List of operators in our grammar. Their variables can be entities (E), classes (C), values (V), ordered sets of such elements (resp. SE, SC and SV), or properties (P). + +ators, six are in common (follow_property, follow_backward, cardinality, union, intersect, difference), four are modified (keep, is_in, argmax, argmin), and the other ten are new. New intents that can be modeled include numerical reasoning (e.g. What actor plays the younger child?), temporal reasoning (e.g. What is the number of seasons until 2018?), ordinal reasoning (e.g. What was the first episode date?), textual form reasoning (e.g. What was Elvis Presley given name?). We refer to Appendix C.1 for more details and comparison methodology. + +# 4 Model + +# 4.1 Overview + +The model, called Object-Aware Transformer (OAT), is a Transformer-based (Vaswani et al., 2017) auto-regressive neural semantic parser. As illustrated in Figure 1, the model has several steps. + +The first step consists of retrieving relevant objects, annotated with metadata, that might appear + +in the resulting LF. This step is performed using NEL on the utterances and KG lookups to retrieve the graph context information. At this point, the input is composed of lists of objects with their fields. After embedding each field value in a vector space, we perform successive layers of input flattening and Transformer encoding. The Flattener layer is useful to transform the structured input into a list of embeddings. Then a decoder Transformer layer produces a linearized LF, i.e. a list of string tokens. Finally, we evaluate the LF over the KG to produce a candidate answer. In the next sections, we describe each step in details. + +# 4.2 Structured Input computation + +Hierarchical structure For each query, we construct the input as a JSON-like structure, consisting of lists of objects with their fields (represented in the left part of Figure 1). We chose this representation as it allows to incorporate general structured information into the model. A field can be a string, a KG integer ID, a numerical value, or a list thereof. + +![](images/a1098a4dad35679593b0413e1e0e5e41e537f63487a33df222c0b168aa2de318.jpg) +Figure 1: Architecture of the proposed model. The initial field embeddings are Positional (P), Property ID (PID), Entity ID (EID), and Class ID (CID). After the first Flattener layer, we obtain Property Embeddings (PE), Class Embeddings (CE), Entity Embeddings (EE). There are also Grammar Token (GT) embeddings in the output. Note that the entity IDs are actually randomized (not shown here). + +![](images/83eebfa1f7bd80607042c4ec8d4af3b55809c6a263f17d0a107e392fd28050f8.jpg) + +To construct the input, we start from the last utterances in the dialog: the current query, previous query and previous answer. We first perform NEL to retrieve a list of entities $\mathcal{E}$ (and numerical values) matching the utterances. The KG is then queried to retrieve additional contextual information: the classes of the entities, and all outgoing and incoming properties from these entities $\mathcal{E}$ . This gives a list of properties $\mathcal{P}$ . For each property $p\in \mathcal{P}$ , we fill several fields: its ID, its name, and an Entity IDs field, which corresponds to all entities $e\in \mathcal{E}$ such that at least one graph operator gives a nonempty result when applied to $e$ and $p$ . For instance, in Wikidata, the property birth name (P1477) is filled for Marie Curie but not for Pierre Curie, so the Entity IDs field of the birth name property only contains Marie Curie. + +Let us introduce some formal notations, useful to explain the computation of the input's embeddings (Section 4.3). The input is a tree where the root corresponds to the whole input, and each leaf contains the primitive values. For a non-leaf node $x$ , we denote by $c(x)$ its children. For instance, in Figure 1, the node Property 2 has three children (leaves) whose values are mother, P25 and Q37463. A node $x$ has also a type, and $T_{\sim}(x)$ denotes the types of all nodes on the path from the root to $x$ . + +For instance, for the mother node, $T_{\sim}(x)$ is equal to (root, property, name). In our setup, the depth of the input is at most 2. + +ID randomization Directly giving the entity ID to the model would mean training a categorical classifier with millions of possible outcomes, which would lead to poor generalization. To avoid this, we replace the integer ID with a random one, thereby forcing the model to learn to predict the correct entity from the list of entities in input by copying their randomized entity ID to the output. + +For numerical values, we associate each value to an arbitrary random ID, that the model should learn to copy in the output. For properties and classes, since there are fewer possibilities in the graph (a few thousand), we do not randomize them. + +# 4.3 Embedding + +Preprocessing We apply BERT tokenization (Devlin et al., 2019) to textual inputs. A vocabulary $\mathcal{V}_t$ is generated for each of the non-textual input types $t$ . + +Token embedding The goal of this step is to associate an embedding to each field of each object in the input. We do so by using a learned embedding for each input type: BERT embeddings (Devlin + +et al., 2019) for textual inputs, and categorical embeddings for non-textual inputs. When the input is a list (textual tokens or Entity IDs field), we add to this embedding a positional embedding. To reduce the size of the model, list embeddings are averaged into a single embedding. Formally, the embedding step associates a matrix of embeddings $h(x) \in \mathbb{R}^{1 \times d_h}$ to each leaf of the input tree. + +# 4.4 Encoding layers + +There are two types of encoding layers: Flattener layers and Transformer layers. + +Flattener The goal of these layers is to compute the embeddings of tree nodes bottom-up. They are successively applied until we are able to compute the embedding of the root node, i.e. of the whole input. This operation can be seen as flattening the JSON-like structure, hence their name. + +Say we want to compute the embedding of some parent node $x$ . An affine projection is first applied to the embedding of each child, then the embedding of the parent node is computed by applying a reduction operation $\mathcal{R}$ , which can be either a sum or a concatenation. The weights of the projections are shared between all nodes having the same types $T_{\sim}(x)$ . For example, all class name nodes - with types (root, class, name) - share the same weights, but they do not share the weights of entity name nodes - with types (root, entity, name). Hence the embedding of $x$ is + +$$ +h (x) = \mathcal {R} _ {y \in c (x)} \left(\left\{W _ {\text {p r o j e c t}} ^ {T \rightsquigarrow (y)} h (y) + b _ {\text {p r o j e c t}} ^ {T \rightsquigarrow (y)} \right\}\right). +$$ + +If the reduction is a sum, all children embeddings need to be matrices of the same dimension, and the dimension of the parent embedding is also the same. If the reduction is a concatenation, the dimension of the parent embedding is $\left(\sum_{y\in c(x)}d(y),d_h\right)$ + +Transformer This layer is a classical multi-head Transformer encoder layer (Vaswani et al., 2017), taking as input a matrix of embeddings of dimensions $(n, d_h)$ , performing self-attention between the input embeddings, and outputting another matrix of the same dimensions. Detailed setup can be found in Appendix B.4. + +Architecture We apply a first Transformer layer only to the utterances, and in parallel a first Flattener layer with sum reduction to all other inputs. The latter computes one embedding for each object. We add a positional embedding to each object, + +to account for its position in the list of objects of the same type. Then we apply a second Flattener layer with concatenation to all outputs of the first layer. This creates a single matrix of embeddings containing the embeddings of all the objects and utterances. Finally, a second Transformer layer is applied to this matrix. + +# 4.5 Decoding layers + +The output is a list of tokens, which correspond to a prefix representation of the LF tree. Note that the model architecture is grammar agnostic, as this output structure is independent of the grammar and we do not use grammar-guided decoding. The tokens can belong to one of the non-textual input types or be a grammar token. Remember that we computed a vocabulary $\mathcal{V}_t$ for all token types $t\in \mathcal{T}$ . We augment the vocabulary with a STOP token. + +The decoder predicts the output list of tokens iteratively. Assume that we are given the first $j$ tokens $y_{1},\ldots ,y_{j}$ . We then apply an auto-regressive Transformer decoder on the full sequence, and we condition on the last embedding $h_j$ of the sequence to predict the next token $\hat{y}_{j + 1}$ . Several categorical classifiers are used to predict $\hat{y}_{j + 1}$ . We first decide whether we should stop decoding: + +$$ +\hat {s} _ {j + 1} = \operatorname {a r g m a x} p _ {\text {s t o p}, j} \tag {1} +$$ + +where $p_{stop,j} = \mathrm{softmax}(W_{stop}h_j)$ is a distribution over $\{0,1\}$ given by a binary classifier. If $\hat{s}_{j + 1} = 1$ , the decoding is finished, and we set $\hat{y}_{j + 1}$ to STOP; otherwise, we predict the type of the token: + +$$ +\hat {t} _ {j + 1} = \operatorname {a r g m a x} p _ {\text {t y p e}, j} \tag {2} +$$ + +where $p_{type,j} = \mathrm{softmax}(W_{type}h_j)$ is a distribution over $\mathcal{T}$ given by a $|\mathcal{T}|$ -class classifier. + +Finally, depending on the predicted type, we predict the token itself + +$$ +\hat {y} _ {j + 1} = \operatorname {a r g m a x} p _ {\text {t o k e n}, j} ^ {\hat {t} _ {j + 1}} \tag {3} +$$ + +where $p_{token,j}^{\hat{t}_{j+1}} = \text{softmax}(W_{token}^{\hat{t}_{j+1}} h_j)$ is a distribution over $\mathcal{V}_{\hat{t}_{j+1}}$ given by a $\left|\mathcal{V}_{\hat{t}_{j+1}}\right|$ -class classifier. + +Training We train by teacher forcing: for some training sample $(\mathbf{x},[y_1,\dots ,y_M])$ and for each step $j$ , the embedding $h_j$ is computed using the expected output at previous steps: $h_j = h(y_j;\mathbf{x},y_1,\dots ,y_{j - 1})$ . The loss is the cross-entropy between the expected output $y_{j + 1}$ and the distributions produced by the model. Precisely, let + +$T:\bigcup_{t\in \mathcal{T}}\mathcal{V}_t\to \mathcal{T}$ be the mapping which projects tokens to their type. We denote by $p(x)$ the value of a categorical distribution $p$ for the category $x$ . Then, omitting the step subscripts $j$ , the loss equals + +$$ +\begin{array}{l} l (p, y) = - \log (p _ {s t o p} (0)) \\ - \left[ \log (p _ {t y p e} (T (y))) + \log (p _ {t o k e n} ^ {T (y)} (y)) \right] \\ \end{array} +$$ + +for all steps except the last, and $l(p,y) = -\log (p_{stop}(1))$ for the last step. $p_{stop}$ , $p_{type}$ , and $p_{token}$ are computed as explained above. The total loss is obtained by averaging over all training samples and over all steps. + +# 5 Experiments + +Additional comments about the datasets, setups, and additional results can be found in the appendix. + +# 5.1 Datasets + +We use two weakly supervised conversational QA datasets to evaluate our method, Complex Sequential Question Answering (CSQA)1 (Saha et al., 2018) and ConvQuestions2 (Christmann et al., 2019), both grounded in Wikidata3. CSQA consists of about 1.6M turns in 200k conversations (152k/16k/28k splits), versus 56k turns in 11k conversations (7k/2k/2k splits) for ConvQuestions. + +CSQA was created by asking crowd-workers to write turns following some predefined patterns, then turns were stitched together into conversations. The questions are organized in different categories, e.g. simple, logical or comparative questions. + +For ConvQuestions, crowd-workers wrote a 5-turn dialog in a predefined domain (e.g. Books or Movies). The dialogs are more realistic than in CSQA, however at the cost of a smaller dataset. + +As presented in Table 2, the datasets have different characteristics, which make them an interesting test bed to assess the generality of our approach. + +# 5.2 CSQA Experimental Setup + +Metrics To evaluate our grammar, we report the coverage, i.e. the percentage of training questions for which we found a candidate Logical Form. + +To evaluate the QA capabilities, we use the same metrics as in Saha et al. (2018). F1 Score is used for questions whose answers are entities, while accuracy is used for questions whose answer is + +boolean or numerical. We don't report results for "Clarification" questions, as this question type can be accurately modeled with a simple classification task, as reported in Appendix A. Similarly the average metric "Overall" (as defined in Saha et al. 2018) is not reported in Table 3, as it depends on "Clarification", but can be found in the Appendix. + +Baselines We compare our results with several baselines introduced in Section 2: D2A (Guo et al., 2018), D2A+ES (Shen et al., 2020), S2A+MAML (Guo et al., 2019a), and MaSP (Shen et al., 2019). + +# 5.3 ConvQuestions Experimental Setup + +Metrics We use the coverage as above, and the $\mathrm{P}@\mathrm{l}$ metric as defined in Christmann et al. (2019). + +**Baseline** The only baseline to our knowledge is CONVEX (Christmann et al., 2019), which casts the problem to a node classification task. For comparison, we tried to make our setup as close as possible to theirs, and refer to Appendix C.3 for details. + +Data augmentation Given the small size of the dataset, we merge it with two other data sources: CSQA, and 3.6M examples generated by random sampling. The latter are single-turn dialogs made from graph triplets, e.g. the triplet (Marie Curie, instance of, human) generates the dialog: $Q$ : Marie Curie instance of? A: Human. More details are given in Appendix B.3. The ConvQuestions dataset is upsampled to match the other data sources sizes. + +# 5.4 Named Entity Linking setup + +We tried to use a similar setup as baselines for fair comparison. For CSQA, the previous gold answer is given to the model in an oracle-like mode, as in baselines. In addition, we use simple string matching between utterances and names of Wiki-data entities to retrieve candidates that are given in input to the model. For ConvQuestions, we use the gold seed entity (as in the CONVEX baseline we compare with), and the Google Cloud NLP service. We refer to Appendices B.2 and B.4 for details. + +Regarding CARTON (Plepi et al., 2021), their results are not directly comparable as their model uses gold entity annotations as input and hence is not affected by NEL errors. This different NEL setup does have a strong influence on the performance, as running our model on CSQA with a setup similar to CARTON improves our Total Average score by over $10\%$ . We refer to Appendix D.2 for details. More generally, a more thorough study + +
CSQAConvQuestions
Average length of a dialog8 turns5 turns
Possible change of topic inside a conversationYesNo
Answer typeEntities, boolean, quantityEntities (usually a single one), boolean, date, quantity, string
Entity annotations in the datasetYes, with coreference resolutionOnly the seed entity (topic of the dialog) and the answer entities
Coreferences in questionsYes, to the previous turnYes, to any preceding turn
+ +Table 2: Some characteristics of the benchmark datasets. + +
MethodsD2AD2A+ESS2A+MAMLMaSPOAT (Ours)
Question type# ExamplesF1
Simple (Direct)82k91.4183.0092.6685.1882.69
Simple (Coreferenced)55k69.8364.6271.1876.4779.23
Simple (Ellipsis)10k81.9883.9482.2183.7384.44
Logical22k43.6272.9344.3469.0481.57
Quantitative9k50.2563.9550.3073.7574.83
Comparative15k44.2055.0548.1368.9070.76
Question type# ExamplesAccuracy
Verification (Boolean)27k45.0545.8050.1660.6366.39
Quantitative (Count)23k40.9441.3546.4343.3971.79
Comparative (Count)15k17.7820.9318.9122.2636.00
Total Average260k64.4764.7566.5470.5675.57
+ +of the impact of the NEL step on the end-to-end performance would be an interesting direction of future work (see also Section 5.6). + +# 5.5 Results + +Our grammar reaches high coverage. With approximately the same numbers of operators as in baselines, we improve the CSQA coverage by $16\%$ , as presented in Table 4. The improvement is particularly important for the most complex questions. We reach a coverage of $86.2\%$ on ConvQuestions, whose questions are more varied than in CSQA. + +Most queries can be expressed as relatively shallow LFs in our grammar, as illustrated by Table 5. This is especially interesting for the ConvQuestions dataset, composed of more realistic dialogs. On CSQA, the average depth of our LFs (2.9) is slightly slower than with D2A grammar (3.2). + +We improve the QA performance over baseline on both datasets. For CSQA, our model outper + +Table 3: QA performance on CSQA. The metric is the F1 score for question types above the vertical separator, and accuracy for those under. The Total Average score is an average over all question types. + +
Question typeD2AD2A+ESOurs
Comparative28.64584.9
Logical48.292100.0
Quantitative58.16291.1
Simple94.49699.7
Verification77.98591.4
Overall74.38096.2
+ +Table 4: Coverage per question type for CSQA. + +
Depth1234+
CSQA (D2A)0.047.030.922.0
CSQA (Ours)5.567.97.419.2
ConvQuestions53.943.72.40.0
+ +Table 5: Silver LF depth distribution for both datasets. + +
Domain1stturnFollow-upCONVEX
Books68.120.919.8
Movies54.231.325.9
Music37.518.119.0
Soccer43.822.818.8
TV66.331.817.8
Overall54.025.020.3
+ +forms baselines for all question types but Direct Simple questions, as shown in Table 3. Overall, our model improves the performance by $5\%$ . For Conv-Questions, Table 6 shows that our model improves over the baseline for all domains but one, yielding an overall improvement of $4.7\%$ . A precise evaluation of the impact of the various components of our KG-QA approach (grammar, entity linking, model inputs, model architecture, size of the training data, etc.) on the end-to-end performance was out of the scope of this paper, and is left for future work. Nevertheless, the fact that we are able to improve over baselines for two types of Simple questions and for Logical questions, for which the grammar does not matter so much, as these question types correspond to relatively shallow LFs, suggests that our proposed model architecture is effective. + +# 5.6 Error analysis + +CSQA By comparing the silver and the predicted LFs on 10k random errors, we could split the errors in two main categories: first, the LF general form could be off, meaning that the model did not pick up the user intent. Or the form of the LF could be right, but (at least) one of the tokens is wrong. Table 7 details the error statistics. The most frequent errors concern entity disambiguation. There are two types of errors: either the correct entity was not part of the model input, due to insufficient recall of the NEL system. Or the model picked the wrong entity from the input due to insufficient precision. It is known that the noise from NEL strongly affects model performance (Shen et al., 2019). We tried an oracle experiment with perfect recall NEL (see Appendix D.2), which corroborates this observation, in particular for Simple questions. As we focused on modeling complex questions, improving NEL was not our main focus, but would an interesting direction for future work, in particular + +via multi-task approaches (Shen et al., 2019). + +ConvQuestions We manually analyzed 100 examples. Errors were mostly due to the LF general form, then to a wrong property token. + +The model learns the grammar rules. In all inspected cases, the predicted LF is a valid LF according to the grammar, i.e. it could be evaluated successfully. This shows that grammar-guided decoding is not needed to achieve high performance. + +Table 6: ConvQuestions results by domain. The first two columns are our results. The baseline (Oracle+CONVEX) only reports follow-up turns. + +
Error categoryOverallSimple Dir.
LF general form31.824.1
Entity ID token36.238.2
insuff. recall17.116.8
insuff. precision19.621.6
Property ID token4.22.9
Class ID token24.737.6
Grammar token11.62.6
+ +Table 7: Distribution of errors in CSQA. The numbers are (non exclusive) percentages. We also report statistics for the Simple Direct type, as it is the largest. + +# 6 Conclusion + +For the problem of weakly-supervised conversational KG-QA, we proposed Object-Aware Transformer, a model capable of processing structured input in a JSON-like format. This allows to flexibly provide the model with structured KG contextual information. We also introduced a KG grammar with increased coverage, which can hence be used to model a wider range of queries. These two contributions are fairly independent: on the one hand, since the model predicts LFs as a list of tokens, it is grammar agnostic, and thus it could be used with another grammar. On the other hand, the grammar is not tied to the model, and can be used to generate training data for other model architectures. Experiments on two datasets validate our approach. We plan to extend our model with richer KG context, as we believe there is headroom for improvements. + +# Acknowledgments + +We thank Yasemin Altun, Eloise Berthier, Guillaume Dalle, Maxime Godin, Clément Mantoux, Massimo Nicosia, Slav Petrov, and anonymous reviewers, for their constructive feedback, and Daya Guo for providing results with the D2A grammar. P.M. was supported by a Corps des Mines stipend. + +# Ethical considerations + +This work is not connected to any specific real-world application, and solely makes use of publicly available data (KG and QA datasets). The predominant ethical concern of the paper is the computing power associated with the experiments. To limit the energy impact of the project, we did not perform hyper-parameter tuning for model training. Using the formulas from Patterson et al. (2021), we estimate the GHG emissions associated with one run of model training to be approximately $29 - 42\mathrm{kg}$ of CO2e. For the silver LF generation, we iterated on a small subset of the datasets, then computed the LFs for the entire datasets as a one-off task. + +# References + +M. Ahmed, M. R. Samee, and R. E. Mercer. 2019. Improving Tree-LSTM with Tree Attention. In 2019 IEEE 13th International Conference on Semantic Computing (ICSC), pages 247-254. +Ram G Athreya, Srividya K. Bansal, Axel-Cyrille Ngonga Ngomo, and Ricardo Usbeck. 2021. Template-based question answering using recursive neural networks. In 2021 IEEE 15th International Conference on Semantic Computing (ICSC), pages 195-198. +Ruisheng Cao, Su Zhu, Chenyu Yang, Chen Liu, Rao Ma, Yanbin Zhao, Lu Chen, and Kai Yu. 2020. Unsupervised dual paraphrasing for two-stage semantic parsing. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6806-6817, Online. Association for Computational Linguistics. +Xinyun Chen, Chang Liu, and Dawn Song. 2018. Tree-to-tree neural networks for program translation. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, Canada, pages 2552-2562. +Philipp Christmann, Rishiraj Saha Roy, Abdalghani Abujabal, Jyotsna Singh, and Gerhard Weikum. 2019. Look before you hop: Conversational question answering over knowledge graphs using judicious context expansion. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, CIKM 2019, Beijing, China, November 3-7, 2019, pages 729-738. ACM. +William W. Cohen, Matthew Siegler, and Alex Hofer. 2019. Neural Query Language: A Knowledge Base Query Language for Tensorflow. Computing Research Repository, arXiv:1905.06209. +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. +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 (Volume 1: Long Papers), pages 33-43, Berlin, Germany. Association for Computational Linguistics. +Li Dong and Mirella Lapata. 2018. Coarse-to-fine decoding for neural semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 731-742, Melbourne, Australia. Association for Computational Linguistics. +Daya Guo, Duyu Tang, Nan Duan, Ming Zhou, and Jian Yin. 2018. Dialog-to-action: Conversational question answering over a large-scale knowledge base. 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 2946-2955. +Daya Guo, Duyu Tang, Nan Duan, Ming Zhou, and Jian Yin. 2019a. Coupling retrieval and meta-learning for context-dependent semantic parsing. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 855-866, Florence, Italy. Association for Computational Linguistics. +Jiaqi Guo, Zecheng Zhan, Yan Gao, Yan Xiao, Jian-Guang Lou, Ting Liu, and Dongmei Zhang. 2019b. Towards complex text-to-SQL in cross-domain database with intermediate representation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4524-4535, Florence, Italy. Association for Computational Linguistics. +William L. Hamilton, Zhitao Ying, and Jure Leskovec. 2017. Inductive representation learning on large graphs. 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 1024-1034. +Jacob Harer, Chris Reale, and Peter Chin. 2019. TreeTransformer: A Transformer-Based Method for Correction of Tree-Structured Data. Computing Research Repository, arXiv:1908.00449. +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. +Wonseok Hwang, Jinyeong Yim, Seunghyun Park, and Minjoon Seo. 2019. A Comprehensive Exploration on WikiSQL with Table-Aware Word Contextualization. Computing Research Repository, arXiv:1902.01069. Version 2. Presented at KR2ML Workshop at NeurIPS 2019. +Robin Jia and Percy Liang. 2016. Data recombination for neural semantic parsing. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 12-22, Berlin, Germany. Association for Computational Linguistics. +Endri Kacupaj, Joan Plepi, Kuldeep Singh, Harsh Thakkar, Jens Lehmann, and Maria Maleshkova. 2021. Conversational question answering over knowledge graphs with transformer and graph attention networks. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 850-862, Online. 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. +Thomas N. Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +Shucheng Li, Lingfei Wu, Shiwei Feng, Fangli Xu, Fengyuan Xu, and Sheng Zhong. 2020. Graph-to-tree neural networks for learning structured input-output translation with applications to semantic parsing and math word problem. In *Findings of the Association for Computational Linguistics: EMNLP* 2020, pages 2841-2852, Online. Association for Computational Linguistics. +Chen Liang, Jonathan Berant, Quoc Le, Kenneth D. Forbus, and Ni Lao. 2017. Neural symbolic machines: Learning semantic parsers on Freebase with weak supervision. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 23-33, Vancouver, Canada. Association for Computational Linguistics. +David Patterson, Joseph Gonzalez, Quoc Le, Chen Liang, Lluis-Miquel Munguia, Daniel Rothchild, David So, Maud Texier, and Jeff Dean. 2021. Carbon emissions and large neural network training. Computing Research Repository, arXiv:2104.10350. + +Joan Plepi, Endri Kacupaj, Kuldeep Singh, Harsh Thakkar, and Jens Lehmann. 2021. Context transformer with stacked pointer networks for conversational question answering over knowledge graphs. In *The Semantic Web*, pages 356-371, Cham. Springer International Publishing. +Amrita Saha, Ghulam Ahmed Ansari, Abhishek Laddha, Karthik Sankaranarayanan, and Soumen Chakrabarti. 2019. Complex program induction for querying knowledge bases in the absence of gold programs. Transactions of the Association for Computational Linguistics, 7:185-200. +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 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 705-713. AAAI Press. +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 The Semantic Web, Proceedings of the 15th International Conference, ESWC 2018, pages 593-607, Heraklion, Crete, Greece. Springer, Cham. +Peter Shaw, Philip Massey, Angelica Chen, Francesco Piccinno, and Yasemin Altun. 2019. Generating logical forms from graph representations of text and entities. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 95-106, Florence, Italy. Association for Computational Linguistics. +Tao Shen, Xiubo Geng, Guodong Long, Jing Jiang, Chengqi Zhang, and Daxin Jiang. 2020. Effective search of logical forms for weakly supervised knowledge-based question answering. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020, pages 2227-2233. ijcai.org. +Tao Shen, Xiubo Geng, Tao Qin, Daya Guo, Duyu Tang, Nan Duan, Guodong Long, and Daxin Jiang. 2019. Multi-task learning for conversational question answering over a large-scale knowledge base. 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 2442-2451, Hong Kong, China. Association for Computational Linguistics. +Vighnesh Leonardo Shiv and Chris Quirk. 2019. Novel positional encodings to enable tree-based transformers. 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 12058-12068. + +Kai Sheng Tai, Richard Socher, and Christopher D. Manning. 2015. Improved semantic representations from tree-structured long short-term memory 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 1556–1566, Beijing, China. Association for Computational Linguistics. + +Raghuveer Thirukovalluru, Mukund Sridhar, Dung Thai, Shruti Chanumolu, Nicholas Monath, Sankaranayanan Ananthakrishnan, and Andrew McCallum. 2021. Knowledge informed semantic parsing for conversational question answering. In Proceedings of the 6th Workshop on Representation Learning for NLP (RepL4NLP-2021), pages 231-240, Online. Association for Computational Linguistics. + +Peihao Tong, Qifan Zhang, and Junjie Yao. 2019. Leveraging Domain Context for Question Answering Over Knowledge Graph. Data Science and Engineering, 4(4):323-335. + +Svitlana Vakulenko, Javier David Fernandez Garcia, Axel Polleres, Maarten de Rijke, and Michael Cochez. 2019. Message passing for complex question answering over knowledge graphs. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, CIKM 2019, Beijing, China, November 3-7, 2019, pages 1431-1440. ACM. + +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. + +William Woof and Ke Chen. 2020. A Framework for End-to-End Learning on Semantic Tree-Structured Data. Computing Research Repository, arXiv:2002.05707. + +Kun Xu, Lingfei Wu, Zhiguo Wang, Mo Yu, Liwei Chen, and Vadim Sheinin. 2018. Exploiting rich syntactic information for semantic parsing with graph-to-sequence model. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 918-924, Brussels, Belgium. Association for Computational Linguistics. + +Hamid Zafar, Giulio Napolitano, and Jens Lehmann. 2019. Deep Query Ranking for Question Answering over Knowledge Bases. In Machine Learning and Knowledge Discovery in Databases, Proceedings of the European Conference, ECML PKDD 2018, Lecture Notes in Computer Science, pages 635-638, Dublin, Ireland. Springer International Publishing. + +Jiawei Zhang, Haopeng Zhang, Congying Xia, and Li Sun. 2020. Graph-Bert: Only Attention is Needed for Learning Graph Representations. Computing Research Repository, arXiv:2001.05140. Version 2. + +# A Clarification Questions in CSQA + +Take the following dialog as example: + +
T1Can you tell me which cities border Verderio Inferiore? +Cornate d’Adda, Bernareggio, Robbiate
T2And which cities flank that one? +Did you mean Robbiate?
T3No, I meant Cornate d’Adda. +Bottanuco, Busnago, Trezzo sull’Adda
+ +The second turn is a "Clarification" question: the system asks the user for disambiguation. The disambiguation question usually takes the form "Did you mean", followed by an entity chosen among the previous turn answers. This choice appears to be entirely random. For this reason, we found that it would not be very interesting to try to predict this entity, as baselines propose. Hence we only ask the model to predict that the question is a Clarification (via a special clarification operator). + +We report in Table 8 the scores for Clarification questions, as well as the "Overall" score, as defined in Saha et al. (2018). The results are not directly comparable as the baseline systems report an F1 score, while our approach uses accuracy. + +# B Detailed experimental setup + +# B.1 Meta-operators + +Take the example given in the main paper: "Which musical instrument is played by the maximum number of persons?" The corresponding LF is: + +```txt +argmax( cardinality( follow_property( for_each( members(musical instrument)), played by))) +``` + +Assume that the KG contains exactly two musical instruments, piano and violin, i.e. members(musical instrument) equals {piano, violin}. + +for_each creates a dictionary of entities. Each (key, value) pair corresponds to one entity in the argument of for_each, where the key is the entity itself and the value is a singleton set + +
Question type# ExamplesD2AD2A+ESS2A+MAMLMaSPOAT (Ours)
Clarification12k18.3136.6619.1280.7999.63
Overall206k62.8872.02N/R79.2681.49
+ +Table 8: QA performance on CSQA, including "Clarification" questions. The "Overall" metric is the average F1 scores of the following question types: "Simple (Direct)", "Simple (Coreferenced)", "Simple (Ellipsis)", "Logical", "Quantitative", "Comparative" and "Clarification". + +containing the entity. Here for_each(\{piano, violin\}) gives the following dictionary: + +{piano:{piano},violin:{violin} + +We then apply the same computation to each of the dictionary values, while keeping the keys untouched. In our example, we apply the expression cardinality( + +follow_backward(., played by), + +which gives the result + +{piano: 20392, violin: 7918}. + +Finally, an aggregation operator is computed over the values, and the result is a subset of the keys. argmax returns the set of keys associated with the maximum values, in our example {piano}. In other cases, we want to return all the keys associated to a non-empty value, arg allows to do so. + +# B.2 Silver LF generation + +Wikidata version For CSQA, we used the preprocessed version of Wikidata made available by the authors, which contains 21.2M triplets over 12.8M entities and 567 distinct properties. For ConvQuestions, we used a more recent version of Wikidata, containing 1.1B triplets over 91.8M entities and 7869 distinct properties. + +Named Entity Linking For ConvQuestions, we use gold entity annotations and Google Cloud NLP entity linking service. For CSQA, we use gold entity annotations. + +To resolve the coreferences, in ConvQuestions, we use entity annotations from previous utterances during the silver LF generation step. In CSQA, since coreferences are already resolved by the gold annotations, we just use annotations from the current utterance. + +Simplifying the BFS We observed that reaching a depth of $4+$ is needed for some queries (see Table 5 of the main paper), but is impractical by exhaustive BFS, as the size of the space of LFs grows very quickly with their depth. To improve the efficiency, we used the following ideas: + +- Stopping criteria to abort the exploration: timeout $t_{\mathrm{max}}$ and maximum depth $d_{\mathrm{max}}$ . + +- Type checking: by leveraging the operators' signatures (presented in Table 1 of the main paper), we only construct legal LFs. + +- Putting constraints on the form of the LF: we manually forbid certain combinations of operators, e.g. follow_backward after follow_property. + +- Restriction of the list of operators: for ConvQuestions, we use the graph operators, the numerical operators, is_in, and get_first. The removal of some set operators and of meta-operators strongly reduces the complexity of the BFS. For CSQA, all operators are needed, but we add more constraints to keep the BFS simple enough. + +We choose $d_{\mathrm{max}} = 3$ for ConvQuestions and $d_{\mathrm{max}} = 7$ for CSQA, and $t_{\mathrm{max}} = 1200$ seconds. + +All LFs found by BFS are evaluated over the KG, which gives candidate answers. We keep the LFs whose candidate answers have the highest F1 score w.r.t. the gold answer. The minimal F1 score for keeping a LF is 0.3. + +Scores for LF ranking The BFS often returns several LFs (with the top F1 score, as explained above), among which some are spurious: they do not correspond to the semantic meaning of the question, but their evaluation over the KG yields the correct result by chance. As we keep only one for training, we need a way to rank the candidate LFs. We use the following heuristic scores to do so: + +- Complexity: the score is $1 - \frac{(d - 1)}{(d_{\max} - 1)}$ where $d$ is the depth of the LF and $d_{\max}$ is defined above. + +- Property lexical matching: for each property appearing in the LF, we compute the Jaccard index of the words appearing in its name and of the words of the question. + +- Annotation coverage: among the entities retrieved by NEL, we compute the percentage of entities which appear in the LF. + +As these three scores are between 0 and 1, we average them and keep the LF with the highest total score. We found that this simple method is a good way to reduce spurious LFs, which are often either too complex or not matching lexically the question. + +# B.3 Random examples generation + +To generate the random examples for data augmentation for ConvQuestions training, we first sample uniformly 80k entities from the graph. Then, for each entity, we generate a conversation for each triplet that links it to other entities. The question text is made by stitching the entity name and the property name. For instance, the triplet (Marie Curie, native language, Polish) generates the dialog: $Q$ : Marie Curie native language? A: Polish. We also generate variants where the property name is replaced by aliases, which are alternative names in Wikidata, for example mother tongue for native language. When the question or answer has more than 256 characters, we eliminate it. + +# B.4 Modeling + +# Wikidata version As in B.2. + +Named Entity Linking NEL is performed again, this time to create the structured context in input to the model. Due to the randomization step described in Section 4.2, missing entities in the input cannot be retrieved by the model, so we want to have a high NEL recall. The trade-off is that the NEL precision is low: we have many spurious entities in the input, which the model has to learn to ignore. + +For CSQA, we use simple string matching between the utterances and the names of Wikidata entities. Note that in our model, as well as in all CSQA baselines (in particular Guo et al., 2018; Shen et al., 2019), the previous gold answer is given as input to the model in an oracle-like setup. + +For ConvQuestions, we use the gold seed entity and the Google Cloud NLP entity linking service. + +To resolve coreferences, we use entities from the dialog history: all preceding turns for ConvQuestions and only the previous turn for CSQA. + +Implementation details We tokenize the input using the BERT-uncased tokenizer. All embeddings in the model have dimension 768. The two + +transformer encoders share the same configuration: 2 layers each, with output dimension 768, intermediate dimension 2048, 12 attention heads, and dropout probability set to 0.1. The model has 260M parameters. The transformer implementation is based on publicly available BERT code. We initialize the word embedding from a BERT checkpoint, but do not load the transformer layer weights, instead training them from scratch. We train for 600k steps with batch size 128, using the ADAM optimizer (Kingma and Ba, 2015) with learning rate $3 \times 10^{-5}$ . Training takes around 14 hours on 16 TPU v3 with 32 cores. + +# C Comparison with baselines + +# C.1 Comparison with D2A grammar + +The D2A (Guo et al., 2018) grammar is the main baseline in previous KG-QA works. We compare with the grammar implemented in their open-sourced code4, which is a bit different from the published one. Numbers for D2A in Tables 4 and 5 were computed thanks to the results of the BFS gracefully provided by the authors. + +Table 9 presents some intents which we are able to model in our grammar and are not straightforward to model with D2A grammar. First, textual form reasoning corresponds to questions about string attributes of entities, which are not included in the D2A grammar. Second, to handle numerical and temporal reasoning, computations based on numerical values are needed, which is not possible with the D2A grammar. Finally, the D2A grammar does not model the order of relations in the graph and the selection of class members, which we start to tackle with respectively the get_first and members operators. + +# C.2 Comparison with MaSP architecture + +MaSP (Shen et al., 2019) also follows the semantic parsing approach, where the LF is encoded as a sequence of operators and graph items IDs. Regarding the model input, they only use the utterances, whereas we add additional KG context structured as a JSON tree. The training method differs: MaSP uses multi-task learning to learn jointly entity linking and semantic parsing, whereas we chain both, and trust the model to pick the good entity. Our approach is simpler in this regard, but we pay it by + +
IntentQuestion exampleMissing in D2A
Textual form reasoningWhat was Elvis Presley given name?string type
Numerical reasoningWhat actor plays the younger child?get_value, for_each, argmin
Numerical reasoningHow old is the younger child?min
Selection of the members of a classWhich television programs have been dubbed by at least 20 people ?members
Temporal reasoningWhat is the number of seasons until 2018?for_each, get_value, lesser Than, arg
Ordinal reasoningWhat was the first episode date?get_first
+ +having a slightly lower performance on Simple Direct questions (see Table 3). Finally, we do not use beam search for the decoding, contrarily to them. + +# C.3 Comparison with node classification + +An alternative to the semantic parsing approach is to train classifiers to predict entities as nodes of the KG. A precise comparison of both approaches is out of the scope of this paper. Nevertheless, we think that the semantic parsing approach is better suited to our purpose of modeling complex questions. For instance, complex intents involving numerical comparisons can be expressed naturally by a LF, but would be difficult to perform using solely node classifiers. Examples include the numerical and temporal reasoning in Table 9. Additional examples include The series consists of which amount of books? (ConvQuestions) or Which television programs have been dubbed by at least 20 people?, How many episodes is it longer than the second longest season out of the three? (CSQA). + +CONVEX (Christmann et al., 2019) is an example of such an approach. It is an unsupervised graph exploration method: at each turn, a subgraph is expanded by matching the utterance with neighboring entities. Then a candidate answer is found in the subgraph by a node classifier. On our side, we propose a semantic parsing approach that makes use of entities annotated by an external entity linking service. This is a similar setup to the CSQA baselines (Shen et al., 2019), which we re-purposed for ConvQuestions in order to assess the quality of our proposal on another dataset. In order to be closer to the CONVEX baseline, we changed our CSQA setup by applying the entity linker only to the questions' text and not to the answers' text. In addition, + +Table 9: Examples of questions that are difficult to model with the D2A grammar. Examples are mostly chosen from ConvQuestions, as their questions look more realistic than CSQA. + +
DomainCoverage
Books88.6
Movies87.6
Music90.0
Soccer78.6
TV86.2
Overall86.2
+ +Table 10: ConvQuestions coverage per domain. + +as we use the gold seed entity, we compare with the Oracle+CONVEX setup of Christmann et al. (2019), which also uses the gold seed entity (and the gold first turn answer entity). Finally, we make use of data augmentation to train our model on ConvQuestions, whereas the baseline does not. + +# C.4 BERT or no BERT, that is the question + +The baselines of Table 3 do not use BERT. MaSP authors provide a variant of their model using a fine-tuned BERT base architecture. The Total Average score of this variant is $72.60\%$ , which is $2\%$ above their vanilla variant and $3\%$ under our model. Since we are only using the word embeddings (loaded from a publicly available BERT base checkpoint) and not loading the transformer layer weights, we decided to compare with the vanilla variant of MaSP. Finally, CARTON is using a pretrained BERT base model as a sentence encoder. + +# D Additional results + +# D.1 Coverage and performance results + +Table 10 shows the coverage per domain for Conv-Questions. Regarding the evolution of the coverage over turns, it is stable for both datasets, hence we + +do not report this result. + +Tables 11 and 12 show the evolution of the performance over turns for both datasets. For CSQA, the performance drops after the first two turns, then remains constant. For ConvQuestions, the performance decreases throughout the turns. There is a sharp decrease after the first turn, probably because it is simpler as there is no coreference or ellipsis. The different behavior between the datasets may be due to the realism of ConvQuestions. + +
Turns01234
Score8587757474
Turns5-67-89-1011-1213+
Score7575757474
+ +Table 11: Average performance over turns for CSQA. For brevity, we average over turn ranges after turn 5. + +
Turn01234
Av. P@15435202915
+ +# D.2 Oracle setup and CARTON comparison + +CARTON (Plepi et al., 2021) gives the entities annotated in the dataset as part of the model input (entities appearing in the previous turn and in the current question), contrarily to the models in Table 3 which all use an entity linker. For a fair comparison, we tested our model in an oracle setup, where we also give the gold annotations as input. As shown in Table 13, the Total Average score of our model increases by $10\%$ w.r.t. the baseline approach. The improvement is particularly important for the most simple question types (Simple and Logical Questions). In this setup, our performance is $8\%$ higher than CARTON, and we obtain a better score for 7 out of 10 question types. + +# D.3 Further error analysis + +An alternative approach for error analysis is to assess the performance of the decoding classifiers (see Section 4.5) in a teacher forcing setup, i.e. to assess how often they predict the next token correctly, given the true previous tokens. Table 14 reports the results on the eval split of both datasets. + +Table 12: Performance over turns for ConvQuestions. + +
Question typeCARTONOurs
Simple (Direct)85.9296.95
Simple (Coreferenced)87.0994.77
Simple (Ellipsis)85.0796.66
Logical80.8095.54
Quantitative80.6276.44
Comparative62.0076.66
Verification (Boolean)77.8267.02
Quantitative (Count)57.0475.89
Comparative (Count)38.3135.10
Total Average77.8985.85
+ +Table 13: QA performance on CSQA in oracle mode. + +
MetricCSQAConvQuestions
Token type99.8894.77
Grammar token98.8682.12
Entity ID92.4750.79
Property ID99.4530.26
Class ID94.64N/A
Numerical value99.91N/A
Avg. token97.7061.53
+ +Table 14: LF token accuracy metrics, on the eval splits. For ConvQuestions, Class ID, numerical value and their relative operators are not used (see B.2). + +The results corroborate the analysis presented in Section 5.6. First, the model learns the grammar rules, as it nearly always predicts the good token type. For CSQA, the most frequent errors concern entity ID and class ID. For ConvQuestions, they concern primarily entities and properties. + +# D.4 Case study + +Table 15 presents examples from ConvQuestions where we are able to predict the good LFs, although there exists very similar properties in the graph. The textual forms of the questions are not sufficient to infer the good property to use, implying that the model had to learn elements from the graph structure in order to answer correctly these questions. Nevertheless, Table 14 shows that there is still significant room for improvement in that direction. + +
QuestionProperty
When did Seinfeld first air?start time (P580)
When did Camp Rock come out?publication date (P577)
Who screen wrote it?screenwriter (P58)
Who wrote it?author (P50)
What country are they from?country (P17)
Belleville of which country?country (P17)
What country did the band Black Sabbath originally come from?country of origin (P945)
What country is Son Heung-min from originally?country for sport (P1532)
+ +Table 15: Examples of ConvQuestions questions for which the model was able to pick up the good property, although there are very similar properties in the graph. \ No newline at end of file diff --git a/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/images.zip b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5113ab9cd1ee6e0aef1d39b654e4de7c39cfb77d --- /dev/null +++ b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8290848306bf036c3f39545abf6e1672d1b48bef7fa97774be315b195071a05f +size 886889 diff --git a/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/layout.json b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..3d8a55d7689bb0c22040d83cf973de6c2557a0a9 --- /dev/null +++ b/structuredcontextandhighcoveragegrammarforconversationalquestionansweringoverknowledgegraphs/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81a0d8b40a823584c0c78ac11b0229c5f718fa68d49f442a2efda1be169735b8 +size 504430 diff --git a/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_content_list.json b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..21ef1f36a653c7699cafaec1eaa45bfeb34a879f --- /dev/null +++ b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ae6d92e76ba24efc0a3c5910ce0657ba62512a15e1efd1fac2e6b8c507c3b1a +size 37098 diff --git a/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_model.json b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..57cf7b1e07eba1d08da07fcfa50800145fc3b17c --- /dev/null +++ b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65dfcafb6d5828332dfbf2b456c9be6a53d1c207bde7069f34ccf857f3e9a938 +size 44926 diff --git a/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_origin.pdf b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6d23d5663184e9eda6f5b78a81b69ea727baf663 --- /dev/null +++ b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/20e69bec-9488-4ee6-9d6a-6952cd0f2f8d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02c6bbf27f642c75d1e4410e43e890a5ba505715fd9a51317fbc7f1cfcdc8b58 +size 194581 diff --git a/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/full.md b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b6d9e3994ae5253ddf65cba6c39e545ff76934a5 --- /dev/null +++ b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/full.md @@ -0,0 +1,134 @@ +# Students Who Study Together Learn Better: On the Importance of Collective Knowledge Distillation for Domain Transfer in Fact Verification + +Mitch Paul Mithun, Sandeep Suntwal, Mihai Surdeanu + +University of Arizona, Tucson, Arizona, USA + +{mithunpaul,sandeepsuntwal,msurdeanu}@email.arizona.edu + +# Abstract + +While neural networks produce state-of-the-art performance in several NLP tasks, they depend heavily on lexicalized information, which transfers poorly between domains. Previous work (Suntwal et al., 2019) proposed delexicalization as a form of knowledge distillation to reduce dependency on such lexical artifacts. However, a critical unsolved issue that remains is how much delexicalization should be applied? A little helps reduce over-fitting, but too much discards useful information. We propose Group Learning (GL), a knowledge and model distillation approach for fact verification. In our method, while multiple student models have access to different delexicalized data views, they are encouraged to independently learn from each other through pair-wise consistency losses. In several cross-domain experiments between the FEVER and FNC fact verification datasets, we show that our approach learns the best delexicalization strategy for the given training dataset and outperforms state-of-the-art classifiers that rely on the original data. + +# 1 Introduction + +Neural networks have achieved state-of-the-art (SOTA) performance across many natural language processing (NLP) tasks, usually in supervised settings. + +However, it has been shown that there are limitations to these methods caused in part by their over-fitting on statistical and lexical nuances (or artifacts) specific to a dataset (Gururanan et al., 2018), which prevent them from transferring well across domains. A key solution to this problem is to not let these models rely on such dataset artifacts and instead encode the true underlying semantics of the dataset. Also, in recent years fact verification has emerged as a critical task with important societal implications (Vosoughi et al., 2018). Formally, the task is defined as: given a pair of claim and evidence texts, determine if the evidence supports or + +rejects the claim, or does not have enough information to reach a conclusion. Several fact verification datasets have been proposed recently, based on real-world news articles (Pomerleau and Rao, 2017), Wikipedia based knowledge bases (Thorne et al., 2018), fact verification websites (Wang, 2017), etc. Several transformer networks (Vaswani et al., 2017) based approaches (Liu et al., 2020) have achieved SOTA performance on these tasks. + +However, as shown in (Panenghat et al., 2020; Karimi Mahabadi et al., 2020; Gururangan et al., 2018), these models are also similarly affected by syntactic and lexical artifacts seen in other NLP tasks. Specifically, (Suntwal et al., 2019) shows the presence of such artifacts in the Fact Extraction and Verification (FEVER) dataset (Thorne et al., 2018), along with demonstrating that this limits the ability of the trained models to transfer knowledge to other similar datasets such as the Fake News Challenge (FNC) dataset (Pomerleau and Rao, 2017). To mitigate this dependency on such artifacts, they proposed a data distillation (or delexicalization) approach, which replaces some lexical artifacts such as named entities with their type and a unique id to indicate the occurrence of the same artifact in claim and evidence. + +A key unresolved issue in this direction is how much delexicalization to apply. As indicated in previous work (Suntwal et al., 2019; Mithun et al., 2021), delexicalization reduces overfitting. But too much delexicalization may discard critical information, e.g., replacing India with its NE label, say LOCATION, may remove contextual information about the country that is necessary for the correct classification of the claim-evidence pair. Our work proposes a solution for this problem, with the following contributions: + +(1) Inspired by teacher-student architectures (Tarvainen and Valpola, 2017; Rasmus et al., 2015), we propose a novel architecture that combines data distillation with model distillation to improve cross + +domain performance of neural networks. In particular, our approach relies on multiple students that have access to different delexicalized views of the data but are encouraged to learn from each other through pair-wise consistency losses. We call our approach Group Learning (GL). Once training completes, the student with the best performance is kept for evaluation purposes. Because we rely on a single model at evaluation time, our approach has the same evaluation run time cost as a single classifier. Note that our method can be seen as an inverse of an ensemble strategy, which trains individual models separately but applies them jointly. GL scales better at inference time due to its reliance on a single model at that stage. + +(2) We implemented a GL architecture for fact verification using BERT (Devlin et al., 2019), as the classifier, and multiple delexicalized views of the data using FIGER (Ling and Weld, 2012) and CoreNLP (Manning et al., 2014) NER systems. We evaluated the domain transfer of the proposed method using two fact verification datasets: FEVER and FNC. Our results show that our method achieves a cross-domain accuracy of $73.06\%$ when trained on FEVER and tested on FNC, and $74.46\%$ in the other direction, outperforming other stand-alone trained methods that rely on the lexicalized data. Importantly, our approach chooses different students in each direction, highlighting different properties of the respective training datasets. + +# 2 Methodology + +# 2.1 Data Distillation + +Based on the findings of (Suntwal et al., 2019) that named entities (NEs) are most likely to overfit in a fact verification task, we delexicalize our data by replacing NEs with their semantic classes (and a unique id). To detect and replace named entities with their most specific label returned by the Named Entity Recognizer (NER), we use their solution of Overlap Aware (OA-NER), which relies on CoreNLP (Manning et al., 2014) NE labels. In addition, we propose two new delexicalization approaches based on the FIGER-NER (Ling and Weld, 2012): + +FIGER Abstract : Replaces NEs with the most abstract classes returned by the FIGER NER, (e.g., LOCATION for Los Angeles). + +![](images/2b711b9739c3bfef173e2b703fe11b0c12ad51832497bcd80deae739642c05ec.jpg) +Figure 1: The multiple-student architecture for knowledge distillation. + +FIGER Specific : Uses the most specific classes returned by the FIGER NER, (e.g., CITY for Los Angeles.) + +# 2.2 Model Distillation + +We propose a combined distillation strategy to mitigate the risk of distilling the data at the incorrect granularity (overly aggressive or too conservative). Specifically, we introduce a Group Learning architecture (shown in Figure 1), inspired from the teacher-student paradigm (Hinton et al., 2015; Tarvainen and Valpola, 2017; Laine and Aila, 2016; Sajjadi et al., 2016). In this architecture, each student method is trained on two techniques: + +(a) Different versions of the same dataset, each delexicalized differently by using different data distillation techniques mentioned above. +(b) The distributions of predictions of other models. + +This combined methodology of knowledge distillation encourages students to learn as much as possible from their views of the data while jointly learning with other students. Training together on the soft labels (distribution of predictions) of other student methods acts as a form of regularization between all methods. More formally, each student component includes a regular classification loss (implemented using cross-entropy) on their respective data. Additionally, each has a consistency loss + +
ClaimEvidence
Plain textJ. R. R. Tolkien created Gimli .A dwarf warrior , he is the son of Góin -LRB- a character from Tolkien's earlier novel, The Hobbit -RRB- . Gimli is a fictional character from J. R. R. Tolkien s Middle-earth legendary, featured in The Lord of the Rings .
OA-NERpersonC1 created personC2.A dwarf warrior, he is the son of personE1 -LRB- a character from personC1's earlier novel, The Hobbit -RRB- . personC2 is a fictional character from personC1's locationE1 legendary, featured in The Lord of the Rings .
FIGER SpecificauthorC1 created locationC1.A dwarf warrior, he is the son of personE1 -LRB- a character from authorE1's earlier novel, The Hobbit -RRB- . locationC1 is a fictional character from authorC1's written_workE1 legendary, featured in The Lord of the Rings .
FIGER AbstractpersonC1 created locationC1.A dwarf warrior, he is the son of personE1 -LRB- a character from personC1's earlier novel, The Hobbit -RRB- . locationC1 is a fictional character from personC1's written_workE1 legendary, featured in The Lord of the Rings .
+ +Table 1: The claim and evidence before and after the data distillation process, along with the distillation technique used. Note that we used actual NERs, which are imperfect tools, to generate these views. + +between all other methods that minimize the difference in predicted label distributions. + +The intuition behind our approach is that by providing multiple data distillation options to choose from, we encourage the student methods to 'pull' towards each other and the original underlying semantics. The part of semantic knowledge that is obscured from a student method due to the particular delexicalization technique used in the dataset version it sees is instead learned in its effort to perform on par with other methods. Thus, similar to a classroom environment where the students learn from both known labels (e.g., a textbook) and by helping another student learn, each student can thus choose the right amount of granularity needed to enhance its understanding. + +# 2.3 Classifiers + +We use BERT (Devlin et al., 2019) as the pretrained model used in all our experiments since it has achieved SOTA results in many NLP tasks, including fact verification. Specifically, we experiment with two variants, BERT-Base, and Mini BERT (Turc et al., 2019), a light-weight version of BERT, both from the Hugging Face repository (Wolf et al., 2019). + +# 3 Experiments + +Data: We use two distinct fact verification datasets for our experiments, The Fact Extraction and Verification (FEVER) dataset (Thorne et al., 2018) and the Fake News Challenge (FNC) dataset (Pomerleau and Rao, 2017). + +The FEVER dataset consists of 145,449 data points, each having a claim and evidence pair. These claim-evidence pairs typically contain one + +or more sentences compiled from Wikipedia using an information retrieval (IR) module and are classified into three classes: supports, refutes and not enough information. The evidence for data points that had the gold label of not enough information were retrieved (using a task-provided IR component) either by finding the nearest neighbor to the claim or randomly. Even though the training partition of the FEVER dataset was publicly released, the gold test labels used in the final shared task were not. We therefore built our own test partition by dividing the randomized training partition into $80\%$ (119,197 data points) and $20\%$ (26,252 data points). + +The FNC dataset comprises claim-evidence pairs that were divided into four classes, agree, disagree, discuss and unrelated. These claim-evidence pairs were created using the headlines and content section of real news articles, respectively. While the training partition of the publicly available dataset comprised 49,972 data points, the testing partition had 25,413 data points. We further divided the training partition into 40,904 data points for training and 9,068 data points for development. + +In order to evaluate the proposed methods in a cross-domain setting, we modified the label space of the source domain to match that of the target domain as done in (Suntwal et al., 2019). + +Setting: In all the experiments, the performance of the underlying method on the respective original, lexicalized data is considered as the baseline. In the baseline model, we use the default hyper parameters from Hugging Face. We focus our analysis on cross-domain evaluation, i.e., we train all methods on one dataset (e.g., FEVER) and evaluate their accuracy on the other dataset (e.g., FNC). At the + +end of the training, the best student model from the list of all the trained models is saved to be used for evaluation. + +
Configuration
Train EvalFEVER FEVERFEVER FNCFNC FNCFNC FEVER
Decomposable Attention Lex Decomposable Attention Delex83.43%48.86%68.99%41.16%
75.26%46.71%45.51%51.77%
Mini BERT Lex Mini BERT GL83.86%69.50%89.33%54.11%
83.74%73.06%*89.72%74.46%*
BERT-Base Cased Lex BERT-Base Cased GL90.88%66.68%99.21%73.78%
84.88%75.37%*97.07%75.51%
BERT-Base Un-cased Lex BERT-Base Un-cased GL91.95%64.21%99.45%76.59%
86.12%73.61%*98.42%77.67%
+ +Table 2: In-domain and cross-domain accuracies for various methods. All scores reported are averaged across three random seeds. "Lex" is the stand alone model trained on the original lexicalized data; "GL" denotes the student in the proposed multi-student 'Group Learning' architecture. Decomposable Attention Delex refers to the best performing model in (Suntwal et al., 2019), a stand alone decomposable attention model (Parikh et al., 2016) which was trained on data that was delexicalized using the OA-NER and Super Sense tagging techniques. * indicates that the corresponding result is significantly better than its baseline ("lex" in the same column), under a bootstrap resampling test with 1,000 samples, and $p$ -value $< 0.05$ . + +# 4 Results + +Table 2 summarizes our results. We focus on two sets of experiments using each training method and setting: in-domain (columns 2 and 4) and cross-domain (columns 3 and 5). For comparison purposes, we also show the results from (Suntwal et al., 2019) where a decomposable attention model was used for the same experiments. As shown in Table 2, although all the baseline models perform well $(83.43\% - 99.45\%)$ in-domain, they transfer poorly when evaluated cross-domain where up to $35\%$ drop in performance is observed. This verifies our findings that the signal the model learns from the un-masked text does not generalize well between domains. On the other hand, we observe a marginal in-domain drop in performance for the student models trained on the GL architecture (e.g., $6\%$ in the FEVER/FEVER setting for BERT-Base + +Cased) compared to their lexical counterparts. This indicates that GL models retain most signal from lexical data. Importantly, the GL models perform considerably better than their corresponding lexical versions across domain (e.g., up to $20.35\%$ improvement in the FNC/FEVER setting for MiniBERT). This demonstrates that data distillation and model distillation can be successfully combined as a strategy to improve domain transfer of fact verification methods. + +# 5 Discussion and Conclusion + +Previous work (Suntwal et al., 2019) has shown that delexicalization is useful in learning domain transferable knowledge. However, the level of delexicalization suitable for each task is unclear. In this work, we provide multiple delexicalization choices to neural network models and encourage them to choose the most appropriate choice. We suspect this approach acts as regularization (through the consistency losses), as well as a form of data noise (because of the imperfect NERs), which has been shown to aid in knowledge distillation paradigms (Hinton et al., 2015; Tarvainen and Valpola, 2017). + +Also, note that the BERT models perform better than the decomposable attention (DA) (Parikh et al., 2016) model in most of the cases, especially in the FNC dataset. More importantly, the cross-domain performance gain when using BERT with the proposed group learning architecture is higher than that achieved by the decomposable attention model. This is likely caused by three reasons. First, BERT has a considerably larger number of parameters than DA. Second, in applications involving text pairs, the decomposable attention model individually encodes these text pairs before using bidirectional cross attention. Instead, BERT combines these two stages using the self-attention mechanism that operates jointly over the two concatenated sentences (and separated with the [SEP] token). Lastly, BERT is pretrained on massive amounts of texts related to the datasets used here, whereas DA learns its parameters from scratch. + +Further, analyzing the selection made by the GL framework for various random seeds, we observed that when trained on FEVER and tested on FNC, GL selects the lexicalized student, while in the other cross-domain direction, the common choice is the student delexicalized with OA-NER. We hypothesize this happens for two reasons. First, the training data in the FNC dataset is smaller + +(40,904 data points) compared to the FEVER dataset (119,197 training data points). Therefore it is more prone to overfitting in the original, lexicalized form. Second, as mentioned above, since the FNC dataset is derived from real-world news articles, the number of evidence sentences in the FNC is higher than FEVER sentences. This means that delexicalized sentences in FNC preserve enough lexical signal for training, even in their delexicalized forms. The opposite observations hold in the other direction (FEVER to FNC), which caused the lexicalized students to perform better. Also, please note that even though we use only four student methods in our experiments to train with each other, this can be extended to any number of methods. However, the correct number of student models (and their corresponding delexicalized datasets) for a given task needs to be empirically determined. + +Our approach demonstrates that: (a) delexicalization helps model generalization, (b) the amount of delexicalization to apply varies from dataset to dataset, and (c) it is possible to learn how much delexicalization to apply through our proposed GL architecture. + +# Acknowledgments + +This work was supported by the Defense Advanced Research Projects Agency (DARPA) under the World Modelers and HABITUS programs. Mihai Surdeanu declares a financial interest in lum.ai. This interest has been properly disclosed to the University of Arizona Institutional Review Committee, and is managed in accordance with its conflict of interest policies. The authors would also like to thank Steve Bethard, Becky Sharp, and Marco Valenzuela-Escárcega for all their valuable comments and reviews. + +# References + +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. + +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, New Orleans, Louisiana. Association for Computational Linguistics. +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. 2015. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531. +Rabeeh Karimi Mahabadi, Yonatan Belinkov, and James Henderson. 2020. End-to-end bias mitigation by modelling biases in corpora. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8706-8716, Online. Association for Computational Linguistics. +Samuli Laine and Timo Aila. 2016. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242. +Xiao Ling and Daniel S Weld. 2012. Fine-grained entity recognition. In AAAI, volume 12, pages 94-100. +Xiaodong Liu, Yu Wang, Jianshu Ji, Hao Cheng, Xueyun Zhu, Emmanuel Awa, Pengcheng He, Weizhu Chen, Hoifung Poon, Guihong Cao, and Jianfeng Gao. 2020. The Microsoft toolkit of multi-task deep neural networks for natural language understanding. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 118-126, Online. Association for Computational Linguistics. +Christopher D Manning, Mihai Surdeanu, John Bauer, Jenny Rose Finkel, Steven Bethard, and David McClosky. 2014. The stanford corenlp natural language processing toolkit. In Proceedings of 52nd annual meeting of the association for computational linguistics: system demonstrations, pages 55-60. +Mitch Paul Mithun, Sandeep Suntwal, and Mihai Surdeanu. 2021. Data and model distillation as a solution for domain-transferable fact verification. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4546-4552. +Mithun Paul Panenghat, Sandeep Suntwal, Faiz Rafique, Rebecca Sharp, and Mihai Surdeanu. 2020. Towards the necessity for debiasing natural language inference datasets. In Proceedings of The 12th Language Resources and Evaluation Conference, pages 6883-6888. +Ankur Parikh, Oscar Täckströ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. +Dean Pomerleau and Delip Rao. 2017. Fake news challenge. + +Antti Rasmus, Harri Valpola, Mikko Honkala, Mathias Berglund, and Tapani Raiko. 2015. Semi-supervised learning with ladder networks. arXiv preprint arXiv:1507.02672. +Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. 2016. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. Advances in neural information processing systems, 29:1163-1171. +Sandeep Suntwal, Mithun Paul, Rebecca Sharp, and Mihai Surdeanu. 2019. On the importance of delexicalization for fact verification. 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 3413-3418, Hong Kong, China. Association for Computational Linguistics. +Antti Tarvainen and Harri Valpola. 2017. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in neural information processing systems, pages 1195-1204. +James Thorne, Andreas Vlachos, Oana Cocarascu, Christos Christodoulopoulos, and Arpit Mittal. 2018. The fact extraction and VERIFICATION (FEVER) shared task. In Proceedings of the First Workshop on Fact Extraction and VERIFICATION (FEVER), pages 1-9, Brussels, Belgium. Association for Computational Linguistics. +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. +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. +Soroush Vosoughi, Deb Roy, and Sinan Aral. 2018. The spread of true and false news online. Science, 359(6380):1146-1151. +William Yang Wang. 2017. "liar, liar pants on fire": A new benchmark dataset for fake news detection. arXiv preprint arXiv:1705.00648. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, 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, pages arXiv-1910. \ No newline at end of file diff --git a/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/images.zip b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cd5708e4e97c00ff22a1c1ef79af253d93ec1485 --- /dev/null +++ b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0eb5eab20e2efb724ab1820470990433c7a6585ad6d8bb5d9464e52500393768 +size 185986 diff --git a/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/layout.json b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b4ca5f60cc506e59832ecd0787bbaddbbb4e12b8 --- /dev/null +++ b/studentswhostudytogetherlearnbetterontheimportanceofcollectiveknowledgedistillationfordomaintransferinfactverification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2914da8d5934702f3e9c0e89fe54e3863d804a45ab54d8d12c02938e578cca2 +size 141106 diff --git a/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_content_list.json b/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..314726e1d46de31ba6c1f5094e84d4ceadb24d1d --- /dev/null +++ b/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6ad7545ed9c72feaecd6447c33817807e5fb053efc8e7857ec13bdfc5181d70 +size 123025 diff --git a/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_model.json b/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f60d6288685746173559c28ee1d56f5b32fbedc1 --- /dev/null +++ b/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:895c1aa08b1ea82dda0972b97e6eefab85402aa1c0e3674022ec675bc4d5a78e +size 149034 diff --git a/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_origin.pdf b/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c21e16eda9d5a67fd4a999591f26b57c78166f4 --- /dev/null +++ b/studyingwordorderthroughiterativeshuffling/afb62a0a-9c54-4158-87d8-4324a2b1e4ea_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0e0dfc59470dd01697ffc59eb0844c0a611506e9e2becf944e188980ad800ae +size 1879478 diff --git a/studyingwordorderthroughiterativeshuffling/full.md b/studyingwordorderthroughiterativeshuffling/full.md new file mode 100644 index 0000000000000000000000000000000000000000..29952e3f001d56d053e3230b8cb17f5b4ff736b0 --- /dev/null +++ b/studyingwordorderthroughiterativeshuffling/full.md @@ -0,0 +1,580 @@ +# Studying word order through iterative shuffling + +Nikolay Malkin $^{1,2,5}$ + +Sameera Lanka + +Pranav Goel $^{4,5}$ + +Nebojsa Jojic + +1Mila, Université de Montréal 2Byle University 3Microsoft +4University of Maryland 5Microsoft Research + +kolya.malkin@yale.edu, pgoell@umd.edu, {sameera.lanka, jojic}@microsoft.com + +# Abstract + +As neural language models approach human performance on NLP benchmark tasks, their advances are widely seen as evidence of an increasingly complex understanding of syntax. This view rests upon a hypothesis that has not yet been empirically tested: that word order encodes meaning essential to performing these tasks. We refute this hypothesis in many cases: in the GLUE suite and in various genres of English text, the words in a sentence or phrase can rarely be permuted to form a phrase carrying substantially different information. Our surprising result relies on inference by iterative shuffling (IBIS), a novel, efficient procedure that finds the ordering of a bag of words having the highest likelihood under a fixed language model. IBIS can use any black-box model without additional training and is superior to existing word ordering algorithms. Coalescing our findings, we discuss how shuffling inference procedures such as IBIS can benefit language modeling and constrained generation. + +# 1 Introduction + +Is a model's understanding of syntax a precondition for its understanding of natural language? Recent work on large language models (Devlin et al., 2019; Tenney et al., 2019; Rogers et al., 2021) has made this a popular hypothesis. Yet, models that consume only bag-of-words features but rival those that understand syntax have surprised researchers time and again (Iyyer et al., 2015; Joulin et al., 2017). New concerns have emerged that natural language understanding benchmarks may not be challenging enough to make sentence structure relevant (McCoy et al., 2019; Niven and Kao, 2019). + +Syntax is an essential aspect of language (Chomsky, 1965). Sentence structure can be quite important: two sentences with very different meanings may use the same set of words (Fig. 1). But how much does syntax, as realized in word order, matter in typical English text? Given the words that make + +![](images/7cab3e74fb559764fcfd1a26fa642acdbb027fd582c5e9d99e64ae1ed4f7f8c8.jpg) +Figure 1: Which word order is more likely? + +![](images/fcca3cad4694bb695eac5b7a24d4f2fcae8b5eb310d4e17e069bc2c69d1f5e06.jpg) + +up a sentence, but not their order, is the order usually recoverable? If so, word order rarely encodes more information than is found in the bag of words. + +In the past, linguists could not have answered this question empirically. Manually ordering words into sentences is too laborious, and when there are multiple orders that satisfy grammatical constraints, one needs a way to choose among them. + +With the power of large language models, we can reduce this question to a computational one and resolve both issues: given the bag of words, find the word order that is most likely under a trained LM. To make this search tractable, we develop inference by iterative shuffling (IBIS), a procedure inspired by techniques in combinatorial optimization, that is superior to existing approaches to this problem. Armed with IBIS, we answer the question above statistically and explore the implications. + +First, we measure how often sentences and phrases are permutable in text of various genres. + +Next, we analyze the effect of word order on the GLUE suite (Wang et al., 2018) and on the task of autoregressive language modeling. Randomly reordering input words drops the performance of models on nearly all tasks, but when we infer the order with the aid of a pretrained LM, this drop is small or absent. Thus, NLP pipelines can effectively consume bags of words as input, and order carries much less meaning than we might imagine. + +We conclude with the implications of our results for language modeling. A computationally feasible search for word order clears a path for models that focus on content, rather than syntax, enabling a range of constrained generation applications. + +# NLL Ordered sentence + +# IBIS (10 search steps) + +140.9 the housed is 1967. period furniture the exterior beautiful in fine complemented by Restored inside +124.9 Restored is 1967, period furniture the exterior beautiful in fine complemented by the housed inside. +121.6 Restored is 1967, in fine period furniture the beautiful exterior complemented by the housed inside. +112.3 Restored is 1967, in fine the beautiful exterior complemented by the period furniture housed inside +112.1 Restored in fine is the 1967, beautiful exterior complemented by the period furniture housed inside. +105.7 Restored in 1967, fine beautiful exterior is the complemented by the period furniture housed inside. +104.1 Restored in 1967, fine exterior is complemented by the beautiful the period furniture housed inside. +88.0 Restored in 1967, the beautiful exterior is complemented by the fine period furniture housed inside. + +# Beam search (64) without future costs + +116.9 is complemented by the beautiful exterior in the fine period furniture housed inside.Restored 1967, + +# Beam search (64) with future costs + +110.9 Restored exterior is complemented by the beautiful furniture housed in the fine 1967, period inside. + +Figure 2: Above: IBIS iteratively infers the word order that has lowest negative log-likelihood (left column) under GPT-2. At each step, the sentence is cut into pieces, which are then rearranged. After several such $k$ -opt moves, the original order is found. Below: Reconstructed versions of the same sentence using algorithms from prior work. + +# 1.1 Related work + +Research in cognitive science and psycholinguistics has raised the notion that syntax is a convention optimized for communicating bags of concepts over a linear channel. The emergence of syntactic phenomena is explained by information structure constraints (Jaeger, 2010; Levy and Jaeger, 2006; Hahn et al., 2020). Ours is the first large computational study to lend support to this view of syntax. + +Circumstantial evidence for the redundancy of word order comes from work such as that of Niven and Kao (2019), which showed that language models' predictions in certain tasks are largely explained by word-level triggers. Concurrently with this work, Sinha et al. (2021a,b); Pham et al. (2021); Gupta et al. (2021) probed and demonstrated, in various ways, the surprising insensitivity of infilling LMs' performance on GLUE tasks to word order in training and evaluation data. These studies complement our discovery that nearly all of models' accuracy on GLUE tasks can be explained by bags of words only ( $\S 5.2$ ) to show that word order rarely carries information useful for classifying textual similarity, entailment, or sentiment. + +In the domain of text generation, Khandelwal et al. (2018) found that the order of distant context words has little effect on prediction of the next word in a text. In §5.1 we confirm that the order of recent context strongly affects next-word prediction, but also show that this order can nearly always be inferred from the bag of words. + +The problem of inferring word order from bags of words – text linearization – dates back to Elman (1990). This problem has been studied using both treelike and autoregressive models (de Gispert et al., 2014; Zhang and Clark, 2011; Liu and Zhang, 2015; Song et al., 2018). Horvat and Byrne (2014) reduce linearization under an $n$ -gram model to generalized traveling salesman problems (TSP), but stop short of extending TSP algorithms to neural models, as we do in this work. + +Algorithms based on best-first search were proposed by Liu et al. (2015) and Schmaltz et al. (2016). The latter introduced a beam search with future costs, a key baseline in this paper. In the basic beam search algorithm for ordering a target bag of words, a LSTM model generates text from left to right, expanding a horizon of fixed size. The next-word distributions at each step are restricted to the words in the target bag that have not yet been used. The innovation of future costs is to modify the beam scoring function (which is usually the log-likelihood of the partially generated text) by adding the sum of log-likelihoods under a unigram model of the yet-unused tokens in the target bag. + +# 2 Text linearization by iterative shuffling + +IBIS is motivated by a need not only to generate text from left to right when inferring the most likely word order under a base LM, but to reason over an entire sentence and permute spans or words. + +The bottom of Fig. 2 shows some of the fail + +![](images/52c5cbcb899fe274af8137b4e21aa5a716f62926bbea5cd9b031dfb8e7ec868c.jpg) + +![](images/111dddfdb325e52a4a39d5d295f0560b03620d436d7373481ba874ad0b1ee6d4.jpg) +current tour weight $= 40.3$ candidate tour weight $= 27.3$ +Figure 3: One IBIS search step: The edge weights in the left graph are negative log-likelihoods from GPT-2 Small conditioned on previous context in the current best sentence, "mouse chased cat" (thick blue path). A candidate 4-opt move that decreases the tour weight (dashed red path) is proposed and scored by the LM, yielding the graph on the right. Because the new NLL is lower than the old NLL, the move is accepted. + +![](images/74662ff83d08a742ec92b7ad0e2f1e655b717c67cf2d70d44d5d3e3235c46902.jpg) +new current tour weight $= 39.5$ + +ure modes of beam search, with and without future costs. The reconstructions of a short sentence (in italics) by beam search using the GPT-2 Small model (Radford et al., 2019) are ungrammatical.1 Beam search without future costs is unable to reason that the capitalized word is unlikely to occur in the middle of a text and should come first. Beam search with future costs suffers from the same inability to 'plan ahead': by the end of the sentence, the algorithm begins to fail as it is left with a set of words that cannot be arranged coherently. + +However, some long spans that appear in the original sentence are generated, such as "is complemented by the" and "the fine period furniture housed inside". The IBIS algorithm, which we will now describe, enables reasoning over the entire text to excise and recombine such coherent spans. + +$k$ -opt moves. A $k$ -opt move is the following operation: A sentence is 'cut' at $k$ positions, creating $k - 1$ spans between the cuts. These $k - 1$ spans are then permuted (in one of $(k - 1)!$ ways) to form a new sentence. Note that the cuts may come immediately before the first or after the last word. + +Such operations were introduced by Lin and Kernighan (1973) in the context of the TSP on graphs. Recall that a tour of a weighted directed graph is a closed path that visits each vertex exactly once. A $k$ -opt move on a tour is the operation of + +removing $k$ edges and inserting $k$ new edges to create a new tour. Many heuristic algorithms for solving the TSP – finding the tour of lowest total weight – use $k$ -opt moves as the core search step; a maximum of $k = 5$ is typical (Helsgaun, 2000). + +There is a precise equivalence between text linearization and the TSP on graphs when the base language model is a bigram model. Suppose that the likelihood of a string has a factorization + +$$ +p \left(w _ {0} w _ {1} \dots w _ {n}\right) = \prod_ {i = 1} ^ {n} p \left(w _ {i} \mid w _ {i - 1}\right), \tag {1} +$$ + +where $w_0$ and $w_n$ are a fixed start/end token. We form a bidirected graph with vertices corresponding to the words of the sentence (and the start/end token) and set the weight of the edge from $v$ to $w$ to $-\log p(w \mid v)$ . An ordering of the words is then equivalent to a tour of the graph, and its negative log-likelihood (NLL) is the weight of this tour. Finding the most likely order is equivalent to solving the TSP on this graph. + +Local search and the IBIS heuristic. While $k$ -opt search was developed with graph tours in mind, it can be applied to any scoring function, such as a language model, which produces a NLL of the next word depending on a long sequence of words preceding it, $-\log p(w_{i+1} \mid w_0w_1 \dots w_i)$ . + +A naive form of $k$ -opt local search would find the order of a bag of words most likely under a base LM by beginning with a random candidate order, then repeatedly performing a random $k$ -opt move, scoring the resulting order with the model, and accepting it as the new best candidate if it decreases the NLL. However, this approach is inefficient, as we will show below. + +Instead, we propose a heuristic to improve the search. Let the current best order be $w_0w_1 \ldots w_n$ . We form an auxiliary graph as above, but set the weight of the edge from $w_i$ to $w_j$ to + +$$ +- \log p \left(w _ {j} \mid w _ {0} w _ {1} \dots w _ {i}\right), \tag {2} +$$ + +that is, the NLL of word $w_{j}$ at position $i + 1$ given by the base LM. If the LM is a bigram model, then the (2) reduces to $-\log p(w_{j} \mid w_{i})$ , as before. + +Now, we observe that the current order is a tour of this graph: $w_0 \to w_1 \to \dots \to w_n$ . We rank all possible $k$ -opt moves by how much they decrease the weight of this tour. Then, we create a batch of new candidate orders by performing $k$ -opt moves sampled from near the top of this ranking + +and we score this batch with the LM. The move that decreases the NLL most, if it exists, is accepted, yielding the new best candidate. + +We emphasize that this is a heuristic, not an exact method. It is possible that a $k$ -opt move decreases the weight of the tour in the auxiliary graph, but that when this move is performed and the sentence rescored by the LM, the NLL does not decrease. This is the case because the next-word probabilities given by the LM may depend on all preceding words. A $k$ -opt move may change the context preceding a word $w_{i}$ , which will modify the weights of the edges from $w_{i}$ to other words in the graph. Nevertheless, the likelihood of a word depends mostly on recent context, especially on the preceding word, making IBIS an efficient heuristic. + +Practical considerations. This heuristic for proposing $k$ -opt moves is limited by computational constraints, mainly the difficulty of ranking all possible $k$ -opt moves in memory. These difficulties arise in classical TSP solvers as well and are typically resolved by additional heuristics and sampling procedures. Our precise answers to these difficulties are described in Appendix A. + +All our experiments are initialized with a random order of the target bag and use the heuristic described above to iteratively decrease the NLL. The search is terminated when there is no improvement for a specified number of steps (the 'patience' constant). For our experiments, we use a proposal batch size of 128 and a patience of 128 and limit the search to 3-, 4-, and 5-opt moves. + +Our search for optimal $k$ -opt moves uses core tensor operations and can run on a GPU – the first implementation of this kind, to the best of our knowledge. Runnable example code is provided in the associated repository: https://github.com/malkin1729/ibis. The reader can run the provided program and see a text of their choice iteratively shuffled into the most likely order (Fig. 5 in the Appendix). + +# 3 Experiments: IBIS + +We show that IBIS achieves a new state of the art in text linearization using a black-box LM. Following Wan et al. (2009), we evaluate on section 23 of the Penn Treebank (PTB) dataset of Wall Street Journal articles (Marcus et al., 1999). + +Setup and baselines. The results here use GPT-2 Small as a base LM. There are three reasons for + +
Base LMInferenceBLEUNLL
LSTMBS-512 +g44.5-
GPT-2 SmallBS-51242.45.60
GPT-2 SmallBS-512 +g45.45.48
GPT-2 SmallBS-102444.05.52
GPT-2 SmallBS-1024 +g47.15.43
GPT-2 SmallIBIS50.05.19
Distil-GPT-2IBIS47.2-
GPT-2 MediumIBIS53.1-
GPT-2 LargeIBIS54.6-
GPT-2 XLIBIS*53.6-
GPT-2 Smallrandom k-opt44.15.36
-original text100.05.22
+ +Table 1: BLEU scores of PTB sentences ordered by beam search and shuffling algorithms. NLL is negative log-likelihood per word under GPT-2 Small, averaged over test examples. First row is from Schmaltz et al. (2016); $+g$ denotes search with future costs. \*Batch size 64, patience 256 was used for GPT-2 XL. + +this choice. First, it enables direct comparison between beam search and IBIS under the same base LM, which is difficult with the LSTM model of Schmaltz et al. (2016) due to an incompatible code base. Second, it simultaneously allows us to measure the effect of the base model on results using the same inference procedure: IBIS is model-agnostic and can work with any base LM that produces next-token likelihoods. Third, GPT-2 is trained on generic English text and can handle arbitrary strings, making it a natural candidate for use in all parts of this paper. We chose the Small variant of the model for computational efficiency. + +We used the published code of Schmaltz et al. (2016), to tokenize the sentences, with minor processing for compatibility with GPT-2's tokenizer. We then evaluated beam search with beam sizes 512 and 1024, with and without future costs. The future cost function used unigram frequencies estimated from the GPT-2 training data. Any input word that is broken into multiple tokens by GPT-2's subword tokenizer was always generated as a single unit. These baselines are thus directly comparable with the results of Schmaltz et al. (2016). + +IBIS inference. We ran the IBIS algorithm on this data, also using GPT-2 as the base LM, to infer an order of each sentence in the evaluation set. + +To ensure that the bags of input and output words coincided, we did not allow $k$ -opt moves that broke intact words between GPT-2 subword tokens. + +Results and discussion. The BLEU scores of reconstructed sentences with respect to the original orders, and their NLLs per word, are shown in Table 1. IBIS outperforms beam search with size 512 and future costs – the strongest procedure in past work – by a large margin. Doubling the beam size, and the computation time, closes less than half of the gap in BLEU and in mean log-likelihood. + +A less surprising, yet still meaningful, comparison is between base LMs: beam search with future costs with Schmaltz et al. (2016)'s LSTM model and with GPT-2 Small (first and third rows). The former model is trained on a mix of target-domain (PTB) data, other datasets of news articles, and the Gigaword corpus, yet still resorts to using OOV tokens in place of infrequent words; GPT-2 is trained on a (biased) crawl of the Internet and processes rare words as sequences of subword tokens. + +Finally, the mean log-likelihood per word under the base LM of sentences reconstructed with IBIS exceeds that of the original text. There are two ways to interpret this result. On one hand, it shows the strength of IBIS as an optimization algorithm: it may indeed be possible to permute the words in the original text, perhaps into an order more acceptable to human judgment, making word order more normative without changing the meaning. On the other hand, it shows that IBIS approaches the limit of what a text linearization algorithm that optimizes for GPT-2 Small likelihood can achieve as measured in BLEU score, which can be seen as a limitation of the base LM itself. + +Computation cost. It is difficult to directly compare computation costs of beam search and IBIS due to the very different nature of these algorithms. A measure that corresponds well to the evaluation time is the number of calls to the base LM. During IBIS inference over the dataset of 2416 sentences, $67\mathrm{m}$ strings were scored by GPT-2. Beam search with beam size 1024 and future costs would make approximately $60\mathrm{m}$ calls to GPT-2 if all words were single tokens; handling of subwords increases this number to $76\mathrm{m}$ . The computation time for the two algorithms was approximately equal. Thus IBIS is comparable to the BS- $1024 + g$ baseline in computation, but performs significantly better. + +Unlike beam search, which infers order incre- + +
Base LMIBIS output
Distil-GPT-2Ibises, all mud and crustaceans, usually feed as a group, have long downcurved bills, usually probing for food items.
GPT-2SmallIbises, all mud crustaceans, usually as a group, have long downcurved bills, usually probing for food items and feed.
GPT-2MediumIbises as a group usually have long downcurved bills, usually probing for feed, mud, crustaceans, and all food items.
GPT-2LargeIbises usually feed as a group, usually have long, downcurved bills, all probing for food items, mud and crustaceans.
GPT-2XLIbises usually feed as a group, and all have long, downcurved bills, probing for food items, usually mud crustaceans.
originalIbises all have long, downcurved bills, and usually feed as a group, probing mud for food items, usually crustaceans.
+ +Table 2: The words of a sentence from Wikipedia ordered by the IBIS algorithm with five base LMs. + +mentally from left to right, IBIS works with the entire string at every step and can be stopped early to set a balance between time and output quality. As we note below, IBIS exceeds beam search in log-likelihood per word after far fewer search steps than were performed in our experiment. + +Dependence on base LM. We tested IBIS on the PTB dataset using four other GPT-2 variants: the lighter Distil-GPT-2 and the larger GPT-2 Medium, Large, and $\mathrm{XL}^3$ ; the BLEU scores are shown in Table 1. More powerful base LMs improve the performance of IBIS, due to their greater 'world knowledge' or understanding of syntax, yet IBIS using the smallest model, Distil-GPT-2, still outperforms beam search with GPT-2 Small. Table 2 shows a sentence reordered using all five models. + +Importance of the heuristic. We demonstrate the importance of the IBIS heuristic for proposing $k$ -opt moves by performing the naive $k$ -opt local search described in §2 – randomly sampling $k$ -opt moves, but keeping all other search parameters the same as for IBIS. On the PTB test data, the sentence reconstructions by this algorithm are significantly worse than those by IBIS: the search tends to exceed the patience (128 steps without improvement) at a higher negative log-likelihood. + +![](images/f6406230dcc10c4348fe5f502da464f2d67904bed953c01829d85ea7868ad438.jpg) +Figure 4: The NLL/word on PTB sentences (defined as in Table 1) as a function of the number of $k$ -opt batches, with and without the IBIS heuristic. IBIS tends to converge faster than an unguided $k$ -opt search and stabilizes at lower NLL, yet both reach lower NLL than the computationally comparable beam search baseline (BS-1024+g). + +Fig. 4 shows the mean negative log-likelihood per word as a function of the number of search steps, averaged over all sentences in PTB. IBIS reaches a lower NLL than the strongest beam search algorithm we evaluate after just 59 size-128 batches - equivalent to about $\frac{1}{4}$ of the number of calls to GPT-2 made by beam search - and a lower NLL than the original text after 169 batches. Random $k$ -opt search requires 6 times as many steps to reach the NLL of beam search. + +Curiously, random $k$ -opt search reaches a better NLL but a worse BLEU score than the beam search baseline, suggesting that beam search is good at correctly generating short spans of text (benefiting BLEU), but $k$ -opt search is better at reasoning over the entire sentence (benefiting total likelihood). + +# 4 Experiments: (Im)permutability + +Using the IBIS algorithm, we analyze the importance of word order in English text of different genres. We use three publicly available corpora covering different domains of textual expression: + +Yelp: About 560k Yelp reviews, commonly used as a text classification benchmark.4 + +Wiki: 2m Wikipedia articles (Shaoul, 2010).5 + +arXiv: 1.7m scientific preprint abstracts (Clement et al., 2019)6 filtered to remove $\mathrm{T}_{\mathrm{EX}}$ . + +IBIS can be applied to any bag of tokens, including punctuation marks, as shown in Fig. 2 and Table 2. In §3, we shuffled all tokens in a sentence to be consistent with the setup in prior work. However, to measure whether order is essential to conveying meaning, we face the problem of discerning whether punctuation marks are used to structure a compound thought or to separate distinct thoughts: + +the pathological example is a stylistic choice to replace all periods with semicolons. + +To simply investigate how long a phrase needs to be before it becomes possible to find significant rearrangements with higher likelihoods, we limit our analysis to text spans of two kinds: sentences that contain no punctuation and spans of text between two consecutive punctuation marks. We sample 1000 such sentences and spans from each of the three domains with lengths (in words) falling into each of several buckets (Table 4) and infer their most likely word orders using IBIS. For the spans between punctuation, 50 words of ordered context before the initial punctuation mark are provided for scoring of candidate word orders. + +We analyze the reconstructions automatically using BLEU scores and via human evaluation. + +Results and discussion. Table 4 shows the BLEU scores of the IBIS-inferred spans with respect to the original orders, as well as the ratio of perplexities under GPT-2 of the original and reconstructed texts. IBIS often finds orders that are more likely than the original ones in all three domains. The similarity of reconstructed and original spans at small lengths ( $<30$ tokens) is remarkably high. $^{7}$ + +We also see some differences between the domains. Especially at higher lengths, sentences and spans from Wikipedia and Yelp are difficult to permute into sentences with higher likelihood $(\mathrm{PR} > 1)$ . Reconstructed sentences from Yelp and arXiv retain fewer of the original 2-, 3-, and 4-grams (lower BLEU). Indeed, long Yelp sentences tend to 'ramble' using many frequent words, arXiv sentences are full of scientific terms that a non-expert can easily permute without losing grammar + +I was just there again in April and bragged to my friends about how great it was and we were all horribly disappointed. just bragged to all my friends about how great it was in April and we were there again and I was horribly disappointed. + +Mao Zedong's philosophical essay furthered Marx and Lenin's thesis and suggested that all existence is the result of contradiction. Marx and Lenin's philosophical essay suggested and furthered Mao Zedong's thesis that all existence is the result of contradiction. + +We introduce a longevity feature to the classical optimal dividend problem by adding a constraint on the time of ruin of the firm. We introduce the classical problem of the optimal ruin of a firm by adding longevity to the feature time constraint on a dividend. + +Table 3: Examples of original and IBIS-reconstructed sentences from Yelp, Wikipedia, and arXiv (top to bottom). More examples are shown in Table 8. + +
(no punct.)YelpWikiarXiv
LengthBLEUPRBLEUPRBLEUPR
5-981.50.9477.40.9175.00.91
10-1969.50.9167.40.9051.60.80
20-2951.30.9751.90.9637.00.79
30-3935.71.0438.81.0127.20.79
40-4924.71.0131.41.0723.10.82
(btw punct.)YelpWikiarXiv
LengthBLEUPRBLEUPRBLEUPR
5-967.50.9867.00.8561.50.96
10-1963.41.0862.40.9749.91.03
20-2949.71.0847.51.0243.20.89
+ +Table 4: Comparison of original and IBIS-inferred orders of punctuationless sentences (above) and spans between punctuation (below) of different lengths. We report BLEU score and ratio of perplexities (PR). A PR less than 1 indicates that IBIS reaches lower NLL per word than the original text. + +icality, and Wikipedia sentences have a measured style more familiar to GPT-2 (see Table 3). + +Human evaluation. Three human subjects were asked to rate the relationship of IBIS-inferred punctuationless sentences to the original texts. We sampled 50 sentences from each of the five length buckets from the Wiki dataset; annotators ranked each pair (original sentence, IBIS-inferred order) on a scale of 0 (the inferred order is unreadable or completely dissimilar to the original sentence) to 3 (the original and inferred orders are identical, achieved for 47 of the 250 sentences). + +For punctuationless sentences with fewer than 20 words, more than half of pairs were given scores of 2 or 3 (similar or identical meaning). This number sharply drops with increasing length, but long punctuationless sentences are rare in normal text: most sentences without punctuation have fewer than 20 words. More details can be found in Appendix D. + +
nperplexitytoken acc %πacc %
latenttoprandlatenttoprand
130.138.1100.0
230.531.749.438.138.031.398.5
331.434.272.937.537.525.496.4
432.236.297.037.337.221.894.0
533.239.3123.536.936.718.190.9
634.242.2150.636.436.216.086.8
735.146.0177.136.335.914.383.0
+ +Table 5: Perplexity and accuracy of next-word predictions of GPT-2 Small, conditioned on the bag of the previous $n$ words $B$ and ${50} - n$ tokens of earlier context $C$ . The last column is the frequency with which the true order of the $n$ previous words is the most likely under the posterior $p\left( {\pi \mid C,B}\right)$ . + +# 5 Experiments: (Dis)order in NLP tasks + +In this section we answer the question: How well could language models perform on standard NLP tasks if they were not given access to word order? + +# 5.1 Word order and text generation + +Left-to-right (autoregressive) text generation remains a principal direction of NLP research. How well could models such as GPT-2 generate text if, when prompted to generate the next word in a text, they did not know the order of the previous words? We measure the performance of GPT-2 in generating the next token in a text where the order of the previous $n$ words is treated as a latent variable. + +GPT-2 is a generative model of tokens, where preceding tokens (context) are used as predictor variables. We break this context into two parts: the distant ordered context $C$ , followed by a bag of $n$ tokens $B = \{w_{1},\dots ,w_{n}\}$ whose order is not known (50 tokens in total). We evaluate the perplexity and word prediction accuracy of GPT-2 on a sample from OpenText, a reacquired version of the model's training data, under three schemes for predicting the next word $w_{n + 1}$ given $C$ and $B$ : + +Latent. There are $n!$ possible orders of the bag + +
CoLA MCCentailmentparaphraseSST-2 acc %WNLI acc %
MNLI-m/mm acc %QNLI acc %RTE acc %MRPC F1 / acc %QQP F1 / acc %STS-B ρP / ρS
original58.283.7 / 84.190.764.888.0 / 83.690.6 / 87.388.3 / 88.191.939.4
random0.465.5 / 65.474.856.581.8 / 73.174.2 / 72.382.1 / 82.080.754.3
IBIS39.279.4 / 79.886.464.886.1 / 81.088.9 / 84.487.8 / 87.586.040.3
+ +Table 6: Standard metrics of finetuned BERT models (mean of 32 random seeds) on the GLUE benchmark tasks, evaluated on raw validation data, data with randomly ordered words, and data with word order inferred by IBIS. + +of tokens $B$ . We denote the order by $\pi$ , a discrete latent variable taking values in permutations $(\pi : \{1, \dots, n\} \to \{1, \dots, n\})$ . By scoring each of these permutations following the context $C$ under the base LM, we compute the posterior distribution over this latent variable conditioned on $C$ : + +$$ +p (\pi \mid C, B) \propto p _ {\mathrm {L M}} \left(w _ {\pi (1)} \dots w _ {\pi (n)} \mid C\right). +$$ + +Under any order $\pi$ of the past $n$ tokens, the LM gives a distribution over the word $w_{n + 1}$ + +$$ +p \left(w _ {n + 1} \mid \pi , C, B\right) = p _ {\mathrm {L M}} \left(w _ {n + 1} \mid C w _ {\pi (1)} \dots w _ {\pi (n)}\right). +$$ + +In this setting, we predict $w_{n+1}$ by integrating out the latent $\pi$ (i.e., summing over all possible orders): + +$$ +\begin{array}{l} p \left(w _ {n + 1} \mid C, B\right) = \sum_ {\pi} p (\pi \mid C, B) p \left(w _ {n + 1} \mid \pi , C, B\right) \\ \propto \sum_ {\pi} p _ {\mathrm {L M}} \left(w _ {\pi (1)} \dots w _ {\pi (n)} w _ {n + 1} \mid C\right). \tag {3} \\ \end{array} +$$ + +Top. The same as Latent, but using only the top $\pi$ , i.e., $p(w_{n+1} \mid \arg \max_{\pi} p(\pi \mid C, B), C, B)$ . + +Random. In this case, we assume a uniform distribution over orders $\pi$ of the bag $B$ and predict + +$$ +p \left(w _ {n + 1} \mid C, B\right) = \frac {1}{n !} \sum_ {\pi} p \left(w _ {n + 1} \mid \pi , C, B\right). \tag {4} +$$ + +This expression differs from (3) in that the likelihood under the base LM of the order of recent context is not taken into account: the order $\pi$ of the bag $B$ is assumed to be randomly sampled. + +Results and discussion. The perplexity and token accuracy of GPT-2 Small under the Latent, Top, and Random schemes are shown in Table 5. Remarkably, even for 7 tokens of unordered context, integrating over a latent order reduces accuracy only about $2\%$ from the model that has access to fully ordered context, and $83\%$ of the time, the true order of the bag of 7 preceding tokens has the highest likelihood out of $7! = 5040$ possible orders. + +In light of the latter, it is unsurprising that the Top method has only lightly worse metrics than Latent. + +However, the model rapidly degenerates when we randomly sample the order of the previous tokens. Indeed, the dependence of a word on a context word appearing $m$ positions earlier sharply decreases with $m$ . When the number of shuffled tokens $n$ is large, the recent words, which are most predictive of the target word, are often moved far back in the context (see Appendix C for an example). + +GPT-2 was trained with the objective of predicting a word given ordered context. We have shown that GPT-2 is able to infer the order of the context itself, then use it for prediction, while losing little in accuracy and perplexity. This is as much a result about language as it is a result about language models: the bag of tokens carries almost as much information as the ordered sequence. + +# 5.2 Word order and GLUE + +We evaluate the dependence of the GLUE benchmark (Wang et al., 2018) on word order in the input data. Because the inputs are often long, a full search over orders is infeasible, so we use IBIS. + +Specifically, for each of the 9 tasks, we finetuned the BERT-Base model (Devlin et al., 2019), a standard baseline, on (ordered) training data using typical settings. We then ran the IBIS algorithm with GPT-2 Small as the base LM to infer an order of the bag of words in each validation set sentence (in tasks with two input sentences per example, the sentences were ordered independently). The finetuned models were then evaluated on this IBIS-ordered validation data. For comparison, we evaluated the same models on validation data with words ordered randomly, as well as on the original orders. + +Fairy in techniques for coronavirus vaccine has been confirmed by research. + +The mouse was hungry. It started feeding itself by taking UndergroundMISC's engineered growth cheese assay. Now the mouse is still hungry. + +The cat was hungry. Someone picked up the mouse and chased the cat away from it. Now the cat is still hungry. + +The cat liked mice. His appetite for sweet treats was a little more intense. Now the cat hates mice. + +The Dragon King has reached out to the court at the request of a judge with the Magic Kingdom. The Minister of Magic declined to comment. + +Table 7: Constrained generation using IBIS variants (Appendix B): sentences were forced to begin or end with the underlined spans and to contain the bold words in any order; all other words were generated by the model. + +Results and discussion. The standard evaluation metrics for these models are shown in Table 6. At least $95\%$ of the prediction accuracy on tasks related to textual entailment (MNLI, QNLI, RTE), $97\%$ on tasks evaluating similarity detection (MRPC, QQP) $^{9}$ , and $94\%$ on the sentiment classification task (SST-2) is explained by bags of words alone. That is, such high scores can be achieved by a model that consumes only bags of words as input. Our model is a composition of a combinatorial search (IBIS) with a feedforward model (BERT), but these results place a lower bound on what models that are not given word order can achieve. + +The last two tasks, CoLA and WNLI, do not follow this pattern. The anomaly of WNLI, which tests resolution of ambiguous anaphora, seems to be due to the tiny size of the data (71 validation examples); the baseline models, on average, perform worse than random guessing. On the other hand, CoLA tests grammaticality judgments, which clearly depend on word order; many examples have no grammatical order in the first place. The large drop in Matthews correlation is unsurprising. + +The finetuned models perform substantially worse on evaluation data with randomly ordered words on all tasks (except WNLI), though still much better than chance (except on CoLA). We conclude that the trained models need word order to perform, but that the word order itself carries little information, as we can infer word orders that result in near-baseline evaluation scores. + +# 6 Conclusion and future work + +We have shown that word order in an English sentence encodes surprisingly little information in addition to that contained in the bag of words. NLP models such as BERT and GPT-2 depend on order when creating representations of text, because they were trained on ordered words, but at the same time do not strictly need it, since their understanding of syntax – and the compressed world knowledge that + +they hold - are sufficient to infer word order. + +It would be interesting to use techniques such as IBIS to study investigate humans' capacities for syntax, both productive and receptive. Are sentences with unlikely word order – as measured by a language model – more likely to lead to confusion (as in the first and last rows of Table 8)? + +A bolder conjecture states that many aspects of English syntax can be explained by optimality for language modeling. If, for a corpus of unordered sentences, we jointly infer a most likely word order for each example and a language model that fits these orders, do the inferred orders recover true English syntax, or at least a syntax satisfying known cross-lingual universals? If so, we would be led to vastly generalize the main claims of Levy and Jaeger (2006) and Hahn et al. (2020). An iterative ordering algorithm like IBIS is an essential step towards answering such questions.[10] + +Our work can guide and motivate research into combining long-range dependencies in the evolution of content – vocabulary constraints such as sentiment, global story arcs, rules of rhyme and meter, etc. – with models like GPT-2 that are capable of generating and scoring text. As we discuss in Appendix B, variants of IBIS can be used for a wide variety of such constrained generation tasks by making some of the words in the bag latent and sampling them in concert with $k$ -opt moves: generating text from keywords, constraining text to a fixed length, composing poetry, and others where beam search is inefficient (Table 7). + +Thus, IBIS is an attractive, flexible alternative to beam search in generative language models. It may find applications well beyond word ordering. + +# Acknowledgments + +The authors thank the anonymous reviewers for their comments and suggestions. + +# Ethics statement + +We use this section not only to promote discussion of possible societal impacts, but also to help researchers keep certain things in mind when they look to use our method and results. + +Annotation Process. All three human annotators (\$4) have English as their native or first language and are at least college-graduated. They were all compensated at the rate of US\$15 per hour. They were made aware that the first of the two sentences they are shown is from English Wikipedia while the second sentence is a reordering that need not be grammatical. We share the full set of instructions given to help them do the rating task in Fig. 8. + +Use of Large Language Models. The usage of large language models has significant environmental and financial impacts. However, the majority of the cost is borne by training a new large language model, rather than using an already trained fixed language model as we do in our algorithm. We posit that using more computationally feasible inference methods using existing large language models and resources, instead of training even bigger models or methods that require months of compute cycle, makes our work more usable and accessible. + +Large pretrained language models are also known to carry significant social biases, and this might affect the optimal ordering of a bag of words that our approach may find (since our search space stems from the probabilities learned by large language models). In fact, it will be interesting to conduct a study specifically focused on language model preferences for word order in cases where the subject and object of a text operate in an imbalanced power hierarchy: we expect the training data of language models to have an impact on the recovered word order. On a broader note, our findings of how sentence structure may often be redundant in English text could be a premise for further work in sociolinguistics about variation in norms of word order. + +Language. It is important to keep in mind that our experiments pertain to the English language and that our findings and implications should not + +be transferred to other languages without further experimentation. For example, we may expect measures of permutability to differ significantly in synthetic languages that mark grammatical roles by suffixation and have a freer word order: a Russian or Warlpiri sentence is more likely to have a grammatical reordering than an English or Mandarin one, but this reordering may have nearly the same meaning as the original sentence, with the context of surrounding sentences playing a large role in conditioning topicalization. In other highly agglutinative languages, entire complex sentences can be expressed in a single (orthographic) word, and the very notion of 'word' as separate from 'morpheme' is difficult to define – a challenge for NLP models. + +# References + +Noam Chomsky. 1965. Aspects of the Theory of Syntax. MIT Press. +Colin B. Clement, Matthew Bierbaum, Kevin P. O'Keeffe, and Alexander A. Alemi. 2019. On the use of arxiv as a dataset. +Adrià de Gispert, Marcus Tomalin, and Bill Byrne. 2014. Word ordering with phrase-based grammars. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 259-268, Gothenburg, Sweden. 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. +Jeffrey L. Elman. 1990. Finding structure in time. Cognitive Science, 14(2):179-211. +Ashim Gupta, Giorgi Kvernadze, and Vivek Srikumar. 2021. Bert & family eat word salad: Experiments with text understanding. Proceedings of the AAAI Conference on Artificial Intelligence, 35:12946-12954. +Michael Hahn, Dan Jurafsky, and Richard Futrell. 2020. Universals of word order reflect optimization of grammars for efficient communication. Proceedings of the National Academy of Sciences, 117(5):2347-2353. +Keld Helsgaun. 2000. An effective implementation of the Lin-Kernighan traveling salesman heuristic. European Journal of Operational Research, 126(1):106-130. + +Matic Horvat and William Byrne. 2014. A graph-based approach to string regeneration. In Proceedings of the Student Research Workshop at the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 85-95, Gothenburg, Sweden. Association for Computational Linguistics. +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. +T. Florian Jaeger. 2010. Redundancy and reduction: Speakers manage syntactic information density. Cognitive Psychology, 61(1):23-62. +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: Volume 2, Short Papers, pages 427-431, Valencia, Spain. Association for Computational Linguistics. +Urvashi Khandelwal, He He, Peng Qi, and Dan Jurafsky. 2018. Sharp nearby, fuzzy far away: How neural language models use context. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 284-294, Melbourne, Australia. Association for Computational Linguistics. +Roger Levy and T. Florian Jaeger. 2006. Speakers optimize information density through syntactic reduction. In Advances in Neural Information Processing Systems, volume 19, pages 849-856. +Shen Lin and Brian Kernighan. 1973. An effective heuristic algorithm for the traveling-salesman problem. Operations Research, 21(2):498-516. +Jiangming Liu and Yue Zhang. 2015. An empirical comparison between n-gram and syntactic language models for word ordering. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 369–378, Lisbon, Portugal. Association for Computational Linguistics. +Yijia Liu, Yue Zhang, Wanxiang Che, and Bing Qin. 2015. Transition-based syntactic linearization. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 113-122, Denver, Colorado. Association for Computational Linguistics. +Mitchell P Marcus, Beatrice Santorini, Mary Ann Marcinkiewicz, and Ann Taylor. 1999. Treebank-3. Linguistic Data Consortium, Philadelphia, 14. + +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. +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. +Thang Pham, Trung Bui, Long Mai, and Anh Nguyen. 2021. Out of order: How important is the sequential order of words in a sentence in natural language understanding tasks? In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 1145-1160, Online. Association for Computational Linguistics. +Alec Radford, Jeffrey Wu, R. Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2021. A Primer in BERTology: What We Know About How BERT Works. Transactions of the Association for Computational Linguistics, 8:842-866. +Allen Schmaltz, Alexander M. Rush, and Stuart Shieber. 2016. Word ordering without syntax. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2319-2324, Austin, Texas. Association for Computational Linguistics. +Cyrus Shaoul. 2010. The Westbury Lab Wikipedia corpus. Edmonton, AB: University of Alberta, 131. +Koustuv Sinha, Robin Jia, Dieuwke Hupkes, Joelle Pineau, Adina Williams, and Douwe Kiela. 2021a. Masked language modeling and the distributional hypothesis: Order word matters pre-training for little. arXiv:2104.06644. +Koustuv Sinha, Prasanna Parthasarathi, Joelle Pineau, and Adina Williams. 2021b. UnNatural Language Inference. 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 7329-7346, Online. Association for Computational Linguistics. +Linfeng Song, Yue Zhang, and Daniel Gildea. 2018. Neural transition-based syntactic linearization. In Proceedings of the 11th International Conference on Natural Language Generation, pages 431-440, Tilburg University, The Netherlands. Association for Computational Linguistics. + +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, Florence, Italy. Association for Computational Linguistics. + +Stephen Wan, Mark Dras, Robert Dale, and Cecile Paris. 2009. Improving grammaticality in statistical sentence generation: Introducing a dependency spanning tree algorithm with an argument satisfaction model. In Proceedings of the 12th Conference of the European Chapter of the ACL (EACL 2009), pages 852-860, Athens, Greece. 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. + +Yue Zhang and Stephen Clark. 2011. Syntax-based grammaticality improvement using CCG and guided search. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pages 1147-1157, Edinburgh, Scotland, UK. Association for Computational Linguistics. + +# A More on IBIS + +# A.1 Search parameters and code + +We describe the search strategy of IBIS. As noted in the main text, a complete enumeration of $k$ -opt moves to rank in the batch proposal step is not feasible. Thus we do the following: + +(1) At each step, we randomly sample $k \in \{3, 4, 5\}$ and a permutation of $(k - 1)!$ spans resulting from cutting the candidate sentence at $k$ points. We search only for $k$ -opt moves that permute the spans according to this permutation. +(2) For long sentences it is impractical or infeasible, due to memory constraints, to compute the improvement in tour weight under every $k$ -opt move – for a sentence of length $N$ , the number of such moves is $O(N^{k})$ . Thus we sample a smaller set of candidate cut positions and score only $k$ -opt moves that cut the sentence at positions in this set, alternating two strategies: (a) sampling $20$ ( $k = 5$ ) or $40$ ( $k = 4$ ) random candidate cut positions and (b) taking between 7 and 14 consecutive cut candidates at a random position in the text. + +![](images/d65f7267ff4cc522499e303f148aba1f201f9d39fa56095b13177d704251fffc.jpg) +Figure 5: IBIS example code usage. + +![](images/5d2a88f9ad1d0f8b6d6e8e646386de6944346100348d1a067770e745501b8e63.jpg) +Figure 6: Number of IBIS search steps and number of accepted $k$ -opt moves plotted with sentence length (in words) in the PTB dataset. + +![](images/34722e317cb037d32c204a0b359eda3891ff8ffcdb5379b42cf32ce2c4de1c2b.jpg) + +(3) We rank all $k$ -opt moves, with the given $k$ and permutation of spans, that cut at the candidate positions by how much they improve the current tour of the auxiliary graph with its current weights. A random $b$ of the top $B$ moves are proposed as the candidate batch. (We chose $B = 512$ and took $b$ , the batch size, to be 128.) + +Our experiments were run on a mixture of Nvidia Tesla K80 and P40 GPUs. The latter are able to run GPT-2 Large with batch size 128 on texts the length of the longest sentence in the PTB dataset. + +Figure 6 shows the distribution of search steps and accepted $k$ -opt moves by sentence length. + +# A.2 Visualizations + +The associated repository includes three videos showing the evolution of texts with a widely known order, and weight matrices of the auxiliary graphs, as IBIS shuffles them into their optimal orders. + +# A.3 Permutation examples + +Table 8 shows more examples of original sentences and the word orders restored by IBIS, meant to illustrate its various success and failure modes. Of note, the first example is commonly misinterpreted by humans as having the opposite meaning. It would be interesting to study whether difficulty in communication between humans arises when spoken sentences can be permuted into text that is more likely and has very different meaning. + +
Let's make a bet: winner owes loser 50 dollars. +Let's make a bet: loser owes winner 50 dollars.
The mouse chases the cat. +The cat chases the mouse.
Thoughts without content are empty, intuitions without concepts are blind. +Thoughts without content are empty, intuitions without concepts are blind.
Experience without theory is blind, but theory without experience is mere intellectual play. +Experience without theory is blind, but experience without theory is mere intellectual play.
Heat 12 oz. light beer, 1/2 tsp. Dijon mustard on low; whisk in 4 c. shredded sharp cheddar cheese until melted and smooth. +Heat 1/2 tsp. Dijon mustard, melted in 4 oz. beer; whisk 12 c. shredded cheddar cheese on low light until smooth and sharp.
To be, or not to be, that is the question: whether ‘tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles, and by opposing end them: to die, to sleep; no more; and by a sleep, to say we end the heart-ache, and the thousand natural shocks that flesh is heir to? +To say we suffer is to take a thousand shocks, whether in the flesh, or by the nobler heart, or by the more outrageous sea-ache and slings of arrows, and to be against them: and to end troubles, to end arms, to be of the opposing mind; and to die: no question, that ‘tis not a sleep; that sleep is the natural heir to fortune?
Remarkably, even for entire paragraphs, the heuristic search is able to find mostly grammatical and somewhat coherent orderings. +Remarkably, heuristic search is mostly grammatical, somewhat coherent and even able to find the orderings for entire paragraphs.
It certainly was cold, he concluded, as he rubbed his numbed nose and cheek-bones with his mittened hand. +It was certainly cold, he concluded, as he numbed his hand and rubbed his nose with mitten-ed cheekbones.
This much-needed paper fills a gap in the literature. +This paper fills a much-needed gap in the literature.
+ +Table 8: Miscellaneous original sentences and the rearrangements of their bags of words inferred by IBIS under GPT-2. + +# B IBIS beyond linearization + +In this section, we explore a few additional applications of IBIS and its variants. The generated examples presented here were chosen out of multiple runs for each prompt and not thoroughly evaluated by automatic metrics, but are rather intended to suggest possible uses and advantages of order-free generation. + +# B.1 Latent bags of words and lexical constraints + +Suppose that we aim to generate a text with lexical constraints; e.g., the number of instances or particular words or the total length of the text may be fixed. Under an autoregressive LM, sampling from the set of sequences where the constraints are satisfied is in general intractable; for instance, it + +is even intractable to sample from the distribution over sequences of length 10 ending with a period. + +The IBIS algorithm can be modified to search for the most likely sequences of tokens satisfying such constraints. For example, suppose we are generating a text with six tokens that is required to contain the words 'cat' and 'mouse'. We initialize a search with a sentence with 'cat', 'mouse', and four random words. To the IBIS search step of permuting spans of text, we add a step of replacing any word - besides 'cat' and 'mouse' - with any other word in the vocabulary. A batch proposal heuristic is possible here as well: we sample candidate replacement words at a position from the (perhaps softened) distribution over words at this position under the base LM given the current context. + +Table 9 shows examples of sentences inferred + +by such a search, constrained to begin with certain words and to contain certain other words. + +# B.2 Reverse generation. + +IBIS is readily modified to fix last few words of the generated text by simply restricting the set of candidate cut positions for $k$ -opt moves. Thus we can generate text constrained to end with given words. IBIS with a word replacement step enables a faster and more robust reverse generation using only a forward LM (Table 10). + +Notice that this search is able to find strings relevant to future context: when the sentence is forced to end with a span about cats, replacing a word in the middle of the sentence with 'cat' increases the likelihood of the entire text. At some point in the search, 'cat' gets sampled as a replacement, and the search enters a NLL sink: the word 'cat' is now likely to remain. + +# B.3 Rhyming constraints + +To give a taste of what further applications are possible, we use a modified IBIS to generate short verses. Rhyme and meter are lexical constraints that can be incorporated into word replacement search steps: for example, the words sampled for replacement at certain positions may be required to lie in the set of words that rhyme with an already generated line. + +Let us rewrite Shelley's famous lines: + +Rise like Lions after slumber + +In unvanquishable number- + +Shake your chains to earth like dew + +Which in sleep had fallen on you + +Ye are many-they are few. + +with the help of Distil-GPT-2, forced to keep the two underlined lines and generate two new rhyming lines of appropriate length: + +If you have a ton of lumber + +In unvanquishable number + +Then enjoy your lumber stew-- + +Ye are many-they are few. + +Similarly, the following haiku verses, the result of a human-machine collaboration between the authors and GPT-2, were constrained to use the bold words and satisfy metric constraints. + +Fuji. Simple frog, + +humble, short feet, do you know + +the distance to home? + +See the early moon + +Nightwatcher's little lantern + +But I see nothing. + +# C On random and latent next-word prediction + +The goal of this short section is to illustrate how randomly sampling an order of recent context degrades the performance of GPT-2 in predicting the next token, while inferring it as a latent order does not. Consider the input: "Our Father, who art in Heaven, hallowed be thy" (I indicates subword division). GPT-2 recognizes this standard text and would predict the next word as 'name' if given ordered context. Integrating over a latent order of the last $n = 2, \ldots, 7$ tokens, or taking a random order of the last 2 or 3 tokens, the most likely next token is still 'name'. However, for $n = 4$ , the most likely next token under a random order is 'lowed': the distribution over next tokens is quite flat, and the most significant pattern is that 'hall' is the last token in $\frac{1}{4}$ of orders - strong evidence for 'lowed' to follow. + +# D Human evaluation on punctuationless sentences + +All pairs of punctuationless sentences (original and IBIS-inferred orderings) were independently rated by 3 annotators, where each annotator followed the instruction set laid out in Fig. 8. + +The distribution of users' ratings for punctuationless sentences in each of the length buckets is shown in Fig. 7. For sentences in the most common length bucket (10-19), almost half of sentences are either identical to or have the same or similar meaning as the original text. + +12 11 10 9 8 7 6 5 4 3 2 1 + +-4-3-2-101234567 + +Fairy in techniques for coronavirus vaccine has been confirmed by research. + +In the aftermath of the storm, humans and hippos, penguins, dolphins, and the dinosaurs were forced into the streets by the hive mind of the Internet. + +See the full video for a long list of physicists and Mars' history as well as insights to the origins of bubbles. + +Drones, drugs, climate change: the search for answers to nothing. + +Table 9: Examples of constrained generation using IBIS endowed with a word replacement step. Underlined words are a fixed initial context, while the bold words are required to appear anywhere in the text, in some order. The base LM was Distil-GPT-2; a slight relaxation of greedy ascent is employed. + +The cat was hungry. Someone picked up the mouse and chased the cat away from it. Now the cat is still hungry. + +The mouse was hungry. It started feeding itself by taking UndergroundMISC's engineered growth cheese assay. Now the mouse is still hungry. + +The cat liked mice. His appetite for sweet treats was a little more intense. Now the cat hates mice. + +The world just had a cat and a dog fight. Now the cat isn't hungry anymore. + +The cat and the mouse were both hungry. Although they oversee the animal kingdom, their predators eat more. Now only one of them is hungry. + +I thought I could find my future and fix it, but everyone was running in panic. + +The announcement of the student strike is expected to be welcomed by many of us. Students across Canada are rejoicing. + +The Dragon King has reached out to the court at the request of a judge with the Magic Kingdom. The Minister of Magic declined to comment. + +Table 10: Examples of reverse generation with an IBIS variant. Just as in Table 9, the underlined tokens are fixed and the bold tokens are required to appear. + +![](images/c732055768383211b43c1a49f648686b9705a1161f660e207098a9ebadb1cc85.jpg) +Figure 7: Annotators' ratings of similarity between original and reordered sentences (§D). + +Rate or label the given pair of sentences for "the similarity in their meanings", where the label can be 0/1/2 as follows: + +LABEL 0: The two sentences are essentially completely different with not even surface similarities in what they mean or how they are structured, etc. This includes cases where the second sentence by itself seems non-sensical or meaningless because it is completely ungrammatical or not how English sentences look like (according to your understanding) by starting the sentence from the middle, etc. Examples of this score: + +Sentence 1: Tyrone Winsloe takes an interest in Elena, wanting her to wear skimpy clothing as well as watch, and participate in his 'hunts'. +Sentence 2: hunts, Winsloe takes an interest in Elena, wanting to participate in and watch her, as well as wear his skimpy clothing 'Tyrone'. + +Label: [0] + +Sentence 1: When he would pass out, the staff would throw water on him. +Sentence 2: When staff would pass him on, he would throw out the water. + +Label: [0] + +Sentence 1: Always for Canale 5, Boldi has interpreted his first fiction tv, giving life to the character of "big dad", Lorenzo Fumagalli in the television series "Un cyclone in famiglia", directed by Carlo Vanzina. +Sentence 2: for tv series directed by Lorenzo F. Boldagalli, Carlo Van toi cycloneum, first television character in "Unbigale", has interpreted the life of his dad in "Always 5", giving the Canzina famiglia fiction + +Label: [0] + +LABEL 1: There are surface similarities between the two sentences or they are same except for some entities being switched around but in a way that the meaning changes. The meaning of the two sentences is different overall, though they say the same things in part. This can be loosely translated as "some similarities but different in their overall meaning". Examples: +Sentence 1: "In 1895 they joined the South East Lancashire League, and a new professional and coach was employed, a John Redfern from Linthwaite." +Sentence 2: "In 1895 the Linthwaite League joined from Lancashire and they employed a new coach, John Redfern, and was a South East professional." + +Label: [1] + +Sentence 1: "Bekhud Badayuni's most recent biographer was the late Dr. Asad Ahmad of Aligarh Muslim University's Urdu Department." +Sentence 2: "Budhayuni Muslim University's Urdu Department of the late Dr. Asad Ahmad Badek was Aligarh's most recent biographer." + +Label: [1] + +Sentence 1: "The party merged into the Deutsche Konservative Partei in 1946." +Sentence 2: "The Deutsche Partei merged into the Konservative party in 1946." + +Label: [1] + +LABEL 2: The two sentences have the same or similar meaning even though they are not exact copies of one another. Examples: +Sentence 1: "A keel-laying ceremony for the submarine was held at Electric Boat's Quonset Point facility in North Kingstown, Rhode Island, on 30 April 2007." +Sentence 2: "A keel-laying ceremony for the submarine was held on April 30, 2007 at Electric Boat's Quonset Point facility in North Kingstown, Rhode Island." + +Label: [2] + +Sentence 1: "In 1970, the remains of Sears, Smyth and Daly were repatriated to Ireland by The National Graves Association and given a military funeral with full honours." +Sentence 2: "In 1970, the remains of Sears, Daly and Smyth were repatriated to Ireland and given a full military funeral with honours by The National Graves Association." + +Label: [2] + +Sentence 1: "Since 2005, Maxim Vengerov has been Professor at the Royal Academy of Music in London." +Sentence 2: "Since 2005, Professor Maxim Vengerov has been at the Royal Academy of Music in London." + +Label: [2] + +Following this order of going about your rating should help with efficiency: + +1. First, just look at the second sentence and if it does not seem like a well-formed English sentence and appears to be meaningless and basically unreadable, rate it 0 and move on. The first sentence ("original") is a sentence from English wikipedia while the second one has no such guarantee of belonging to an English text. +2. If the second sentence seems okay when considered by itself, look at the first sentence and determine what you think should apply between 1 and 2, though 0 is still possible. + +Figure 8: Instructions given to the annotators. \ No newline at end of file diff --git a/studyingwordorderthroughiterativeshuffling/images.zip b/studyingwordorderthroughiterativeshuffling/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a051d72ff12563a9748ed9355c3000adcdc008e4 --- /dev/null +++ b/studyingwordorderthroughiterativeshuffling/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21de727dd2a38be3298f0ab2bdbf6eeff1b53a66e648d28e0d6e3bf279c76f5d +size 713931 diff --git a/studyingwordorderthroughiterativeshuffling/layout.json b/studyingwordorderthroughiterativeshuffling/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e6b4b224669f636a7375b0179d98ed1ad57f44d6 --- /dev/null +++ b/studyingwordorderthroughiterativeshuffling/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19217dad5f9f8cbc11f8d51038fa486442678ab1794dc889acfafa065d911c97 +size 597773 diff --git a/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_content_list.json b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..85c2e099eb0717e49cb9495dc97fd7b2d1c4cca2 --- /dev/null +++ b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0a7cf5f139b6c0ac460c0ee52f877ccd0e53dc8735a3220a2bdfe031225dbb86 +size 98495 diff --git a/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_model.json b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e66475e44368b5fe39693dba6175cb25f1d38bfb --- /dev/null +++ b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6378a906358d5a3d9a4078e8f796f8c7dbd0863cdb899004bde02258917c5c2f +size 117101 diff --git a/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_origin.pdf b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3c21b7cf5b65840bff3dcbce0f4400ba07c46fd4 --- /dev/null +++ b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/529ddeee-2518-4f4a-a647-39df109a4bb2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4cc37a1bc00223cdbfc9822f2e07087bff36f14bb1da8fe8e14315b4d3627a0 +size 1238055 diff --git a/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/full.md b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f44b811c0e1acf9552e8072fd96bc4fb85e11778 --- /dev/null +++ b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/full.md @@ -0,0 +1,379 @@ +# Style Pooling: Automatic Text Style Obfuscation for Improved Classification Fairness + +Fatemehsadat Mireshghallah, Taylor Berg-Kirkpatrick + +University of California San Diego, + +{fatemeh, tberg}@ucsd.edu + +# Abstract + +Text style can reveal sensitive attributes of the author (e.g. race or age) to the reader, which can, in turn, lead to privacy violations and bias in both human and algorithmic decisions based on text. For example, the style of writing in job applications might reveal protected attributes of the candidate which could lead to bias in hiring decisions, regardless of whether hiring decisions are made algorithmically or by humans. We propose a VAE-based framework that obfuscates stylistic features of human-generated text through style transfer by automatically re-writing the text itself. Our framework operationalizes the notion of obfuscated style in a flexible way that enables two distinct notions of obfuscated style: (1) a minimal notion that effectively intersects the various styles seen in training, and (2) a maximal notion that seeks to obfuscate by adding stylistic features of all sensitive attributes to text, in effect, computing a union of styles. Our style-obfuscation framework can be used for multiple purposes, however, we demonstrate its effectiveness in improving the fairness of downstream classifiers. We also conduct a comprehensive study on style pooling's effect on fluency, semantic consistency, and attribute removal from text, in two and three domain style obfuscation.1 + +# 1 Introduction + +Machine learning (ML) algorithms are used in a wide range of tasks, including high-stakes applications like determining credit ratings, setting insurance policy rates, making hiring decisions, and performing facial recognition. It has been shown that such algorithms can produce outcomes that are biased towards a certain gender or race (Buolamwini and Gebru, 2018; Silva et al., 2021; Sheng et al., 2021). + +Ideally, high-stakes decisions made by either humans or ML algorithms, should not be influenced by irrelevant, protected attributes like nationality, + +age, or gender. In many instances, the input data used for making high-stakes decisions is text that is authored by a human candidate – for example, hiring decisions are often based on bios and personal statements. Recent work (De-Arteaga et al., 2019) shows that automatic hiring-decision models trained on bios are less likely to select female candidates for certain roles (e.g. architect, software engineer, and surgeon) even when the gender of the author is not explicitly provided to the system. Bias is, of course, not limited to algorithmic decisions, humans make biased decisions based on text, even when the protected attributes of the author are not explicitly revealed (Pedreshi et al., 2008). Together, these results indicate that both algorithms and humans can (1) decipher protected attributes of authors based on stylistic features of text, and (2) whether consciously or not, be biased by this information. + +A large body of prior work has attempted to address algorithmic bias by modifying different stages of the natural language processing (NLP) pipeline. For example, Ravfogel et al. (2020) attempt to de-bias word embeddings used by NLP systems, while Elazar and Goldberg (2018) address the bias in learned model representations and encodings. While effective in many cases, such approaches do nothing to mitigate bias in decisions made by humans based on text. We propose a fundamentally different approach. Rather than mitigating bias in learning algorithms that make decisions based on text, we propose a framework that obfuscates stylistic features of human-generated text by automatically re-writing the text itself. By obfuscating stylistic features, readers (human or algorithms) will be less able to infer protected attributes that enable bias. + +We introduce a novel framework that enables 'style pooling': the automatic transduction of user-generated text to a central, obfuscated style. Notions of 'centrality' can themselves introduce bias - for example, a system might learn to obfuscate by mapping all text to the dominant style + +Table 1: Example Blog sentences transformed with A4NT (Shetty et al., 2018) and our proposed Intersection and Union obfuscations. Our Intersection obfuscation aims at changing the style such that it does not reflect either teen or adult style. However, the union, tries to reflect both by making changes like adding "... to the beginning of the sentence (adult style) while keeping the "grr" (teen style). Or by adding exclamation marks at the end of the sentence. + +
AgeInput Sentence (Original Data)A4NT (Baseline)IntersectionUnion
Teengrr ... now i get cold quicker.grr now i get cold lol.hmmm ... now i get cold.... grr ... now i get cold quicker.
Teenit was so fricken hilarious.it was so boring hilarious.it was so utterly hilarious.it was so totally hilarious
Adultwell i 've just been too busy.well i 've just been kinda fun.well i 've just been too busy.well i 've just been too busy.
Adultthese were common phrases.these were common teacher.these were common.these were common !!
+ +seen in its training corpus. This might 'white-wash' text, ignoring stylistic features of underrepresented groups in the learned notion of central style. Our framework operationalizes the notion of centrality in a more flexible way: our probabilistic approach allows us to choose between two distinct notions of centrality. First, we define a variant of our model which is incentivized to learn a minimal notion of central style that effectively intersects the various styles seen in training. This is achieved through the design of this variant's probabilistic prior. We further equip this variant with a novel "de-boosting" mechanism, which amplifies the use of words that are less likely to leak sensitive attributes, and de-incentivizes the use of words whose presence might hint at a particular sensitive attribute. Second, we propose an alternative prior that instead incentivizes a maximal notion of style that seeks to obfuscate by adding stylistic features of all protected attributes to text – in effect, computing a union of styles. Table 1 shows our intersection and union obfuscation applied to sentences from the Blogs dataset, and highlights the differences between them. + +While we propose both these obfuscations in our framework and leave it to the users to choose, it is worth noting that the cognitive process literature shows that when humans are confronted with conflicting biasing information, they tend to form an opinion about the conflicting text, based on their own implicit biases (Richter and Maier, 2017). Therefore, removing sensitive stylistic features may be more effective than combining them. This is also commensurate with our findings, where we observed that intersection more successfully improves the fairness metric (Section 4.2.1). + +We extensively evaluate our proposed framework on a wide range of tasks. First, we compare and contrast our "intersection" and "union" obfuscations on a modified version of the Yelp dataset (Shen et al., 2017) where we have created three stylistic domains by deliberately misspelling three disjoint sets of words. We show that our intersection obfuscation successfully removes these + +![](images/c3c57ecac747b638664fc581e92ba7f4cc7b51070867f7c71f0b9a5c655abd6d.jpg) +Figure 1: Proposed unsupervised framework for style pooling: inducing a centralized obfuscated style. $x_{i}$ represent observed text which are clustered by their sensitive attribute (age). $y_{i}$ are corresponding latent variables representing the induced obfuscated text. Training leverages an amortized inference setup similar to a VAE-style training, but, critically the prior is produced by pooling language models from each domain using two different strategies targeting (1) intersected style and (2) the union of all styles in the corpus. + +misspellings and replaces them by the dominant spelling of the word $99.20\%$ of the time, while our union obfuscation spreads the misspellings into the other two domains $46.40\%$ of the time. Then, we evaluate our framework on the Blogs data (Schler et al., 2006), where the sensitive attribute is age, and we measure the impact our obfuscations have on the fairness of a job classifier, using the TPR-gap measure from De-Arteaga et al. (2019). We also evaluate the removal of sensitive attributes, fluency of the generated text, and the uncertainty of a sensitive attribute classifier for our framework, in both two and three domain setups. + +# 2 Proposed Method + +In this section, we first introduce our model structure, then describe our style-pooling priors and the unsupervised learning and inference techniques we leverage for this model class. Finally, we introduce our style de-boosting mechanism. + +# 2.1 Model Structure + +Consider a training corpus consisting of utterances produced by authors with various protected attributes. In Figure 1, we depict a grouping of authors by age into three domains. We let $x_{i}$ represent an individual observed text utterance in the corpus, and assume $M$ domains (sensitive attribute classes) in the dataset. $y_{i}$ is a latent variable that represents the obfuscated version of $x_{i}$ . Hence, $y_{i}$ is a text valued latent, while $x_{i}$ is a text valued observation. We let $d(i)$ denote the domain of the $i^{th}$ sample in the dataset. With this definition, our generative process assumes each sentence $x_{i}$ , with corresponding domain $d(i)$ , is generated as follows: First, a latent sentence $y_{i}$ is sampled from a central prior, $p_{prior}(y_i)$ , which is domain agnostic. Then, $x_{i}$ is sampled conditioned on $y_{i}$ from a transduction model, $p(x_{i}|y_{i};\theta_{y\rightarrow x}^{d(i)})$ . We let $\theta_{y\rightarrow x}^{D_j}$ represent the parameters of the transduction model for the $j$ th domain. We extensively discuss $p_{prior}$ in the next section. For now, we assume the prior distributions are pretrained on the observed data and therefore omit their parameters for simplicity of notation. Together, this gives the following joint likelihood: + +$$ +\begin{array}{l} p (X ^ {D _ {1}}, \dots ., X ^ {D _ {M}}, Y; \theta_ {y \rightarrow x} ^ {D _ {1}}, \dots ., \theta_ {y \rightarrow x} ^ {D _ {M}}) \\ = \prod_ {i = 1} ^ {N} p \left(x _ {i} \mid y _ {i}; \theta_ {y \rightarrow x} ^ {d (i)}\right) p _ {\text {p r i o r}} \left(y _ {i}\right) \tag {1} \\ \end{array} +$$ + +The log marginal likelihood of the observed data, which we approximate during training, can be written as: + +$$ +\begin{array}{l} \log p \left(X ^ {D _ {1}}, \dots , X ^ {D _ {M}}; \theta_ {y \rightarrow x} ^ {D _ {1}}, \dots , \theta_ {y \rightarrow x} ^ {D _ {M}}\right) (2) \\ = \log \sum_ {Y} p \left(X ^ {D _ {1}}, \dots , X ^ {D _ {M}}; \theta_ {y \rightarrow x} ^ {D _ {1}}, \dots , \theta_ {y \rightarrow x} ^ {D _ {M}}\right) (2) \\ \end{array} +$$ + +Neural Architectures. We select a parameterization for our transduction distributions that makes no independence assumptions. We use an encoder-decoder architecture based on the standard attentional Seq2Seq model which has been shown to be successful across various tasks (Bahdanau et al., 2015; Rush et al., 2015). Our prior distributions for each domain are built using recurrent language models which also make no independence assumptions. + +# 2.2 Prior Distributions + +The critical component of our framework that incentivizes obfuscation are our specialized priors, as depicted in Figure 1. We introduce two prior variants, $p_{\mathrm{Inter}}(y)$ and $p_{\mathrm{Union}}(y)$ , which incentivize induction of intersected styles and the union of all styles, respectively. Each prior is assembled out of $M$ (here $M = 3$ ) separate language models $-p^{D_1}$ , $p^{D_2}$ , ..., $p^{D_M}$ - each trained on the corresponding domain + +of observed utterances in the training data. The intersection prior, $p_{\mathrm{Inter}}(y)$ , is computed by taking the sum of the likelihoods of an entire utterance across the language models from all $M$ domains (and then re-normalizing to ensure that resulting prior is a valid distribution). This utterance-level average pooling approach incentivizes a "majority-voting" effect, in which the model is pressured to remove any words and stylistic features that are characteristic of one domain, but not the others, and converge to features that are shared by the majority of the domains. Therefore the prior for intersection becomes: + +$$ +p _ {I n t e r} \left(y _ {i}\right) = \frac {1}{M} \sum_ {j} ^ {M} p ^ {D _ {j}} \left(y _ {i}\right) \tag {3} +$$ + +In contrast, the union prior, $p_{\mathrm{Union}}(y)$ , computes the likelihood of an utterance according to the minimum likelihood across each domain's language model at each token position, $t$ . Through experimentation (Sec. 4.1) we empirically observed that this prior rewards the model for inserting as many stylistic features as possible that are unique to each domain. + +$$ +p _ {U n i o n} \left(y _ {i}\right) \propto \prod_ {t} ^ {T} \min \left(p ^ {D _ {1}} \left(y _ {i, t} \mid y _ {i, < t}\right), \dots , p ^ {D _ {M}} \left(y _ {i, t} \mid y _ {i, < t}\right)\right) \tag {4} +$$ + +# 2.3 Learning and Inference + +Training is accomplished using an approach from (He et al., 2020): We employ seq2seq inference networks and use an amortized inference scheme similar to that used in a conventional VAE, but for sequential discrete latents. + +Ideally, learning should directly optimize the log data likelihood, which is the marginal shown in Eq. 2. However, due to our model's neural parameterization, the marginal is intractable. To overcome the intractability of computing the true data likelihood, we adopt amortized variational inference (Kingma and Welling, 2013) to derive a surrogate objective for learning the evidence lower bound (ELBO) on log marginal likelihood: + +$$ +\begin{array}{l} \log p (X ^ {D _ {1}}, \dots , X ^ {D _ {M}}; \theta_ {y \rightarrow x} ^ {D _ {1}}, \dots , \theta_ {y \rightarrow x} ^ {D _ {M}}) \\ \geq \mathcal {L} _ {\text {E L B O}} \quad \left(X ^ {D _ {1}},..., X ^ {D _ {M}}; \theta_ {y \rightarrow x} ^ {D _ {1}},..., \theta_ {y \rightarrow x} ^ {D _ {M}}, \phi_ {x \rightarrow y}\right) \\ = \sum_ {i} ^ {N} \underbrace {\left[ \mathbb {E} _ {q \left(y _ {i} \mid x _ {i} ; \phi_ {x \rightarrow y}\right)} \left[ \log p \left(x _ {i} \mid y _ {i}; \theta_ {y \rightarrow x} ^ {d (i)}\right)\right]\right.} _ {\text {R e c o n s t r u c t i o n l i k e l i h o o d}} \\ - \underbrace {D _ {\mathrm {K L}} \left( \right.q \left(y _ {i} \mid x _ {i} ; \phi_ {y \rightarrow x}\right) \mid \left| \right. p _ {p r i o r} \left(y _ {i}\right)\left. \right)\left. \right]} _ {\text {K L r e g u l a r i z e r}} \tag {5} \\ \end{array} +$$ + +This new objective introduces $q(y|x; \phi_{x \to y})$ , which represents the inference network distribution + +that approximates the model's true posterior, $p(y|x;\theta_{x\rightarrow y})$ . Learning operates by optimizing the lower bound over both variational and model parameters. Once training is over, the posterior distribution can be used for style obfuscation. + +The reconstruction and KL terms in Eq. 5 involve intractable expectations, which means we need to approximate their gradients. To address this, we use the Gumbel-softmax (Jang et al., 2017) straight-through estimator to backpropagate gradients from both the KL and reconstruction loss terms. + +Length Control. During the training of the model, we observed that it tends to repeat the same word when it is trying to generate obfuscated text, $y_{i}$ . To mitigate this, we append two floating point length tokens to the input of the inference networks decoder at each step $t$ , one of these tokens tells the model which step it is on, and the other tells it how many steps are left (Kikuchi et al., 2016; Hu et al., 2017). We also experimented with positional embeddings instead of floating point tokens, but we observed that they yield worse convergence. Another measure we take to encourage shorter sentences was to hard stop the decoding during training once the re-written sentence had the same length as the original sentence. To further stabilize training we share parameters between the inference network and the transduction models, appending an embedding to the input to indicate the output domain. + +# 2.4 Style De-boosting + +To better encourage the removal of identifying stylistic features, we introduce a de-boosting mechanism, which incentivizes the use of words that are less likely to leak sensitive attributes, and de-incentivizes the use of words whose presence might hint at a particular sensitive attribute. We build on the intuition that for a given word $w$ in the vocabulary, if the probability that it belongs to domain $m$ is similar to the probability that it belongs to domain $k$ , for any given $m, k$ within the possible domains, $M$ , then we can assume that this word does not reveal style. However, if there is a huge gap in the two probabilities, that word might hint at a certain domain if it is present in the re-written text. Therefore, we devise a normalized "style score", $s$ , for each word $w$ in the vocabulary3: + +$$ +s _ {w} = \frac {\operatorname* {m a x} \left(f _ {w} ^ {D _ {1}} , f _ {w} ^ {D _ {2}} , \dots , f _ {w} ^ {D _ {M}}\right) - \operatorname* {m i n} \left(f _ {w} ^ {D _ {1}} , f _ {w} ^ {D _ {2}} , \dots , f _ {w} ^ {D _ {M}}\right)}{\operatorname* {m a x} \left(f _ {w} ^ {D _ {1}} , f _ {w} ^ {D _ {2}} , \dots , f _ {w} ^ {D _ {M}}\right)} \tag {6} +$$ + +Where $f_{w}^{D_{1}}$ is frequency of word $w$ in the training corpus for domain $D_{1}$ , divided by the overall number of tokens (words) in the domain corpus. Using these scores, we modify the output logits of the decoder so that the output probability distribution over the vocabulary for sample $i$ at step $t$ is given by: + +$$ +p \left(y _ {i, t} \mid y _ {i, < t}, x _ {i}\right) \propto \operatorname {s o f t m a x} \left(L _ {i, t} - \gamma * S\right) \tag {7} +$$ + +Here, $L_{i,t}$ represents the logits at step $t$ , while $S$ is the score vector for all the words in the vocabulary. $\gamma$ is a multiplier that helps tune the amount of de-boosting. Due to the nature of this de-boosting mechanism, it makes sense only to use it with the intersection obfuscation and not the union. + +# 3 Experimental Setup + +Here, we provide a brief description of our experimental setup. Our code, data and model checkpoints are uploaded in the supplementary material. More details on the code, model configurations, datasets and hyperparameters are provided in Appendix Sections A.1, A.2, A.3 and A.4. + +# 3.1 Model Configurations + +We used a single layer attentional LSTM-based Seq2Seq encoder-decoder for all the experiments, with hidden layer size of 512 for both encoder and decoder, and word embedding size of 128. For the attribute classifiers and language models, we also use LSTM models with the same architecture, with a final projection layer of the size of sensitive classes/vocabulary. + +# 3.2 Datasets + +Synthetic Yelp dataset (Shen et al., 2017). We shuffle all the sentences in the Yelp reviews dataset and divide them into three groups (domains). We then randomly choose 15 words from the top 20 highest frequency words in the dataset, and allocate the set of top 5 words $(W_{1})$ to $D_{1}$ (domain 1), next 5 to $D_{2}$ and the least frequent 5 words to $D_{3}$ . We misspell all occurrences of $W_{1}$ in $D_{1}$ , by changing "word" to "11word11". We then add "11word11" to the vocabulary, and do this for all the 5 words in all 3 domains (15 words total). After this transformation, we have 3 domains with disjoint stylistic markers, which can help us more concretely analyze our obfuscation mechanism. + +Blogs dataset (Schler et al., 2006). The blogs dataset is a collection of micro blogs containing over 3.3 million sentences along with annotation of author's age and occupation. We use this data in both two and three domain style pooling, where we treat age as the sensitive attribute and balance the data so each domain has the same number of sentences. In the two domain setup, we divide the data in two groups of teenagers and adults. In the three style setup, we have three groups of teenagers, young adults (20s) and adults (people in their 30s and 40s). We use this dataset for multiple evaluations including fairness. We compare our obfuscation to that of Shetty et al. (2018) in all evaluations with this data. + +Twitter dataset (Rangel et al., 2016). We use data from the PAN16 dataset, which contains manually annotated (from LinkedIn) age and gender of 436 Twitter users, along with up to 1000 tweets from each user. We use this data for the purpose of sensitive attribute (age) removal comparison with Elazar and Goldberg (2018) in Section A.7, and have therefore used the exact same preprocessing and handling of the data as done by them. + +DIAL dataset (Blodgett et al., 2016). This is a Twitter dataset which has binary dialect annotations of African American English (AAE) and Standard American English (SAE) $^4$ , setting "author's race" as the sensitive attribute. We use this dataset for comparison with the work Xu et al. (2019). + +# 3.3 Baselines + +One language model prior (One-LM). This model is an instance of our framework which uses the output distribution of a single language model as the prior. For the Yelp Synthetic data this single LM is trained on the original data which does not have our modifications and would provide the ideal "intersection", since the original data itself does not have misspellings from any of our synthetic domains and can be considered as central. In the case of the Blogs data where we don't have any ideal central data which is void of style, we train an age classifier and then choose the sentences from the training set that the classifier missclassifies. We create a new training set with these samples and train a single LM on them, and use it for the prior. The intuition is that if the classifier could not guess the domain, these samples are probably close to the + +notion of centrality we are looking for. + +A4NT (Shetty et al., 2018). "A4NT: Author Attribute Anonymity by Adversarial Training of Neural Machine Translation" is the most closely related past work that also attempts to obfuscate text style through automatic re-writing. However, their adversarial approach uses a discriminator network to hide protected attributes simply by mapping the style of one protected category to that of another. + +PATR (Xu et al., 2019). Privacy Aware Text Rewriting (PATR) is another work close to ours, which removes sensitive attributes through text re-writing using translation and adversarial learning. Unlike style pooling, PATR, targets privacy and is therefore not concerned with the union vs. intersection of sensitive attributes. + +Original. We include an "original" baseline in our measurements, which shows the value of a given metric if the original un-obfuscated data was used. + +# 3.4 Evaluation Metrics + +Below we discuss our evaluation metrics, all of which are measured on the test data. + +# 3.4.1 Fairness + +TPR-gap. We first define a classifier whose main task is to determine if the occupation of an author is student or not, given text from their blog. We set the age of the author as a sensitive attribute, and want to measure the bias in the classifier, given age. We follow (De-Arteaga et al., 2019) and use the "True Positive Rate gap in age" metric. This measure quantifies the bias in a classifier by finding the gap between the true positive rate for each sensitive attribute group (teen vs. adult). For a binary sensitive attribute $a$ (age) and a true class (for the classifier's main task) $y$ , we define: + +$$ +T P R _ {a, y} = P (\hat {Y} = y \mid A = a, Y = y) \tag {8} +$$ + +$$ +G A P _ {a, y} ^ {T P R} = T P R _ {a, y} - T P R _ {a ^ {\prime}, y} \tag {9} +$$ + +where $A$ is the random variable denoting binary sensitive attribute with values $a$ and $a'$ . $Y$ , $\hat{Y}$ are random variables denoting the correct class and the predicted class, respectively. The lower the gap is, the more fair the classifier. We report $GAP_{Teen,Student}$ , which reflects how biased the classifier is towards classifying teens as students. + +# 3.4.2 Linguistic + +Back-Translation (BT) accuracy. We translate the obfuscated samples back to their original domain using the model, and then for each token + +see if it has been correctly back-translated to its origin or not. We use this metric to see whether the obfuscated version contains sufficient information about content to reconstruct the original. + +GPT-2 PPL. We feed our obfuscated test sentences to a huggingface (Radford et al., 2019) pre-trained GPT-2 medium model, and report its perplexity (PPL), as an automatic measure of fluency. Lower PPL hints at more fluent text. + +BLEU Score. In the Yelp Synthetic data experiments, since we have the original (not misspelled) text, we can calculate and report the BLEU score. + +GLEU Score. We use GLEU (Wu et al., 2016) score as another metric for evaluating the fluency of the generated sentences. + +Lexical Diversity (Lex. Div.) To better quantify the differences between different obfuscations, we calculate the lexical diversity as a ratio where the size of the vocabulary of the model's output text is the numerator, and the denominator is the overall size of the model's output text (number of all the tokens in the output). + +# 3.4.3 Sensitive-Attribute Classification + +Sensitive-attribute Classifier (Clsf.) accuracy. To evaluate the removal of sensitive attributes, we train a sensitive-attribute classifier, and use its accuracy as a metric. The closer the accuracy is to chance level (random guess), the more successful is the removal. However, there is a caveat to this metric: it is not always clear how the classifier is making its decision, if it is based on content, or style. Therefore, this metric alone is not conclusive. + +Entropy. To better measure how uncertain the classifier becomes, we also compute its average Entropy across all test samples. Entropy is always between $[0.0, 1.0]$ for two domain classification and $[0.0, 1.59]$ for three domain classification. The higher it is, the more uncertain the classifier is (more desirable for our purpose). + +Confident Response (CR) percentage. We calculate the percentage of the responses from the classifier for which it was more than $75\%$ sure. + +# 4 Experimental Results + +# 4.1 Synthetic Yelp Data + +Table 2 shows the experimental results for the Synthetic Yelp dataset experiment, where we trained our proposed framework using the three synthetic domains with misspellings, as explained in Section 3.2. The Corrected, Remaining and Removed percentages refer to the average ratio of + +Table 2: Results for the Synthetic Yelp dataset with 3 domains. Corrected shows what % of modified words in a domain were corrected back to their original format. Spread shows the reverse. + +
IntersectionUnionOne-LM
BT Accuracy (%)92.4794.5295.58
Corrected (%)99.2045.1799.87
Remaining (%)0.6154.370.00
Removed (%)0.180.460.12
Spread (%)0.1846.400.00
Cls Accuracy (%)33.4834.9933.35
BLEU81.7470.8693.01
+ +the misspellings corrected, remaining and removed for each domain. These should all sum up to $100\%$ . The Spread is the average ratio of the number of words from one domain that have been changed to misspellings from another domain. For instance, if there are 100 occurrences of "word" outside $D_{1}$ before obfuscation, if 40 of them are converted to "11word11" after obfuscation, then the spread would be $40\%$ . The One-LM can be considered as an "oracle baseline" in this case, since it was trained on original (no misspellings) data. + +The main goal of this controlled experiment is to compare and contrast our intersection and union obfuscations. From the Table we can see that both our obfuscations lead to high fidelity (back-translation accuracy) and semantic consistency (BLEU score). They also both render the domain classifier very close to chance level $(33.33\%)$ . The main differences between these two methods become more clear when we look at the corrected, remaining, and spread numbers. The intersection obfuscation with its average pooling, demonstrates a majority voting behavior which incentivizes correcting the misspellings since 2 out of the 3 language models advocate for the correct spelling. Therefore $99.20\%$ of the misspellings are corrected using intersection, very close to the oracle baseline. The Union prior, on the other hand, corrects only $45.17\%$ of the misspellings, and lets $54.37\%$ of them to remain as they are. It also converts $46.40\%$ of the correctly spelled words in other domains to misspellings. This shows that the union is in fact mixing the styles, creating sentences that might have more than one misspelling in them. + +# 4.2 Blogs Data + +Tables 3, 5 and 6 summarize the experimental results for the Blogs dataset. Below, we will explain each experiment in more detail. + +# 4.2.1 Fairness Results + +Table 3 shows the results for the fairness metric measurements on text generated using different obfuscations, for "Occupation" classifiers. We have selected a subset of the Blogs data for this experiment, where author occupation is either student or arts, and the age is either teen or adult (two domain obfuscation). we have taken an approach similar to that of Ravfogel et al. (2020), where we create 4 different levels of imbalance. In all cases, the dataset is balanced with respect to both occupation and age. We change only the proportion of each age within each occupation class (e.g., in the 0.8 ratio, the student occupation class is composed of $80\%$ teens and $20\%$ adults, while the arts class is composed of $20\%$ teens and $80\%$ adults). For each imbalance ratio we train the classifier on the original imbalanced data, and then test it with original and automatically generated data from different baselines. + +Based on Table 3, we can see that our Intersection obfuscation can improve fairness (TPR-gap) with little harm to the classifier accuracy (Occupation), in comparison to the original data and A4NT. We can trade-off classifier accuracy and fairness, by increasing the de-boosting (DB) multiplier. In the Table, Intersection shows Intersection obfuscation with different DB levels. In the case of $DB = 40$ , we lose slightly more utility, but observe much better fairness. + +A4NT's performance in terms of the fairness metric (TPR-Gap) is comparable to our Intersection obfuscation (even without de-boosting), however, in maintaining occupation accuracy (utility), A4NT performs much more poorly. We presume this is because A4NT removes sensitive attributes solely based on hints from a discriminator, and the low occupation accuracy suggests the discriminator captures the content more than it captures style, therefore it changes the meaning and structure of the sentences as well. Our human judgments for semantic consistency and fluency in Section 4.4 support this hypothesis. Our Union obfuscation, however, does not improve the fairness. We hypothesize this could be caused by keeping/adding biasing words, which can perpetuate the existing impartialities in the classifier, similar to how human cognition works (Richter and Maier, 2017). + +# 4.2.2 Linguistic and Sensitive-attribute Classification Results + +The top section of Tables 5 and 6 show the linguistic and sensitive-attribute classification metrics for the + +two and three domain obfuscations, respectively. Since A4NT cannot be applied to non-binary style obfuscations as is, there are no results for it in three domains. We can see that for both two and three domains the de-boosting (denoted as DB) offers a trade-off between the linguistic quality of the generated text and the obfuscation of sensitive attributes. Compared to the One-LM baseline, for corresponding levels of de-boosting, our Intersection obfuscation is almost always superior, in both text quality and obfuscation. The Intersection obfuscation with de-boosting multiplier of 25 outperforms A4NT, with lower classifier accuracy, higher entropy and much lower Confident Response (CR) rate from the classifier. In general, the Intersection obfuscation, even without de-boosting does well on Entropy and CR, which shows that our method is doing well at creating doubt in terms of what the age of the author is. One caveat however, across both two and three domain obfuscations is the classifier accuracy, which does not decrease much. We hypothesize that one reason for this could be the dependency between style and content, and that the sensitive-attribute classifier could be basing its decisions on content, therefore changing the style would not hide the sensitive attribute. + +Our Union obfuscation is behaving differently from the Intersection, and is inferior in terms of obfuscating the text, with higher classifier accuracy and lower entropy. However, it has higher lexical diversity, which could hint at it trying to keep sentences diverse and "adding styles", whereas the Intersection is only keeping the common words and is therefore decreasing the lexical diversity. + +# 4.3 Comparison with PATR + +Table 4 provides a comparison between our style pooling method, and PATR (Xu et al., 2019). $\alpha$ is knob used by PATR to tune the intensity of attribute removal, and the classifier accuracy on non-modified text is $86.3\%$ . We can see that without de-boosting, our intersection method drops the classifier accuracy to $74.05\%$ with a GLEU score of 26.32. PATR drops the classifier accuracy to $74.85\%$ , but with a worse level of GLEU. With de-boosting, however, we can achieve a classifier accuracy of $62.12\%$ with GLEU of 17.2, whereas PATR reports accuracy of $65.75\%$ for a much lower GLEU of 9.67 when $\alpha$ is increased. This shows that our de-boosting mechanism can provide an advantage by giving a lower probability to attribute + +Table 3: Fairness results for the Blogs data. The main task is classifying if the author occupation is student or not. Higher occupation accuracy and lower TPR-gap are better. DB denotes our style de-boosting technique, and the number next to it shows its multiplier. Larger multiplier means stronger style obfuscation. + +
RatioOccupation Accuracy (Utility)TPR-gap (Fairness)
OriginalA4NTIntersectionUnionOriginalA4NTIntersectionUnion
No DBDB=25DB=40No DBDB=25DB=40
0.9574.5659.3574.7771.1269.7373.220.540.290.230.230.210.51
0.8065.5554.7465.3165.1259.6065.430.350.210.350.180.180.36
0.6559.0152.7358.4156.6854.4557.190.120.050.110.110.110.15
0.5058.0953.4756.2153.653.1855.490.040.080.050.050.030.05
+ +Table 4: Comparison with PATR (Xu et al., 2019), on the Twitter DIAL dataset, where the author's race is the sensitive attribute. + +
MetricPATRIntersectionUnion
α=1α=5No DBDB = 20
GLEU24.779.6726.3217.2126.25
Clsf. Acc (%)74.8565.7574.0562.1273.27
+ +revealing components, while maintaining the sentence structure. Our union method also achieves $73.27\%$ accuracy with 26.25 GLEU, making it most suitable for cases where the semantic consistency of the sentences is most important. + +# 4.4 Evaluation with Human Judgments + +We design two crowd-sourcing tasks on Amazon Mechanical Turk. (1) Fluency: We provide workers with a pair of obfuscated sentences, and ask them which sentence is more fluent. (2) Semantic Consistency: We provide the original (un-obfuscated) sentences, and ask workers which of the obfuscated sentences is closer in meaning to the original sentence. The model checkpoints used for human evaluations here are those whose fairness and linguistic metrics are reported in Tables 3, 5. We use our intersection obfuscation, with no de-boosting. We randomly select 188 sentences from the test set, and used the model outputs for human judgment. For consistency, each pair of sentences is rated by three workers and we take the majority vote. In terms of fluency, the workers preferred our obfuscations over those of A4NT for $60.38\%$ of the sentences. In terms of semantic consistency, for $72.13\%$ sentences they found our obfuscations to be closer in meaning to the original ones. + +# 5 Related Work + +A large body of prior work has attempted to address algorithmic bias by modifying different stages of the natural language processing (NLP) pipeline. Blodgett et al. (2021), Barikeri et al. (2021), Farrand et al. (2020), Mireshghallah et al. + +(2021a) and Sheng et al. (2019) propose and analyze benchmarks for evaluating fairness in different applications. Ravfogel et al. (2020), Kaneko and Bollegala (2019), Shin et al. (2020) and Kaneko and Bollegala (2021) attempt to de-bias word embeddings used by NLP systems, while Elazar and Goldberg (2018); Barrett et al. (2019); Wang et al. (2021) attempt to de-bias model representations and encodings. + +There is also a large body of work on modifying learning algorithms and inference procedures to produce more fair outcomes (Agarwal et al., 2018; Madras et al., 2018; Zafar et al., 2017; Han et al., 2021; Mireshghallah et al., 2021b). While effective in many cases, such approaches do nothing to mitigate human bias in decisions based on text. Fundamentally, our framework is concerned with stylistic features of human-generated text. Thus, a large body of prior work on methods for unsupervised style transfer are related to our approach (Santos et al., 2018; Yang et al., 2018; Luo et al., 2019; He et al., 2020). There is also a vast body of work on style obfuscation (Emmery et al., 2018; Reddy and Knight, 2016; Bevendorff et al., 2019; Shetty et al., 2018). + +Our work is most closely related to Shetty et al. (2018) and Xu et al. (2019). A4NT (Shetty et al., 2018) attempts to obfuscate text style through automatic re-writing. However, their approach attempts to hide protected attributes simply by mapping the style of one protected category to that of another. In contrast, we seek not to map the author's text to another author's style, but to a central obfuscated style. Xu et al. propose Privacy Aware Text Re-writing (PATR), which takes a similar adversarial learning translation based approach to address this problem and re-write text. One fundamental difference between our style-pooling method and PATR is that we provide the choice of union vs. intersection of styles, which is concerned with the societal aspects of removing sensitive attributes, since we + +Table 5: Linguistic and sensitive-attribute classifier results for Blogs data, considering two sensitive age domains of teens and adults. For BT accuracy and entropy higher is better, for PPL and Confident Response (CR) lower is better. + +
MetricOriginalA4NTOne-LMIntersectionUnion
No DBDB = 25DB = 40No DBDB = 25DB = 40
LingBT Accuracy (%)100.0066.4994.4792.8890.6095.4187.3988.6396.88
GPT-2 PPL41.7144.8539.5153.6566.2141.642.8058.1542.07
Lex. Div. (%)3.222.282.521.821.092.501.470.972.71
Clsf.Clsf. Accuracy (%)64.7361.3162.0761.6959.5264.2360.9059.8164.02
Entropy0.870.860.870.910.950.870.930.950.87
CR (%)14.2115.7213.446.492.8013.954.782.4714.22
+ +Table 6: Linguistic and sensitive-attribute classifier results for Blogs data, considering three sensitive age domains of teens and adults. For BT accuracy and entropy higher is better, for PPL and Confident Response (CR) lower is better. + +
MetricOriginalA4NTOne-LMIntersectionUnion
No DBDB = 25DB = 40No DBDB = 25DB = 40
LingBT Accuracy (%)100.00-93.8493.6487.8389.0989.2582.4793.30
GPT-2 PPL41.70-43.4948.9984.6148.1549.7069.0842.66
Lex. Div. (%)3.41-2.461.810.941.971.020.772.86
Clsf.Clsf. Accuracy (%)49.78-49.1647.6445.4148.1247.1345.8148.81
Entropy1.38-1.381.431.471.441.441.491.38
CR (%)43.00-43.3338.8930.7538.7635.3728.0245.88
+ +are targeting removal of bias. PATR, however, targets privacy and is therefore not concerned with the union vs. intersection of sensitive attributes. + +Finally, there is a body of work on re-writing text to mitigate the potential biases within the content of the text itself. Ma et al. propose PowerTransformer, which rewrites text to correct the implicit and potentially undesirable bias in character portrayals. Pryzant et al. propose a framework that addresses subjective bias in text and Field and Tsvetkov and Zhou et al. introduce approaches to identifying gender bias against women at a comment level and dialect bias in text, respectively. These works focus on the text content, and not on the stylistic features of the author. + +# 6 Conclusion + +We proposed a probabilistic VAE framework for automatically re-writing text in order to obfuscate stylistic features that might reveal sensitive attributes of the author. We demonstrated in experiments that our proposed framework can indeed reduce bias in downstream text classification. Finally, our model poses two ways of defining a central style. Future work might consider further explorations of alternative notions of stylistic centrality. + +# Acknowledgments + +The authors would like to thank the anonymous reviewers and meta-reviewers for their helpful + +feedback. We also thank Junxian He for insightful discussions. Additionally, we thank our colleagues at the UCSD Berg Lab for their helpful comments and feedback. + +# Ethical Considerations + +Our proposed model is intended to be used to address a real-world fairness issue. However, this is an extremely complicated topic, and it should be treated with caution, especially upon deploying possible mitigations such as ours. One potential issue we see is the chance that systems like this might obfuscate text by converging towards the majority and erasing styles of marginalized communities. We have tried to address this concern, and raise discussion around it in our introduction and model design, by allowing for multiple operationalizations of a "central" style, and introducing the union and intersection obfuscations. Defining a true notion of centrality that would effectively protect sensitive attributes without erasing any specific styles of writing requires further study. + +# References + +Alekh Agarwal, Alina Beygelzimer, Miroslav Dudík, John Langford, and Hanna Wallach. 2018. A reductions approach to fair classification. In International Conference on Machine Learning, pages 60-69. PMLR. + +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In Proceedings of ICLR. +Soumya Barikeri, Anne Lauscher, Ivan Vulic, and Goran Glavš. 2021. RedditBias: A real-world resource for bias evaluation and debiasing of conversational language 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 1: Long Papers), pages 1941-1955, Online. Association for Computational Linguistics. +Maria Barrett, Yova Kementchedjhieva, Yanai Elazar, Desmond Elliott, and Anders Søgaard. 2019. Adversarial removal of demographic attributes revisited. In EMNLP/IJCNLP. +Janek Bevendorff, Martin Potthast, Matthias Hagen, and Benno Stein. 2019. Heuristic authorship obfuscation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1098-1108. +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. +Su Lin Blodgett, Gilsinia Lopez, Alexandra Olteanu, Robert Sim, and Hanna Wallach. 2021. Stereotyping Norwegian salmon: An inventory of pitfalls in fairness benchmark datasets. 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 1004-1015, Online. Association for Computational Linguistics. +Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew Dai, Rafal Jozefowicz, and Samy Bengio. 2016. Generating sentences from a continuous space. In Proceedings of ConNLL. +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. PMLR. +Maria De-Arteaga, Alexey Romanov, Hanna Wallach, Jennifer Chayes, Christian Borgs, Alexandra Chouldechova, Sahin Geyik, Krishnamaram Kenthapadi, and Adam Tauman Kalai. 2019. Bias in bios: A case study of semantic representation bias in a high-stakes setting. In Proceedings of the Conference on Fairness, Accountability, and Transparency, pages 120-128. + +Yanai Elazar and Yoav Goldberg. 2018. Adversarial removal of demographic attributes from text data. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 11-21. +Chris Emmery, Enrique Manjavacas, and Grzegorz Chrupał. 2018. Style obfuscation by invariance. In Proceedings of the 27th International Conference on Computational Linguistics, pages 984-996. +Tom Farrand, Fatemehsadat Mireshghallah, Sahib Singh, and Andrew Trask. 2020. Neither private nor fair: Impact of data imbalance on utility and fairness in differential privacy. In Proceedings of the 2020 Workshop on Privacy-Preserving Machine Learning in Practice, pages 15-19. +Anjalie Field and Yulia Tsvetkov. 2020. Unsupervised discovery of implicit gender bias. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 596-608. +Xudong Han, Timothy Baldwin, and Trevor Cohn. 2021. Decoupling adversarial training for fair NLP. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 471-477, Online. Association for Computational Linguistics. +Junxian He, Xinyi Wang, Graham Neubig, and Taylor Berg-Kirkpatrick. 2020. A probabilistic formulation of unsupervised text style transfer. arXiv preprint arXiv:2002.03912. +Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. 2017. Toward controlled generation of text. In ICML. +Eric Jang, Shixiang Gu, and Ben Poole. 2017. Categorical reparameterization with gumbel-softmax. In Proceedings of ICLR. +Masahiro Kaneko and Danushka Bollegala. 2019. Gender-preserving debiasing for pre-trained word embeddings. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1641-1650. +Masahiro Kaneko and Danushka Bollegala. 2021. Debiasing pre-trained contextualised embeddings. In Proceedings of the European Chapter of the Association for Computational Linguistics. +Yuta Kikuchi, Graham Neubig, Ryohei Sasano, Hiroya Takamura, and Manabu Okumura. 2016. Controlling output length in neural encoder-decoders. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1328-1338. +Diederik P Kingma and Max Welling. 2013. Autoencoding variational bayes. arXiv preprint arXiv:1312.6114. + +Fuli Luo, Peng Li, Jie Zhou, Pengcheng Yang, Baobao Chang, Zhifang Sui, and Xu Sun. 2019. A dual reinforcement learning framework for unsupervised text style transfer. arXiv preprint arXiv:1905.10060. +Xinyao Ma, Maarten Sap, Hannah Rashkin, and Yejin Choi. 2020. Powertransformer: Unsupervised controllable revision for biased language correction. In EMNLP. +David Madras, Toni Pitassi, and Richard Zemel. 2018. Predict responsibly: Improving fairness and accuracy by learning to defer. Advances in Neural Information Processing Systems, 31:6147-6157. +Fatemehsadat Mireshghallah, Huseyin Inan, Marcello Hasegawa, Victor Ruhle, Taylor Berg-Kirkpatrick, and Robert Sim. 2021a. Privacy regularization: Joint privacy-utility optimization in LanguageModels. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3799-3807, Online. Association for Computational Linguistics. +Fatemehsadat Mireshghallah, Mohammadkazem Taram, Ali Jalali, Ahmed Taha Taha Elthakeb, Dean Tullsen, and Hadi Esmaeilzadeh. 2021b. Not all features are equal: Discovering essential features for preserving prediction privacy. In Proceedings of the Web Conference 2021, pages 669-680. +Dino Pedreshi, Salvatore Ruggieri, and Franco Turini. 2008. Discrimination-aware data mining. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 560-568. +Reid Pryzant, Richard Diehl Martinez, Nathan Dass, S. Kurohashi, Dan Jurafsky, and Diyi Yang. 2020. Automatically neutralizing subjective bias in text. In AAAI. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Francisco Rangel, Paolo Rosso, Ben Verhoeven, Walter Daelemans, Martin Potthast, and Benno Stein. 2016. Overview of the 4th author profiling task at pan 2016: cross-genre evaluations. Working Notes Papers of the CLEF, 2016:750-784. +Shauli Ravfogel, Yanai Elazar, Hila Gonen, Michael Twiton, and Yoav Goldberg. 2020. Null it out: Guarding protected attributes by iterative nullspace projection. arXiv preprint arXiv:2004.07667. +Sravana Reddy and Kevin Knight. 2016. Obfuscating gender in social media writing. In Proceedings of the First Workshop on NLP and Computational Social Science, pages 17-26. +Tobias Richter and Johanna Maier. 2017. Comprehension of multiple documents with conflicting information: A two-step model of validation. Educational psychologist, 52(3):148-166. + +Alexander M Rush, Sumit Chopra, and Jason Weston. 2015. A neural attention model for abstractive sentence summarization. In Proceedings of EMNLP. +Cicero Nogueira dos Santos, Igor Melnyk, and Inkit Padhi. 2018. Fighting offensive language on social media with unsupervised text style transfer. arXiv preprint arXiv:1805.07685. +Jonathan Schler, Moshe Koppel, Shlomo Argamon, and James W Pennebaker. 2006. Effects of age and gender on blogging. In Proceedings of AAAI. +Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2017. Style transfer from non-parallel text by cross-alignment. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6833-6844. +Emily Sheng, Kai-Wei Chang, Prem Natarajan, and Nanyun Peng. 2019. The woman worked as a babysitter: On biases in language 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 3407-3412. +Emily Sheng, Kai-Wei Chang, Premkumar Natarajan, and Nanyun Peng. 2021. Societal biases in language generation: Progress and challenges. In Proceedings of the Conference of the 59th Annual Meeting of the Association for Computational Linguistics (ACL). +Rakshith Shetty, Bernt Schiele, and Mario Fritz. 2018. A4nt: Author attribute anonymity by adversarial training of neural machine translation. In 27th USENIX Security Symposium (USENIX Security 18), pages 1633-1650, Baltimore, MD. USENIX Association. +Seungjae Shin, Kyungwoo Song, JoonHo Jang, Hyemi Kim, Weonyoung Joo, and Il-Chul Moon. 2020. Neutralizing gender bias in word embedding with latent disentanglement and counterfactual generation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 3126-3140. +Andrew Silva, Pradyumna Tambwekar, and Matthew Gombolay. 2021. Towards a comprehensive understanding and accurate evaluation of societal biases in pre-trained transformers. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2383-2389, Online. Association for Computational Linguistics. +Liwen Wang, Yuanmeng Yan, Keqing He, Yanan Wu, and Weiran Xu. 2021. Dynamically disentangling social bias from task-oriented representations with adversarial attack. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3740-3750, Online. Association for Computational Linguistics. + +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144. +Qiongkai Xu, Lizhen Qu, Chenchen Xu, and Ran Cui. 2019. Privacy-aware text rewriting. In Proceedings of the 12th International Conference on Natural Language Generation, pages 247-257. +Zichao Yang, Zhiting Hu, Chris Dyer, Eric P Xing, and Taylor Berg-Kirkpatrick. 2018. Unsupervised text style transfer using language models as discriminators. arXiv preprint arXiv:1805.11749. +Muhammad Bilal Zafar, Isabel Valera, Manuel Gomez Rogriguez, and Krishna P Gummadi. 2017. Fairness constraints: Mechanisms for fair classification. In Artificial Intelligence and Statistics, pages 962-970. PMLR. +Xuhui Zhou, Maarten Sap, Swabha Swayamdipta, Noah A Smith, and Yejin Choi. 2021. Challenges in automated debiasing for toxic language detection. arXiv preprint arXiv:2102.00086. + +# A Appendix + +# A.1 Experiment Code + +We have uploaded code, data and model checkpoints needed for reproducing the experiments in https://github.com/mireshghallah/style-pooling. There, you will find a Read Me file which includes all the necessary steps and link to the data and model checkpoints. In short, you need to download the data and model checkpoints from the link. When you download the models-data compressed folder, extract it. Place the content of the data folder and the models in corresponding folders in the code. The package dependencies are all included in the dependencies file. In order to create a similar setup, please install the exact version mentioned there. + +Once all the directories are setup, you can train your own models using the commands in the Read Me, or you can evaluate the models we have already provided. Evaluation code is included in the results_ipynbs folder. + +# A.2 Model Configurations + +Seq2Seq Model. For all the experiments, We use single layer LSTMs with hidden size of 512 as both the encoder and decoder, and we use a word embedding size of 128. We apply dropout to the readout states before softmax with a rate of 0.3. We add a max pooling operation over the encoder hidden states before feeding it to the decoder. + +Language Model: Yelp data. We use an LSTM language model with hidden size of 512 and word embedding size of 128 and dropout value of 0.3. + +Language Model: Blog and Twitter data. We use an LSTM language model with hidden size of 2048 and word embedding size of 1024 and dropout value of 0.3. + +Sensitive-attribute Classifiers. We use LSTM classifiers for classifying sensitive attributes. The hidden size is 512 and word embedding size is 128. The last layer size is the number of sensitive classes. + +GPT-2 We used this repository https://github.com/priya-dwivedi/Deep-Learning/tree/master/GPT2-HarryPotter-Training to download and feed data to the GPT-2 model, and get the PPL score. + +# A.3 Dataset Details + +Yelp. The training set contains 399,999 sentences, and test set consists of 30,000 sentences, both divided equally between the 3 domains. The vocabulary size is 9.6k words. The misspelled words of $D_0$ , $D_1$ and $D_2$ are "00great00, 00this00, 00it00, 00to00, 00food00", "11of11, 11place11, 11for11, 11good11, 11service11" and "22they22, 22are22, 22in22, 22very22, 22my22", respectively. + +Blogs. The blogs dataset is a collection of micro blogs from blogger.com which consists of 19,320 'documents' (over 3.3 million sentences) along with annotation of author's age, gender, and occupation. Each document is a collection of an individual author's posts. We will use this data in both two and three domain style-pooling, where we treat age as the sensitive attribute and balance the data so each domain has the same number of sentences. In the two domain setup, we divide the data in two groups of teenagers, 13 - 18 and adults 23 - 48. In the three style setup, we have three groups of teenagers (13 - 18), young adults (23 - 28) and adults (33 - 48). The age groups 19 - 22 and 29 - 32 are missing from the data. After preprocessing and balancing the dataset, we end-up with 1.2 Million sentences in the training set, 400k sentences in the test for the 2 domain setup, and 762k training sentences and 192k test sentences for the test set. There are 10k words in the vocabulary. All the datasets are balanced. + +Twitter. There are 146.5k sentences in the training set, and 11.2k sentences in the test set. We reproduced this data using this scripts from Elazar and Goldberg (2018)'s GitHub repository: https://github.com/yanaiela/demog-text-removal. + +# A.4 Hyperparameters + +For all experiments, we set the training batch size to 32, the test batch size to 128 and the temperature of the softmax to 0.01. + +KL weight hyperparameter: The KL term in Eq. 5 that appears naturally in the ELBO objective, can be treated as a regularizer that uses our $p_{prior}$ to induce the type of style we want. Therefore, in practice, we add a weight $\lambda$ to the KL term in ELBO since the regularization strength from our priors varies depending on the datasets, training data size, or prior structures (Bowman et al., 2016). + +Yelp. For the Yelp experiments, the learning rate is set to 0.001 and the KL weight $(\lambda)$ for the Union, One-LM and Intersection experiments are 0.03, 0.03 and 0.02, respectively. + +Blogs and Twitter. For the Blogs experiments, the learning rate is 0.0005, and the KL weight $(\lambda)$ is 0.04 (for both 2 and 3 domains). + +# A.5 Comparison with A4NT Details + +To compare with the work "A4NT: Author Attribute Anonymity by Adversarial Training of Neural Machine Translation" (Shetty et al., 2018), we downloaded a checkpoint of their pre-trained model, available in their github repository: https://github.com/rikshithShetty/ + +A4NT-author-masking. Since we have also used the same dataset with the same train/test separation, we use the model as is for evaluation. + +# A.6 Human Evaluation Experiment Details + +Our crowd workers are recruited from the Amazon Mechanical Turk (AMT) platform. Each HIT required the workers to answer a question regarding only one pair of sentences, and each worker was paid $0.1 per HIT. For English proficiency, the workers were restricted to be from USA or UK. For the semantic consistency test, the question asked from the Turkers was: "Which sentence is closer in meaning to the original sentence below?", where the original sentence and the obfuscated ones where provided to the workers. For fluency, we asked: "Which sentence is more fluent in English?" + +# A.7 Comparison + +# with Elazar and Goldberg (2018) + +Elazar and Goldberg (2018) aims at creating representations for text that could be used for a specific classification task, while hiding sensitive attributes. Although our approach deals with the text as opposed to representations and and can be applied for a wider range of downstream tasks, we offer a brief comparison to this method. Elazar and Goldberg use the Twitter dataset Rangel et al. (2016), set the sensitive attribute to be age, and try to produce representations that would perform well on the main task of "conversation detection" (mention detection) on Tweets. On the original data, they report an accuracy of $77.5\%$ and $64.8\%$ for a classifier that tries to classify conversations and age, respectively, which drop to $72.5\%$ and $57.3\%$ , after applying their adversarial learning scheme. + +We cloned their repository and used their code to process the dataset. We then created and trained the conversation and age classifiers, and reached an accuracy of $75.8\%$ and $64.63\%$ for them, respectively. These dropped to $73.28\%$ and $54.2\%$ , after applying applying our intersection method. This shows that for this particular task, our re-written text can out-perform prior work. \ No newline at end of file diff --git a/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/images.zip b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9d7691ed0308b537a1d4a41cb7cb3ed15dd9230e --- /dev/null +++ b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c397d2b1e1c5cbc0b20fc95aadf819b742c8b93f41982365838f0b23b5d30165 +size 368300 diff --git a/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/layout.json b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9cdc3acbbf6558ac8c1d11992887c75fda9c148d --- /dev/null +++ b/stylepoolingautomatictextstyleobfuscationforimprovedclassificationfairness/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e71790cd56580e2b017b4f0aea8477613fcd9b9ce3722f87302ea88cf3a5f6ad +size 437553 diff --git a/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_content_list.json b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..ca3aee96dcece58b4febc33b11d3c6ace1259ee5 --- /dev/null +++ b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e7a57b9b12c9f274ba7940e471bc29a27fce8ac31cd2a298ac89a33ccecdff5 +size 108927 diff --git a/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_model.json b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d6ef33de14bf2195de2d98810e3b1f5536e2759a --- /dev/null +++ b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11b5fe11596592868d100d93af48e3b1738e2c9c3b751f4b5234c5d764e59cea +size 131915 diff --git a/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_origin.pdf b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..57a3fbb4806867917086be36fddc42bb294e53d9 --- /dev/null +++ b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/3b573cc7-d959-4eed-b79d-4d8595746829_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:206e6c0f20d5699b69070a634b21e5dd7c335faaaa6743e96dfb48b029ed9263 +size 947371 diff --git a/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/full.md b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9e2587ef4b176f09a2fec3fac1b3605eb054b8a0 --- /dev/null +++ b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/full.md @@ -0,0 +1,491 @@ +# Summarize-then-Answer: Generating Concise Explanations for Multi-hop Reading Comprehension + +Naoya Inoue\*, Harsh Trivedi\*, Steven Sinha\*, Niranjan Balasubramanian\*, Kentaro Inui\* + +Stony Brook University, RIKEN + +Tohoku University + +{ninoue,hjtrivedi,stsinha,niranjan}@cs.stonybrook.edu + +inui@tohoku.ac.jp + +# Abstract + +How can we generate concise explanations for multi-hop Reading Comprehension (RC)? The current strategies of identifying supporting sentences can be seen as an extractive question-focused summarization of the input text. However, these extractive explanations are not necessarily concise i.e. not minimally sufficient for answering a question. Instead, we advocate for an abstractive approach, where we propose to generate a question-focused, abstractive summary of input paragraphs and then feed it to an RC system. Given a limited amount of human-annotated abstractive explanations, we train the abstractive explainer in a semi-supervised manner, where we start from the supervised model and then train it further through trial and error maximizing a conciseness-promoted reward function. Our experiments demonstrate that the proposed abstractive explainer can generate more compact explanations than an extractive explainer with limited supervision (only 2k instances) while maintaining sufficiency. + +# 1 Introduction + +Recent approaches to multi-hop Reading Comprehension (RC) have greatly improved its explainability, models ability to explain their own answers (Thayaparan et al., 2020). Some adopt a pipelined architecture, where they generate an explanation first and then use it to answer the question. This "faithful-by-construction" approach is aimed at ensuring that generated explanations are closer to the systems' internal reasoning (i.e. faithfulness). The explanation generation step is typically formulated as a sentence selection task over the input text — selecting a set of sentences which provide support for the answer output by the model (Yang et al., 2018; Groeneveld et al., 2020, etc.). + +![](images/ede687493fcfa740b663b4ca1737528a514c9225910be9fe160d8dea6d60481b.jpg) +Figure 1: Summary of SUmmarizer-augmented QA (SuQA). To generate more concise (i.e. minimal, sufficient and comprehensible) explanations, SuQA augments QA module with an abstractive explainer. $^{1}$ + +However, the main problem with these approaches is that the explanations obtained from the sentence selection tasks are not always minimal, sufficient, and comprehensible. The extractive explanations can include extraneous or superfluous texts which express information that is not necessary for answering questions. For example, as shown in Fig. 1 (a), the fragments such as 2007 British-American fantasy adventure and Young Tommy in "Never Let Me Go" are not needed to explain the answer Northern Lights. Secondly, the extractive explanations may also not be sufficient: the interpretation of explanations may be dependent on its original paragraphs (e.g. pronouns). In Fig. 1 (a), His film roles means Charles Rowe's + +film, but this is not included in the extractive explanation. These types of gaps can also limit comprehensibility of the explanations. + +In this work, we target concise explanations which provide minimal, sufficient and comprehensible information related to the answer. This can also be seen as targeting an abstractive question-focused summary. To this end, we propose SUmmarizer-augmented QA (SuQA), an RC system augmented with an abstractive explainer component that generates an abstractive summary of explanations, which is then fed to a separate QA module to produce an answer. An abstractive explainer can summarize longer sentences into short phrases and replace pronouns with their referent, leading to more compact and sufficient explanations compared to extractive explanations. For example, as shown in Fig. 1 (b), the abstractive explainer, unlike an extractive one, is allowed to remove unnecessary information such as 2007 British-American fantasy adventure, and to generate context-independent sentences such as Charlie Rowe plays Billy Costa in The Golden Compass, instead of His film roles includes.... + +However, developing such an abstractive explainer imposes a significant challenge because of the limited amount of human-annotated abstractive explanations available and prohibitively high costs in extending these (Inoue et al., 2020). Given this limited supervision, how can we ensure that generated explanations are sufficient while promoting compression? + +Our solution is to teach an abstractive explainer through trial and error maximizing a conciseness-promoting reward function in a reinforcement learning (RL) framework. The reward function assesses generated explanations against various criteria related to conciseness, such as linguistic acceptability, abstractiveness, and the accuracy of RC module's prediction on the generated explanations. By doing so, the model gradually learns to extract and summarize information from input texts so that they help the RC module arrive at the correct answers. Also, because the explainer aims to produce abstractive summaries, we can initialize the explainer with an abstractive summarizer that is pretrained on standard summarization datasets. + +We evaluate the proposed approach on HotpotQA (Yang et al., 2018), one of the most popular multi-hop RC datasets. The findings of this paper can be summarized as follows: + +- The semi-supervised abstractive explainer can generate more compact and sufficient explanations than extractive explanations while keeping explanations informative for answering questions. Compared to extractive ones, the abstractive explanations have a compression rate that is $\times 2.9$ higher, and improve human-judged sufficiency by 2.5 points, without incurring any significant drop in the QA accuracy. + +- Even small amounts of human-annotated explanation supervision significantly improve the conciseness of generated explanations. For example, incorporating even 298 instances of annotated explanations makes the compression rate $\times 1.3$ higher and improves human-judged sufficiency by $+11.0$ points compared to the setting with no supervision for explanations. + +# 2 Related work + +Explainable NLP Three aspects of explainability have been explored (Jacovi and Goldberg, 2020): (i) comprehensibility to humans (Camburu et al., 2018; Rajani et al., 2019), (ii) faithfulness, correlation with systems' internal decision (Kumar and Talukdar, 2020; Glockner et al., 2020), (iii) conciseness, namely minimality, comprehensibility and sufficiency for solving an end task (Paranjape et al., 2020). + +Earlier approaches to explainable NLP focus on comprehensibility (Camburu et al., 2018; Rajani et al., 2019), and then the community moves towards ensuring faithfulness by a system's architecture (faithful by construction), ranging from Natural Language Inference (Kumar and Talukdar, 2020), Fact Verification (Glockner et al., 2020) to Question Answering (Latcinnik and Berant, 2020; Groeneveld et al., 2020; Yadav et al., 2020). + +Conciseness, in contrast, has been relatively unexplored. One exception is Paranjape et al. (2020), who propose to learn to extract a minimal set of input sentences that are useful for solving downstream tasks by imposing information bottleneck on the NLP framework. Although our work shares the similar spirit with their work, unlike our work, their explainer is extractive. Our work is the first to incorporate abstractive explainers into RC systems. + +To date, more NLP datasets are being annotated with explanations (Wiegreffe and Marasovic, 2021), but most of them are based on extractive + +explanations (Yang et al., 2018; DeYoung et al., 2020, etc.). For abstractive explanations, there are a few resources: textual entailment dataset (Camburu et al., 2018), and question answering dataset in non-RC settings (i.e. input paragraphs are not given) (Jansen et al., 2018; Rajani et al., 2019). As for RC, Inoue et al. (2020) annotate HotpotQA (Yang et al., 2018) with abstractive explanations, but only $2\mathrm{k}$ of them (i.e. $3\%$ of the whole dataset) are annotated. + +Abstractive explainer A similar pipeline model has been proposed for textual entailment (Camburu et al., 2018) and commonsense QA (Rajani et al., 2019), where the model first generates an explanation, and then the downstream classifier consumes it to predict a task label. Although the architecture is the same as ours, the training process is different: they train the explainer in a fully supervised manner using input-explanation pairs, while our work additionally leverages a signal from the downstream QA model in RL. As demonstrated in §5.5, we show that this additional training is crucial when few annotated explanations are available. + +Generating abstractive explanations is closely related to query-focused summarization (QFS), where a few datasets are publicly available (Dang, 2006; Baumel et al., 2016; Nema et al., 2017; Pasunuru et al., 2021). However, the task setting of QFS is radically different from our problem setting, which makes it difficult to leverage the datasets and models in a straightforward manner. The QFS task typically consists of non-question queries (e.g. keywords or complex sentences) or opinion-oriented questions (e.g. Is $X$ a good idea?), and gold summaries are not guaranteed to contain all information required for answering questions. We leave it the future work to explore how to effectively use their datasets and models in our task. + +# 3 SuQA: SUMmarizer-augmented QA + +Extractive explanations may contain superfluous information that is not necessary for answering questions or may not be sufficient for answering questions. We address this issue by generating concise explanations defined as follows. + +Definition 1. An explanation is concise if it is (i) minimal, (ii) comprehensible, and (iii) sufficient for answering the question. + +Fig. 1 summarizes the overall architecture. To ensure the faithfulness of explanations, we use a + +pipeline architecture consisting of two main components: (i) an abstractive explainer (AX) and (ii) $QA$ module (QAM) ( $\S 3.1$ ). The AX takes a question and paragraph as inputs and is responsible for generating a question-focused, abstractive summary of input paragraphs. The QAM then answers the question solely based on the generated summary. This summary is supposed to contain information necessary for answering questions and is the only factor that the QAM relies on. Thus, the generated summary can be interpreted as a faithful explanation of the model. + +# 3.1 Architecture + +First, we formalize the overall pipeline. Given a question $q$ and paragraphs $p$ , we first generate the most-likely explanation $e$ as follows: + +$$ +e = \underset {e ^ {\prime}} {\arg \max } p _ {\pi} \left(e ^ {\prime} | q, p\right), \tag {1} +$$ + +where $p_{\pi}$ is the AX. We then answer the question $q$ solely based on the generated explanation $e$ : + +$$ +a = \underset {a ^ {\prime}} {\arg \max } p _ {\phi} \left(a ^ {\prime} | q, e\right), \tag {2} +$$ + +where $p_{\phi}$ is the QAM. Our architecture is agnostic to the implementation of AX and QAM as long as they are differentiable. + +From the viewpoint of probabilistic models, this formulation is a special case of a probabilistic latent variable model of $p(a|q,p)$ where explanations are treated as latent variables, similar to retrieval-augmented language models (Guu et al., 2020; Lewis et al., 2020b). Specifically, we have $p(a|q,p) = \sum_{e}p_{\phi}(a|q,e)p_{\pi}(e|q,p)$ , assuming $p_{\phi}(a|q,e,p) = p_{\phi}(a|q,e)$ . Replacing the sum with arg max yields Equation 2. The main challenge is that $p_{\pi}(e|q,p)$ is not a retriever but a text generator. + +Abstractive explainer (AX) It takes a paragraph $p$ and a question $q$ as an input, and outputs an explanation $e$ . We implement the AX using a sequence-to-sequence generation model as follows: + +$$ +p _ {\pi} (e | q, p) = \prod_ {t} ^ {n} p _ {\pi} \left(e _ {t} \mid e _ {< t}, q, p\right) \tag {3} +$$ + +In our experiments, we use BART (Lewis et al., 2020a). We simply concatenate $q$ and $p$ into one text with a separator token to generate a question-focused summary of the paragraph. + +![](images/864e138d0b816beb904fc7cebaabd80d0be0cf4515c694d1865a6e40c21d810f.jpg) +Figure 2: Training regime of the proposed method. We pretrain the AX with a large summarization dataset and finetune it on a limited amount of human-annotated explanations (§4.1). We then train it further through indirect supervision from the QAM using Reinforcement Learning (§4.2). + +QA module (QAM) It takes a question $q$ an explanation $e$ generated by the AX as an input, and outputs an answer $a$ . We implement the QAM as a generation-based question answering module. + +$$ +p _ {\phi} (a | q, e) = \prod_ {t} ^ {n} p _ {\phi} \left(a _ {t} \mid a _ {< t}, q, e\right) \tag {4} +$$ + +# 4 Training + +Fig. 2 shows an overview of our training regime. The main challenge of training the AX is that human-annotated explanations are rarely available for question-answer pairs, though the conciseness of explanations heavily relies on human judgement. To address this issue, we train the AX in a semi-supervised manner. + +# 4.1 Supervised training with summarization and explanation generation + +Because the AX aims to produce abstractive summaries, we initialize the AX with an abstractive summarizer that is pretrained on standard summarization datasets. As we will see later (§5.6.2), this initialization is one of the key ingredients for the AX. + +Given a training dataset consisting of QA pairs annotated with its gold explanations, we train the AX with a standard teacher forcing approach. Specifically, we minimize the following loss: + +$$ +L _ {\mathrm {M L}} = \sum_ {t = 1} ^ {n} \log p _ {\pi} \left(y _ {t} ^ {*} \mid y _ {< t} ^ {*}, q\right), \tag {5} +$$ + +where $q$ is a question, and $(y_1^*, y_2^*, \ldots, y_n^*)$ is a human-annotated explanation for the QA pair. + +# 4.2 Semi-supervised training + +Although the fully supervised training provides the AX with direct signals, large-scale annotation of such abstractive explanation is prohibitively costly (Inoue et al., 2020). Thus, after training the AX in a supervised fashion, we further train the AX through indirect supervision from answers, which are much cheaper to annotate. + +We use the RL framework and design a reward function that assesses the goodness of generated explanations based on answers and sentence-level supporting facts. A state here is a sequence of explanation tokens generated so far $y_{ T$ ; 0 otherwise. This is to prevent noisy explanations from being rewarded. We use $T = -50$ . + +- Well-formedness: 1 if $e$ has repetition or too long words, starts from pronouns, or ends without period; 0 otherwise. + +# 5 Evaluation + +# 5.1 Dataset + +We use HotpotQA (Yang et al., 2018), which consists of 90,564 training and 7,405 development instances. All instances are annotated with extractive explanations called supporting facts, or SFs, sentences that are required to answer questions from input documents. We use the distractor setting in our experiments. + +For human-annotated explanations, we use $\mathcal{R}^4\mathcal{C}$ (Inoue et al., 2020), which annotates 2,379 training instances (3% of the training instances) and 2,541 development instances from HotpotQA with reasoning steps. The reasoning steps are abstractive explanations that describe information necessary for deriving answers, consisting of entity relation triplets in natural language texts (e.g. (Biden, is a president of, US)). We concatenate entities and its relation into one sentence for training the AX. + +# 5.2 Relevant paragraph prediction + +To select relevant paragraphs for the AX, we trained a ranker that ranks paragraphs according to its relevance to questions. The ranker takes a question and one paragraph as an input and outputs a relevance score. To train the ranker, we used a binary cross entropy loss, where paragraphs containing gold SFs (henceforth, supporting paragraphs) are used as positive instances and the other distractor paragraphs are negative instances. Following Kim et al. (2020), we also randomly sample one supporting paragraph from other questions for each question and used them as negative instances. + +At test time, we retain top- $k$ paragraphs and give them to the AX. We use $k = 3$ because HotpotQA has two supporting paragraphs always. Our evaluation shows that all supporting paragraphs are included at top- $k$ ranked paragraphs in $97.4\%$ of dev instances on HotpotQA. When training the AX, we gave gold supporting paragraphs and randomly selected distractor paragraphs to the AX. To implement the ranker, we use a standard sequence classifier on top of RoBERTa-large (Liu et al., 2019). + +# 5.3 Setup + +Models We create $\text{Extr}$ , a simple baseline model that resembles a typical extraction-based explainable NLP architecture (Glockner et al., 2020; Paranjape et al., 2020). Here, we train the AX using Eq. 5 only, where we use SFs as supervision. + +We denote our proposed model as SuQA. To see the effectiveness of RL, we have SuQA-NoRL, a model trained with annotated explanations using Eq. (5) without additional RL training. SuQA-NoRL resembles fully-supervised, generation-based explain-then-predict models by Camburu et al. (2018); Rajani et al. (2019). + +AX We initialize the AX with DistilBART finetuned on CNN/Daily Mail, one of large, standard datasets of summarization (Shleifer and Rush, 2020). During training, we feed supporting paragraphs as an input to the model. At test time, we use predicted relevant paragraphs from §5.2 as an input. For hyperparameter tuning, we reserve 500 training instances as a validation dataset. See §A in Appendix for further details. + +QAM We use UnifiedQA-base (Khashabi et al., 2020) as the QAM and frozen it during training. Ideally, the AX should learn from a "perfect" QA model that does not perform disconnected reasoning (Trivedi et al., 2020). However, such a QA model is not available at the moment. We thus simulate it by using UnifiedQA (Khashabi et al., 2020), a T5 (Raffel et al., 2020)-based QA model finetuned on a diverse set of QA datasets (e.g. SQuAD, NarrativeQA, RACE) excluding HotpotQA. We expect this to discourage the QAM from giving correct answers for insufficient explanations by disconnected reasoning, which improves the quality of reward function of RL. At test time, we use UnifiedQA finetuned on HotpotQA, whose performance is shown in Table 2 (see QAM w/o AX). + +# 5.4 Evaluation measures + +Conciseness To assess the compactness of generated explanations, we calculate (i) a compression ratio $(Cm)$ , # tokens in an input paragraph divided by # tokens in a generated explanation, and (ii) abstractiveness $(Abs)$ with respect to a given paragraphs selected by the paragraph ranker, calculated by the equation from §4.3. + +To assess the sufficiency of generated explanations, we use crowdsourcing. Given a generated explanation and its original question, five crowdwork + +ers are asked to judge if generated explanations alone provide sufficient information for answering the question in a 3-point Likert scale (yes, likely, no) plus "unsure". To reliably estimate the quality of explanations, we additionally ask them answers that they inferred from the given explanations. + +To aggregate each annotator's judgement, we first replace crowdworker's submission with 'no' when (i) the answer is different from the gold standard answer, or (ii) the judgement is unsure, and replace 'likely' with 'yes'. We then used MACE (Hovy et al., 2013) to aggregate all the judgements $(Suf)$ . Due to the cost,[5] we evaluate 100 gold explanations and 200 generated explanations for each configuration. We obtained Krippendorff's $\alpha$ of 0.298 on average, indicating a fair agreement. See §D in Appendix for further details of crowdsourced judgement. + +In some experiments, we report the similarity between generated explanations and human-annotated explanations as a proxy for sufficiency, due to the cost of human evaluation. We employ ROUGE-2 (Lin, 2004) (RG2), which is proven a high correlation between human ratings on several summarization datasets (Bhandari et al., 2020). + +QA performance We report $F1$ , one of the official evaluation measures of HotpotQA. + +Given that our ultimate goal is to create an explainable RC system, we also introduce $XF1$ , new evaluation measure: + +$$ +\mathrm {X F} 1 = \frac {1}{N} \sum_ {i} ^ {N} \operatorname {s u f} (i) \cdot \mathrm {F} 1 (i), \tag {8} +$$ + +where $N$ is the number of instances in the dataset, $\operatorname{suf}(i)$ is a crowdsourced sufficiency label (yes=1, no=0), and $\mathrm{F}1(i)$ is a F1 score of $i$ -th instance. This captures how well the system generates sufficient explanations and predicts the correct answer. + +# 5.5 Results and discussion + +Abstractive explanations are more concise (i.e. compact and sufficient) than extractive ones. To understand the advantage of abstractive explanations, we compare gold extractive explanations (Gold SF) with gold abstractive explanations (Gold XP) in Table 1. It clearly indicates that abstractive explanations are more abstract and compact than extractive ones. Surprisingly, it also shows that extractive explanations are much less sufficient than + +
InputAbsCmSuf†F1
Gold SF†1.14.472.079.7
Gold SF1.24.368.074.9
Gold XP†51.011.190.085.2
+ +Table 1: Upper bound study on HotpotQA (HQ) dev set. †: evaluated only on 2,541 dev instances annotated with explanations. ‡: manually evaluated on 100 instances. + +
ModelAbsCmSuf†F1XF1†
QAM w/o AX0.01.0-64.2-
Extr (baseline)0.34.270.069.460.5
SuQA-NoRL40.111.271.565.662.6
SuQA42.612.272.567.663.7
+ +abstractive ones. Our manual inspection of insufficient explanations reveals that $100\%$ of the explanations do contain gold answer spans, but the interpretation of them depends on the context of input paragraphs that is not included in the explanations (e.g. pronoun referents). On the one hand, pronouns in abstractive explanations can be replaced with the actual referent, which allows explanations to be more self-contained and compressed. F1 also improved given more sufficient explanations. + +The abstractive explainer generates more concise explanations. Now we turn to the proposed models. The results are shown in Table 2. As consistent with Table 1, it shows that SuQA generates more abstractive, compact and sufficient explanations than the extractive baseline model. Examples of sufficient explanations generated by SuQA are shown in Table 4 (see §E in Appendix for more outputs with full input paragraphs). It shows that the abstractive explainer successfully captures information about important entities in question (e.g. bridging entity World War II in (b)). + +One may think why F1 of SuQA is lower than that of the extractive baseline (-1.8 point) given more sufficient and compressed explanations, which is inconsistent with Table 1. To obtain further insights, we investigated the relation between the sufficiency of explanations and the correctness of answers in Table 3, where "Correct" here means the number of instances with $>0.5$ Answer F1. + +Table 3 shows that the extractive baseline got 27 correct answers even when explanations are insufficient (27/151=17.9%), while SuQA got 17 correct answers for insufficient explanations + +Table 2: Main results on HotpotQA dev set. †: evaluated on 200 instances with human-judged sufficiency. + +
CorrectWrongCorrectWrong
Suf.12416Suf.12817
Insuf.2733Insuf.1738
Total15149Total14555
+ +(a) Extr (baseline) + +(b) SuQA + +Table 3: Sufficiency-Answer correctness matrix. SuQA gets more correct answers with sufficient explanations (128/145=88%) than Extr (124/151=82%). + +(17/145=11.7%). This suggests that the QA module relies on task-unrelated lexical cues — so-called disconnected reasoning (Trivedi et al., 2020), and such task-unrelated cues become unavailable in SuQA's more compressed explanations, which undesirably degrades the QA performance. We also experimented with SAE-large (Tu et al., 2020), one of the strong QA models in HotpotQA, but got a similar trend. See §B in Appendix for further details. We believe that QA performance will improve if one can successfully develop a QA model that performs less shortcut reasoning, which is an emerging research topic in the QA community. + +The proposed model generates more correct answers with sufficient explanations. Our ultimate goal is to predict correct answers and to generate sufficient explanations. Here we investigate how many instances we generate sufficient explanations and predict the correct answer for. Table 3 show that SuQA gets more correct answers with sufficient explanations (128/145=88%) than the extractive baseline (124/151=82%). XF1 in Table 2 reflects this tendency and now tells a different story from conventional F1: the extractive baseline is now behind the proposed model. + +RL helps generate concise explanations. As described in §5.3, we pretrain the AX with explanations before applying RL. How much does the additional RL help the AX generate more concise explanations? The results are shown in Table 2 (SuQA-NoRL v.s. SuQA). It indicates that RL is important to obtain more concise explanations in all the aspects of conciseness. + +# 5.6 Analysis + +# 5.6.1 Role of explanation supervision + +It is costly to manually annotate QA datasets with abstractive explanations (Inoue et al., 2020). The natural question is then: how much supervision do we need to generate concise explanations? + +
QuestionGenerated explanationGold answer
(a) Who was born first Burton Cummings or Sharleen Spiteri?Burton Cummings is born on December 31, 1947. Sharleen Spiteri is born on 7 November 1967.Burton Lorne Cummings
(b) The Livesey Hal War Memorial commemorates the fallen of which war, that had over 60 million casualties?Livesey Hall War Memorial commemorates the fallen of World War II. World War II had over 60 million casualties.World War II
(c) Charles Barton "Chuck" Kendall, Jr. was reportedly interested in purchasing the Los Angeles Clippers from which Jewish-American businessman?Charles Kendall, Jr. was reportedly interested in purchasing the Los Angeles Clippers from owner Donald Sterling. Donald Sterling is a Jewish-American businessman.Donald Sterling
+ +![](images/83269d8c19470fe7be5058f71ac3be9d1b59b2feade053959d2d1222adcb53ff.jpg) +Figure 3: Effect of size of explanation supervision. Our human-judged sufficiency shows 55.0 at size 0 and 66.0 at size 298, indicating the importance of explanation supervision. + +Table 4: Sufficient explanations from SuQA. Important entities are gray-highlighted by the author. + +
Pretrain?\(L_{\text{ML}}\)?AbsCmRG2†F1
SUMY37.511.964.765.3
XGY47.013.755.754.3
SUM,XGY42.612.267.467.6
SUM,XG46.312.752.162.7
+ +Table 5: Ablation of training strategy. Pretraining on the summarization task plays an important role in generating concise explanations. Using seq2seq loss $L_{\mathrm{ML}}$ during RL prevents generated explanations from deviating too much from gold explanations. †: evaluated only on 2,541 dev instances annotated with explanations. + +We pretrain and apply RL, using various sizes of explanation supervision (0, 298, 595, 1190, 2379) and plotted each result in Fig. 3. Due to the cost of human evaluation, we evaluated 100 generated explanations at size 0 and 298 only, and plotted RG2 as a proxy for human-judged sufficiency. + +The results indicate that incorporating even 298 explanations has a large impact on both the conciseness of explanations and the QA performance. Our human-judged sufficiency shows 55.0 for size 0, and 66.0 for size 298. Even with zero explanation supervision, the explainer still generates con + +![](images/82f73abef2d128d6ece08d553897a982d046a385f33811351d7d0140e5808d31.jpg) +Figure 4: Effect of RL. Y axis indicates the benefit of each evaluation measure from RL (i.e. the difference from SuQA-NoRL to SuQA). The benefit of RL is more pronounced in low-resource settings. + +cise explanations to some extent. This indicates that the task of generating abstractive explanations matches with the pretrained summarizer's original task. Thus, even with such small amounts of data, the AX can learn to produce question-focused summaries that are useful for answering questions. + +To see the benefit of RL in low-resource settings, we also repeated the same procedure with SuQA-NoRL and plotted how each evaluation measure changes from SuQA-NoRL to SuQA in Fig. 4. We observe that the benefit of F1 and RG2 is more pronounced in lower resource settings, which indicates the importance of RL for generating concise explanations. See §C in Appendix for the absolute performance of SuQA-NoRL. + +# 5.6.2 Training strategy + +Pretraining tasks We pretrain the AX on the summarization task (SUM) and the explanation generation task (XG) (§4.1). To investigate the contribution of each factor, we conduct ablation experiments in Table 5. It shows that the summarization task is the most contributing factor: without the pretraining, we obtain more compact explana + +
Insufficiency typeQuestionGenerated explanationGold answerFreq.
No answer spanIn which city was this band formed, whose rhythm guitarist featured in "Cupid's Chokehold?"Cupid's Chokehold is performed by Gym Class Heroes. Fall Out Boy is formed in Wilmette, Illinois.Chicago13
Partially missingCreed features the boxer who held what WBC title from 2016 to 2017?Creed (film) features (missing: the boxer) Tony Bellew. Tony Bellew held the WBC cruiserweight title from 2016 to 2017.cruiserweight8
Bridge fact missingWhere does the descendant of the Red Setter originate?James Andrew Hanna is known as Red Setter. Scotch Collie originated from the highland regions of Scotland. Missing: Scotch Collie is the descendant of Red Setter.Scotland3
Fact inventedWhich game was released first, Icehouse pieces or Kill Doctor Lucky?Icehouse pieces was released in 1996 (correct: 1987). Kill Doctor Lucky was released in 1996.Icehouse pieces1
Dataset flawWhich Walt Disney film was released earlier, The Rescuers or The Muppets?The Rescuers was released on June 22, 1977. The Muppets was released in 2011.The Muppets3
Worker errorDoes Lucozade pre-date Hires Root Beer?Hires Root Beer is introduced in 1876. Lucozade is created in 1927.no2
+ +Table 6: Manual analysis of 30 insufficient explanations from SuQA. + +tions, but fatally, they are less similar to the gold explanations and lead to more incorrect answers. + +Seq2seq loss We incur the seq2seq loss $(L_{\mathrm{ML}})$ along with the RL loss (§4.2). To see the effect of this, we conduct ablation experiments in Table 5. Without the seq2seq loss, the generated explanations get more compact, but dissimilar to the gold standard explanations. We speculate that the seq2seq loss is important in keeping the search space of the AX closer to gold explanations. + +# 5.6.3 Error analysis + +When model's prediction is wrong, we have two possibilities: (A) generated explanations are insufficient, or (B) generated explanations are sufficient, but the QAM fails to find the correct answer. Table 3 indicates that case A is more frequent (69.1% (38/55)) than case B (30.9% (17/55)). + +We thus randomly sampled and manually analyzed 30 insufficient explanations generated by SuQA in Table 6. First of all, we found that $43.3\%$ (13/30) of generated explanations have no gold answer spans ('No answer span'). Among the rest of explanations, the AX successfully mentions important entities, but fails to generate some related information such as entity type ('Partially missing', $26.7\%$ (8/30)). We also observed that the AX fails to provide important information bridging two entities such as a family relation ('Bridge fact missing', $10.0\%$ (3/30)), and sometimes the AX invents new fact that is not mentioned in the original input + +paragraph ('Fact invented', $3.3\%$ (1/30)). + +The remaining explanations are wrongly judged as insufficient (16.7% (5/30)) in 2 cases: (i) crowdworkers' answers were wrongly judged as incorrect due to wrong gold answers ('Dataset flaw'); (ii) the crowdworkers' judgement was wrong, and they are actually sufficient ('Worker error'). + +The error analysis highlighted that a major source of errors is the explainer failing to include answer spans in generated explanations. One can possibly enhance our architecture with one more pass: before generating explanations, the QAM predicts candidate answers based on questions and input paragraphs, and feeds them into the explainer. + +# 6 Conclusions + +We have proposed SuQA, an RC system augmented with an abstractive explainer component. Our experiments have demonstrated that the abstractive explainer can generate more concise explanations than an extractive explainer with limited supervision, while keeping explanations sufficient for QA. + +One limitation of our work is that the QA module is trained separately from the explainer. One can jointly optimize the AX and QAM by extending our framework. Finally, our abstractive explainer explains what facts were used for answering questions, but does not explain the inference process. It would be an interesting research direction to extend our work by explaining how these facts are combined to arrive at the answer. + +# Acknowledgements + +This work was supported in part by the National Science Foundation under grant No. IIS-1815358 and JST CREST Grant Number JPMJCR20D2, Japan. We thank the anonymous reviewers for the insightful feedback. + +# Ethical concerns + +To make fair compensation for Mechanical Turk workers in human evaluation (§5.4), we setup a reward based on a minimum hourly wage in the United States. Our preliminary experiments show that it takes about one minute to finish one HIT, so we rewarded crowdworkers with $0.15 per HIT. This amounts to $9.00 per hour, which is above $7.25, a minimum wage in the United States. + +# References + +Tal Baumel, Raphael Cohen, and Michael Elhadad. 2016. Topic concentration in query focused summarization datasets. In AAAI, pages 2573-2579. +Manik Bhandari, Pranav Narayan Gour, Atabak Ashfaq, Pengfei Liu, and Graham Neubig. 2020. Re-evaluating evaluation in text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9347-9359, Online. Association for Computational Linguistics. +Oana-Maria Camburu, Tim Rocktäschel, Thomas Lukasiewicz, and Phil Blunsom. 2018. e-snli: Natural language inference with natural language explanations. In Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc. +Hoa Trang Dang. 2006. DUC 2005: Evaluation of question-focused summarization systems. In Proceedings of the Workshop on Task-Focused Summarization and Question Answering, pages 48-55, Sydney, Australia. 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. +Max Glockner, Ivan Habernal, and Iryna Gurevych. 2020. Why do you think that? exploring faithful sentence-level rationales without supervision. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1080-1095, Online. Association for Computational Linguistics. + +Dirk Groeneveld, Tushar Khot, Mausam, and Ashish Sabharwal. 2020. A simple yet strong pipeline for HotpotQA. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8839-8845, Online. Association for Computational Linguistics. +Kelvin Guu, Kenton Lee, Zora Tung, Panupong Papat, and Mingwei Chang. 2020. Retrieval augmented language model pre-training. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 3929-3938. PMLR. +Dirk Hovy, Taylor Berg-Kirkpatrick, Ashish Vaswani, and Eduard Hovy. 2013. Learning whom to trust with MACE. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1120-1130, Atlanta, Georgia. Association for Computational Linguistics. +Naoya Inoue, Pontus Stenetorp, and Kentaro Inui. 2020. R4C: A benchmark for evaluating RC systems to get the right answer for the right reason. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6740-6750, Online. 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. +Peter A. Jansen, Elizabeth Wainwright, Steven Marmorstein, and Clayton T. Morrison. 2018. WorldTree: A Corpus of Explanation Graphs for Elementary Science Questions supporting Multi-Hop Inference. In Proc. of LREC, pages 2732-2740. +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. +Hyounghun Kim, Zineng Tang, and Mohit Bansal. 2020. Dense-caption matching and frame-selection gating for temporal localization in VideoQA. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4812-4822, Online. Association for Computational Linguistics. +Sawan Kumar and Partha Talukdar. 2020. NILE: Natural language inference with faithful natural language explanations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8730-8742, Online. Association for Computational Linguistics. + +Veronica Latcinnik and Jonathan Berant. 2020. Explaining question answering models through text generation. arXiv preprint:2004.05569. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020a. 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. Association for Computational Linguistics. +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. +Chin-Yew Lin. 2004. ROUGE: A Package for Automatic Evaluation of Summaries. In Proc. of the Workshop on Text Summarization Branches Out, pages 74-81. +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:1907.11692. +Preksha Nema, Mitesh M. Khapra, Anirban Laha, and Balaraman Ravindran. 2017. Diversity driven attention model for query-based abstractive summarization. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1063-1072, Vancouver, Canada. Association for Computational Linguistics. +Bhargavi Paranjape, Mandar Joshi, John Thickstun, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2020. An information bottleneck approach for controlling conciseness in rationale extraction. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1938-1952, Online. Association for Computational Linguistics. +Ramakanth Pasunuru, Asli Celikyilmaz, Michel Galley, Chenyan Xiong, Yizhe Zhang, Mohit Bansal, and Jianfeng Gao. 2021. Data augmentation for abstractive query-focused multi-document summarization. In AAAI, pages 13666-13674. +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. + +Nazneen Fatema Rajani, Bryan McCann, Caiming Xiong, and Richard Socher. 2019. Explain yourself! leveraging language models for commonsense reasoning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4932-4942, Florence, Italy. Association for Computational Linguistics. +Steven J. Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. 2017. Self-critical sequence training for image captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR). +Sam Shleifer and Alexander M. Rush. 2020. Pre-trained summarization distillation. arXiv preprint:2010.13002. +Mokanarangan Thayaparan, Marco Valentino, and André Freitas. 2020. A survey on explainability in machine reading comprehension. arXiv preprint:2010.00389. +Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal. 2020. Is multihop QA in DiRe condition? measuring and reducing disconnected reasoning. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8846-8863, Online. Association for Computational Linguistics. +Ming Tu, Kevin Huang, Guangtao Wang, Jing Huang, Xiaodong He, and Bowen Zhou. 2020. Select, answer and explain: Interpretable multi-hop reading comprehension over multiple documents. In AAAI, pages 9073-9080. +Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. 2018. Neural network acceptability judgments. arXiv preprint:1805.12471. +Sarah Wiegrefe and Ana Marasovic. 2021. Teach me to explain: A review of datasets for explainable nlp. arXiv preprint:2102.12060. +Vikas Yadav, Steven Bethard, and Mihai Surdeanu. 2020. Unsupervised alignment-based iterative evidence retrieval for multi-hop question answering. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4514-4525, 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. + +# A Training detail + +For all experiments, we used public implementations from huggingface's transformers library available at https://huggingface.co/. We used roberta-large for the paragraph ranker, distilbart-cnn-12-6 for AX, and unifiedqa-t5-base for UnifiedQA-base. + +For Reinforcement Learning, we used AdamW with the learning rate of 2e-6 and the batch size of 8. We clipped the minimum reward to -0.001. For sampling, we used a temperature of 0.4. To prevent overfitting, we used early stopping with a patience of 5. Specifically, we monitor the Answer F1 on the validation set every 4096 training steps and stopped training if the best F1 is not updated for five times. The RL training took $10\mathrm{h}31\mathrm{m}$ on a single GPU (DGXA-100). + +For pretraining the AX, we used AdamW with the learning rate of 8e-6 and the batch size of 16. In all experiments, we used a linear learning rate scheduler with $10\%$ warm up and trained the models with 5 epochs. For the learning curve, we monitored the Answer F1 every 128 steps for size 298, 256 steps for size 595, 512 steps for size 1,190 & 2,379 and used early stopping with a patience of 5. We used 512 as a maximum length of input subwords for both the AX and QAM. We used 256 as a maximum length of generation outputs for the AX. We used greedy decoding for both the AX and QAM. + +# B Experiments with stronger QA model + +We conducted additional analysis with SAE-large (Tu et al., 2020), one of the large QA models top-ranked at the leaderboard. We downloaded a publicly available pretrained model and ran the exactly same experiments in Table 1, 2, and 3, where we used SAE-large as the QAM at test time only. Note that during training, we used UnifiedQA-base not finetuned on HotpotQA (see §5.3 for further details). + +The results are shown in Table 7 and Table 8. Overall, they show the same trend as Table 1, 2, and 3: (i) gold abstractive explanations yields higher F1; (ii) SuQA achieved better XF1 than the extractive baseline; and (iii) there are more correct answers led by insufficient explanations in the extractive baseline. + +
ModelF1XF1‡
Gold SF†80.1-
Gold SF77.7-
Gold XP†84.4-
QAM w/o AX70.7-
Extr71.559.4
SuQA-NoRL64.958.5
SuQA66.860.4
+ +Table 7: Larger QA models on HotpotQA (HQ) dev set. †: evaluated only on 2,541 dev instances annotated with explanations. ‡: evaluated on 200 instances with human-judged sufficiency. + +
CorrectWrongCorrectWrong
Suf.12214Suf.12018
Insuf.2830Insuf.1441
Total15044Total13459
+ +(a) Extr (baseline) + +(b) SuQA + +Table 8: Sufficiency-Answer correctness matrix. SuQA gets more correct answers with sufficient explanations (120/134=90%) than Extr (122/150=81%). + +# C Learning curve of SuQA-NoRL + +To see the effectiveness of RL in low-resource settings, we investigated the performance change from SuQA-NoRL to SuQA in Fig. 4. Here we plot the absolute performance of SuQA-NoRL in Fig. 5. + +![](images/26f1c9908c6343529e011d701059e3c21425c3080c99af13adadbce86b8044bf.jpg) +Figure 5: Size of explanation supervision v.s. QA performance and conciseness for SuQA-NoRL. + +# D Human evaluation + +We use Mechanical Turk as a crowdsourcing platform for human evaluation. We hired five annotators per Human Intelligence Task (HIT) and rewarded them with $0.15. Our preliminary experiments show that it takes about one minute to finish one HIT, so it is $9.00 per hour, which is above + +\(7.25, a minimum wage in the United States. To ensure the quality of annotations, we used crowdworkers with \(\geq 5,000\) HITs experiences and \(\geq 99\%\) approval rates. Among them, we manually find the pool of high-quality workers and used the same pool throughout the experiments. + +The instruction to crowdworkers is shown in Fig. 6 and Fig. 7, and the task interface is shown in Fig 8. + +# E Example of generated explanations with full inputs + +Examples of generated explanations and predicted answers along with their full input paragraphs retrieved by the paragraph ranker are shown in Table 9, Table 10 and Table 11. + +# 1.1 Input and your task + +You will be given two pieces of information: + +- AI-generated Sentences +Question + +Your first task is the following: + +- Judge if you can answer the question solely based on the AI-generated sentences. Your answer choices are "Yes", "Likely", "No", and "Unsure". + +The meaning of each choice is as follows: + +- Yes: I'm sure I can answer the question. All information needed is there. +- Likely: I can answer the question, but I have to guess something. +- No: I cannot answer the question because important information is missing. +- Unsure: It's difficult to judge. + +General Guildlines: + +- Select Yes: When all information is present, and you have to make no assumptions or very reasonable assumptions. +- Select Likely: When most information is present, but you have to make a reasonable assumption +- Select No: When critical information is missing, and you must make an unreasonable assumption. +- Select Unsure: When it's difficult to judge. + +You will have to use your best judgement in determining what is an unreasonable versus reasonable vs very reasonable assumption. + +Your second task is the following: + +1. If you select "Yes" or "Likely": tell us your answer. +2. If you select "Likely" or "No": please tell us what information is missing for answering the question in a text box. +3. If you select "Unsure": tell us the reason in a text box. + +Figure 6: Instruction for crowdworkers (general guidelines). + +# 1.2 Examples + +
Sentences (input)Question (input)Your answer should be...
Krzysztof Zanussi was born on 17 June 1939. Thom Andersen was born in 1943.Who was born first, Krzysztof Zanussi or Thom Andersen?Judge: Yes +Answer: Krzysztof Zanussi +Exp: All necessary information is present, no assumptions required.
Raj Kapoor was a noted Indian film actor. Mike Cahill is an American film director and screenwriter.What profession do Raj Kapoor and Mike Cahill share?Judge: Yes +Answer: Nothing +Exp: All necessary information is present, no assumptions required.
K-Y Jelly is a water-based, water-soluble personal lubricant. Johnson & Johnson is founded in 1886.What company founded in 1886 has owned the K-Y brand?Judge: No +Missing information: which company owns the K-Y brand. +Exp: It is an unreasonable assumption to assume that J and J owns this brand just because it was founded in 1886.
Mexico is a small mill town for the papermaking industry. Mexico is a town in Oxford County, Maine, United States.What is the main industry of this town with a population of around 2,600 as of 2010 that has Mountain Valley High School attendees as residents?Judge: No +Missing information: The population of the town as of 2010. The fact that Mountain Valley High School attendees are residents. +Exp: It is an unreasonable assumption to assume that Mexico has a certain population or high school.
I Love You was written by Chris White. I Love You was covered by People! and The Carnabeats.Who covered the song I Love You by Chris Write?Judge: Likely +Answer: People! and The Carnabeats. +Missing information: "I Love You" is a song. +Exp: It is reasonable to assume that "I Love You" is a song, since the word cover is usually used for songs.
Johnny Angel (film) stars George Raft. George Raft was an American film actor and dancer.Which American film actor and dancer starred in the 1945 film Johnny Angel?Judge: Likely +Answer: George Raft. +Missing information: Johnny Angel is a 1945 film. +Exp: It is reasonable to assume that Johnny Angel is the same film as Johnny Angel (1945), since films usually don't have the same title.
+ +Figure 7: Instruction for crowdworkers (examples). + +# Al-generated Short Quiz + +Welcome to the HIT! Recently, Artificial Intelligence (AI) grows rapidly, but they still fall short of generating human-like sentences. In this task, you will answer an AI-generated quiz consisting of a few sentences and question. + +# 1. Instruction + +First time user? Click here to expand the instruction. + +# 2. The task + +# 2.1 Read the sentences and question + +Please read the following sentences and question carefully. + +# AI-generated Sentences + +Hotel Splendide is a 2000 British independent dark comedy film. +Hotel Splendide stars Daniel Craig. +Daniel Craig is an English actor. + +# Question + +Hotel Splendide is a British film from 2000 that features which James Bond actor? + +# 2.2 Answer questions + +Do the AI-generated sentences contain enough information for answering the question? + +Yes, that's perfect. +$\bigcirc$ Likely, with one some additional information. +No, important information is missing. +$\bigcirc$ Unsure, it's difficult to judge. + +What do you think is the answer? + +Figure 8: Crowdsourcing interface for sufficiency evaluation. + +
QuestionInput paragraphs from the rankerGenerated explanationPredicted answer
Charlie Rowe plays Billy Costa in a film based on what novel?[P1] Charles John Rowe is an English actor. His film roles include Young Tommy in "Never Let Me Go", James in "The Boat That Rocked", Billy Costa in "The Golden Compass", Peter in the SyFy/Sky Movies Peter Pan prequel "Neverland", and recently played Leo Roth on the Fox medical comedy-drama series "Red Band Society" alongside Octavia Spencer and Dave Annable. The Golden Compass is a 2007 British-American fantasy adventure film based on "Northern Lights", the first novel in Philip Pullman's trilogy "His Dark Materials". Written and directed by Chris Weitz, it stars Nicole Kidman, Dakota Blue Richards, Daniel Craig, Sam Elliott, Eva Green, and Ian McKellen. The project was announced in February 2002, but difficulties over the script and the selection of a director caused significant delays. At US$180 million, it was one of New Line Cinema's most expensive projects ever, and its disappointing results in the USA contributed to New Line's February 2008 restructuring. Charlie St. [P2] Cloud is a 2010 American drama film based on Ben Sherwood's best-selling novel, "The Death and Life of Charlie St. Cloud" published in 2004 by Bantam Books. The film is directed by Burr Steers and stars Zac Efron and Amanda Crew. The story is of Charlie St. Cloud's choice between keeping a promise he made to his brother, who died in a car accident, or going after the girl he loves. In some markets the film used the complete title of the book. [P3] The Golden Compass is a 2007 British-American fantasy adventure film based on "Northern Lights", the first novel in Philip Pullman's trilogy "His Dark Materials". Written and directed by Chris Weitz, it stars Nicole Kidman, Dakota Blue Richards, Daniel Craig, Sam Elliott, Eva Green, and Ian McKellen. The project was announced in February 2002, but difficulties over the script and the selection of a director caused significant delays. At US$18O million, it was one of New Line Cinema's most expensive projects ever, and its disappointing results in the USA contributed to New Line's February 2008 restructuring. Charles John Rowe is an English actor. His film roles include Young Tommy in "Never Let Me Go", James in "The Boat That Rocked", Billy Costa in "The Golden Compass", Peter in the SyFy/Sky Movies Peter Pan prequel "Neverland", and recently played Leo Roth on the Fox medical comedy-drama series "Red Band Society" alongside Octavia Spencer and Dave Annable. 400 Boys is a Canadian/Chinese action-fantasy thriller film directed, written and produced by Alastair Paton and starring Jodelle Ferland, Li Bingbing, Maria Valverde and Charlie Rowe. Northern Lights "Northern Lights" Charlie Rowe plays Billy Costa in The Golden Compass. The Golden Compass is based on Northern Lights.Charlie Rowe plays Billy Costa in The Golden Compass. The Golden Compass is based on Northern Lights.Northern Lights
+ +Table 9: Full input and output example (1). + +
QuestionInput paragraphs from the rankerGenerated explanationPredicted answer
Who was born first, Krzysztof Zanussi or Thom Anderen?[P1] Krzysztof Zanussi, (born 17 June 1939) is a Polish film and theatre director, producer and screenwriter. He is a professor of European film at the European Graduate School in Saas-Fee, Switzerland where he conducts a summer workshop. He is also a professor at the Sile-sian University in Katowice. [P2] Thom Andersen (born 1943, Chicago) is a filmmaker, film critic and teacher. [P3] Weronika Anna Rosati (); born 9 January 1984) is a Polish actress and a member of European Film Academy. She began her acting career in Polish soaps. In 2005, she starred as Džemma in her first theatrical feature film "Pitbull". A year later, she launched her international career with a small uncredited role in "Inland Empire" directed by David Lynch. Since then she has appeared in many critically acclaimed Polish and international productions. In 2013, she has received her first Polish Academy Award nomination for Best Actress for her role in "Obława" (2012). A year later, she starred along-side Agnieszka Grochowska in "Obce ciało" directed by Krzysztof Zanussi. She also had a recurring role in the HBO TV series "Luck" (2012).Krzysztof Zanussi is born on 17 June 1939. Thom Andersen is born on 1943.Krzysztof Zanussi
+ +Table 10: Full input and output example (2). + +
QuestionInput paragraphs from the rankerGenerated explanationPredicted answer
Kalle Mäkinen is nicknamed after a Spanish football that captains what two teams?[P1] Kalle Mäkinen (born 1 February 1989) is a Finnish footballer who last played for the Finnish Veikkausliiga club Maskun Palloseura. He was nicknamed "Sergio" because his style of play was similar to that of Spanish fullback Sergio Ramos. [P2] Sergio Ramos García (]; born 30 March 1986) is a Spanish professional footballer who plays for and captains both Real Madrid and the Spain national team. Primarily a central defender, he can also play as a right back. [P3] The Primera División, commonly known as La Liga and as La Liga Santander for sponsorship reasons with Santander, is the top professional association football division of the Spanish football league system. Administered by the Liga de Fútbol Profesional (LFP), La Liga is contested by 20 teams, with the three lowest-placed teams relegated to the Segunda División and replaced by the top two teams in that division plus the winner of a play-off.Kalle Mäkinen is nickname Sergio Ramos. Sergio Ramos captains both Real Madrid and the Spain national team.Real Madrid and the Spain national team
+ +Table 11: Full input and output example (3). \ No newline at end of file diff --git a/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/images.zip b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5e183aea28244edd2db55cf04bac896bbc83b4fc --- /dev/null +++ b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc46f97a49824de7669badb5721e901b53cac1da4d9597589162b74f74628ab8 +size 1275408 diff --git a/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/layout.json b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ae93c5ac6e24f98cb6298be1a8516591ceeff50a --- /dev/null +++ b/summarizethenanswergeneratingconciseexplanationsformultihopreadingcomprehension/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb49d8304cbf34a46df1c827e93f1da8549d47017f9e4a07dda04faa4a854b92 +size 504343 diff --git a/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_content_list.json b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1d59f22522986ef5e5c82370a98eec53c8c17f2a --- /dev/null +++ b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b65b80f917f88eb06f4c45c908d8e6b349151de344d8954e14a80333da211fe9 +size 101346 diff --git a/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_model.json b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9b54046adc9b4df54302e47d63498ee2d5182a9b --- /dev/null +++ b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b201302858211b53cd43372ebb1bc7a1bd558ed534e7f1f050d9067724986ef9 +size 123541 diff --git a/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_origin.pdf b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f8866e1d8bfcdf6aafe4e63f0103cffea8f5942c --- /dev/null +++ b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/7fd3d8c0-db63-468b-b80f-dd70167bd714_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1eeab7880d903e62d330208a82182089f88d10af1a6786cceba5552c65b5127a +size 4666296 diff --git a/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/full.md b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/full.md new file mode 100644 index 0000000000000000000000000000000000000000..cd489df5f64234eb47c062504d48400c74c00f7a --- /dev/null +++ b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/full.md @@ -0,0 +1,429 @@ +# Surface Form Competition: Why the Highest Probability Answer Isn't Always Right + +Ari Holtzman $^{1*}$ Peter West $^{1,2*}$ Vered Shwartz $^{1,2}$ Yejin Choi $^{1,2}$ Luke Zettlemoyer $^{1}$ + +1Paul G. Allen School of Computer Science & Engineering, University of Washington +2Allen Institute for Artificial Intelligence +{ahai, pawest}@cs.washington.edu + +# Abstract + +Large language models have shown promising results in zero-shot settings (Brown et al., 2020; Radford et al., 2019). For example, they can perform multiple choice tasks simply by conditioning on a question and selecting the answer with the highest probability. + +However, ranking by string probability can be problematic due to surface form competition—wherein different surface forms compete for probability mass, even if they represent the same underlying concept in a given context, e.g. “computer” and “PC.” Since probability mass is finite, this lowers the probability of the correct answer, due to competition from other strings that are valid answers (but not one of the multiple choice options). + +We introduce Domain Conditional Pointwise Mutual Information, an alternative scoring function that directly compensates for surface form competition by simply reweighing each option according to its a priori likelihood within the context of a specific task. It achieves consistent gains in zero-shot performance over both calibrated (Zhao et al., 2021) and uncalibrated scoring functions on all GPT-2 and GPT-3 models on a variety of multiple choice datasets. + +# 1 Introduction + +Despite the impressive results large pretrained language models have achieved in zero-shot settings (Brown et al., 2020; Radford et al., 2019), we argue that current work underestimates the zero-shot capabilities of these models on classification tasks. This is in large part due to surface form competition—a property of generative models that causes probability to be rationed between different valid strings, even ones that differ trivially, e.g., by capitalization alone. Such competition can be largely removed by scoring choices according to + +# A human wants to submerge himself in water, what should he use? + +Humans select options + +![](images/1d4a642e997f854d9b030c975fd07845e92726ca91a5cea10eec829ece7006cb.jpg) + +(a) Coffee cup +(b) Whirlpool bath +X (c) Cup +X (d) Puddle + +Language Models assign probability to every possible string + +Figure 1: While humans select from given options, language models implicitly assign probability to every possible string. This creates surface form competition between different strings that represent the same concept. Example from CommonsenseQA (Talmor et al., 2019). +![](images/c27948fc2e1d718c2624ea54f8973b2d6a976e65e18222ab39a7c93c53c7a3ad.jpg) +OK = right concept, wrong surface form + +Domain Conditional Pointwise Mutual Information $(\mathrm{PMI}_{\mathrm{DC}})$ , which reweighs scores by how much more likely a hypothesis (answer) becomes given a premise (question) within the specific task domain. + +Specifically, consider the example question (shown in Figure 1): "A human wants to submerge himself in water, what should he use?" with multiple choice options "Coffee cup", "Whirlpool bath", "Cup", and "Puddle." From the given options, "Whirlpool bath" is the only one that makes sense. Yet, other answers are valid and easier for a language model to generate, e.g., "Bathtub" and "A bathtub." Since all surface forms compete for finite + +probability mass, allocating significant probability mass to "Bathtub" decreases the amount of probability mass assigned to "Whirlpool bath." While the total probability of generating some correct answer may be high (i.e., across all valid surface forms), only one of these is a listed option. This is particularly problematic here, because "Whirlpool bath" will be much lower probability than "Bathtub," due to its rarity. More generally, methods that do not account for surface form competition will favor answers with fewer lexical paraphrases. + +$\mathrm{PMI_{DC}}$ factors out the probability of a specific surface form, by instead computing how much more probable a hypothesis is when conditioned on a premise. We use a domain premise string to estimate the unconditional probability of a hypothesis in a given domain. On CommonsenseQA, for example, we compute the probability of each answer option immediately following the string “? the answer is:”, and then divide the conditional probability by this estimate to calculate $\mathrm{PMI_{DC}}$ . This scaling factor reweighs answer scores according to the surface form competition that is inherent to the domain or task, e.g. completions of the domain premise that are just inherently unlikely will be up-weighted more. This allows us to directly measure how much an answer tells us about the question and vice versa (mutual information is symmetric, see §3). Valid hypotheses no longer need to compete with each other: both “Whirlpool bath” and “Bathtub” will be considered reasonable answers to the question, and so both will attain a high score. + +Extensive experiments show that $\mathrm{PMI_{DC}}$ consistently outperforms raw, normalized, and calibrated probability scoring methods on zero-shot multiple choice for more than a dozen datasets and it does so for every model in the GPT-2 and GPT-3 families ( $\S 4$ ); this holds true across different possible prompts and in preliminary few-shot experiments as well. To better explain these gains, we use the distinct structure of the COPA dataset (Roemmelo et al., 2011) to remove surface form competition entirely, showing that all methods perform well in this idealized setting ( $\S 5$ ). Additionally, we analyze the only three datasets where $\mathrm{PMI_{DC}}$ does worse than other methods and put forward a hypothesis for why normalizing log probabilities works better than raw probabilities ( $\S 6$ ). We conclude with a discussion of how generative models should be used for selection tasks ( $\S 7$ ). + +# 2 Background and Related Work + +Zero-shot vs. Few-Shot Zero-shot inference has long been of interest in NLP, Computer Vision, and ML in general (Socher et al., 2013; Guadarrama et al., 2013; Romera-Paredes and Torr, 2015). However, Radford et al. (2019) popularized the notion that language models have many zero-shot capabilities that can be discovered simply by prompting the model, e.g., placing "TL;DR" (internet slang for Too Long; Didn't Read) at the end of a passage causes the model to generate a summary. Efficiently constructing the right prompt for a given task is difficult and has become an active area of research (Reynolds and McDonell, 2021; Lu et al., 2021; Shin et al., 2020; Jiang et al., 2020a,b). + +Brown et al. (2020) demonstrated that few-shot learning without fine-tuning is possible with very large language models. Contemporary work has shown it is possible to get smaller models to exhibit few-shot learning behavior using fine-tuning (Hambardzumyan et al., 2021; Gao et al., 2020; Schick and Schütze, 2020a,b,c; Shin et al., 2020), an intermediate learning phase (Ye et al., 2021), or calibration (Zhao et al., 2021), though most assume access to a validation set (Perez et al., 2021). Recent work suggests it may be possible to finetune language models in order to improve their zero-shot and few-shot capabilities on a large swathe of tasks (Wei et al., 2021; Zhong et al., 2021). + +Surface Form Competition When applying generative models to multiple choice problems, simply choosing the highest probability answer becomes problematic due to different valid surface forms competing for probability. Indeed, recent work in question answering has demonstrated the importance of considering all multiple choice options together (Khashabi et al., 2020), rather than independently assigning each answer a score and simply choosing the highest. This is a difficult strategy to adapt to left-to-right generative language models, which implicitly choose between all possible strings. Using unsupervised language models pretrained on relatively expansive corpora exacerbates surface form competition because such language models generate a much wider distribution than a given question answering dataset contains. + +"What is the most populous nation in North America?" Posed with this question, a language model such as GPT-3 can generate a correct response such as "USA", "United States", or "United + +States of America" with high probability. While correct strings like this all contribute to the probability of a correct generation, they may have vastly different probabilities: a common string "United States" will be much more likely than rarer forms like "U.S. of A." In generative scenarios, as long as most of the probability mass goes to valid strings the generation is likely to be valid. This is not the case for multiple choice problems. Given two options, e.g., "USA" and "Canada", GPT-3 will choose the correct answer by probability. However, if we substitute out "USA" for "U.S. of A.", GPT-3 will assign higher probability to "Canada", a less likely answer conceptually, but a much more likely surface form. Beyond this, incorrect generic answers such as "I don't know" are often assigned high probability, relegating the desired answers to the tail of the distribution where softmax is poorly calibrated (Holtzman et al., 2020). + +PMI Work in dialogue has used PMI to promote diversity (Zhou et al., 2019; Yao et al., 2017; Li et al., 2016; Mou et al., 2016; Tang et al., 2019). Recently, Brown et al. (2020) used a scoring function resembling $\mathrm{PMI_{DC}}$ for zero-shot question answering, though they only use the string "A:" as a prompt for the unconditional probability estimate, whereas we use a task-specific domain premise (see §3 for details). Furthermore, Brown et al. (2020) only report this scoring method on three datasets (ARC, OpenBookQA, and RACE, included here) out of the more than 20 tested and do not compare scores with their standard method, averaging log-likelihoods (Avg in this work). In contrast, we report a comprehensive comparison on GPT-3 and GPT-2, as well as shedding light on the underlying issue of surface form competition in §5. + +Contextual Calibration Recently, Zhao et al. (2021) describe a new method for calibrating the probabilities of an LM using a learned affine transformation. Though geared towards few-shot learning, the authors devise a clever means of using "content free inputs" for zero-shot learning. Zhao et al. (2021) calibrate for three forms of bias: (1) majority label bias, (2) recency bias, and (3) common token bias. $\mathrm{PMI_{DC}}$ directly compensates for common token bias by dividing by the domain conditional probability of each answer, and performs superior to contextual calibration (CC) in the majority of cases. + +Prompt Sensitivity Recent work highlights LM sensitivity to inputs, and proposes to consider paraphrases of the prompt to overcome this (Davison et al., 2019; Jiang et al., 2020b), as well as noting that certain trigger tokens (Shin et al., 2020) can strongly effect the output of such models. In this work, we focus on the surface form of possible outputs, but do also analyze robustness to different prompts in §4.4. + +Interpreting Language Models Language models tend to model selectional preferences and thematic fit (Pantel et al., 2007; Erk et al., 2010) rather than semantic plausibility (Wang et al., 2018). Probability, possibility and plausibility are distinct (Van der Helm, 2006), but reporting bias (Gordon and Van Durme, 2013) means that language models only model what people are likely to write (on websites that are easily crawled). $\mathrm{PMI_{DC}}$ aims to adjust for these challenges to better measure the underlying agreement between language models and human judgements, but of course is still subject to the limits and biases of the language model used. + +# 3 Zero-shot Scoring Strategies + +This paper does not define any new modeling or finetuning methods. Rather, we propose the broad use of $\mathrm{PMI_{DC}}$ scoring for any given model and prompt. $\mathrm{PMI_{DC}}$ compensates for the fact that different correct answers compete for probability, even though only one will be listed as the correct multiple choice option. + +We begin by describing the two most common methods currently in use. + +# 3.1 Standard Methods + +Our first baseline is simply selecting the highest-probability option, e.g., baselines in Zhao et al. (2021) and Jiang et al. (2020b), which we refer to as LM. Given a prompt $\mathbf{x}$ (e.g. "The bar closed") and a set of possible answers $\mathbf{y}_1,\dots ,\mathbf{y}_n$ (e.g. "it was crowded.", "it was 3 AM"), LM is defined: + +$$ +\underset {i} {\arg \max } P (\mathbf {y} _ {i} | \mathbf {x}). \tag {1} +$$ + +However, using length normalized log-likelihoods (Brown et al., 2020) has become standard due to its superior performance, and is also commonly used in generation (Mao et al., 2019; Oluwatobi and Mueller, 2020). For causal language models, e.g., + +# Template + +Premise (X): + +The bar closed because + +Domain Premise (Xdomain): because + +Hypothesis 1 $(\mathbf{Y}_1)$ : + +it was crowded. + +Hypothesis 2 $(\mathbf{y}_2)$ : + +it was 3am. + +# Scoring Functions + +$$ +\begin{array}{c} \text {P r o b a b i l i t y} \\ (\text {L M}) \end{array} \qquad \underset {i} {\operatorname {a r g m a x}} P (\mathbf {y} _ {i} | \mathbf {x}) +$$ + +$$ +\begin{array}{l l} \text {A v e r a g e L o g - L i k e l i h o o d} & \arg \max _ {i} \frac {\sum_ {j = 1} ^ {\ell_ {i}} P (y _ {i} ^ {j} | \mathbf {x} , \mathbf {y} ^ {1 \cdots j - 1})}{\ell_ {i}} \end{array} +$$ + +$$ +\begin{array}{c} \text {C o n t e x t u a l C a l i b r a t i o n} \\ (\mathbf {C C}) \end{array} \quad \arg \max _ {i} \mathbf {w} P (\mathbf {y} _ {i} | \mathbf {x}) + \mathbf {b} +$$ + +$$ +\underset {(\mathbf {P M I} _ {\mathrm {b c}})} {\text {D o m a i n C o n d i t i o n a l P M I}} \quad \arg \max _ {i} \frac {P (\mathbf {y} _ {i} | \mathbf {x})}{P (\mathbf {y} _ {i} | \mathbf {x} _ {\mathrm {d o m a i n}})} +$$ + +Figure 2: An example from COPA (Roemmle et al., 2011) with the template we use as well as the scoring functions we test. LM returns the highest probability option, while AVG length-normalizes log-likelihoods and chooses the highest option. $\mathrm{PMI_{DC}}$ is a measurement of the mutual information between hypothesis and premise, intuitively how much $\mathbf{x}$ explains $\mathbf{y}_i$ and vice versa. CC is an affine transform of LM, where $\mathbf{w}$ and $\mathbf{b}$ are averaged over solutions that cause "content free inputs" to yield uniform scores over a given label set, see Zhao et al. (2021). + +GPT-2 and GPT-3, Equation 1 can be decomposed: + +$$ +P (\mathbf {y} _ {i} | \mathbf {x}) = \prod_ {j = 1} ^ {\ell_ {i}} P (y _ {i} ^ {j} | \mathbf {x}, y _ {i} ^ {1}, \dots , y _ {i} ^ {j - 1}) +$$ + +where $y_{i}^{j}$ is the $j$ th token of $\mathbf{y}_i$ and $\ell_i$ is the number of tokens in $\mathbf{y}_i$ . The Avg strategy can thus be defined as: + +$$ +\arg \max _ {i} \frac {\sum_ {j = 1} ^ {\ell_ {i}} \log P (y _ {i} ^ {j} | \mathbf {x} , \mathbf {y} ^ {1 \cdots j - 1})}{\ell_ {i}}. +$$ + +# 3.2 Domain Conditional PMI + +Our core claim is that direct probability is not an adequate zero-shot scoring function due to surface form competition. A natural solution is to factor out the probability of specific surface forms, which is what Pointwise Mutual Information (PMI) does: + +$$ +\operatorname {P M I} (\mathbf {x}, \mathbf {y}) = \log \frac {P (\mathbf {y} | \mathbf {x})}{P (\mathbf {y})} = \log \frac {P (\mathbf {x} | \mathbf {y})}{P (\mathbf {x})}. \tag {2} +$$ + +In effect, this is how much more likely the hypothesis ("it was 3 AM.") becomes given the premise ("The bar closed because"), see Figure 2 for the full example. In a multiple-choice setting—where the premise $\mathbf{x}$ does not change across hypotheses—this is proportional to $P(\mathbf{x}|\mathbf{y})$ , i.e. the probability of the premise given the hypothesis. We call this scoring-by-premise and it is the reverse of LM, $P(\mathbf{y}|\mathbf{x})$ . We use scoring-by-premise to show the presence of surface form competition in §5. + +While Equation 2 estimates how related premise $\mathbf{x}$ is to hypothesis $\mathbf{y}$ in general, we found that estimates of $P(\mathbf{y})$ vary wildly. GPT-2 and GPT-3 are not trained to produce unconditional estimates of document excerpts, an issue which is exacerbated by the fact that many possible answers are extremely rare in a large scrape of public web pages. This causes the unconditional probability of such answers to be poorly calibrated for the purposes of a given task. + +We are specifically trying to measure $P(\mathbf{y})$ in a given domain, e.g., for the "because" relation in our running example, shown in Figures 2 & 3. To quantify this, we propose Domain Conditional PMI: + +$$ +\begin{array}{l} \mathrm {P M I} _ {\mathrm {D C}} (\mathbf {x}, \mathbf {y}, \text {d o m a i n}) = \frac {P (\mathbf {y} | \mathbf {x} , \text {d o m a i n})}{P (\mathbf {y} | \text {d o m a i n})} \\ = \frac {P (\mathbf {y} | \mathbf {x} , \text {d o m a i n})}{P (\mathbf {y} | \mathbf {x} _ {\text {d o m a i n}})} \\ \end{array} +$$ + +or how much $\mathbf{x}$ tells us about $\mathbf{y}$ within a domain. + +Typically, $P(\mathbf{y}|\mathbf{x}, \text{domain}) = P(\mathbf{y}|\mathbf{x})$ because the premise $\mathbf{x}$ typically implies the domain, e.g., "The bar closed because" sets the model up to predict an independent clause that is the cause of some event, without further representation of the domain. In order to estimate $P(\mathbf{y}|\text{domain})$ the probability of seeing hypothesis $\mathbf{y}$ in a given domain—we use a short domain-relevant string $\mathbf{x}_{\text{domain}}$ , which we call a "domain premise", usually just the ending of the conditional premise $\mathbf{x}$ . For example, to predict a causal relation like in Figure 2 we use $\mathbf{x}_{\text{domain}} =$ "because" and thus divide by $P(\mathbf{y}|\text{because})$ -how + +likely $y$ is to be a "cause". For examples of each template see Appendix B. + +# 3.3 Non-standard Baselines + +Unconditional We also compare to the unconditional (in-domain) estimate as a scoring function: + +$$ +\underset {i} {\arg \max } P (\mathbf {y} _ {i} | \mathbf {x} _ {\text {d o m a i n}}). +$$ + +We refer to this as UNC. It ignores the premise completely, only using a domain premise $\mathbf{x}_{\mathrm{domain}}$ (e.g., using $P(\mathbf{y}|$ because) as the score). Yet, it is sometimes competitive, for instance on BoolQ (Clark et al., 2019). UNC is a sanity check on whether zero-shot inference is actually using the information in the question to good effect. + +Contextual Calibration Finally, we compare to the reported zero-shot numbers of Zhao et al. (2021). Contextual Calibration adjusts LM with an affine transform to make a closed set of answers equally likely in the absence of evidence. Contextual Calibration thus requires computing matrices $\mathbf{w}$ and $\mathbf{b}$ for a number of "content free inputs" and then averaging these weights, see Zhao et al. (2021) for details. In contrast, $\mathrm{PMI_{DC}}$ requires nothing but a human-written template (as all zero-shot methods do, including Contextual Calibration), can be computed as the difference of two log probabilities, and is naturally applicable to datasets where the set of valid answers varies between questions. + +# 4 Multiple Choice Experiments + +# 4.1 Setup + +We use GPT-2 via the HuggingFace Transformers library (Wolf et al., 2020) and GPT-3 via OpenAI's beta API.† We do not finetune any models, nor do we alter their output. See Appendix B for examples from each dataset in our templated format. + +# 4.2 Datasets + +We report results on 16 splits of 13 datasets, and briefly describe each dataset here. + +Continuation These datasets require the model to select a continuation to previous text, making them a natural way to test language models. Choice of Plausible Alternatives (COPA) (Roemmle et al., 2011) asks for cause and effect relationships, as shown in Figure 2. StoryCloze (SC) (Mostafazadeh et al., 2017) gives the model a choice between two + +alternative endings to 5 sentence stories. Finally, HellaSwag (HS) (Zellers et al., 2019) uses GPT-2 to generate, BERT to filter, and crowd workers to verify possible continuations to a passage. Following previous work (Brown et al., 2020) we report development set numbers for COPA and HS. + +Question Answering RACE-M & -H (R-M & R-H) (Lai et al., 2017) are both drawn from English exams given in China, the former being given to Middle Schoolers and the latter to High Schoolers. Similarly, ARC Easy & Challenge (ARC-E & ARC-C) (Clark et al., 2018) are standardized tests described as "natural, grade-school science questions," with the "Easy" split found to be solvable by either a retrieval or word co-occurrence system, and the rest of the questions put in the "Challenge" split. Open Book Question Answering (OBQA) (Mihaylov et al., 2018) is similar to both of these, but was derived using (and intended to be tested with) a knowledge source (or "book") available; we do not make use of the given knowledge source, following Brown et al. (2020). Finally, CommonSenseQA (CQA) (Talmor et al., 2019) leverages CONCEPTNET (Speer et al., 2017) to encourage crowd workers to write questions with challenging distractors. We report development set numbers on CQA because their test set is not public. + +Open Set vs. Closed Set Datasets The above datasets are all "open set" in that multiple choice answers may be any string. Below we describe "closed set" datasets with a fixed set of answers. + +Boolean Question Answering BoolQ (BQ) (Clark et al., 2019) poses yes/no (i.e. Boolean) questions based on a multi-sentence passage. + +Entailment Entailment datasets focus on the question of whether a hypothesis sentence B is entailed by a premise sentence A. Recognizing Textual Entailment (RTE) (Dagan et al., 2005) requires predicting an "entailment" or "contradiction" label while Commitment Bank (CB) (De Marneffe et al., 2019) adds a "neutral" label. Following previous work (Brown et al., 2020) we report development set numbers for both RTE and CB. + +Text Classification We consider three more complex classification datasets: SST-2 & -5 (Socher et al., 2013) for various granularities of sentiment classification, AG's News (Zhang et al., 2015) (AGN) for topic classification, and TREC (Li and Roth, 2002) for question classification. + +Multiple Choice Accuracy on GPT-3 + +
Params.2.7B6.7B13B175B
UncLMAvgPMIDCCCUncLMAvgPMIDCUncLMAvgPMIDCUncLMAvgPMIDCCC
COPA54.868.468.474.4-56.475.873.677.056.679.277.884.256.085.282.889.2-
SC50.966.068.373.1-51.470.273.376.852.074.177.879.951.979.383.184.0-
HS31.134.541.434.2-34.740.853.540.038.848.866.245.843.557.677.253.5-
R-M22.437.842.442.6-21.243.345.948.522.949.650.651.322.555.756.455.7-
R-H21.430.332.736.0-22.034.836.839.822.938.239.242.122.242.443.343.7-
ARC-E31.650.444.744.7-33.558.252.351.533.866.259.757.736.273.567.063.3-
ARC-C21.121.625.530.5-21.826.829.833.022.332.134.338.522.640.243.245.5-
OBQA10.017.227.242.8-11.422.435.448.010.428.241.250.410.633.243.858.0-
CQA15.933.236.044.7-17.440.042.950.316.448.847.958.516.361.057.466.7-
BQ62.258.558.553.5-37.861.061.061.062.261.161.160.337.862.562.564.0-
RTE47.348.748.751.649.552.755.255.248.752.752.752.754.947.356.056.064.357.8
CB08.951.851.857.150.008.933.933.939.308.951.851.850.008.948.248.250.048.2
SST-249.953.753.7672.371.449.954.554.580.049.969.069.081.049.963.663.671.475.8
SST-518.120.020.423.5-18.127.822.732.018.118.629.619.117.627.027.329.6-
AGN25.069.069.067.963.225.064.264.257.425.069.869.870.325.075.475.474.773.9
TREC13.029.419.257.238.822.630.222.861.622.634.021.432.422.647.225.458.457.4
+ +Table 1: Comparison of scoring algorithms when using GPT-3 for zero-shot inference on multiple choice questions. + +Percent of Ties or Wins by Method + +
MethodUncLMAvgPMI DCCC
125M12.506.2512.5068.75-
350M6.2518.7512.5068.75-
760M6.256.2512.5075.00-
1.6B6.2512.5012.5080.0020.00
2.7B6.256.256.2586.660.00
6.7B6.2525.0025.0075.00-
13B6.2518.7518.7568.75-
175B6.2512.5018.7562.506.25
+ +Table 2: Percentage of datasets that a given method produced the best score or was tied with other methods, aggregated over each model size. The first four rows use GPT-2 (full data available in the Appendix), while the final four rows use GPT-3 and summarize data from Table 1. Since ties are included, rows sometimes sum to more than 100. CC is only measured on the 5 datasets we use where Zhao et al. (2021) also report accuracies. + +# 4.3 Results + +We report zero-shot results for GPT-3 in Table 1, with GPT-2 results available in Appendix A. A summarized view is shown in Table 2, which aggregates the percentage of splits where a given method achieves the best score or ties for first-place. In this summarized view it is clear that $\mathrm{PMI_{DC}}$ consistently outperforms other scoring methods when assessed over a variety of datasets. The smallest margin (in number of datasets won or tied) between $\mathrm{PMI_{DC}}$ and the best competing method is on GPT-3 + +Prompt Robustness on SST-2 + +
MethodUncLMPMI DC
125M49.9056.87.358.87.6
350M49.9058.011.360.311.4
760M49.9057.09.267.713.4
1.6B49.9057.38.269.813.3
2.7B49.9056.19.066.215.7
6.7B49.9059.510.767.913.6
13B49.9063.014.971.716.1
175B49.9072.515.774.814.0
+ +Table 3: The mean and standard deviations over the 15 templates considered for SST-2 in (Zhao et al., 2021). Avg is excluded, as it is equivalent to LM since all the given templates use single-token answers. + +175B with Avg, but that margin is over 40 percentage points. This does not imply that $\mathrm{PMI_{DC}}$ is always better or that it will be better by a large margin, though it often is. It does suggest that $\mathrm{PMI_{DC}}$ is a significantly better bet on a new dataset. + +# 4.4 Robustness + +To verify that these trends hold across different prompts, we report the mean and standard deviation over the fifteen different prompts considered in (Zhao et al., 2021) for SST-2. Table 3 shows, $\mathrm{PMI_{DC}}$ always maintains the highest mean, often by a hefty margin. Scores are lower than in Table 1 because many of the prompts used are optimized for few-shot rather than zero-shot scoring. + +
SST-2CQA
MethodUncLMPMIDCUncLMAvgPMIDC
125M49.9063.67,471.75,115.5029.91,632.71,438.31,7
350M49.9076.313,876.48,116.5037.62,340.42,345.72,4
760M49.9085.97,287.13,016.1041.52,642.42,547.01,5
1.6B49.9085.41,789.44,016.0046.21,547.71,952.32,1
2.7B49.9088.14,987.75,516.6043.01,745.61,950.41,1
6.7B49.9092.92,179.86,916.9052.31,453.41,056.51,6
13B49.9085.49,086.97,516.7058.42,059.31,563.41,4
175B49.9089.95,595.50,716.5069.11,969.40,872.00,9
+ +Table 4: The mean and standard deviation for 5 randomly sampled sets of 4 examples used for few-shot inference. We include a closed answer dataset (SST-2) and an open answer dataset (CQA). For SST-2 Avg is equivalent to LM due to using single-token answers. + +
MethodCOPACOPA Flipped
UncLMAvgPMI\( _{DC} \)UncLMAvgPMI\( _{DC} \)
125M56.461.063.262.850.063.263.263.2
350M55.867.066.070.050.066.466.466.4
760M55.669.867.669.450.070.870.870.8
1.6B56.069.068.471.650.073.073.073.0
2.7B54.868.468.474.450.068.468.468.4
6.7B56.475.873.677.050.076.876.876.8
13B56.679.277.884.250.079.079.079.0
175B56.085.282.889.250.083.683.683.6
+ +Table 5: LM does better on COPA Flipped than COPA because surface form competition is removed when scoring-by-premise, see §5. Methods that don't directly adjust for competing surface forms (LM and Avg) have the same score as $\mathrm{PMI_{DC}}$ on COPA Flipped. + +# 4.5 Few-shot + +While our focus in this paper is on zero-shot scoring, $\mathrm{PMI_{DC}}$ is just as applicable to few-shot scenarios. In Table 4 we report 4-shot results on one closed set dataset (SST-2) and one open set dataset (CQA). We show the mean of 5 randomly sampled sets of 4 examples that are used to prime the model for the task, along with standard deviations. The overall trend on both datasets clearly favors $\mathrm{PMI_{DC}}$ , though LM is superior for two models on SST-2. + +# 5 Removing Surface Form Competition + +What if we used the probability of the premise given the hypothesis, $P(\mathbf{x}|\mathbf{y}_i)$ , instead? While we are still measuring the probability of a surface form (e.g. "the bar closed"), it is the same surface form across different options ("It was crowded so", "It was 3 AM so"), eliminating the surface form competition. $\mathbf{y}_i$ and $\mathbf{y}_i'$ can now both attain high scores if they are both correct answers, by causing $\mathbf{x}$ to be likely. We call this scoring-by-premise. + +Causal language models like GPT-3 cannot measure this directly, because they are only capable of conditioning on past tokens to predict future tokens. We exploit the structure of the COPA dataset to create "COPA Flipped" via a simple transformation, shown in Figure 3. COPA consists of cause and effect pairs (CAUSE so EFFECT, and EFFECT because CAUSE). In the original dataset, whatever comes second (either CAUSE or EFFECT) has two options that a model must choose between. These can be reversed by switching CAUSE and EFFECT, then substituting the natural inverse relation ("because") $\rightarrow$ "so" and "so" $\rightarrow$ "because"). + +# 5.1 Results + +Table 5 shows scores on COPA and COPA Flipped side-by-side. On COPA Flipped everything except UNC produces the exact same result. This is because flipping the hypothesis and premise means that it's the context that changes and not the continuation. LM, AVG, and $\mathrm{PMI_{DC}}$ only differ from each other over different continuations, not over different contexts for the same continuation. + +On COPA Flipped all methods generally perform similarly to $\mathrm{PMI_{DC}}$ on the unflipped version. This is because surface form competition has been eradicated: we are measuring how well different prefixes condition a model to predict a fixed continuation rather than which continuation is highest probability. Unlike LM, where different answers compete for probability, in COPA Flipped it only matters how likely each answer can make the question. This is not subject to surface form competition because there is only one string being so scored, so it is not competing with any other strings for probability mass. + +Not all datasets are so easily flippable, so manually flipping individual questions to remove surface form competition is not a generally applicable strategy. Luckily, $\mathrm{PMI_{DC}}$ is symmetric: + +$$ +\begin{array}{l} \arg \max _ {i} \frac {P (\mathbf {y} _ {i} | \mathbf {x} , \text {d o m a i n})}{P (\mathbf {y} _ {i} | \text {d o m a i n})} \\ = \arg \max _ {i} \frac {P (\mathbf {x} | \mathbf {y} _ {i} , \text {d o m a i n})}{P (\mathbf {x} | \text {d o m a i n})} \\ = \underset {i} {\arg \max } P (\mathbf {x} | \mathbf {y} _ {i}, \text {d o m a i n}) \\ \end{array} +$$ + +In theory, the answer selected by $\mathrm{PMI_{DC}}$ should be the same between COPA and COPA Flipped + +![](images/caf31dfa998417dee48ccd7214cd38d4bbe81c8ccc96930f998ddd7bec170c7d.jpg) +Figure 3: In §5 we experiment with flipping the premise and hypothesis so that the highest probability premise is chosen as the answer, i.e. scoring-by-premise. The transformation above the dashed line shows the experimental setup used in §5.1, while the extra distractor below the dashed line is used for illustrative purposes in §5.2. + +as PMI is symmetric, though we expect some differences due to “so” and “because” not being perfect inverses and shuffled references. Thus, $\mathrm{PMI}_{\mathrm{DC}}$ does better on COPA than COPA Flipped, likely due to more natural phrasing in the original dataset. + +These results suggest that surface form competition is the primary cause of the depressed performance of LM and Avg in comparison to $\mathrm{PMI_{DC}}$ . + +# 5.2 In-depth Example + +Scoring-by-Premise Improves LM Figure 3 shows an example of transforming one question from COPA to COPA Flipped. In the example depicted, when we use GPT-3 to calculate $P$ , we get: + +$$ +P (\mathbf {y} _ {1} | \mathbf {x}) > P (\mathbf {y} _ {2} | \mathbf {x}) +$$ + +which is wrong, since bars usually close at fixed, late-night closing times, rather than because of being overcrowded. However we also find that + +$$ +P (\hat {\mathbf {y}} | \hat {\mathbf {x}} _ {2}) > P (\hat {\mathbf {y}} | \hat {\mathbf {x}} _ {1}) +$$ + +$$ +\frac {P \left(\mathbf {y} _ {2} \mid \mathbf {x}\right)}{P \left(\mathbf {y} _ {2} \mid \mathbf {x} _ {\text {d o m a i n}}\right)} > \frac {P \left(\mathbf {y} _ {1} \mid \mathbf {x}\right)}{P \left(\mathbf {y} _ {1} \mid \mathbf {x} _ {\text {d o m a i n}}\right)} +$$ + +indicating that scoring-by-premise causes the right answer to be selected and that $\mathrm{PMI_{DC}}$ successfully simulates scoring by premise in this example. + +Stability Over Valid Answers To see how scoring-by-premise allows multiple correct options to achieve high scores, consider the slightly perturbed $\mathbf{y}_2^{\prime}$ and $\hat{\mathbf{x}}_2^\prime$ in Figure 3. The inequalities shown above still hold when substituting + +$\mathbf{y}_2 \to \mathbf{y}_2'$ and $\hat{\mathbf{x}}_2 \to \hat{\mathbf{x}}_2'$ : + +$$ +P (\mathbf {y} _ {1} | \mathbf {x}) > P (\mathbf {y} _ {2} ^ {\prime} | \mathbf {x}) +$$ + +$$ +P (\hat {\mathbf {y}} | \hat {\mathbf {x}} _ {2} ^ {\prime}) > P (\hat {\mathbf {y}} | \hat {\mathbf {x}} _ {1}) +$$ + +$$ +\frac {P \left(\mathbf {y} _ {2} ^ {\prime} \mid \mathbf {x}\right)}{P \left(\mathbf {y} _ {2} ^ {\prime} \mid \mathbf {x} _ {\text {d o m a i n}}\right)} > \frac {P \left(\mathbf {y} _ {1} \mid \mathbf {x}\right)}{P \left(\mathbf {y} _ {1} \mid \mathbf {x} _ {\text {d o m a i n}}\right)} +$$ + +with the key difference that the conditional probability of $\mathbf{y}_2^{\prime}$ is much lower: + +$$ +\log P (\mathbf {y} _ {2} | \mathbf {x}) \approx - 1 6 +$$ + +$$ +\log P (\mathbf {y} _ {2} ^ {\prime} | \mathbf {x}) \approx - 2 0 +$$ + +This is undesirable, as both $\mathbf{y}_2$ and $\mathbf{y}_2'$ are correct answers with similar meanings. Yet, when scoring-by-premise the conditional probability of $\hat{\mathbf{y}}$ is stable when substituting $\hat{\mathbf{x}}_2 \rightarrow \hat{\mathbf{x}}_2'$ : + +$$ +\log P (\hat {\mathbf {y}} | \hat {\mathbf {x}} _ {2}) \approx - 1 2 +$$ + +$$ +\log P (\hat {\mathbf {y}} | \hat {\mathbf {x}} _ {2} ^ {\prime}) \approx - 1 2 +$$ + +This suggests that eliminating surface form competition allows different correct answers to score well, as they are no longer competing for probability mass. Specifically, "it was 3 AM" and "it was 3:30AM" score wildly differently in COPA but nearly identically in COPA Flipped. + +# 6 Analysis + +Failure Cases There are three datasets where $\mathrm{PMI_{DC}}$ does not consistently outperform other methods: HellaSwag, ARC Easy, and BoolQ. Surprisingly, each is dominated by a different method. + +HellaSwag is most amenable to AVG. On examination we find that HellaSwag is more focused on the internal coherence of the hypotheses, rather than external coherence, i.e. how much a premise and hypothesis match. This is likely due to HellaSwag being generated by GPT-2 (Radford et al., 2019) and filtered with BERT, as it contains relatively on-topic but intrinsically strange hypotheses that humans can distinguish from natural data. + +ARC Easy yields the highest scores to LM, i.e., selecting the highest probability option. Clark et al. (2018) note that ARC Easy questions can be solved by a retrieval or word co-occurrence baseline, while examples that were answered incorrectly by both were put into the Challenge split. This suggests a bias towards a priori likely phrases. Manual inspection reveals many stock answers, e.g., "[clouds are generated when] ocean water evaporates and then condenses in the air," supporting our hypothesis. + +Finally, BoolQ, a reading comprehension dataset in which all answers are either "yes" or "no", is best solved by an unconditional baseline. This is because the dataset presents truly complex questions that require more reasoning than GPT-2 or 3 are capable of out of the box. Indeed, none of the methods reported do better than the majority baseline, except $\mathrm{PMI_{DC}}$ with the largest GPT-3 model. + +Why does length normalization work? Past work offers little explanation for why AVG should be a successful strategy, other than the intuition that estimates are strongly length biased and require compensation. Length bias may be caused by the final softmax layer of current language models assigning too much probability mass to irrelevant options at each time-step, as noted in open-ended generation, character-level language modeling, and machine translation (Holtzman et al., 2020; Al-Rfou et al., 2019; Peters et al., 2019). + +Another (not mutually exclusive) argument is that length normalization may account for unconditional probability in a similar way to $\mathrm{PMI_{DC}}$ . Length normalization is often measured over Byte Pair Encoding (BPE) tokens (Sennrich et al., 2016) and BPE tends to produce vocabularies where most tokens are equally frequent (Wang et al., 2020). Recent evidence suggests that language is approximately uniformly information dense (Levy, 2018; Levy and Jaeger, 2007; Jaeger, 2006). As such, length in BPE tokens may correspond roughly to a unigram estimate of log-probability, supposing that BPE tokens have approximately uniform uni + +gram frequency. The adjustment made by AVG is still somewhat different than $\mathrm{PMI_{DC}}$ , (division of log terms rather than subtraction) but could have a similar effect, if length and probability correlate. + +# 7 Discussion + +Language Models are density estimation functions that assign probability to every possible string, but there are often many strings that could represent a given idea equally well. Our key observation is that a generative model assigning probability to a string that represents a certain option isn't equivalent to selecting the concept an option corresponds to. We expect surface form competition anywhere that generative models are used where more than one string could represent the same concept. + +$\mathrm{PMI_{DC}}$ aligns the predictions being made by the model more closely with the actual task posed by multiple choice questions: "choose the hypothesis that explains the premise" rather than "generate the exact surface form of the hypothesis". From this perspective, $\mathrm{PMI_{DC}}$ does not go far enough, because the model still cannot consider the given set of options altogether when selecting its choice. This matters when answers interact with each other, e.g., "all of the above". + +# 8 Conclusion + +We conduct a large-scale comparison of standard and recent scoring functions for zero-shot inference across all GPT-2 and GPT-3 models. We show that $\mathrm{PMI_{DC}}$ consistently outperforms previous scoring functions on a wide variety of multiple choice datasets. We also argue that compensating for surface form competition is the cause of this boost, by demonstrating that other methods work just as well as $\mathrm{PMI_{DC}}$ when surface form competition is eliminated. In future work we would like to explore how surface form competition affects generation, as we hypothesize that it may be the cause of overly generic outputs under high model uncertainty. + +# Acknowledgments + +This work was supported in part by the ARO (AROW911NF-16-1-0121), the NSF (IIS-1562364), DARPA under the MCS program through NIWC Pacific (N66001-19-2-4031) and the Allen Institute for AI (AI2). We thank Mitchell Wortsman, Gabriel Ilharco, Tim Dettmers, and Rik Koncel-Kedziorski for thorough and insightful feedback on preliminary drafts. + +# References + +Rami Al-Rfou, Dokook Choe, Noah Constant, Mandy Guo, and Llion Jones. 2019. Character-level language modeling with deeper self-attention. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3159-3166. +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. +Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. 2019. *Boolq: Exploring the surprising difficulty of natural yes/no questions.* 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 2924–2936. +Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. 2018. Think you have solved question answering? try arc, the ai2 reasoning challenge. arXiv preprint arXiv:1803.05457. +Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The pascal recognising textual entailment challenge. In *Machine Learning Challenges Workshop*, pages 177–190. Springer. +Joe Davison, Joshua Feldman, and Alexander Rush. 2019. Commonsense knowledge mining from pretrained 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 1173-1178, Hong Kong, China. Association for Computational Linguistics. +Marie-Catherine De Marneffe, Mandy Simons, and Judith Tonhauser. 2019. The commitmentbank: Investigating projection in naturally occurring discourse. In proceedings of Sinn und Bedeutung, volume 23, pages 107-124. +Katrin Erk, Sebastian Padó, and Ulrike Padó. 2010. A flexible, corpus-driven model of regular and inverse selectional preferences. Computational Linguistics, 36(4):723-763. +Tianyu Gao, Adam Fisch, and Danqi Chen. 2020. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723. +Jonathan Gordon and Benjamin Van Durme. 2013. Reporting bias and knowledge acquisition. In Proceedings of the 2013 workshop on Automated knowledge base construction, pages 25-30. +Sergio Guadarrama, Niveda Krishnamoorthy, Girish Malkarnenkar, Subhashini Venugopalan, Raymond Mooney, Trevor Darrell, and Kate Saenko. 2013. + +Youtube2text: Recognizing and describing arbitrary activities using semantic hierarchies and zero-shot recognition. In Proceedings of the IEEE international conference on computer vision, pages 2712-2719. +Karen Hambardzumyan, Hrant Khachatrian, and Jonathan May. 2021. Warp: Word-level adversarial reprogramming. arXiv preprint arXiv:2101.00121. +Ari Holtzman, Jan Buys, Maxwell Forbes, and Yejin Choi. 2020. The curious case of neural text degeneration. International Conference on Learning Representations. +Tim Florian Jaeger. 2006. *Redundancy and syntactic reduction in spontaneous speech*. Ph.D. thesis, Stanford University Stanford, CA. +Zhengbao Jiang, Jun Araki, Haibo Ding, and Graham Neubig. 2020a. How can we know when language models know? arXiv preprint arXiv:2012.00955. +Zhengbao Jiang, Frank F. Xu, Jun Araki, and Graham Neubig. 2020b. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423-438. +Daniel Khashabi, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. 2020. Unifiedqa: Crossing format boundaries with a single qa system. arXiv preprint arXiv:2005.00700. +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. +Roger Levy. 2018. Communicative efficiency, uniform information density, and the rational speech act theory. In CogSci. +Roger Levy and T Florian Jaeger. 2007. Speakers optimize information density through syntactic reduction. Advances in neural information processing systems, 19:849. +Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and William B Dolan. 2016. A diversity-promoting objective function for neural conversation models. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 110-119. +Xin Li and Dan Roth. 2002. Learning question classifiers. In COLING 2002: The 19th International Conference on Computational Linguistics. +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. + +Huanru Henry Mao, Bodhisattwa Prasad Majumder, Julian McAuley, and Garrison Cottrell. 2019. Improving neural story generation by targeted common sense grounding. 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 5990-5995. +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. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2381-2391. +Nasrin Mostafazadeh, Michael Roth, Annie Louis, Nathanael Chambers, and James Allen. 2017. Lsdsem 2017 shared task: The story cloze test. In Proceedings of the 2nd Workshop on Linking Models of Lexical, Sentential and Discourse-level Semantics, pages 46-51. +Lili Mou, Yiping Song, Rui Yan, Ge Li, Lu Zhang, and Zhi Jin. 2016. Sequence to backward and forward sequences: A content-introducing approach to generative short-text conversation. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 3349-3358. +Olabiyi Oluwatobi and Erik Mueller. 2020. DLGNet: A transformer-based model for dialogue response generation. In Proceedings of the 2nd Workshop on Natural Language Processing for Conversational AI, pages 54-62, Online. Association for Computational Linguistics. +Patrick Pantel, Rahul Bhagat, Bonaventura Coppola, Timothy Chklovski, and Eduard Hovy. 2007. ISP: Learning inferential selectional preferences. In Human Language Technologies 2007: The Conference of the North American Chapter of the Association for Computational Linguistics; Proceedings of the Main Conference, pages 564-571, Rochester, New York. Association for Computational Linguistics. +Ethan Perez, Douwe Kiela, and Kyunghyun Cho. 2021. True few-shot learning with language models. arXiv preprint arXiv:2105.11447. +Ben Peters, Vlad Niculae, and André FT Martins. 2019. Sparse sequence-to-sequence models. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1504-1519. +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. +Laria Reynolds and Kyle McDonell. 2021. Prompt programming for large language models: Beyond the few-shot paradigm. arXiv preprint arXiv:2102.07350. + +Melissa Roemmele, Cosmin Adrian Bejan, and Andrew S Gordon. 2011. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In AAAI Spring Symposium: Logical Formalizations of Commonsense Reasoning, pages 90-95. +Bernardino Romera-Paredes and Philip Torr. 2015. An embarrassingly simple approach to zero-shot learning. In International conference on machine learning, pages 2152-2161. PMLR. +Timo Schick and Hinrich Schütze. 2020a. Exploiting cloze questions for few-shot text classification and natural language inference. arXiv preprint arXiv:2001.07676. +Timo Schick and Hinrich Schütze. 2020b. Few-shot text generation with pattern-exploiting training. arXiv preprint arXiv:2012.11926. +Timo Schick and Hinrich Schütze. 2020c. It's not just size that matters: Small language models are also few-shot learners. arXiv preprint arXiv:2009.07118. +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. +Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. 2020. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4222-4235, Online. Association for Computational Linguistics. +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, pages 1631-1642. +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. +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. +Jianheng Tang, Tiancheng Zhao, Chenyan Xiong, Xiaodan Liang, Eric Xing, and Zhiting Hu. 2019. Target-guided open-domain conversation. In Proceedings + +of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5624-5634. +Ruud Van der Helm. 2006. Towards a clarification of probability, possibility and plausibility: how semantics could help futures practice to improve. Foresight. +Changhan Wang, Kyunghyun Cho, and Jiatao Gu. 2020. Neural machine translation with byte-level subwords. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 9154-9160. +Su Wang, Greg Durrett, and Katrin Erk. 2018. Modeling semantic plausibility by injecting world knowledge. 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 303-308, New Orleans, Louisiana. Association for Computational Linguistics. +Jason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V. Le. 2021. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funowicz, 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. +Lili Yao, Yaoyuan Zhang, Yansong Feng, Dongyan Zhao, and Rui Yan. 2017. Towards implicit content-introducing for generative short-text conversation systems. In Proceedings of the 2017 conference on empirical methods in natural language processing, pages 2190-2199. +Qinyuan Ye, Bill Yuchen Lin, and Xiang Ren. 2021. Crossfit: A few-shot learning challenge for cross-task generalization in nlp. arXiv preprint arXiv:2104.08835. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. 2019. Hellaswag: Can a machine really finish your sentence? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4791-4800. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. Advances in Neural Information Processing Systems, 28:649-657. + +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. +Ruiqi Zhong, Kristy Lee, Zheng Zhang, and Dan Klein. 2021. Adapting language models for zero-shot learning by meta-tuning on dataset and prompt collections. arXiv preprint arXiv:2109.01652. +Kun Zhou, Kai Zhang, Yu Wu, Shujie Liu, and Jing-song Yu. 2019. Unsupervised context rewriting for open domain conversation. 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 1834-1844. + +# A GPT-2 Results + +Table 6 shows the results for zero-shot multiple choice using GPT-2. + +# B Templates + +Table 7 shows an example of each template used for each dataset. + +Multiple Choice Accuracy on GPT-2 + +
Params.125M350M760M1.6B
UncLMAvgPMIDCUncLMAvgPMIDCUncLMAvgPMIDCCC
COPA0.5640.6100.6320.6280.5580.6700.6600.7000.5560.6980.6760.6940.560
SC0.4950.6000.6150.6700.4890.6300.6670.7160.5030.6610.6880.7340.512
HS0.2710.2860.2950.2910.2980.3220.3760.3280.3090.3500.4320.3510.331
R-M0.2220.3610.4060.4090.2130.3870.4200.4240.2140.3930.4390.4390.223
R-H0.2090.2750.3100.3440.2150.3040.3260.3630.2150.3180.3450.3830.219
ARC-E0.3130.4290.3780.3930.3270.4940.4340.4240.3340.5270.4670.4700.334
ARC-C0.1980.2010.2350.2820.1970.2280.2540.2860.2210.2310.2660.3160.211
OBQA0.110.1640.2720.3240.1080.1860.3020.3860.1080.1940.2960.4320.114
CQA0.1700.2550.3070.3640.1650.3090.3520.4180.1700.3330.3680.4450.171
BQ0.6220.5880.5880.5110.6220.6080.6080.4970.6220.5800.5800.4670.622
RTE0.5270.5160.5160.4980.4730.5310.5310.5490.4730.5310.5310.5420.473
CB0.0890.4820.4820.5000.0890.5000.5000.5000.0890.4820.4820.5000.089
SST-20.4990.6360.6360.6710.4990.8020.8020.8620.4990.7700.7700.8560.499
SST-50.1810.2740.2440.3000.1760.1850.2720.3930.1760.2030.2670.2200.176
AGN0.2500.5740.5740.6300.2500.6430.6430.6440.2500.6070.6070.6410.250
TREC0.2260.2300.1440.3640.2260.2880.1220.2160.2260.2280.2260.4400.226
+ +Table 6: Comparison of scoring algorithms when using GPT-2 for zero-shot inference on multiple choice questions. + +
TypeDatasetTemplate
ContinuationCOPA[The man broke his toe]P [because]DP [he got a hole in his sock.]UH
[I tipped the bottle]P [so]DP [the liquid in the bottle froze.]UH
StoryCloze[Jennifer has a big exam tomorrow. She got so stressed, she pulled an all-nighter. She went into class the next day, weary as can be. Her teacher stated that the test is postponed for next week.]P [The story continues:]DP [Jennifer felt bittersweet about it.]UH
HellaSwag[A female chef in white uniform shows a stack of baking pans in a large kitchen presenting them. the pans]P [contain egg yolks and baking soda.]UH
QARACE[There is not enough oil in the world now. As time goes by, it becomes less and less, so what are we going to do when it runs out [...]P question: [According to the passage, which of the following statements is true]P?]DP answer: [There is more petroleum than we can use now.]UH
ARC[What carries oxygen throughout the body?]P [the answer is:]DP [red blood cells.]UH
OBQA[Which of these would let the most heat travel through?]P [the answer is:]DP [a steel spoon in a cafeteria.]UH
CQA[Where can I stand on a river to see water falling without getting wet?]P [the answer is:]DP [bridge.]UH
Boolean QABoolQtitle: [The Sharks have advanced to the Stanley Cup finals once, losing to the Pittsburgh Penguins in 2016 [...]P question: [Have the San Jose Sharks won a Stanley Cup?]P [answer:]DP [No.]UH
EntailmentRTE[Time Warner is the world's largest media and Internet company.]P question: [Time Warner is the world's largest company.]P [true or false? answer:]DP [true.]UH
CBquestion: Given that [What fun to hear Artemis laugh. She's such a serious child.]P Is [I didn't know she had a sense of humor.]P true, false, or neither? [the answer is:]DP [true.]UH
Text ClassificationSST-2“[Illuminating if overly talky documentary]P” [The quote] has a tone that is]DP [positive.]UH
SST-5“[Illuminating if overly talky documentary]P” [The quote] has a tone that is]DP [neutral.]UH
AG's Newstitle: [Economic growth in Japan slows down as the country experiences a drop in domestic and corporate [...]P summary: [Expansion slows in Japan]P [topic:]DP [Sports.]UH
TREC[Who developed the vaccination against polio?]P [The answer to this question will be]DP [a person.]UH
+ +Table 7: The templates used for each task, along with an example instance (with a single random candidate answer). Original questions (premises) are colored blue, and original answers (hypotheses) are colored red. Long premises are abbreviated with “[...]”. The full premises, conditional hypotheses and domain premises are marked in $[\cdot]_{\mathrm{P}}$ , $[\cdot]_{\mathrm{UH}}$ , and $[\cdot]_{\mathrm{DP}}$ respectively. For a complete description of our templating methodology, please see our code at https://github.com/peterwestuw/surface-form-competition \ No newline at end of file diff --git a/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/images.zip b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1201d0e4f0671c1f41d9f20b1a4648e2322cdf93 --- /dev/null +++ b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e79e5b0ce42b58f9c9742a7b00bbae1142007bb2711e516c9c3f9d28b88fe383 +size 914556 diff --git a/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/layout.json b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..58a06df3ddb28c0319bf19ceea63c987c4f97013 --- /dev/null +++ b/surfaceformcompetitionwhythehighestprobabilityanswerisntalwaysright/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ced8882a4767606444b01b84f66b5266114512cbeec2aa118a3c6decd101642c +size 459036 diff --git a/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_content_list.json b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c84a936812f34231a5470ed2952d62248d92607a --- /dev/null +++ b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c15a1dae23e97e2619590b477fd29a7cdc95df6ed6b99cc302009c50b7c0434 +size 83877 diff --git a/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_model.json b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2cba3d67948e475630304cf60c1a7574e8711049 --- /dev/null +++ b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92cde5a7dd66d4217805539c7e0e578fe46606401cf19484e6427ad68af4fda3 +size 100805 diff --git a/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_origin.pdf b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4545f2ef3412ffba05e81d78475e036c5c49e6f8 --- /dev/null +++ b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/9883e866-c9c7-4a6a-90d1-5d13704d1cc2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6333a232c3732ad839d89041d955f27eb8b54190318b2328ffdf7b1d83b56fe +size 833659 diff --git a/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/full.md b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..57cb029639c2cafc2f38bf65c48bece5e1004b11 --- /dev/null +++ b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/full.md @@ -0,0 +1,357 @@ +# Synchronous Dual Network with Cross-Type Attention for Joint Entity and Relation Extraction + +Hui Wu $^{12}$ and Xiaodong Shi $^{123*}$ + +$^{1}$ Department of Artificial Intelligence, School of Informatics, Xiamen University, China +$^{2}$ National Institute for Data Science in Health and Medicine, Xiamen University, China +3Key Laboratory of Digital Protection and Intelligent Processing of Intangible Cultural Heritage of Fujian and Taiwan (Xiamen University), Ministry of Culture and Tourism, China + +huistudent@stu.xmu.edu.cn, mandel@xmu.edu.cn + +# Abstract + +Joint entity and relation extraction is challenging due to the complex interaction of interaction between named entity recognition and relation extraction. Although most existing works tend to jointly train these two tasks through a shared network, they fail to fully utilize the interdependence between entity types and relation types. In this paper, we design a novel synchronous dual network (SDN) with cross-type attention via separately and interactively considering the entity types and relation types. On the one hand, SDN adopts two isomorphic bi-directional type-attention LSTM to encode the entity type enhanced representations and the relation type enhanced representations, respectively. On the other hand, SDN explicitly models the interdependence between entity types and relation types via cross-type attention mechanism. In addition, we also propose a new multi-task learning strategy via modeling the interaction of two types of information. Experiments on NYT and WebNLG datasets verify the effectiveness of the proposed model, achieving state-of-the-art performance. + +# 1 Introduction + +Joint entity and relation extraction is a fundamental and important task in information extraction, providing necessary information for knowledge base construction (Mesquita et al., 2019), question answering (Yu et al., 2017), and dialogue systems (Xu et al., 2019), etc. This task can be decomposed into two subtasks: named entity recognition (NER) and relation extraction (RE), aiming respectively to detect text spans with specific types (entities) and semantic relations among those text spans (relations) from unstructured texts. + +Early studies employ pipeline models (Zelenko et al., 2002; Zhou et al., 2005; Chan and Roth, 2011), which first extract all entities of the sentence + +![](images/0693162c67d2aaf8cf408e9b9b1fc4b51442ba34dba7581a277d6df3e137d67d.jpg) +Figure 1: An example of joint entity and relation extraction. The italics with underline represent entities. The red and blue represent entity types and relation types, respectively. + +by an entity model, and then these extracted entities are used as the inputs of a relation model to identify semantic relations between entity pairs. However, pipeline models disregard the correlation between NER and RE (Li and Ji, 2014). + +In recent years, joint learning models have gained increasing attention. Among them, multitask learning methods (Miwa and Bansal, 2016; Katiyar and Cardie, 2017; Fu et al., 2019; Liu et al., 2020) are popular and they utilize a shared network to learn common features, but making independent predictions for the two tasks. Later, Sun et al. (2020) propose a new multi-task learning method to dynamically learn the interactions between the two tasks. Lin et al. (2020) propose a joint neural framework OneIE to study the interaction of different feature categories by a set of global feature templates. Other methods such as novel tagging (Zheng et al., 2017; Wei et al., 2020; Wang et al., 2020) and generative models (Zeng et al., 2018, 2019; Nayak and Tou Ng, 2020; Ye et al., 2021) adopt a unified model to directly extract relational triplets. Although these methods show effectiveness for joint entity and relation extraction, they only apply a shared network or a unified model to capture the connection between NER and RE without taking into account the interdependence of entity types and relation types. + +Intuitively, the relation types of relational triplets are not only relevant to the textual context and entities, but also to entity types (Peng et al., 2020). + +Conversely, the entity types of subject and object entities are also constrained by relation types in the triplets. For example, the instance in Figure 1 contains three entities: "Jackie R. Brown" (PER), "Washington" (LOC), and "United States of America" (LOC). The relation type of ("Jackie R. Brown", "Washington") and ("Jackie R. Brown", "United States of America") is Birth_Place, while the relation type of ("Washington", "United States of America") is Capital_of. When the subject entity type is PER and the object entity type is LOC, the relation type between them may be Birth_Place, but never Capital_of. Conversely, when the relation type is Capital_of, the corresponding entity type does not include PER. In addition, although Sun et al. (2019) adopt graph convolutional network to handle the joint type inference problem, they fail to discuss the fine-grained correlation between entity types and relation types. + +In this paper, we propose a Synchronous Dual Network (SDN) with cross-type attention to separately and interactively capture the vector representations related to entity types and relation types. First, SDN adopts two isomorphic bi-directional type-attention LSTM to learn two different feature representations, where one is the entity type enhanced representations and the other is the relation type enhanced representations. Then the entity type information and the relation type information are introduced into the relation type enhanced representations and the entity type enhanced representations respectively to explicitly model the interaction between entity types and relation types via cross-type attention mechanism. These type-related representations are concatenated together for NER and RE via a multi-task learning strategy. The above type-attention LSTM is a general structure to select the preferred type distribution. The main idea is to inject all possible entity types simultaneously via multiple type-related cells based on the standard LSTM. In this way, our model obtains the preferred type information via training auxiliary tasks. + +To summarize, the main contributions of this work are as follows1: + +(1) We design a general type-attention LSTM structure to inject all possible type information, which can capture the preferred type features via training the corresponding auxiliary task. +(2) We propose a novel synchronous dual net + +work with cross-type attention, which adopts crosstype attention mechanism to explicitly model the interdependence between entity types and relation types, to capture the vector representations related to entity types and relation types. + +(3) Experiments on two public datasets verify the effectiveness of the multi-task learning strategy via fusing the interaction of two types of information. + +# 2 Related Work + +Multi-Task Learning Model. Some multi-task learning models like (Miwa and Bansal, 2016; Katiyar and Cardie, 2017) learn the shared features through parameter sharing and then use them for the two subtasks of entity recognition and relation extraction. Based on this, Sun et al. (2018) enhance the interaction between the two subtasks by optimizing a global loss function. Sun et al. (2019) apply graph convolutional network to handle the interaction in type inference. These approaches essentially belong to a pipeline decoder: first extract entities and then identify the relation of the predicted entities. Later, Fu et al. (2019), Sun et al. (2020) and Liu et al. (2020) do joint learning via a shared network and simultaneously make independent predictions. Zeng et al. (2020) propose CopyMTL, a multi-task learning framework to enhance the capability of handling with multi-token entities. However, it is based on the strong assumption that the shared network is sufficient to capture the correlations between the tasks. + +Tagging Model. Zheng et al. (2017) firstly convert the joint extraction task to a sequence labeling problem and propose a unified tagging scheme. Later Wei et al. (2020) and Wang et al. (2020) propose different tagging schemes. Yuan et al. (2020) propose a relation-attentive sequence labeling framework. Yu et al. (2020) adopt a novel decomposition strategy, which first recognizes head entities and then extracts corresponding tail entities and relations. + +Generative Model. Zeng et al. (2018) firstly propose a sequence-to-sequence model with copy mechanism to generate relational triplets but fail to generate multi-word entities. Subsequently, Zeng et al. (2019), Nayak and Tou Ng (2020) and Sui et al. (2020) adopt different encoder-decoder architectures to generate relational triplets. Ye et al. (2021) propose contrastive triple extraction with a generative transformer. + +![](images/770296742e882f581be21f4900d5b9e379631c2712dd4637f75b244104fb7999.jpg) +(a) Type-Attention LSTM unit +(b) Synchronous Dual Network with Cross-Type Attention +Figure 2: Overall structures. The red in (a) represents the calculation of type-attention mechanism and $TC_{m}$ represents the $m$ -th type-related cell. $ETC_{p}$ and $RTC_{q}$ in (b) represent the $p$ -th entity type cell and $q$ -th relation type cell, respectively. $\oplus$ denotes concatenation operation. + +Compared with these works, we propose a new multi-task learning strategy to explicitly model the interdependence between entity types and relation types within one relation to synchronize their information and make them mutually beneficial. + +# 3 Type-Attention LSTM + +In this section, we will introduce the general framework of Type Attention LSTM (TA-LSTM). As shown in Figure 2 (a), each TA-LSTM unit is composed of a LSTM unit and a type-attention unit. For each token $w_{t}$ , the LSTM unit is used to obtain the contextual representation $\mathbf{h}_t^c$ , while the type-attention unit uses the scaled dot-product attention (Vaswani et al., 2017) to obtain the type representation $\mathbf{h}_t^l$ by integrating $m$ type-related cells for controlling type information flow. + +We adopt the standard LSTM (Graves and Schmidhuber, 2005) to encode the contextual representation for each token. At each time step $t(t \in [1, \dots, n])$ , the current hidden state $\mathbf{h}_t^c$ based on a memory cell $\mathbf{c}_t$ is calculated as follows: + +$$ +\left[ \begin{array}{c} \mathbf {i} _ {t} \\ \mathbf {o} _ {t} \\ \mathbf {f} _ {t} \\ \widetilde {\mathbf {c}} _ {t} \end{array} \right] = \left[ \begin{array}{c} \sigma \\ \sigma \\ \sigma \\ \tanh \end{array} \right] (\mathbf {W} [ \mathbf {h} _ {t - 1}; \mathbf {x} _ {t} ] + \mathbf {b}) \tag {1} +$$ + +$$ +\mathbf {c} _ {t} = \mathbf {i} _ {t} \odot \widetilde {\mathbf {c}} _ {t} + (\mathbf {1} - \mathbf {i} _ {t}) \odot \mathbf {c} _ {t - 1} +$$ + +$$ +\mathbf {h} _ {t} ^ {c} = \mathbf {o} _ {t} \odot \tanh (\mathbf {c} _ {t}), +$$ + +where $[\mathbf{W};\mathbf{b}]$ are trainable parameters. $\mathbf{x}_t\in \mathbb{R}^{d_w}$ is the word embedding of each token $w_{t}$ . $\sigma$ represents the sigmoid activation function. $\mathbf{i}_t$ , $\mathbf{o}_t$ , and $\mathbf{f}_t$ represent the input gate, output gate, and forget gate, respectively. The hidden state $\mathbf{h}_t^c\in \mathbb{R}^{d_e}$ + +represents the vector representation with context information. + +Type-Attention Mechanism. Given $\mathbf{x}_t$ and $\mathbf{h}_{t - 1}$ , the key-value pair of the $k$ -th $(k \in [1, \dots, m])$ type-related cell is computed as: + +$$ +\left[ \begin{array}{l} \mathbf {k} _ {k} ^ {(t)} \\ \mathbf {v} _ {k} ^ {(t)} \end{array} \right] = \left[ \begin{array}{l} \sigma \\ \sigma \end{array} \right] \left(\mathbf {W} _ {k} [ \mathbf {h} _ {t - 1}; \mathbf {x} _ {t} ] + \mathbf {b} _ {k}\right), \tag {2} +$$ + +where $[\mathbf{W}_k;\mathbf{b}_k]$ represent the trainable parameters specific to the $k$ -th type-related cell. $\sigma$ represents the sigmoid activation function. $\mathbf{k}_k^{(t)}\in \mathbb{R}^{d_e}$ and $\mathbf{v}_k^{(t)}\in \mathbb{R}^{d_e}$ represent the key and value of the $k$ -th type-related cell, respectively. + +The above operations are repeated for $m$ type-related cells. At the time step $t$ , we finally acquire a set of key-value pairs $\mathbf{K}^{(t)} = [\mathbf{k}_1^{(t)}, \ldots, \mathbf{k}_m^{(t)}]$ and $\mathbf{V}^{(t)} = [\mathbf{v}_1^{(t)}, \ldots, \mathbf{v}_m^{(t)}]$ . + +We regard the contextual representation $\mathbf{h}_t^c$ as the query. The scaled dot-product attention first computes the dot products of the query with all corresponding keys, divide each by $\sqrt{d_e}$ , and apply a softmax function to obtain the weight $\alpha^{(t)}$ on the values. Then the type representation $\mathbf{h}_t^l$ is computed as a weighted sum of the values: + +$$ +\mathbf {h} _ {t} ^ {l} = \text {a t t e n t i o n} \left(\mathbf {h} _ {t} ^ {c}, \mathbf {K} ^ {(t)}, \mathbf {V} ^ {(t)}\right) = \boldsymbol {\alpha} ^ {(t)} \mathbf {V} ^ {(t)} +$$ + +$$ +\boldsymbol {\alpha} ^ {(t)} = \operatorname {s o f t m a x} \left(\frac {\mathbf {h} _ {t} ^ {c} \mathbf {K} ^ {(t) ^ {\top}}}{\sqrt {d _ {e}}}\right) \tag {3} +$$ + +Finally, the hidden state $\mathbf{h}_t\in \mathbb{R}^{d_e}$ of each TALSTM unit is computed as: + +$$ +\mathbf {h} _ {t} = \mathbf {h} _ {t} ^ {c} + \mathbf {h} _ {t} ^ {l} \tag {4} +$$ + +# 4 Synchronous Dual Network with Cross-Type Attention + +Given a sentence $\mathbf{s} = [w_1, \ldots, w_n]$ of $n$ words, joint entity and relation extraction task aims to identify a collection of relation triplets $\mathcal{T} = \{(\mathbf{e}_i, r, \mathbf{e}_j) | \mathbf{e}_i, \mathbf{e}_j \in \mathcal{E}, r \in \mathcal{R}\}$ , where $\mathbf{e}_i, \mathbf{e}_j$ , and $r$ represent the subject entity, the object entity, and their semantic relation, respectively. Note that the subject and object entities belong to the set of entities $\mathcal{E} = \{\mathbf{e}_i\}_{i=1}^P$ existing in the sentence and the relation is selected from a pre-defined set $\mathcal{R} = \{\mathcal{R}_1, \ldots, \mathcal{R}_M\}$ with $M$ valid relation types. + +In this section, we will describe how to build a synchronous dual network on top of the proposed TA-LSTM and how to interact between entity types and relation types via cross-type attention mechanism for joint entity and relation extraction. As shown in Figure 2 (b), synchronous dual network adopts two bi-directional TA-LSTM to encode the vector representations with corresponding type information from the perspective of entity types and relation types by synchronous dual learning, respectively. Then synchronous dual learning adopts the cross-type attention mechanism to model the interaction between entity types and relation types through introducing entity type information into relation type learning or introducing relation type information into entity type learning. Finally, the vector representations with type information are concatenated together for joint learning. + +# 4.1 Synchronous Dual Learning + +We design entity type learning and relation type learning to obtain the entity type enhanced representation $\mathbf{h}_t^e$ and the relation type enhanced representation $\mathbf{h}_t^r$ , respectively. + +Entity Type Learning. To encode the entity type information, we first define $p$ entity type cells (ETCs) according to the number of entity types. Following Jia and Zhang (2020), we regard each entity type as a label, such as PER, LOC, ORG, and so on. Entity type learning mainly aims at extracting entity type knowledge from a set of labeled training data by training entity type cells. + +From Equation (1) and (2), we can acquire the contextual representation of $\bar{\mathbf{h}}_t^c = [(\overrightarrow{\mathbf{h}}_t^c +\overleftarrow{\mathbf{h}}_t^c) / 2]$ and a set of key-value pairs $\bar{\mathbf{K}}^{(t)} = [\bar{\mathbf{k}}_1^{(t)},\dots ,\bar{\mathbf{k}}_p^{(t)}]$ and $\bar{\mathbf{V}}^{(t)} = [\bar{\mathbf{v}}_1^{(t)},\dots ,\bar{\mathbf{v}}_p^{(t)}]$ related to entity types, where $\bar{\mathbf{k}}_l^{(t)} = [(\overrightarrow{\bar{\mathbf{k}}} _l^{(t)} + \overleftarrow{\bar{\mathbf{k}}} _l^{(t)}) / 2]$ and $\bar{\mathbf{v}}_l^{(t)} = [(\overrightarrow{\bar{\mathbf{v}}} _l^{(t)} + \overleftarrow{\bar{\mathbf{v}}} _l^{(t)}) / 2], (l\in [1,\dots ,p])$ . The contextual + +representation and the type representation related to entity types are computed for the final vector representation $\mathbf{h}_t^e = [\overrightarrow{\mathbf{h}}_t^e\oplus \overleftarrow{\mathbf{h}}_t^e ]$ in Equation (4). Finally the sequence representations associated to entity types are $\mathbf{H}^{(e)} = [\mathbf{h}_1^e,\dots ,\mathbf{h}_n^e ]$ + +To explicitly highlight entity type knowledge, we design entity type prediction as an auxiliary task in Figure 3 (a). Given a sentence $\mathbf{s}$ and its corresponding entity types $\mathbf{T}_e = [T_1^e,\dots,T_n^e]$ ( $T_{t}^{e}\in \mathrm{[O,PER,LOC,ORG,..]and}t\in [1,\ldots ,n])$ ), we regard entity type prediction as the sequence tagging problem by converting the attention scores to the aligned entity type distribution for $w_{t}$ : + +$$ +p \left(T _ {l} ^ {e} \mid w _ {t}\right) = \operatorname {s o f t m a x} \left(\frac {\bar {\mathbf {h}} _ {t} ^ {c} \bar {\mathbf {k}} _ {l} ^ {(t) \top}}{\sqrt {d _ {e}}}\right) \tag {5} +$$ + +And the negative log-likelihood loss is used for training on the sentence s: + +$$ +\mathcal {L} _ {E T} = - \sum_ {t = 1} ^ {n} \log \left(p \left(T _ {t} ^ {e} \mid w _ {t}\right)\right) \tag {6} +$$ + +Relation Type Learning. Similar to entity type learning, $q$ kinds of new relation types are designed to correspond to entity types by considering $M$ valid relation types of the pre-defined set $\mathcal{R}$ and the triplet composition. As shown in Figure 3 (b), these new relation types are composed of relation labels and subject or object labels, namely "R1-S", "R1-O", ..., "RM-S", "RM-O" and "None" ("None" represents the invalid relation type). Obviously, the number of new relation types $q = 2 \times M + 1$ . + +These new relation types are mainly used to learn the distribution of the subject or object type affected by valid relation types. Thus, we design relation-related TA-LSTM as the other model of synchronous dual network to extract new relation type knowledge. + +At the time step $t$ , we can acquire the contextual representation of $\hat{\mathbf{h}}_t^c = [(\hat{\mathbf{h}}_t^c + \hat{\mathbf{h}}_t^c) / 2]$ and a set of key-value pairs $\hat{\mathbf{K}}^{(t)} = [\hat{\mathbf{k}}_1^{(t)}, \dots, \hat{\mathbf{k}}_q^{(t)}]$ and $\hat{\mathbf{V}}^{(t)} = [\hat{\mathbf{v}}_1^{(t)}, \dots, \hat{\mathbf{v}}_q^{(t)}]$ related to new relation types, where $\hat{\mathbf{k}}_l^{(t)} = [(\hat{\mathbf{k}}_l^{(t)} + \hat{\mathbf{k}}_l^{(t)}) / 2]$ and $\hat{\mathbf{v}}_l^{(t)} = [(\hat{\mathbf{v}}_l^{(t)} + \hat{\mathbf{v}}_l^{(t)}) / 2], (l \in [1, \dots, q])$ in Equation (1-2). Finally, the sequence representations associated to new relation types are $\mathbf{H}^{(r)} = [\mathbf{h}_1^r, \dots, \mathbf{h}_n^r]$ , where the vector representation $\mathbf{h}_t^r = [\hat{\mathbf{h}}_t^r \oplus \hat{\mathbf{h}}_t^r]$ is computed by Equation (4). + +Different from entity type prediction, the second auxiliary task relation type prediction is a multi-label classification problem because the same entity + +![](images/7ed5f480e5bb3cac2862ae8981c18d0d2bddf2dadc05a1f6cb12c8339663deeb.jpg) +(b) relation type prediction +Figure 3: Entity type prediction & relation type prediction. The whole sentence in (a) and (b) comes from Figure 1. We omit some words for simplicity. Entity type prediction and relation type prediction are regarded as different sequence tagging tasks to learn entity types and relation types, respectively. "R1" and "Rn" represent relation labels; "R1-S" and "R1-O" represent the labels of the subject and object entities in the relation triplet (S, R1, O), respectively. + +may exist in multiple relational triplets (namely overlapping triplets). We adopt multiple identical binary classifiers to detect different relation types by assigning each token a binary tag $(0/1)$ that indicates whether the current token corresponds to a new relation type. So the aligned relation type distribution for $w_{t}$ is computed as: + +$$ +p \left(T _ {l} ^ {r} \mid w _ {t}\right) = \operatorname {s i g m o i d} \left(\frac {\hat {\mathbf {h}} _ {t} ^ {c} \hat {\mathbf {k}} _ {l} ^ {(t) \top}}{\sqrt {d _ {e}}}\right) \tag {7} +$$ + +where $T_{l}^{r}$ belongs to $q$ new relation type labels, such as $\mathbf{R}_1$ -S, $\mathbf{R}_1$ -O and so on. + +The binary cross-entropy loss is used for training on the sentence s: + +$$ +\begin{array}{l} \mathcal {L} _ {R T} = - \sum_ {t = 1} ^ {n} \sum_ {r = 1} ^ {q} \left\{\log \left(p \left(T _ {t} ^ {r} \mid w _ {t}\right)\right) ^ {\mathbb {I} \left\{\hat {T} _ {t} ^ {r} = 1 \right\}} \right. \tag {8} \\ + \log (1 - p (T _ {t} ^ {r} | w _ {t})) ^ {\mathbb {I} \{\hat {T} _ {t} ^ {r} = 0 \}} \} \\ \end{array} +$$ + +where $\hat{T}_t^r$ represents the gold relation type label. + +# 4.2 Cross-Type Attention Mechanism + +Since entity types and relation types are interdependent in the joint entity and relation extraction task, it is important to synchronize their information and make them mutually beneficial. So we propose a novel cross-type attention mechanism to model the interaction between entity types and relation types. + +Given the entity type enhanced representation $\mathbf{h}_t^e$ and a set of key-value pairs $\hat{\mathbf{K}}^{(t)}$ and $\hat{\mathbf{V}}^{(t)}$ related to new relation types, the relation-entity representation $\mathbf{c}_t^e$ is computed by Equation (3) via introducing relation type information into entity type learning. + +Similarly, given $\mathbf{h}_t^r$ and the entity type key-value pairs $\tilde{\mathbf{K}}^{(t)}$ and $\tilde{\mathbf{V}}^{(t)}$ , we can obtain the entity-relation representation $\mathbf{c}_t^r$ . Finally, we obtain the new entity type enhanced representation $\tilde{\mathbf{h}}_t^e$ and new relation type enhanced representation $\tilde{\mathbf{h}}_t^r$ to model the interdependency between entity types and relation types by adding $\mathbf{c}_t^e$ and $\mathbf{c}_t^r$ into $\mathbf{h}_t^e$ and $\mathbf{h}_t^r$ , respectively. + +# 4.3 Joint Entity and Relation Extraction + +We first concatenate the vector representations $\tilde{\mathbf{h}}_t^e$ and $\tilde{\mathbf{h}}_t^r$ to obtain the overall representation $\tilde{\mathbf{h}}_t$ : + +$$ +\tilde {\mathbf {h}} _ {t} = \tilde {\mathbf {h}} _ {t} ^ {e} \oplus \tilde {\mathbf {h}} _ {t} ^ {r} \tag {9} +$$ + +Then the overall sequence representation $\tilde{\mathbf{H}} = [\tilde{\mathbf{h}}_1, \ldots, \tilde{\mathbf{h}}_n]$ is used for NER and RE. + +Named Entity Recognition. NER is a typical sequence labeling task. Here we use the BIESO tagging as the tagging scheme to recognize the entity boundary accurately. Given a sentence $\mathbf{s}$ , the probability distribution $y_{t}$ of a word $w_{t}$ over these five labels is calculated based on the overall representation $\tilde{\mathbf{h}}_t \in \tilde{\mathbf{H}}$ as follows: + +$$ +y _ {t} = \operatorname {s o f t m a x} \left(\mathbf {W} _ {e} \tilde {\mathbf {h}} _ {t} + \mathbf {b} _ {e}\right) \tag {10} +$$ + +where $[\mathbf{W}_e;\mathbf{b}_e]$ are trainable parameters. + +The negative log-likelihood loss is used for training on the sentence s: + +$$ +\mathcal {L} _ {E} = - \sum_ {t = 1} ^ {n} \log \left(y _ {t}\right) \tag {11} +$$ + +Relation Extraction. Following Sun et al. (2020), we classify all relations between pairs of words in the sentence based on the overall representation $\hat{\mathbf{H}}$ . Similar to relation type prediction, the relation extraction task belongs to a multilabel classification problem. We design multiple identical binary classifiers to detect different relations. + +The probability distribution $y_{i,j}^{r^{\prime}}$ of the word pair $(w_{i},w_{j})$ belonging to the relation $r^\prime \in \mathcal{R}$ is computed as follows: + +$$ +\mathbf {m} = \phi \left(\mathbf {W} _ {m} \left(\tilde {\mathbf {h}} _ {i} \oplus \tilde {\mathbf {h}} _ {j}\right) + \mathbf {b} _ {m}\right) \tag {12} +$$ + +$$ +y _ {i, j} ^ {r ^ {\prime}} = \operatorname {s i g m o i d} \left(\mathbf {W} _ {r ^ {\prime}} \mathbf {m} + \mathbf {b} _ {r ^ {\prime}}\right) +$$ + +where $[\mathbf{W}_m;\mathbf{b}_m;\mathbf{W}_{r'};\mathbf{b}_{r'}]$ are trainable parameters. $\phi$ represents the ReLU activation function. + +The binary cross-entropy loss is used for training on the sentence s: + +$$ +\begin{array}{l} \mathcal {L} _ {R} = - \sum_ {r ^ {\prime} = 1} ^ {M} \sum_ {i, j = 1} ^ {n} \left\{\log \left(y _ {i, j} ^ {r ^ {\prime}}\right) ^ {\mathbb {I} \left\{y _ {i, j} ^ {r ^ {\prime}} = 1 \right\}} \right. \tag {13} \\ + \log (1 - y _ {i, j} ^ {r ^ {\prime}}) ^ {\mathbb {I} \left\{\hat {y} _ {i, j} ^ {r ^ {\prime}} = 0 \right\}} \\ \end{array} +$$ + +where $\hat{y}_{i,j}^{r'}$ represents the gold relation label. + +# 4.4 Training + +Given a training instance $s$ , the training objective of joint entity and relation extraction is as follows: + +$$ +\mathcal {L} = \lambda^ {t 1} \mathcal {L} _ {E T} + \lambda^ {t 2} \mathcal {L} _ {R T} + \lambda^ {e} \mathcal {L} _ {E} + \lambda^ {r} \mathcal {L} _ {R} + \frac {\lambda}{2} \| \Theta \| ^ {2} \tag {14} +$$ + +where $\lambda^{t1},\lambda^{t2},\lambda^e$ , and $\lambda^r$ represent the different task weights. $\lambda$ is the $L_{2}$ regularization parameters and $\Theta$ represents the parameters set. + +# 4.5 Inference + +Following Fu et al. (2019), we adopts the average prediction method to infer whether the extracted triplet is right. Concretely, we can obtain the entity set $\mathcal{E}$ by named entity recognition. Then, given the subject entity $\mathbf{e}_i = [w_{\xi_i},\dots ,w_{\zeta_i}]$ and the object entity $\mathbf{e}_j = [w_{\xi_j},\dots ,w_{\zeta_j}]$ , the probability $p_r$ that they belong to the $r$ -th relation type can be calculated as follows: + +$$ +p _ {r} = \frac {1}{| \mathbf {e} _ {i} |} \frac {1}{| \mathbf {e} _ {j} |} \sum_ {f = \xi_ {i}} ^ {\zeta_ {i}} \sum_ {s = \xi_ {j}} ^ {\zeta_ {j}} y _ {f, s} ^ {r} \tag {15} +$$ + +where $|\mathbf{e}_i|$ and $|\mathbf{e}_j|$ represent the length of $\mathbf{e}_i$ and $\mathbf{e}_j$ , respectively. The triplet $(\mathbf{e}_i, r, \mathbf{e}_j)$ is extracted only if $p_r > \theta$ , where $\theta$ is a free threshold parameter. + +
ClassNYTWebNLG
TrainDevTestTrainDevTest
#ALL56195500050005019500703
#Entity315
#Relation24246
+ +Table 1: Statistics of datasets. #ALL, #Entity, and #Relation represent the total number of sentences, entity types, and relation types, respectively. + +# 5 Experiments + +In this section, we empirically verify the effectiveness of our proposed SDN on two public datasets. In addition, we also investigate how different components in the model impact the performance of joint entity and relation extraction with different settings. + +# 5.1 Experimental Settings + +Datasets. We conduct experiments to evaluate SDN on two public datasets NYT (Riedel et al., 2010) and WebNLG (Gardent et al., 2017). The NYT dataset is produced by the distant supervision method which automatically aligns Freebase with New York Times news articles. It includes 3 entity types (e.g., "PER", "LOC", and "ORG") and 24 valid relation types. The WebNLG dataset is originally created for the natural language generation task. Given a group of triplets, annotators are asked to write a sentence which contains the information of all triplets in this group. We directly use the dataset preprocessed by Zeng et al. (2018), which includes 15 entity types and 246 valid relation types. The statistics of NYT and WebNLG are described in Table 1. + +Hyperparameters. We initialize the word embeddings with Glove 300-dimension vectors (Pennington et al., 2014). The dimensions of hidden states for TA-LSTM, entity extraction module, and relation extraction module are set to 100, 200, 400, respectively. During training, we use the Adam optimizer with the initial learning rates of $1e^{-3}$ on NYT and $5e^{-4}$ on WebNLG, a maximum epoch number of 100 and the batch size of 30. To avoid overfitting, we apply Dropout with a rate of 0.3. In $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}} + \mathrm{BERT}$ and $\mathrm{SDN}_{\mathrm{TA-LSTM}} + \mathrm{BERT}$ , we use bert-base-cased2 to initialize BERT (Devlin et al., 2018) and the initial learning rates is $1e^{-5}$ for fine-tuning BERT. + +
MethodsNYTWebNLG
PRF1PRF1
Multi-taskMRT (Sun et al., 2018)65.240.650.0---
RIN (Sun et al., 2020)83.985.584.777.376.877.0
CopyMTL-One (Zeng et al., 2020)72.769.270.957.860.158.9
CopyMTL-Mul (Zeng et al., 2020)75.768.772.058.054.956.4
TaggingPA-LSTM-CRF (Dai et al., 2019)49.459.153.8---
RSAN (Yuan et al., 2020)85.783.684.680.583.882.1
TPLinker(LSTM) (Wang et al., 2020)86.082.084.091.981.686.4
TPLinker(BERT)† (Wang et al., 2020)91.492.692.088.984.586.7
GenerativeOneDecoder (Zeng et al., 2018)59.453.156.032.228.930.5
MultiDecoder (Zeng et al., 2018)61.056.658.737.736.437.1
PNDec (Nayak and Tou Ng, 2020)89.378.883.8---
CGT(BERT)† (Ye et al., 2021)94.784.289.192.975.683.4
OursSDNLSTM86.581.784.185.182.583.7
SDNTA-LSTM89.884.086.888.285.987.0
SDNCROSS-TA-LSTM90.186.288.190.888.889.8
SDNTA-LSTM + BERT†93.789.191.391.888.890.3
SDNCROSS-TA-LSTM + BERT†94.291.592.892.789.691.1
+ +Table 2: Results of different methods on NYT and WebNLG datasets. The reported results for the above baselines are directly copied from the original published literature. $\dagger$ indicates the method leveraging the pre-trained language model BERT. The bold represents the best results. The underlined represents the best results without BERT. + +All experiments are conducted with an NVIDIA GeForce RTX 2080 Ti. + +Baselines and Evaluation Metrics. We compare our method against three groups of state-of-the-art methods of joint learning: + +i) Multi-task baselines. MRT (Sun et al., 2018) applies a minimum risk training method to highlight connections between an entity model and a relation model. RIN (Sun et al., 2020) uses a recurrent interaction network to dynamically learn. SMHSA (Liu et al., 2020) uses an attention-based joint model to identify the overlapping triplets. CopyMTL-One and CopyMTL-Mul (Zeng et al., 2020) utilize a multi-task framework to extract multi-token entities. +ii) Tagging baselines. PA-LSTM-CRF (Dai et al., 2019) uses a position-attention mechanism to model $n$ tag sequences. RSAN (Yuan et al., 2020) utilizes a relation-attentive sequence labeling framework. TPLinker (Wang et al., 2020) designs a handshaking tagging scheme for joint entity and relation extraction. +iii) Generative baselines. OneDecoder and MultiDecoder (Zeng et al., 2018) utilize a Seq2Seq model to generate relational triplets. PNDec (Nayak and Tou Ng, 2020) uses pointer networks with an encoder-decoder model. CGT (Ye et al., 2021) adopts a framework of contrastive triple extraction with a generative transformer. + +We adopt Precision(P), Recall(R), and standard Micro-F1 $(\mathrm{F}_1)$ to evaluate the performance. A predicted triplet is regarded as correct only if the relation type and the two corresponding entities are all the same as the golden standard annotation3. We report the corresponding results of the test set when the development set achieves the best results. + +# 5.2 Main Results + +As shown in Table 2, $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}}$ is significantly superior to these multi-task baselines (over at least $6.2\%$ P, $0.7\%$ R, $3.4\%$ F $_1$ on NYT and $13.5\%$ P, $12.0\%$ R, $12.8\%$ F $_1$ on WebNLG). It shows that explicitly modeling the interdependence of entity types and relation types related to entities in the NER and RE tasks can obtain more useful representations for joint entity and relation extraction. + +Without considering the pre-training language model BERT, $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}}$ achieves better performances than other tagging baselines and generative baselines (over at least $0.8\%$ P, $2.6\%$ R, $3.5\%$ F1 on NYT and $5.0\%$ R, $3.4\%$ F1 on WebNLG). This indicates that our model can predict as many accurate triples as possible while ensuring a higher precision. + +Recently, pre-trained language models such as + +
MethodsNERRE
F1Δ F1F1Δ F1
Ours94.6-92.8-
-LET93.1-1.591.4-1.4
-LRT93.7-0.991.8-1.0
-LET-LRT91.2-3.488.2-4.6
+ +Table 3: Ablation experiments on the NYT dataset. + +BERT (Devlin et al., 2018) achieve state-of-the-art results on joint entity and relation extraction. To make a fair and direct comparison with our method, we leverage the output of BERT as contextualized word embeddings. $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}} + \mathrm{BERT}$ achieves better results than TPLinker(BERT) (over $2.8\%$ P, $0.8\%$ F $_1$ on NYT and $3.8\%$ P, $5.1\%$ R, $4.4\%$ F $_1$ on WebNLG). $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}} + \mathrm{BERT}$ outperforms CGT(BERT) over $7.3\%$ R, $3.7\%$ F $_1$ on NYT and over $14.0\%$ R, $7.7\%$ F $_1$ on WebNLG, and $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}} + \mathrm{BERT}$ is comparable to CGT(BERT) in Precision ( $94.2\%$ P v.s. $94.7\%$ P on NYT and $92.7\%$ P v.s. $92.9\%$ P on WebNLG). + +Generally speaking, generative triple extraction requires a huge amount of manual annotation or further constraint to improve the precision. But our model focuses on how to extract more relation triples, which indicates the importance of the entity type and relation type information for joint entity and relation extraction. In fact, injecting the effective entity and relation type information via the interaction of entity types and relation types is promising for joint entity and relation extraction. + +To more explicitly illustrate the effectiveness of our method, we make comparisons with some deformed models: (i) $\mathrm{SDN_{LSTM}}$ , which only uses bi-directional LSTM as encoders without any type knowledge and the cross-type interaction; (ii) $\mathrm{SDN_{TA - LSTM}}$ , which uses two bidirectional TA-LSTM to encode different type information and only introduce the knowledge of entity and relation type without considering cross-type interaction; (iii) $\mathrm{SDN_{CROSS-TA-LSTM}}$ , which not only introduces the type knowledge but also models the interaction between entity and relation types; (iv) $\mathrm{SDN_{TA-LSTM}} + \mathrm{BERT}$ , which adds BERT to (ii) $\mathrm{SDN_{TA-LSTM}}$ ; (v) $\mathrm{SDN_{CROSS-TA-LSTM}} + \mathrm{BERT}$ , which adds BERT to (iii) $\mathrm{SDN_{CROSS-TA-LSTM}}$ . $\mathrm{SDN_{TA-LSTM}}$ achieves better results of $2.7\%$ F1 on NYT and $3.3\%$ F1 on WebNLG compared with $\mathrm{SDN_{LSTM}}$ , indicat + +![](images/8f7c73585eba7a2adaef2527b6ece7d213b2f50d1763acb9ad88de27b9de9df4.jpg) +Figure 4: Analysis of the inference threshold $\theta$ + +ing the effectiveness of TA-LSTM for capturing more type informations. $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}}$ outperforms $\mathrm{SDN}_{\mathrm{TA-LSTM}}$ over $1.3\%$ $\mathrm{F_1}$ on NYT and over $2.8\%$ $\mathrm{F_1}$ on WebNLG, which shows that explicitly modeling the interaction between entity and relation types within one relation can further improve performance. In addition, $\mathrm{SDN}_{\mathrm{CROSS-TA-LSTM}} + \mathrm{BERT}$ and is significantly superior to $\mathrm{SDN}_{\mathrm{TA-LSTM}} + \mathrm{BERT}$ (over $1.5\%$ $\mathrm{F_1}$ on NYT and $0.8\%$ $\mathrm{F_1}$ on WebNLG), indicating the effectiveness of cross-type attention mechanism. + +# 5.3 Ablation Experiments + +We conduct ablation experiments of auxiliary tasks on NYT. The results are listed in Table 3. + +When we only ablate $\mathcal{L}_{ET}$ , the results on the two subtasks suffer significant declines $(-1.5\% \mathrm{F}_1$ on NER and $-1.4\% \mathrm{F}_1$ on RE, respectively). When we only ablate $\mathcal{L}_{RT}$ , the results on NER and RE also suffer significant declines (over $-0.9\% \mathrm{F}_1$ on both subtasks). When we both ablate $\mathcal{L}_{ET}$ and $\mathcal{L}_{RT}$ , our model achieves similar results $(-3.4\% \mathrm{F}_1$ on NER and $-4.6\% \mathrm{F}_1$ on RE, respectively). On the one hand, it demonstrates that two auxiliary tasks of entity type prediction and relation type prediction can highlight useful type information as well as decrease the noise. On the other hand, it indicates that our model depends heavily on both auxiliary tasks to capture the right type of knowledge. + +# 5.4 Analysis of Inference Threshold + +We conduct analysis experiments to explore the value of threshold $\theta$ of the inference methods. Figure 4 illustrates how performance varies on different inference threshold $\theta$ of the NYT and WebNLG datasets. It can be seen that the threshold inference method effectively adjusts the performance + +
SentenceGolden ResultResult
“This is rare, and it's messy,” said Gary Chaison, professor of industrial relations at Clark University in Worcester, Mass..(Gary Chaison, /business/person/company, Clark University) (Gary Chaison, /people/person/place_lived, Worcester) (Worcester, /location/location/contains, Clark University)RIN: (Gary Chaison, /business/person/company, Clark University) (Worcester, /location/location/contains, Clark University) SDNTA-LSTM: (Gary Chaison, /business/person/company, Clark University) (Gary Chaison, /people/person/place_lived, Worcester) (Worcester, /location/location/contains, Clark University)
An article yesterday about the Darfur crisis in Sudan misstated a Security Council response to a report to the Council by a United Nations envoy, Ahmedou Ould -Abdallah.(Darfur, /location/administrative_division/country, Sudan) (Sudan, /location/country/administrative_divisions, Darfur) (Sudan, /location/location/contains, Darfur)RIN: (Darfur, /location/administrative_division/country, Sudan) (Sudan, /location/administrative_division/country, Darfur) X (Sudan, /location/location/contains, Darfur) SDNTA-LSTM: (Darfur, /location/administrative_division/country, Sudan) (Sudan, /location/country/administrative_divisions, Darfur) (Sudan, /location/location/contains, Darfur)
+ +Table 4: Examples from the NYT test set. Red, blue, and green represent entities whose types are PER, LOC, and ORG, respectively. $\times$ denotes incorrect relational triplets. + +of SDN with different choices of $\theta$ . With the increase of $\theta$ from 0.1 to 0.6, the $\mathrm{F}_1$ scores on NYT and WebNLG show a consistent trend of first increasing and then decreasing. When the $\theta$ values of NYT and WebNLG are set to 0.4 and 0.3 respectively, the average inference method achieves the best performance on both datasets. Through detailed analysis of NYT and WebNLG, we find that this gap is due to the difference of the entity length. More precisely, the average entity length and max entity length on the NYT test set are 1.4 and 8, respectively. While the average entity length and max entity length on the WebNLG test set are 2.2 and 15, respectively. Longer entities are harder to identify entities and relations in the NER and RE tasks. + +# 5.5 Case Study + +As shown in Table 4, we present two examples from the NYT test set as illustrations. The relation type of “(Gary Chaison (PER), Worcester (LOC))” is “/people/person/place_lived”. RIN only identifies “(Gary Chaison, /business/person/company, Clark University)” and “(Worcester, /location/location/contains, Clark University)”, but fails to identify “(Gary Chaison, /people/person/place_lived, Worcester)”. In addition, RIN does not recognize “(Sudan, /location/country/administrative_divisions, Darfur)” correctly. Because RIN dynamically learns the interaction of the two subtasks without considering any type of information, and some details may be lost to some extent. In contrast, our method correctly extracts all relation triplets, which shows that explicitly modeling the interaction between entity types and relation types can synchronize their in- + +formation and make them mutually beneficial for joint entity and relation extraction. + +# 6 Conclusion + +In this paper, we propose a Synchronous Dual Network (SDN) with cross-type attention for joint entity and relation extraction. Firstly, we use two isomorphic bi-directional type-attention LSTM as encoders to learn the entity type enhanced representations and the relation type enhanced representations from two different perspectives. Then the entity type information (or the relation type information) is introduced into the relation type enhanced representations (or the entity type enhanced representations) to explicitly model the interaction between entity types and relation types via cros-type attention mechanism. In addition, the proposed type-attention LSTM is a general structure to obtain the preferred type distribution. Experiments on two public datasets verify the effectiveness of the proposed model, achieving state-of-the-art performance. + +# Acknowledgements + +We thank the anonymous reviewers for their helpful comments and suggestions. This work is supported the Major Scientific Research Project of the State Language Commission in the 13th Five-Year Plan (Grant nos. WT135-38), the Key Support Project of NSFC-Liaoning Joint Foundation(Grant no. U1908216), and the Project of Technological Innovation 2030 "New Generation Artificial Intelligence" (Grant no. 2020AAA0107904). + +# References + +Yee Seng Chan and Dan Roth. 2011. Exploiting syntactico-semantic structures for relation extraction. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 551-560. +Dai Dai, Xinyan Xiao, Yajuan Lyu, Shan Dou, Qiao-qiao She, and Wang Haifeng. 2019. Joint extraction of entities and overlapping relations using position-attentive sequence labeling. In Proceedings of the 33th AAAI Conference on Artificial Intelligence, pages 6300-6308. +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. +Tsu-Jui Fu, Peng-Hsuan Li, and Wei-Yun Ma. 2019. GraphRel: Modeling text as relational graphs for joint entity and relation extraction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1409-1418. +Claire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. 2017. Creating training corpora for NLG micro-planners. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 179-188. +Alex Graves and Jürgen Schmidhuber. 2005. Framewise phoneme classification with bidirectional LSTM and other neural network architectures. Neural networks, 18(5-6):602-610. +Chen Jia and Yue Zhang. 2020. Multi-cell compositional LSTM for NER domain adaptation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5906-5917. +Arzoo Katiyar and Claire Cardie. 2017. Going out on a limb: Joint extraction of entity mentions and relations without dependency trees. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 917-928. +Qi Li and Heng Ji. 2014. Incremental joint extraction of entity mentions and relations. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 402-412. +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. +Jie Liu, Shaowei Chen, Bingquan Wang, Jiaxin Zhang, Na Li, and Tong Xu. 2020. Attention as relation: + +Learning supervised multi-head self-attention for relation extraction. In Proceedings of the 29th International Joint Conference on Artificial Intelligence, pages 3787-3793. +Filipe Mesquita, Matteo Cannaviccio, Jordan Schmidek, Paramita Mirza, and Denilson Barbosa. 2019. KnowledgeNet: A benchmark dataset for knowledge base population. 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 749-758. +Makoto Miwa and Mohit Bansal. 2016. End-to-end relation extraction using LSTMs on sequences and tree structures. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1105-1116. +Tapas Nayak and Hwee Tou Ng. 2020. Effective modeling of encoder-decoder architecture for joint entity and relation extraction. In Proceedings of the 34th AAAI Conference on Artificial Intelligence. +Hao Peng, Tianyu Gao, Xu Han, Yankai Lin, Peng Li, Zhiyuan Liu, Maosong Sun, and Jie Zhou. 2020. Learning from context or names? an empirical study on neural relation extraction. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 3661-3672. +Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. Glove: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, pages 1532-1543. +Sebastian Riedel, Limin Yao, and Andrew McCallum. 2010. Modeling relations and their mentions without labeled text. In ECML PKDD, pages 148-163. +Dianbo Sui, Yubo Chen, Kang Liu, Jun Zhao, Xiangrong Zeng, and Shengping Liu. 2020. Joint entity and relation extraction with set prediction networks. +Changzhi Sun, Yeyun Gong, Yuanbin Wu, Ming Gong, Daxin Jiang, Man Lan, Shiliang Sun, and Nan Duan. 2019. Joint type inference on entities and relations via graph convolutional networks. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1361-1370. +Changzhi Sun, Yuanbin Wu, Man Lan, Shiliang Sun, Wenting Wang, Kuang-Chih Lee, and Kewen Wu. 2018. Extracting entities and relations with joint minimum risk training. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2256-2265. +Kai Sun, Richong Zhang, Samuel Mensah, Yongyi Mao, and Xudong Liu. 2020. Recurrent interaction network for jointly extracting entities and classifying relation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 3722-3732. + +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. +Yucheng Wang, Bowen Yu, Yueyang Zhang, Tingwen Liu, Hongsong Zhu, and Limin Sun. 2020. Tplinker: Single-stage joint extraction of entities and relations through token pair linking. In Proceedings of the 28th International Conference on Computational Linguistics, pages 1572-1582. +Zhepei Wei, Jianlin Su, Yue Wang, Yuan Tian, and Yi Chang. 2020. A novel cascade binary tagging framework for relational triple extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1476-1488. +Lin Xu, Qixian Zhou, Ke Gong, Xiaodan Liang, Jianheng Tang, and Liang Lin. 2019. End-to-end knowledge-routed relational dialogue system for automatic diagnosis. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 7346-7353. +Hongbin Ye, Ningyu Zhang, Shumin Deng, Mosha Chen, Chuanqi Tan, Fei Huang, and Huajun Chen. 2021. Contrastive triple extraction with generative transformer. In Proceedings of the 35th AAAI Conference on Artificial Intelligence. +Bowen Yu, Zhenyu Zhang, Xiaobo Shu, Yubin Wang, Tingwen Liu, Bin Wang, and Sujian Li. 2020. Joint extraction of entities and relations based on a novel decomposition strategy. In Proc. of ECAI. +Mo Yu, Wenpeng Yin, Kazi Saidul Hasan, Cicero dos Santos, Bing Xiang, and Bowen Zhou. 2017. Improved neural relation detection for knowledge base question answering. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 571-581. +Yue Yuan, Xiaofei Zhou, Shirui Pan, Qiannan Zhu, Zeliang Song, and Li Guo. 2020. A relation-specific attention network for joint entity and relation extraction. In Proceedings of the 29th International Joint Conference on Artificial Intelligence, pages 4054-4060. +Dmitry Zelenko, Chinatsu Aone, and Richardella Anthony. 2002. Kernel methods for relation extraction. In Proceedings of the 2002 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 71-78. +Daojian Zeng, Haoran Zhang, and Qianying Liu. 2020. Copymtl: Copy mechanism for joint extraction of entities and relations with multi-task learning. In Proceedings of the 34th AAAI Conference on Artificial Intelligence. + +Xiangrong Zeng, Shizhu He, Daojian Zeng, Kang Liu, Shengping Liu, and Jun Zhao. 2019. Learning the extraction order of multiple relational facts in a sentence with reinforcement 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 367-377. +Xiangrong Zeng, Daojian Zeng, Shizhu He, Kang Liu, and Jun Zhao. 2018. Extracting relational facts by an end-to-end neural model with copy mechanism. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 506-514. +Suncong Zheng, Feng Wang, Hongyun Bao, Yuexing Hao, Peng Zhou, and Bo Xu. 2017. Joint extraction of entities and relations based on a novel tagging scheme. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1227-1236. +GuoDong Zhou, Jian Su, Jie Zhang, and Min Zhang. 2005. Exploring various knowledge in relation extraction. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL'05), pages 427-434, Philadelphia. Association for Computational Linguistics. \ No newline at end of file diff --git a/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/images.zip b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0a41c69a43d8aef1ac20b3a3b412e5b013b562a4 --- /dev/null +++ b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e695e7c7884dbff0cf675acc3982d81877d99797bf1c08b5e696591992295f2 +size 501373 diff --git a/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/layout.json b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e08985b1adf9b890f6df36d10f25d84c9bb1abbf --- /dev/null +++ b/synchronousdualnetworkwithcrosstypeattentionforjointentityandrelationextraction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b3b1fc28dfbf5b2780ece301e8ade2f2054dc564bb84808e8b61785b0f762ff5 +size 491576 diff --git a/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_content_list.json b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c77cf4e804f6b9f320669088c8417c4a2bb682bb --- /dev/null +++ b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:837c3c1beab71881510d265cfc5b562f60487c9d54f36e14682a65e78eded00d +size 81339 diff --git a/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_model.json b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_model.json new file mode 100644 index 0000000000000000000000000000000000000000..69d8116d2f8415debbe231840489efe4a0edc95e --- /dev/null +++ b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4af56b0ca114bdea18d3a0ab7edd509cd54ac6785fa465a4d669172a97b379b6 +size 98112 diff --git a/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_origin.pdf b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bc160ceb533cfa64e9b147d1fc7546d8fc75add5 --- /dev/null +++ b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/217c95d9-194d-419f-a5b9-fae8f40ec241_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ee7196725c953acd6008baea252c3a2f476a8cc11eccf28ef5ea0d5b6baeec1 +size 512889 diff --git a/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/full.md b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/full.md new file mode 100644 index 0000000000000000000000000000000000000000..63226dee780e2eb577924f51f27bbdb07860f11a --- /dev/null +++ b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/full.md @@ -0,0 +1,354 @@ +# Syntactically-Informed Unsupervised Paraphrasing with Non-Parallel Data + +Erguang Yang $^{1*}$ , Mingtong Liu $^{1}$ , Deyi Xiong $^{2*}$ , Yujie Zhang $^{1}$ , Yao Meng $^{3}$ , Changjian Hu $^{3}$ , Jinan Xu $^{1}$ , Yufeng Chen $^{1}$ + +$^{1}$ School of Computer and Information Technology, Beijing Jiaotong University, Beijing, China + +$^{2}$ College of Intelligence and Computing, Tianjin University, Tianjin, China + +$^{3}$ Lenovo Research AI Lab, Beijing, China + +{egyang,mingtongliu,yjzhang,jaxu,chenyf}@bjtu.edu.cn, + +dyxiong@tju.edu.cn,{yaomeng1,hucj1}@lenovo.com + +# Abstract + +Previous works on syntactically controlled paraphrase generation heavily rely on large-scale parallel paraphrase data that are not easily available for many languages and domains. In this paper, we take this research direction to the extreme and investigate whether it is possible to learn syntactically controlled paraphrase generation with non-parallel data. We propose a syntactically-informed unsupervised paraphrasing model based on conditional variational auto-encoder (VAE) which can generate texts in a specified syntactic structure. Particularly, we design a two-stage learning method to effectively train the model using non-parallel data. The conditional VAE is trained to reconstruct the input sentence according to the given input and its syntactic structure. Furthermore, to improve the syntactic controllability and semantic consistency of the pre-trained conditional VAE, we fine-tune it using syntax controlling and cycle reconstruction learning objectives, and employ Gumbel-Softmax to combine these new learning objectives. Experiment results demonstrate that the proposed model trained only on non-parallel data is capable of generating diverse paraphrases with specified structures. Additionally, we further validate the effectiveness of our method for generating syntactically adversarial examples on a sentiment analysis task. Source codes are available at https://github.com/lanse-sir/sup. + +# 1 Introduction + +Paraphrases are texts or passages conveying the same meaning but with different surface realization. Paraphrase generation (PG) is a key technology of automatically generating a restatement for a given text, which has the potential use in many downstream tasks, such as question answering (Dong et al., 2017), machine translation (Zhou et al., 2019) and text summarization (Zhao et al., 2018). + +Recent years have witnessed that learning controllable paraphrase generation (CPG) with specified styles is attracting intense research interests, e.g., satisfying particular syntactic templates (Iyyer et al., 2018) or exemplars (Chen et al., 2019; Kumar et al., 2020). As CPG can produce diverse paraphrases by exposing syntactic control, it can be also employed for adversarial example generation (Iyyer et al., 2018). + +Existing syntactically controlled paraphrase networks (Iyyer et al., 2018) rely on large paraphrase parallel data for training. Unfortunately, paraphrase parallel corpora are not easily available for many languages, and are expensive to build. Conversely, non-parallel data is much easier to find, and many languages with limited parallel data still possess a huge amount of non-parallel data. + +In this paper, we propose a Syntactically-informed Unsupervised Paraphrasing (SUP) framework based on conditional variational auto-encoder (VAE) to generate syntactic paraphrases with specified syntactic skeletons, which does not require any parallel paraphrase data. The basic assumption behind SUP is that, given a sentence, there may exist many valid paraphrases with different syntactic structures. Specifically, as shown in Figure 1, SUP runs in two stages. At stage 1, we train a conditional VAE to reconstruct a given input sentence according to the sentence itself and its syntactic parse tree. The model trained at this stage is endowed with basic ability to generate texts of desired syntax structures (similar to a warmup procedure). At stage 2, to improve the syntactic controllability and semantic consistency of generated sentences, we fine-tune the model trained at stage 1 using carefully-designed objective functions involving syntax controlling and cycle reconstruction. After the conditional VAE model is fine-tuned, given an input sentence and a different syntactic structure, the model can generate a paraphrase according to the given structure. + +We evaluate SUP on both syntactic paraphrase generation and adversarial example generation tasks. Experiments show that SUP outperforms previous unsupervised paraphrasing method SIVAE (Zhang et al., 2019). It is also capable of generating syntactically adversarial examples that have a significant impact on the performance of attacked neural models. We further show that augmenting training data with such examples can improve the robustness of target neural models. + +In summary, the major contributions of this paper are as follows: + +- We propose a syntactically-informed unsupervised paraphrasing model based on conditional VAE framework and use it to generate syntactically adversarial examples. +- To enable the model to generate syntactically-controlled paraphrases, we propose a novel tree encoder to effectively model structure information and a syntax controlling learning objective to further improve syntactic controllability. Meanwhile, we also introduce a cycle reconstruction learning objective to preserve the semantics of the input sentence. +- Experiments show that our model can successfully generate syntactically adversarial examples. By augmenting training data with such examples, we can improve the robustness of target neural models. + +# 2 Related Work + +Paraphrase Generation The task of paraphrase generation has recently received significant attention (Li et al., 2018, 2019; Liu et al., 2020a). Previous works mainly explore supervised paraphrasing methods, which require large corpora of parallel sentences for training. Due to the lack of parallel data, unsupervised paraphrasing has become an emerging research direction (Miao et al., 2018; Liu et al., 2020c). However, these methods mainly rely on lexical changes to generate paraphrases. Compared to these approaches, our work focus primarily on the syntactically controlled paraphrase generation, which is able to generate a paraphrase according to a given syntactic structure. + +Controlled Text Generation Recent works on controlled generation aim at controlling attributes such as sentiment (Hu et al., 2017; John et al., 2019; Dai et al., 2019). These works use a categorical + +feature as a controlling signal. Different from them, we use a more complicated, non-categorical syntactic structure as a controlling signal. To ensure syntactic controllability, we design a tree encoder and syntax controlling loss to encourage the model to generate sentences that conform to given syntax. + +We have also witnessed other works that attempt to control structural aspects of the generation, such as studies using a given syntactic form (Iyyer et al., 2018; Chen et al., 2019; Liu et al., 2020b). Our work is closely related to this category, and to the syntactically-controlled paraphrase networks (SCPN) proposed by Iyyer et al.(2018) in particular. They use the attentional seq2seq framework to build a parse generator and a paraphrase generator. A two-stage generation process is used. In the first stage, they generate full parse trees from syntactic templates, and then produce final generations in the second stage. Both parse and paraphrase generator require parallel data for training. Significantly different from their method, our model based on conditional VAE is an unsupervised method that does not require any parallel data for training. + +Conditional Variational Autoencoder Our work is also related to syntax-infused text generation (Bao et al., 2019; Zhang et al., 2019). Their models use two variational autoencoders to introduce two latent variables which are designed to capture semantic and syntactic information. The variational autoencoder (VAE) network is proposed by Kingma and Welling (2014) for image generation. Bowman et al. (2016) successfully apply VAE in fluent sentence generation from a latent space. The conditional VAE is a modification of VAE to generate diverse images conditioned on certain attributes, e.g. generating different human faces given skin color (Sohn et al., 2015; Yan et al., 2016). Inspired by conditional VAE, we view the syntactic structure as the conditional attribute and adopt conditional VAE to generate syntactic paraphrases. Furthermore, to improve the syntactic controllability and semantic consistency of generated sentences, we use syntax controlling and cycle reconstruction objective functions to fine-tune the model. + +Adversarial Example Generation To generate adversarial examples for NLP models, most previous works rely on injecting noise either at the character level (Ebrahimi et al., 2018; Gao et al., 2018) or at the word level by adding and deleting + +![](images/5a0ea5901a1935b1bc9b3d25ba299c682bb8dab3139dd23addf752d3c0d1fec9.jpg) +Stage 1: Train a Conditional VAE by Auto-encoding + +![](images/681c8e0ba509006e6006b23b552134bf4fb470f6db726e223fc7c4c28ef8d4c0.jpg) +Stage 2: Fine-tune the pretrained Conditional VAE +Figure 1: Architecture of the proposed syntactically-informed unsupervised paraphrasing model. **Stage 1:** Training a Conditional VAE model by reconstructing the input sentence given the sentence itself and its syntax structure. Here we simply take $\boldsymbol{x} = \{x_1, x_2\}$ as an example. **Stage 2:** Fine-tuning the model using novel objective functions. $\boldsymbol{x}, \boldsymbol{s}, \boldsymbol{s}'$ (different from $\boldsymbol{s}$ ), and $\boldsymbol{y}$ denote the input sentence, its syntactic structure, other syntactic structure, and output sentence, respectively. $\mathcal{L}_*$ denote the loss terms. + +![](images/33c8ace0b5ef1ef759dd2ffdd81c49ae09d8d1ff34781a41f7fbc9dc9521cafd.jpg) + +![](images/0f4a15dd7f90ba306d7e2e5697377e991535a6882f8834feeea39fea2b1840b3.jpg) +Figure 2: The upper part shows a constituency parse tree. The lower part visualizes the tree encoder that uses top-down (green line) and left-to-right (blue line) directions to encode a syntactic template (top three level). + +words (Liang et al., 2017; Garg and Ramakrishnan, 2020). In this paper, we generate syntactically adversarial examples, which still remains an open challenge, as semantic meaning of these examples should be preserved despite of their substantial structural changes. + +# 3 Approach + +We use the constituency parse tree to provide syntactic information. Given a set of training instances $D = \{(\pmb{x}_i, \pmb{s}_i)\}_{i=1}^{|D|}$ , where $\pmb{s}_i$ is the syntactic parse tree of the sentence $\pmb{x}_i$ , we aim to train a syntactic paraphrasing model which can produce more + +diverse paraphrases given arbitrary syntax. + +However, using a full parse tree (the whole tree without leaf nodes) is too specific and poses the challenge of selecting such a tree for a given input as syntactic structures of two different sentences are not easily compatible to each other. Therefore, we mainly use a general template (the top 3 layers of a parse tree), as shown in Figure 2, as the controlling signal which is beneficial to generate meaningful paraphrases. + +Specifically, we employ the conditional variational autoencoder (VAE) framework which have proven to be able to generate diverse texts conditioned on certain attributes. In this work, we view syntax as the conditional attribute. The training process consists of two stages. In the first stage, we train the model in an auto-encoding manner, while in the second stage, we use new objective functions to fine-tune it, as shown in Figure 1. The two stages will be described in detail below. + +# 3.1 Stage 1: Training a Conditional VAE + +At this stage, we pre-train the conditional VAE model. The model is required to reconstruct the input sentence given the sentence itself and its syntactic template. In doing so, the model acquires the preliminary ability to generate a desired sentence conditioning on given syntactic template, which makes the training in the subsequent stage easier. + +Sentence Encoding Given a sentence $\pmb{x}$ , we first obtain the sentence hidden-state $\pmb{h}_{x} = [\overrightarrow{\pmb{h}}_{|\pmb{x}|};\overleftarrow{\pmb{h}_{1}}]$ by the sentence encoder. For the semantic variable $z_{x}$ , we compute the mean and variance of $q(z_{x}|\pmb{x})$ + +from $h_x$ as: + +$$ +\boldsymbol {\mu} _ {x} = \boldsymbol {W} _ {x} ^ {\mu} \boldsymbol {h} _ {x} + \boldsymbol {b} _ {x} ^ {\mu} +$$ + +$$ +\log \sigma_ {x} ^ {2} = W _ {x} ^ {\sigma} h _ {x} + b _ {x} ^ {\sigma} \tag {1} +$$ + +where $W_{x}^{\mu}, b_{x}^{\mu}, W_{x}^{\sigma}, b_{x}^{\sigma}$ are trainable parameters. + +Syntax Encoding This encoder provides the necessary syntactic guidance for the generation of paraphrases. Formally, let syntactic template $s = \{\mathcal{V},\mathcal{E}\}$ , where $\mathcal{V}$ is the set of nodes, $\mathcal{E}$ the set of edges. + +As shown in Figure 2, we traverse the given syntactic template in a top-down (green line) and left-to-right (blue line) manner to obtain and model parent-child and sibling relationships, respectively. For the top-down (TD) direction, we encode each node in a depth-first manner. Specifically, the representation $h_v$ of each node $v \in \mathcal{V}$ with the hidden-state representation of its parent node $pa(v)$ and its embedding as follows: + +$$ +\boldsymbol {h} _ {v} = G R U (\boldsymbol {e} (v), \boldsymbol {h} _ {p a (v)}) \tag {2} +$$ + +where $e(v)$ is the embedding of the node $v$ . Although we can obtain TD representations of all nodes of the syntactic template, only the TD representations of leaf nodes will be used for left-to-right encoding. For the particular example given in Figure 2, the TD representations of all leaf nodes are $H_{leaf}^{TD} = [h_{CC}^{TD}, h_{NP}^{TD}, h_{VP}^{TD}, h_{Dot}^{TD}]$ . + +For the left-to-right (LR) encoding, the encoder is a forward GRU network. We take the leaf nodes sequence $Leaf_{seq} = \{CC, NP, VP, Dot\}$ as input, and compute the LR representations of all leaf nodes $H_{leaf}^{LR} = [h_{CC}^{LR}, h_{NP}^{LR}, h_{VP}^{LR}, h_{Dot}^{LR}]$ . Particularly, take the NP node as an example: + +$$ +\boldsymbol {h} _ {N P} ^ {L R} = G R U \left(\boldsymbol {h} _ {N P} ^ {T D}, \boldsymbol {h} _ {C C} ^ {L R}\right) \tag {3} +$$ + +Then, we use the last hidden state of the syntactic encoder $h_{Dot}^{LR}$ as the final syntax representation $h_s$ for providing the syntactic signal to the decoder. + +Decoding in the Training Phase We employ the reparameterization trick to obtain semantic variables $\boldsymbol{z}_x = \boldsymbol{\mu}_x + \boldsymbol{\sigma}_x \odot \varepsilon, \varepsilon \in \mathcal{N}(\mathbf{0},\mathbf{I})$ . Then at each time step, we concatenate the syntactic representation $h_s$ with the previous word's embedding as the input to the decoder and concatenate the semantic variable $\boldsymbol{z}_x$ with the hidden-state output by the decoder for predicting the word at next time step, as shown in stage 1 in Figure 1. Note that the initial hidden state of the decoder is set to zero. + +Decoding in the Test Phase Giving the same sentence but with a different syntactic template, the model can generate a syntactically controlled paraphrase. We obtain semantic variable $z_{x}$ by the maximum a posteriori (MAP) inference. In this way, semantic information from the input sentence could be preserved as much as possible. After that, the decoding process is the same as the training phase. + +The Objective Function To train the above model, we optimize the following objective function: + +$$ +\mathcal {L} _ {1} = \mathcal {L} _ {c v a e} + \lambda_ {b o w} \mathcal {L} _ {b o w} \tag {4} +$$ + +where $\mathcal{L}_{cvae}$ and $\mathcal{L}_{bow}$ denote the conditional VAE loss and bag-of-word loss, respectively. $\lambda_{bow}$ is a hyper-parameters for balancing the two losses. + +Conditional VAE Loss: The loss is used to optimize the conditional VAE model by minimizing the reconstruction loss $\mathcal{L}_{rec}$ , and meanwhile minimizing the KL loss $\mathcal{L}_{kl}$ to encourage the posterior $q(z_{x}|\boldsymbol{x})$ to match the prior $p(z_{x})$ : + +$$ +\begin{array}{l} \mathcal {L} _ {c v a e} = - \lambda_ {r e s} \mathcal {L} _ {r e c} + \lambda_ {k l} \mathcal {L} _ {k l} \\ = - \lambda_ {r e s} \log p (\boldsymbol {x} | \boldsymbol {z} _ {x}, \boldsymbol {h} _ {s}) \tag {5} \\ + \lambda_ {k l} K L (q (\boldsymbol {z} _ {x} | \boldsymbol {x}) \| p (\boldsymbol {z} _ {x})) \\ \end{array} +$$ + +where $p(\boldsymbol{z}_x)$ follows standard normal distribution $\mathcal{N}(\mathbf{0},\mathbf{I})$ , $q(\boldsymbol{z}_x|\boldsymbol{x})$ takes the form $\mathcal{N}(\boldsymbol{\mu}_x,\boldsymbol{\sigma}_x^2)$ . Here, $\boldsymbol{\mu}_x$ , $\boldsymbol{\sigma}_x$ are computed by Eq. (1). $\lambda_*$ are balancing hyper-parameters. + +Bag-of-Word Loss: We introduce the Bag-of-word loss to enhance content preservation during paraphrase generation. Specifically, we take $z_{x}$ as input and predicts the Bag-of-Word distribution: + +$$ +\boldsymbol {p} _ {b} = \operatorname {s i g m o i d} \left(\boldsymbol {W} _ {\text {b o w}} \boldsymbol {z} _ {x} + \boldsymbol {b} _ {\text {b o w}}\right) \tag {6} +$$ + +where $W_{bow}$ , $b_{bow}$ are trainable parameters. The bag-of-word loss is computed as follows: + +$$ +\mathcal {L} _ {b o w} = - \sum_ {w \in V} t _ {w} \log \boldsymbol {p} _ {b} (w) \tag {7} +$$ + +where $V$ denotes the word vocabulary, $\pmb{t}$ is the bag-of-word ground-truth distribution of the corresponding sentence. + +# 3.2 Stage 2: Fine-tuning the Conditional VAE Model + +During inference, we will give different syntactic structures for every input sentence to generate paraphrases. To encourage generalization on different + +syntactic structures, we fine-tune the pre-trained conditional VAE in a cycle learning manner. + +Specifically, as shown in stage 2 in Figure 1, given an input sentence $\pmb{x}$ , its syntactic template $s$ , and other syntactic template $s'$ , we feed $\pmb{x}$ and $s'$ into the conditional VAE model to generate sentence $y$ (green line). We compute syntax controlling (blue line) and cycle reconstruction losses (red line), and then fine-tune the model to generate a better sentence that is formed in the syntactic structure of $s'$ and preserves the semantic meaning of $x$ . + +Syntax Controlling Loss First, we build a GRU-based seq2seq neural parser as the evaluator, which is pre-trained on the above mentioned training data $D$ , with $\pmb{x}$ as the input and the linearized syntactic template $\pmb{s}$ as the decoding target. For example, the linearized syntactic template in Figure 2 is (ROOT(S(CC)(NP)(VP)(Dot))). + +Second, we apply the pre-trained evaluator to predict the linearized syntactic structure of the output sentence $y$ , where parameters of the conditional VAE are updated to encourage the target syntactic template $s'$ to be predicted from the output sentence, i.e., minimizing the following term: + +$$ +\mathcal {L} _ {s c} = - \log p _ {\text {e v a l}} \left(s _ {l} ^ {\prime} \mid G S (\boldsymbol {y})\right) \tag {8} +$$ + +where $s_{l}^{\prime}$ is the linearized $s^{\prime}$ . $GS(\pmb{y})$ denotes a "softly" generated sentence based on Gumbel-Softmax distribution (Jang et al., 2016), where the representation of each word is defined as the weighted sum of word embeddings with the prediction probability at the current timestep. Please notice that the parameters of the evaluator are not updated in this step. + +Cycle Reconstruction Loss However, only using the above syntax controlling loss will result in generating a sentence that conforms to the target syntactic structure but drifts away from the original meaning. To address this issue, we borrow the cycle reconstruction loss $\mathcal{L}_{cr}$ from style-transfer research (Hu et al., 2017; Dai et al., 2019) to encourage the generated sentence to preserve the meaning in the input sentence. + +We feed the generated sentence $\pmb{y}$ and the syntactic template $s$ of $\pmb{x}$ to the conditional VAE and update the model to reconstruct original input sen + +tence $x$ by minimizing the following term: + +$$ +\mathcal {L} _ {c p} = - \log p (\boldsymbol {x} | G S (\boldsymbol {y}), s) \tag {9} +$$ + +where $GS(\pmb{y})$ is the same as in Eq. (8). + +The Objective Function The final loss function for fine-tuning is defined as follow: + +$$ +\mathcal {L} _ {2} = \mathcal {L} _ {c v a e} + \lambda_ {s c} \mathcal {L} _ {s c} + \lambda_ {c r} \mathcal {L} _ {c r} \tag {10} +$$ + +In our experiments, we still optimize $\mathcal{L}_{cvae}$ during the fine-tuning stage, which helps to stabilize the training process. $\lambda_{*}$ are balancing hyperparameters. + +# 4 Experiments + +In this section, we will answer the following questions: + +- First, we investigate whether our model can generate syntactically controlled paraphrases. +- Second, we examine whether our model can generate syntactically adversarial examples for sentiment analysis. + +# 4.1 Syntactically-Informed Paraphrase Generation + +Given an input sentence, a syntactically-informed paraphrase is a sentence with the same meaning as the input sentence but in a different syntactic structure defined by a given syntactic structure. + +# 4.1.1 Models for Comparison + +We compared with the following unsupervised paraphrase models: 1) VAE: a vanilla variational autoencoder (Bowman et al., 2016) as a simple baseline; 2) SIVAE: a syntax-infused variational autoencoder (Zhang et al., 2019) that utilizes additional syntax information to improve the quality of sentence generation and paraphrase generation, where syntax information is provided by a linearized parse tree. + +We also compared against the supervised method SCPN (Iyyer et al., 2018) which uses an extended pointer-generator network (See et al., 2017) to encode input sentences and linearized parse trees to generate paraphrases. + +# 4.1.2 Datasets + +Quora. The dataset contains 140k pairs of paraphrase sentences and 260k pairs of non-paraphrase sentences. In the standard dataset split, there are 3k + +
ModelQuoraParaNMT
ESM(↑)i-BLEU(↑)BLEU-ref (↑)BLEU-ori (↓)S-BERT(↑)ESM(↑)i-BLEU(↑)BLEU-ref (↑)BLEU-ori (↓)S-BERT(↑)
Original Sentence56.51.131.11000.84536.93.518.51000.755
VAE57.05.523.459.50.76434.63.310.145.40.643
Using full parse tree
SCPN-F (supervised)94.756.664.325.50.86697.053.856.719.00.866
SIVAE-F81.723.932.629.00.76082.618.221.420.90.708
Stage1: SUP-F87.533.943.732.70.80989.232.833.120.70.747
Using syntactic template
SCPN-T (supervised)90.812.123.7438.850.71171.611.218.447.50.708
SIVAE-T65.63.326.978.70.80239.33.316.487.40.733
Stage1: SUP-T73.97.322.4650.550.73865.94.49.634.30.610
Stage2: + Lcvae73.97.123.2953.730.75363.95.111.039.10.652
Stage2: + Lcvae + Lsc80.77.422.1849.060.72875.94.38.930.40.597
Stage2: + Lcvae + Lsc + Lcr78.07.722.9350.60.75572.95.110.133.00.639
+ +Table 1: Performance of syntactic paraphrase generation. The larger $\uparrow$ (or lower↓), the better. S-BERT indicates Sentence-BERT. ESM denotes the rate of exact syntactic match. -F, -T means using full parse tree and syntactic template as controlling signal, respectively. + +
ModelQuoraParaNMT
original referenceis it possible to lose weight without doing exercise? how can i lose weight naturally without doing exercise?you know anybody who might wan na harm your husband? do you know anyone who would want to hurt your husband?
VAEis it possible to lose weight without doing exercise?who might know you ’re gon na kill anybody?
SCPN-Fhow can i loose weight naturally without doing exercise?do you know anyone who might want to hurt your husband?
SIVAE-Fhow can i lose weight loss without doing exercise?do you know anyone who might gon na harm your husband?
SUP-Fhow can i lose weight just without doing exercise?do you know anyone who might want to harm your husband?
SCPN-Thow do i reduce weight without doing exercise?do you know who might want to hurt your husband?
SIVAE-Thow is it possible lose weight without doing exercise?do you wan who might wan na harm your husband?
SUP-Thow can i lose weight without doing exercise?do you know who might harm your husband?
+ +Table 2: Example paraphrases generated by each model. + +and 30k paraphrase pairs in the held-out validation and test set, respectively. We followed the same unsupervised setting as (Miao et al., 2018; Bao et al., 2019), using non-paraphrase sentences as training instances that do not appear in the validation and test set. For the supervised method SCPN (Iyyer et al., 2018), we used paraphrase sentences for training. + +ParaNMT. For the unsupervised setting, we randomly selected 5 million reference sentences from the ParaNMT-50M dataset to train unsupervised methods. The manually annotated 800 sentence pairs created by Chen et al. (2019) were used as our test set, and 500 for the development set. For the supervised method SCPN (Iyyer et al., 2018), we used their trained model. + +# 4.1.3 Evaluation Metrics + +We employed original sentences and syntactic templates (or full parse trees) obtained from references as input, which is convenient for evaluation. But in the application scenario, we can give any syntactic templates to the trained model. + +For semantic evaluation, we computed BLEU (Papineni et al., 2002) scores against the reference and original sentence, denoted as BLEU-ref and BLEU-ori, respectively. Addition + +ally, we used i-BLEU (Sun and Zhou, 2012) to measure the diversity of expressions. We also used the embedding-based evaluation method Sentence-BERT $^3$ (Reimers and Gurevych, 2019) to evaluate the semantic similarity between the generated sentence and the reference sentence. + +For syntactic evaluation, we evaluated how often generated paraphrases completely conform to the target syntactic templates by computing the rate of exact syntactic match (ESM): a paraphrase $g$ is deemed as an exact syntactic match to reference $r$ only if the top three levels of its parse tree $p_g$ exactly matches those of $p_r$ . The tuning of all hyper-parameter was based on the BLEU-ref score on the validation set. + +# 4.1.4 Implementation Details + +We parsed all sentences in the training set, the reference sentences in the validation and test set using Stanford CoreNLP (Manning et al., 2014). We used the Adam optimizer (Kingma and Ba, 2014) for optimization. For the training of Stage 1 and Stage 2, we set the learning rate to 5e-4 and 1e-4, respectively. The word embedding layer was initialized by the publicly available GloVe 300-dimensional + +embeddings. $^4$ We adopted the tricks of KL annealing and word dropout following (Bowman et al., 2016). We set $\lambda_{res}$ to 5, $\lambda_{bow}$ to 0.5, $\lambda_{sc}$ to 2.5, and $\lambda_{cr}$ to 1. + +We reimplemented VAE and SIVAE, and set the same KL weights for fair comparison. + +# 4.1.5 Results + +As shown in Table 1, results in the first row are computed over original sentences, which show a BLEU-ori socre of 100. We can see that all models achieve strong results when using full parse trees as syntactic control. This is because full parse trees contain more fine-grained syntactic information which guides the model to correctly substitute words with equivalents. With the setting of full parse trees, SUP (stage 1) outperforms the existing unsupervised methods in all metrics; With syntactic templates, we beat them in ESM and i-BLEU metrics. VAE and SIVAE-T tend to copy the input sentence as the output and therefore get low ESM but high Ori-BLEU scores. + +Among our models, the SUP-T obtains an ESM of $73.9\%$ and $65.9\%$ on Quora and ParaNMT dataset, respectively. This shows that it can generate sentences according to the given syntactic templates (compared to row 1). At the stage 2, adding the conditional VAE loss leads to improvements in semantic metrics. Using conditional VAE loss and syntax controlling loss, we observe that while the syntactic accuracy has been greatly improved, the semantic metrics has decreased. Adding all loss terms leads to gains across both the semantic and syntactic metric scores. These results demonstrate the effectiveness of the proposed fine-tuning methods. + +Even without using any parallel data, our model is competitive to the supervised SCPN trained on parallel data in some metrics. Especially, SUPT (stage 2) achieves a higher S-BERT score than SCPN on the Quora dataset, a higher ESM score than SCPN on the ParaNMT Dataset. + +Table 2 shows several paraphrases generated by each model. More generation results are presented in Appendix A. We can observe that SUP-F can produce better results than SIVAE-F in terms of both semantics and syntax. VAE and SIVAE-T tend to copy the source sentences. SUP-T can generate paraphrases syntactically similar to the reference. + +
Model210ESM-H
SCPN-T55.015.030.080.0
SIVAE-T57.330.012.737.3
SUP-T35.030.035.062.6
+ +Table 3: Human evaluation on the Quora dataset (percentages of paraphrases scored 0, 1 and 2). ESM-H denotes the percentage that generations follow given syntactic templates. + +
KL-weightBLEU-refBLEU-oriESMS-BERT
Original31.1310056.50.845
0.122.7153.8970.80.750
0.322.4650.5573.90.738
0.522.3748.6675.70.731
0.722.4347.0777.10.723
1.022.0944.4978.30.707
1.321.8741.9679.90.691
1.521.4139.2980.70.673
+ +Table 4: BLEU-ref, BLEU-ori, ESM, and S-BERT score with varying KL weights on the Quora test set. + +# 4.1.6 Human Evaluation + +We also conducted human evaluation to measure paraphrase quality in a blind fashion. Following previous work (Iyyer et al., 2018; Goyal and Durrett, 2020), Three annotators were asked to evaluate the 100 randomly selected generations from the Quora test set according to a three-point scale scoring system: 0 denotes that the generated sentence is not a paraphrase at all; 1 means that the generated sentence is a paraphrase containing grammatical errors; 2 indicates that the generated sentence is a grammatically good paraphrase. Additionally, we also asked annotators to evaluate syntactic controllability (ESM-H): whether generations follow given syntactic templates. + +Table 3 shows the results of human evaluation which are somewhat consistent with the automatic metrics. We notice that the quality of generations from SIVAE-T is better than that of the SCPN-T model. The reason is that SIVAE-T tends to copy input sentences as outputs. It also means that SIVAE-T cannot generate meaningful paraphrases (only copying inputs) according to given syntactic templates. SUP-T obtains comparable results with the SCPN if we consider paraphrases scored 2 and 1 as meaningful paraphrases. Additionally, most generations from SUP-T follow given target syntax. + +# 4.1.7 Influence of KL-Weight on Results + +We also analyzed the influence of different KLweights on the SUP-T (stage 1) model. We can see in Table 4 that BLEU and ESM are more or less + +
ModelValid(↑)No augmentationWith augmentation
Acc(↑)Failure(↑)Acc(↑)Failure(↓)
SCPN72.284.629.283.321.3
SUP68.084.628.083.325.0
+ +Table 5: Performances of adversarial example generation, which are reported as the mean over three runs. + +contradictory to each other. Usually, a smaller KL weight makes the autoencoder less "variational" but more "deterministic," leading to a lower syntactic match but better content preservation. In this experiment, to trade-off the content preservation and syntactic controllability, we set the KL weight to 0.3. + +# 4.2 Adversarial Example Generation + +We further examined the utility of controlled paraphrase generation for adversarial example generation. Following previous work (Iyyer et al., 2018), we evaluated our syntactically adversarial examples on the Stanford Sentiment Treebank Dataset (SST) (Socher et al., 2013). We generated 10 syntactically different paraphrases for each instance using the top 10 frequent syntactic templates and add them to the SST training set. Since we cannot generate a valid paraphrase for each syntactic template, we filtered generated paraphrases using a threshold (BLEU, 1-3gram) to remove nonsensical outputs. In this experiment, we set the threshold to 0.5. + +# 4.2.1 Evaluation Metrics + +We evaluated this task with the following metrics: + +1. Dev Failure (Failure). We assume a development instance $x$ as a prediction failure if the original prediction is correct, but the prediction for at least one paraphrase is incorrect. Dev Failure is the percentage of instances on the development set, which become prediction failures after paraphrasing. +2. Validity (Valid). To measure the validity of our adversarial examples, we perform manual evaluation on randomly selected 100 adversarial examples. We ask three workers to choose the appropriate label (e.g., positive or negative) for a given sentence, and then compare the worker's judgment to the original sentiment label. +3. Test Accuracy (Acc). It is used to measure the performance of sentiment classification + +models on the test set. + +# 4.2.2 Implementation Details + +We first pre-trained our model on preprocessed 2.1M sentences from the One-Billion-Word Corpus5, and then fine-tuned our model on the SST dataset. For the pre-trained classification models, we used the bidirectional LSTM baseline in (Tai et al., 2015). The word embedding layer was initialized by the publicly available GloVe 300-dimensional embeddings. We used the Adam optimizer (Kingma and Ba, 2014) for optimization, and set the learning rate to 1e-4. + +# 4.2.3 Results + +As shown by Table 5, we obtain a validity score of 68.0 and Dev Failure score of 28.0. By augmenting the training data with paraphrases generated by our model, we obtain a lower Dev Failure score of 25.0. These results suggest that our model could generate legitimate adversarial examples. We improve the robustness of models against syntactic adversaries with little effect on the test accuracy. + +We also observe that SCPN obtains strong results. This is because the model is trained on large-scale parallel data, and generated paraphrases include lexical and syntactic variations. However, these advantages are due to the use of large-scale parallel corpus. Our unsupervised method could be very effective for low-resource languages where no parallel data are available. + +# 4.2.4 Case Study + +Table 6 lists some paraphrases generated by SUP with different syntactic templates. Table 7 shows adversarial examples generated by our model. We find that the generated sentences always conform to the target templates. These generation results show that our model could generate legitimate adversarial examples. We also observe that the generated paraphrases have only syntactic variations, not lexical variations. This is because it is difficult for the model to learn to substitute words with equivalents only using non-parallel data. We leave enabling word-level or phrase-level variations in our model for creating more diverse adversarial examples to our future work. + +# 5 Conclusions + +We have presented an unsupervised syntactically-informed paraphrasing model based on conditional + +
TemplateParaphrase
originalstill, as a visual treat, the film is almost unsurpassed.
(S (S) ( , ) ( CC) ( S))the film is a visual treat, but almost unsurpassed.
(S ( PP) ( , ) ( NP) ( VP))as a visual treat, the film is almost unsurpassed.
(S ( ADVP) ( , ) ( NP) ( VP))still, the film is almost unsurpassed as a film.
originalit proves quite compelling as an intense, brooding character study.
(S ( PP) ( , ) ( NP) ( VP) ( .))as compelling, it proves quite an intense character study.
(S ( NP) ( ADVP) ( VP) ( .))it still proves compelling as an intense character study.
(S ( CC) ( NP) ( VP))but it proves compelling as an intense character study.
(S ( ADVP) ( , ) ( NP) ( VP) ( .))however, it proves quite compelling as an intense.
+ +Table 6: Paraphrases generated by SUP with different templates. + +
TemplateParaphraseP
originalthough only 60 minutes long, the film is packed with information and impressions.✓
(S (NP) (VP))the film is only 60 minutes long and packed with information and impressions.×
(S (S) ( , ) ( CC) ( S ))only 60 minutes long , and the film is packed with information.×
originalthis film seems thirsty for reflection , itself taking on adolescent qualities.✓
(S (NP) (VP))this film seems thirsty for taking on adolescent qualities.×
(S (CC) ( NP) ( VP ))but this film seems thirsty for taking on adolescent qualities.×
+ +Table 7: Adversarial examples generated by our model. $\checkmark$ indicates that the prediction of the sentiment classifier model is correct, $\times$ indicates that the prediction is incorrect. NP: Noun Phrase, CC: Coordinating Conjunction. + +VAE and two-stage training process. We first train the conditional VAE model to generate sentences in desired syntactic structures. To further improve the syntactic controllability and semantic consistency of generated sentences, we introduce syntax controlling and cycle reconstruction objective functions to fine-tune the pre-trained model. Experiments show that our model achieves strong improvements over baselines on unsupervised setting and can generate syntactically controlled paraphrases. Furthermore, adversarial example generation experiments also validate that our model is able to generate syntactically adversarial examples for sentiment analysis, which can be used to improve the robustness of the sentiment classifier model via adversarial training. + +# Acknowledgements + +The present research was supported by the National Nature Science Foundation of China (No. 61876198, 61976015, 61976016). Deyi Xiong was partially supported by the National Key Research and Development Program of China (Grant No. 2019QY1802) and Natural Science Foundation of Tianjin (Grant No. 19JCZDJC31400). We would like thank the three anonymous reviewers for their constructive suggestions and insightful comments. + +# References + +Yu Bao, Hao Zhou, Shujian Huang, Lei Li, Lili Mou, Olga Vechtomova, Xin-yu Dai, and Jiajun Chen. 2019. Generating sentences from disentangled syntactic and semantic spaces. In ACL, pages 6008-6019. Association for Computational Linguistics. +Samuel R. Bowman, Luke Vilnis, Oriol Vinyals, Andrew Dai, Rafal Jozefowicz, and Samy Bengio. 2016. Generating sentences from a continuous space. In SIGNLL, pages 10-21, Berlin, Germany. Association for Computational Linguistics. +Mingda Chen, Qingming Tang, Sam Wiseman, and Kevin Gimpel. 2019. Controllable paraphrase generation with a syntactic exemplar. In ACL, pages 5972-5984, Florence, Italy. Association for Computational Linguistics. +Ning Dai, Jianze Liang, Xipeng Qiu, and Xuanjing Huang. 2019. Style transformer: Unpaired text style transfer without disentangled latent representation. In ACL, pages 5997-6007, Florence, Italy. Association for Computational Linguistics. +Li Dong, Jonathan Mallinson, Siva Reddy, and Mirella Lapata. 2017. Learning to paraphrase for question answering. In *EMNLP*, pages 875–886. Association for Computational Linguistics. +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. 2018. HotFlip: White-box adversarial examples for text classification. In ACL. Association for Computational Linguistics. +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. +Siddhant Garg and Goutham Ramakrishnan. 2020. BAE: BERT-based Adversarial Examples for Text Classification. page arXiv:2004.01970. +Tanya Goyal and Greg Durrett. 2020. Neural syntactic preordering for controlled paraphrase generation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 238-252, Online. Association for Computational Linguistics. +Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P. Xing. 2017. Toward controlled generation of text. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pages 1587-1596. PMLR. +Mohit Iyyer, John Wieting, Kevin Gimpel, and Luke Zettlemoyer. 2018. Adversarial example generation with syntactically controlled paraphrase networks. In *NAACL*, pages 1875–1885. Association for Computational Linguistics. +Eric Jang, Shixiang Gu, and Ben Poole. 2016. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144. +Vineet John, Lili Mou, Hareesh Bahuleyan, and Olga Vechtomova. 2019. Disentangled representation learning for non-parallel text style transfer. In ACL, pages 424-434, Florence, Italy. Association for Computational Linguistics. +Diederik Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. Computer Science. +Diederik P Kingma and Max Welling. 2014. Autoencoding variational bayes. In ICLR. +Ashutosh Kumar, Kabir Ahuja, Raghuram Vadapalli, and Partha Talukdar. 2020. Syntax-guided controlled generation of paraphrases. TACL, 8:329-345. +Zichao Li, Xin Jiang, Lifeng Shang, and Hang Li. 2018. Paraphrase generation with deep reinforcement learning. In EMNLP, pages 3865-3878, Brussels, Belgium. Association for Computational Linguistics. +Zichao Li, Xin Jiang, Lifeng Shang, and Qun Liu. 2019. Decomposable neural paraphrase generation. In ACL, pages 3403-3414, Florence, Italy. Association for Computational Linguistics. +Bin Liang, Hongcheng Li, Miaoqiang Su, Pan Bian, Xirong Li, and Wenchang Shi. 2017. Deep text classification can be fooled. arXiv preprint arXiv:1704.08006. + +Mingtong Liu, Erguang Yang, Deyi Xiong, Yujie Zhang, Yao Meng, Changjian Hu, Jinan Xu, and Yufeng Chen. 2020a. A learning-exploring method to generate diverse paraphrases with multi-objective deep reinforcement learning. In Proceedings of the 28th International Conference on Computational Linguistics, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pages 2310-2321. International Committee on Computational Linguistics. +Mingtong Liu, Erguang Yang, Deyi Xiong, Yujie Zhang, Chen Sheng, Changjian Hu, Jinan Xu, and Yufeng Chen. 2020b. Exploring bilingual parallel corpora for syntactically controllable paraphrase generation. In *IJCAI-20*, pages 3955–3961. International Joint Conferences on Artificial Intelligence Organization. Main track. +Xianggen Liu, Lili Mou, Fandong Meng, Hao Zhou, Jie Zhou, and Sen Song. 2020c. Unsupervised paraphrasing by simulated annealing. In ACL, pages 302-312, Online. Association for Computational Linguistics. +Christopher Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven Bethard, and David McClosky. 2014. The Stanford CoreNLP natural language processing toolkit. In ACL, pages 55-60, Baltimore, Maryland. Association for Computational Linguistics. +Ning Miao, Hao Zhou, Lili Mou, Rui Yan, and Lei Li. 2018. Cgmh: Constrained sentence generation by metropolis-hastings sampling. In AAAI, pages 1875-1885. +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. +Nils Reimers and Iryna Gurevych. 2019. SentenceBERT: Sentence embeddings using Siamese BERT-networks. In EMNLP-IJCNLP, Hong Kong, China. 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 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1073-1083, Vancouver, Canada. 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 ACL, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. + +Kihyuk Sohn, Xinchen Yan, and Honglak Lee. 2015. Learning structured output representation using deep conditional generative models. In NIPS. +Hong Sun and Ming Zhou. 2012. Joint learning of a dual SMT system for paraphrase generation. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 38-42, Jeju Island, Korea. Association for Computational Linguistics. +Kai Sheng Tai, Richard Socher, and Christopher D. Manning. 2015. Improved semantic representations from tree-structured long short-term memory networks. In ACL, pages 1556-1566, Beijing, China. Association for Computational Linguistics. +Xinchen Yan, Jimei Yang, Kihyuk Sohn, and Honglak Lee. 2016. Attribute2image: Conditional image generation from visual attributes. In ECCV, pages 776-791, Cham. Springer International Publishing. +Xinyuan Zhang, Yi Yang, Siyang Yuan, Dinghan Shen, and Lawrence Carin. 2019. Syntax-infused variational autoencoder for text generation. In ACL, pages 2069-2078, Florence, Italy. Association for Computational Linguistics. +Sanqiang Zhao, Rui Meng, Daqing He, Andi Saptono, and Bambang Parmanto. 2018. Integrating transformer and paraphrase rules for sentence simplification. In EMNLP, pages 3164-3173, Brussels, Belgium. Association for Computational Linguistics. +Zhong Zhou, Matthias Sperber, and Alexander Waibel. 2019. Paraphrases as foreign languages in multilingual neural machine translation. In ACL, pages 113-122. Association for Computational Linguistics. \ No newline at end of file diff --git a/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/images.zip b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..46644ccdc92868267768ae03d9f6932a58c71e23 --- /dev/null +++ b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06f39497a98cd9a1e06e7a586225c4a4028cc70e7885695a718c079b764a371c +size 458365 diff --git a/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/layout.json b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..31a4733239c0d63c23bff90c7b23be6fedc3c988 --- /dev/null +++ b/syntacticallyinformedunsupervisedparaphrasingwithnonparalleldata/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a66c114714fe4528e2420ccd2a5d1d54fd57b9a5ec1f3ec045f533141004d1b +size 397434 diff --git a/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_content_list.json b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..15aad3423caa976d65bd985f1e9e67a73330502c --- /dev/null +++ b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da7896a835865fb0349bfb71eb68901ddc62e7200e8f7a7a962d99ee6d8f5aec +size 103249 diff --git a/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_model.json b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c9d1b8e3c3091c61832417125dbbd59871f23fb9 --- /dev/null +++ b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:414926f0afa081ec5254c480d90d6ccb5313a58c2ec0fbeaf922492b46340fad +size 125420 diff --git a/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_origin.pdf b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a09e8ca5ffd07d130d319350f7d985c9a9cc5d73 --- /dev/null +++ b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/2a848fb8-1e8c-44ca-84d0-4ed3d3491928_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aae40dc1b56f2c028065c56e16b6583eb74acb582c5b0d7b317f338768266e77 +size 585982 diff --git a/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/full.md b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/full.md new file mode 100644 index 0000000000000000000000000000000000000000..545a3dc2baab673f287edb42a248c9bce0a9c774 --- /dev/null +++ b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/full.md @@ -0,0 +1,395 @@ +# Synthetic Data Augmentation for Zero-Shot Cross-Lingual Question Answering + +Arij Riabi\* Thomas Scialom\* Rachel Keraron\* Benoit Sagot Djamé Seddah Jacopo Staiano + +‡ Inria, Paris, France + +$^{\diamond}$ Sorbonne Université, CNRS, LIP6, F-75005 Paris, France + +\*reciTAL,Paris,France + +{thomas,rachel,jacopo}@recital.ai + +{arij.riabi,benoit.sagot,djame.seddah}@inria.fr + +# Abstract + +Coupled with the availability of large scale datasets, deep learning architectures have enabled rapid progress on Question Answering tasks. However, most of those datasets are in English, and the performances of state-of-the-art multilingual models are significantly lower when evaluated on non-English data. Due to high data collection costs, it is not realistic to obtain annotated data for each language one desires to support. + +We propose a method to improve Cross-lingual Question Answering performance without requiring additional annotated data, leveraging Question Generation models to produce synthetic samples in a cross-lingual fashion. We show that the proposed method allows to significantly outperform the baselines trained on English data only, establishing thus a new state-of-the-art on four multilingual datasets: MLQA, XQuAD, SQuAD-it and PIAF (fr). + +# 1 Introduction + +Question Answering is a fast-growing research field, aiming to improve the capabilities of machines to read and understand documents. Significant progress has recently been enabled by the use of large pre-trained language models (Devlin et al., 2019; Raffel et al., 2020), which reach human-level performances on several publicly available benchmarks, such as SQuAD (Rajpurkar et al., 2016) and NewsQA (Trischler et al., 2017). + +Given that the majority of large scale Question Answering (QA) datasets are in English (Hermann et al., 2015; Rajpurkar et al., 2016; Choi et al., 2018), the development of QA systems targeting other languages is currently addressed via two cross-lingual QA datasets: XQuAD (Artetxe et al., 2020) and MLQA (Lewis et al., 2020a), covering + +respectively 10 and 7 languages. Due to the cost of annotation, both are limited only to an evaluation set. They are comparable to the validation set of the original SQuAD (see more details in Section 3.3). In both datasets, each paragraph is paired with questions in various languages, allowing to evaluate models in a cross-lingual experimental scenario: the input context and the question can be in two different languages. This scenario has important practical applications, such as querying a set of documents in various languages. + +Performing this cross-lingual task is complex and remains challenging for current models, assuming only English training data: transfer results are shown to rank behind training-language performance (Artetxe et al., 2020; Lewis et al., 2020a). In other words, multilingual models fine-tuned only on English data are found to perform significantly better on English than on other languages. Besides the almost simultaneous work of Shakeri et al. (2020), very few alternatives to such a simple zero-shot transfer method have been proposed so far. + +In this paper, we propose to generate synthetic data in a cross-lingual fashion, borrowing the idea from monolingual QA research efforts (Duan et al., 2017). On English corpora, generating synthetic questions has shown to significantly improve the performance of QA models (Du et al., 2017; Golub et al., 2017; Du and Cardie, 2018; Alberti et al., 2019). However, the adaptation of this technique to cross-lingual QA is not straightforward: cross-lingual text generation is a challenging task per se which has not been yet extensively explored, in particular when no multilingual training data is available. + +We explore two Question Generation scenarios: (i) requiring only SQuAD data; and (ii) using a translator tool to obtain translated versions of SQuAD. As expected, the method leveraging on a translator has shown to perform the best. Leveraging on such synthetic data, our best model obtains + +significant improvements on XQuAD and MLQA over the state-of-the-art for both Exact Match and F1 scores. In addition, we evaluate the QA models on languages not seen during training (even for the synthetic data) – using SQuAD-it (for Italian), PIAF (for French), and KorQUaD (for Korean) – reporting a new state-of-the-art for Italian and French, and observing significant improvements on Korean compared to zero-shot without augmentation. This indicates that the proposed method allows to capture better multilingual representations beyond the training languages. Our method paves the way toward multilingual QA domain adaptation, especially for under-resourced languages. + +Our contributions can be summarized as follows: + +- We present a data augmentation approach for Cross-Linguual Question Answering based on synthetic Question Generation; +- We report extensive experiments showing significant improvements on two multilingual evaluation datasets (XQuAD and MLQA); +- We additionally evaluate the proposed methodology on languages unseen during training, thus showing the potential benefits for QA on low-resource languages. + +# 2 Related Work + +Question Answering (QA) QA is the task for which given a context and a question, a model has to find the answer. The interest for Question Answering goes back a long way: in a 1965 survey, Simmons (1965) reported fifteen implemented English language question-answering systems. More recently, with the rise of large scale datasets (Hermann et al., 2015), and large pre-trained models (Devlin et al., 2019), the performance drastically increased, approaching human-level performance on standard benchmarks – see for instance the SQuAD leader board.1 More challenging evaluation benchmarks have recently been proposed: Dua et al. (2019) released the DROP dataset, for which the annotators were encouraged to provide adversarial questions; Burchell et al. (2020) released the MSQ dataset, consisting of multi-sentence questions. + +However, all these works are focused on English. Another popular research direction focuses on the development of multilingual QA models. For this purpose, the first step has been to provide the community with multilingual evaluation sets: Artetxe + +et al. (2020) and Lewis et al. (2020a) concurrently proposed two different evaluation sets which are comparable to the SQuAD development set. Both reach the same conclusion: due to the lack of non-English training data, models do not achieve the same performance in Non-English languages than they do in English. To the best of our knowledge, no method has been proposed to fill this gap. + +Question Generation (QG) QG can be seen as the dual task of QA: the input is composed of the answer and the paragraph containing it, and the model is trained to generate the question. Proposed by Rus et al. (2010), it has leveraged on the development of new QA datasets (Zhou et al., 2017; Scialom et al., 2019). Similar to QA, significant performance improvements have been obtained using pre-trained language models (Dong et al., 2019). Still, due to the lack of multilingual datasets, most previous works have been limited to monolingual text generation. We note the exceptions of Kumar et al. (2019) and Chi et al. (2020), who resorted to multilingual pre-training before fine-tuning on monolingual downstream NLG tasks. However, the quality of the generated questions is still found inferior to the corresponding English ones. + +Question Generation for Question Answering Data augmentation via synthetic data generation is a well-known technique to improve models' accuracy and generalisation. It has found successful application in several areas, such as time series analysis (Forestier et al., 2017) and computer vision (Buslaev et al., 2020). In the context of QA, generating synthetic questions to complete a dataset has shown to improve QA performances (Duan et al., 2017; Alberti et al., 2019). So far, all these works have focused on English QA given the difficulty to generate questions in other languages without available data. This lack of data, and the difficulty to obtain some, constitutes the main motivation of our work and justifies exploring cost-effective approaches such as data augmentation via the generation of questions. + +In a very recent work, almost simultaneous to our previously submitted version, Shakeri et al. (2020) address multilingual QA with a similar approach. However, we argue that their experimental protocol does not allow to totally answer the research question. We detail the differences in our discussion, Section 5.3. + +# 3 Data + +# 3.1 English Training Data + +$\mathbf{SQuAD}_{en}$ The original SQuAD (Rajpurkar et al., 2016), which we refer as $\mathrm{SQuAD}_{en}$ for clarity in this paper. It is one of the first, and among the most popular, large scale QA datasets. It contains about 100K question/paragraph/answer triplets in English, annotated via Mechanical Turk. $^2$ + +QG datasets Any QA dataset can be reversed into a QG dataset, by switching the generation targets from the answers to the questions. In this paper, we use the $qg$ subscript to specify when the dataset is used for QG (e.g. SQuAD $_{en;qg}$ indicates the English SQuAD data in QG format). + +# 3.2 Synthetic Training Sets + +$\mathbf{SQuAD}_{trans}$ is a machine translated version of the SQuAD train set in the seven languages of MLQA, released by the authors together with their paper. + +WikiScrap We collected 500 Wikipedia articles for all the languages present in MLQA. They are not paired with any question or answer. We use them as contexts to generate synthetic multilingual questions, as detailed in Section 4.2. Following the SQuADen protocol, we used project Nayuki's code3 to parse the top 10K Wikipedia pages according to the PageRank algorithm (Page et al., 1999). We then filtered out paragraphs with character length outside of a [500, 1500] interval. Articles with less than 5 paragraphs are discarded, since they tend to be less developed, in a lower quality or being only redirection pages. Out of the filtered articles, we randomly selected 500 per language. + +# 3.3 Multilingual Evaluation Sets + +XQuAD (Artetxe et al., 2020) is a human translation of the SQuAD $_{en}$ development set in 10 languages (Arabic, Chinese, German, Greek, Hindi, Russian, Spanish, Thai, Turkish, and Vietnamese), providing 1k QA pairs for each language. + +MLQA (Lewis et al., 2020a) is an evaluation dataset in 7 languages (English, Arabic, Chinese, + +German, Hindi, and Spanish). The dataset is built from aligned Wikipedia sentences across at least two languages (full alignment between all languages being impossible), with the goal of providing natural rather than translated paragraphs. The QA pairs are manually annotated on the English sentences and then human translated on the aligned sentences. The dataset contains about 46k aligned QA pairs in total. + +Language-specific benchmarks In addition to the two aforementioned multilingual evaluation corpora, we benchmark our models on three language-specific datasets for French, Italian and Korean, as detailed below. We choose these datasets since none of these languages are present in XQuAD or MLQA. Hence, they allow us to evaluate our models in a scenario where the target language is not available during training, even for the synthetic questions. + +PIAF Keraron et al. (2020) provided an evaluation set in French following the SQuAD protocol, containing 3835 examples. + +KorQuAD 1.0 the Korean Question Answering Dataset (Lim et al., 2019), a Korean dataset also built following the SQuAD protocol. + +SQuAD-it Derived from $\mathrm{SQuAD}_{en}$ , it was obtained via semi-automatic translation to Italian (Croce et al., 2018). + +# 4 Models + +Recent works (Raffel et al., 2020; Lewis et al., 2019) have shown that classification tasks can be framed as a text-to-text problem, achieving state-of-the-art results on established benchmarks, such as GLUE (Wang et al., 2018). Accordingly, we employ the same architecture for both Question Answering and Generation tasks. This also allows fairer comparisons for our purposes, by removing differences between QA and QG architectures and their potential impact on the results obtained. In particular, we use a distilled version of XLM-R (Conneau et al., 2020): MiniLM-M (Wang et al., 2020) (see Section 4.3 for further details). + +# 4.1 Baselines + +$\mathbf{Q}\mathbf{A}_{\mathrm{No - synth}}$ Following previous works, we finetuned the multilingual models on $\mathrm{SQuAD}_{en}$ , and consider them as our baselines. + +English as Pivot Leveraging on translation models, we consider a second baseline method, which uses English as a pivot. First, both the question in language $L_{q}$ and the paragraph in language $L_{p}$ are translated into English. We then invoke the baseline model described above, $\mathrm{QA}_{\mathrm{No - synth}}$ , to predict the answer. Finally, the predicted answer is translated back into the target language $L_{p}$ . We used the google translate API. $^{4}$ + +$\mathbf{QA}_{+\mathrm{SQuAD - trans}}$ the translated data $\mathrm{SQuAD_{trans}}$ are used as additional training data to $\mathrm{SQuAD_{en}}$ , to train the QA model. + +# 4.2 Question Generation Data Augmentation + +In this work we consider data augmentation via generating synthetic questions, to improve the QA performance. Different training schemes for the question generator are possible, resulting in different quality of the synthetic data. Before this work, its impact on the final QA system remained unexplored in a multilingual context. + +For all the following experiments, only the synthetic data changes. Given a specific set of synthetic data, we always follow the same two-stages protocol, similar to Alberti et al. (2019): we first train the QA model on the synthetic QA data, then on $\mathrm{SQuAD}_{en}$ . We also tried to train the QA model in one stage, with all the synthetic and human data shuffled together, but observed no improvements over the baseline. + +We explored two different synthetic generation modes: + +Synth the QG model is trained on $\mathrm{SQuAD}_{en,qq}$ (i.e., English data only) and the synthetic data are generated on WikiScrap. Under this setup, the only annotated samples this model has access to are those from SQuAD-en. + +Synth+trans the QG model is trained on SQuADtrans,gg in addition to SQuADen,gg. The questions can thus be in a different languages than the context. Hence, the model needs an indication about the language it is expected to generate the question in. To control the target language, we use a specific prompt per language, defining a special token , which corresponds to the desired target language Y. Thus, the input is structured as Answer Context, where indicates to the model in what language the question should be generated, + +and $<\mathrm{SEP}>$ is a special token acting as a separator. These attributes offer flexibility on the target language. Similar techniques are used in the literature to control the style of the output (Keskar et al., 2019; Scialom et al., 2020; Chi et al., 2020). + +# 4.3 Implementation details + +For all our experiments we use Multilingual MiniLM v1 (MiniLM-m) (Wang et al., 2020), a 12-layer with 384 hidden size architecture distilled from XLM-R Base multilingual (Conneau et al., 2020). With only 66M parameters, it is an order of magnitude smaller than state-of-the-art architectures such as BERT-large or XLM-large. We used the official Microsoft implementation. For all the experiments -both QG and QA- we trained the model for 5 epochs, using the default hyperparameters. We used a single nVidia GTX2080ti with 11G RAM, and the training times amount to circa 4 and 2 hours for Question Generation and for Question Answering, respectively. To evaluate our models, we used the official MLQA evaluation scripts. For reproducibility purposes, we make the code available. + +# 5 Results + +# 5.1 Question Generation + +We report examples of generated questions in Table 1. + +Controlling the Target Language In the context of multilingual text generation, controlling the target language is not trivial. + +When a QA model is trained only on English data, at inference, given a non-English paragraph, it predicts the answer in the input language, as one would expect, since it is an extractive process. Ideally, we would like to observe the same behavior for a Question Generation model trained only on English data (such as Synth), leveraging on the multilingual pre-training. Conversely to QA, QG is a language generation task. Multilingual generation is much more challenging, as the model's decoding ability plays a major role. When a QG model is fine-tuned only on English data (i.e SQuAD-en), its controllability of the target language suffers from catastrophic forgetting: the input language does not + +Paragraph (EN) Peyton Manning became the first quarterback ever to lead two different teams to multiple Super Bowls. He is also the oldest quarterback ever to play in a Super Bowl at age 39. The past record was held by John Elway, who led the Broncos to victory in Super Bowl XXXIII at age 38 and is currently Denver's Executive Vice President of Football Operations and General Manager. + +Answer Broncos + +$\mathbf{Q}\mathbf{G}_{\mathrm{synth}}$ What team did John Elway lead to victory at age 38? +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $= \mathbf{en}$ ) What team did John Elway lead to win in the Super Bowl? + +Paragraph (ES) Peyton Manning se convirtio en el primer mariscal de campo de la historia enVELAR a dos equipos differentes a participar en multiples Super Bowls. Ademas, es con 39 años, el mariscal de campo mas longevo de la historia en jugar ese partido. El record anterior esta en manos de John Elway —mánger general y actual vicepresidente executivo para operaciones futbolísticas de Denver—que conducjo a los Broncos a la victoria en la Super Bowl XXXIII a los 38 años de edad. + +Answer Broncos + +$\mathbf{Q}\mathbf{G}_{\mathrm{synth}}$ Where did Peyton Manning conducjo? +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $=$ es) Que equipo ganó el record anterior? (Which team won the previous record?) +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $= \mathsf{en}$ ) What team did Menning win in the Super Bowl? + +Paragraph (ZH) 培顿·曼宁成为史上首位带领两支不同球队多次进入超级碗的四分卫。他也以39岁高龄参加超级碗而成为上年龄最大的四分卫。过去的记录是由约翰·埃尔维保持的,他在38岁时带领野马队赢得第33届超级碗,目前担任丹佛的橄榄球运营执行副总裁兼总经理 + +Answer 野马队 + +$\mathbf{Q}\mathbf{G}_{\mathrm{synth}}$ What is the name for the name that the name is used? +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language = zh) 约翰·埃尔维在13岁时带领哪支球队赢得第33届超级碗? (Which team did John Elvey lead to win the 33rd Super Bowl at the age of 13?) +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $=$ en) What team won the 33th Super Bowl? + +propagate to the generated text. While still relevant to the context, the synthetic questions are generated in English: for instance, in Table 1 we observe that the $\mathrm{QG}_{\mathrm{synth}}$ model outputs English questions for the paragraphs in Chinese and Spanish. The same phenomenon was reported by Chi et al. (2020). + +Cross-Lingual Training To overcome the aforementioned limitation on target language controllability (i.e. to enable the generation in other languages than English), multilingual data is needed. We can leverage on the translated versions of the dataset to add the required non-English examples. As detailed in Section 4.2, we simply use a specific prompt that corresponds to the target language (with $N$ different prompts corresponding to the $N$ languages present in the dataset). In Table 1, we show how $\mathrm{QG}_{\mathrm{synth + trans}}$ can generate questions in the same language as the input. These synthetic questions seem much more relevant, coherent and fluent, if compared to those produced by $\mathrm{QG}_{\mathrm{synth}}$ : for the Spanish paragraph, the question is well formed and focused on the input answer; for Chinese (see bottom row of Table 1 for $\mathrm{QG}_{\mathrm{synth + trans}}$ ) is perfectly written. + +In Table 2 we report the BLEU4 scores for $\mathrm{QG}_{\mathrm{synth + trans}}$ grouped by the language of the question. As expected, the score is maximized on the + +Table 1: Example of questions generated by the different models on an XQuAD's paragraph in different languages. For $\mathrm{QG_{synth + trans}}$ , we report the outputs given two target languages, the one of the context and English. + +
q/cenesdearhivizh
en14.58.97.25.96.58.46.0
es9.010.6.64.25.96.34.6
de6.24.86.33.13.75.03.2
ar2.82.22.43.32.02.32.1
hi7.96.76.65.88.36.65.2
vi9.17.37.26.06.512.36.1
zh9.28.07.86.17.28.015.0
+ +Table 2: BLEU-4 scores on MLQA test for $\mathrm{QG_{synth + trans}}$ . Columns show context language, rows show question language. + +diagonal (same languages for the context and the question). Still, most of these scores are lower on non-English languages. It is interesting to note BLEU4 correlates with the QA scores: 0.51 Pearson coefficient. The reasons are two folds: 1) QA and QG share the same Language Model, which might struggle for the same languages; 2) the better the QG, the better the synthetic data, therefore the better the QA performs. We discuss further in Section 5.3 how this impacts the QA performance. + +In addition to BLEU, we also report the QA F1 scores for different QA models when applied on the generated questions in the supplementary material. Yet, we warn the reader that these results should be taken with caution: evaluating NLG is known to be an open research problem; BLEU is known to + +suffer from important limitations (Novikova et al., 2017), which might be accentuated in a multilingual context (Lee et al., 2020). For this reason, we conducted a manual qualitative analysis on a small number of samples. Note that the annotators need to have a professional level in the language of the generated question to evaluate its fluency, and to be bilingual, when evaluating its relevance w.r.t. input context in our cross language scenario. This is a significant challenge to conduct a large scale evaluation. + +So far, our results (see at the end of Supplementary Material) for Arabic and German show an overall good quality in the questions: only one question for Arabic was genuinely missing the point while for German there were 2 lexical questionable choices that invalidate the question (out of 10 samples for both languages so far). This indicates that Arabic questions could actually be better than what their low BLEU score shows. Arabic has a very different morphological structure that could explain such low BLEU (Bouamor et al., 2014). This emphasizes the limitation of the current automatic metrics in a multilingual context. + +# 5.2 Question Answering + +We report the main results of our experiments on XQuAD and MLQA in Table 3. The scores correspond to the average over all the different possible combination of languages (de-de, de-ar, etc.). + +English as Pivot Using English as a pivot does not lead to good results. This may be due to the evaluation metrics, which are based on $n$ -grams similarity. For extractive QA, F1 and EM metrics measure the overlap between the predicted answer and the ground truth. Therefore, meaningful answers worded differently are penalized, a situation that is likely to occur because of the backtranslation mechanism. This makes automatic evaluation challenging for this setup, as metrics suffer from similar difficulties as those observed for text generation (Sulem et al., 2018). As an additional downside, this model requires multiple translations at inference time. For these reasons, we decided not to explore this approach further. + +Synthetic without translation (+synth) Compared to the MiniLM baseline, we observe a small performance increase for $\mathrm{MiniLM}_{+\mathrm{synth}}$ (Exact Match increases from 29.5 to 33.1 on XQuAD and from 26.0 to 27.5 on MLQA). + +During the self-supervised pre-training stage, the model was exposed to multilingual inputs. Yet, for a given input, the target language was always consistent, preventing the model to be exposed to such a cross-lingual scenario. The synthetic inputs are composed of questions in English (see examples in Table 1) while the contexts can be in any languages. Therefore, the QA model is exposed for the first time to a cross-lingual scenario. We hypothesise that such a cross-lingual ability is not innate for a default multilingual model: exposing a model to this scenario allows to develop this ability and contributes to improve its performance. + +# Synthetic with translation (+synth-trans) : + +For $\mathrm{MiniLM}_{+\mathrm{synth - trans}}$ , we obtain a much larger improvement over its baselines, MiniLM, compared to $\mathrm{MiniLM}_{+\mathrm{synth}}$ , on both MLQA and XQuAD. Also, it outperforms $\mathrm{MiniLM}_{+\mathrm{SQuADtrans}}$ , indicating the benefit of our proposed approach. This supports the intuition developed in the previous paragraph: independently of the multilingual capacity of the model, a cross-lingual ability is developed when the two inputs components are not exclusively written in the same language. In Section 5.3, we discuss this phenomenon more in depth. + +# 5.3 Discussion + +Cross Linguual Generalisation To explore the models' effectiveness in dealing with cross-lingual inputs, we report in Figure 1 the performance for our $\mathrm{MiniLM}_{+\mathrm{synth - trans}}$ setup, varying the number of samples and the languages present in the synthetic data. The abscissa $x$ corresponds to the progressively increasing number of synthetic samples used; at $x = 0$ , it corresponds to the MiniLM $_{+}$ trans baseline, where the model has access only to the original English data from SQuADen. We explore two sampling strategies for the synthetic examples: + +0. All Languages corresponds to sampling the examples from any of the different languages. +0. Conversely, for Not All Languages, we progressively added the different languages: for $x = 50K$ , all the 50K synthetic data are on a unique language input, $L1$ . Then for $x = 100K$ , the synthetic data are from either $L1$ , or an additional language $L2$ ; finally, for $x = 250K$ , all MLQA languages are present. + +In Figure 1, we observe that the performance for All Languages increases largely at the beginning, then remains mostly stable. Conversely, we note a gradual improvement for Not All Languages, as + +
#ParamsTrans.XQuADMLQA
MiniLM (Wang et al., 2020)66MNo42.2 / 29.538.4 / 26.0
XLM (Hu et al., 2020)8340MNo68.5/52.865.4 / 47.9
English as Pivot66MYes46.2 / 30.936.1 / 23.0
MiniLM+synth66MNo44.8 / 33.139.8 / 27.5
MiniLM+SQuAD-trans66MYes55.0 / 40.749.5 / 35.3
MiniLM+synth-trans66MYes63.3 / 49.156.1 / 41.4
MiniLM+SQuAD-trans+synth-trans66MYes62.5 / 48.655.0 / 40.4
XLM - R+synth-trans340MYes74.3 / 59.265.3 / 49.2
+ +Table 3: Results (F1 / EM) of the different QA models on XQuAD and MLQA. XLM corresponds to the large version. + +
#ParamsPIAF (fr)KorQuADSQuAD-it
MiniLM (Wang et al., 2020)66M58.9 / 34.353.3 / 40.572.0 / 57.7
mBert (Devlin et al., 2019)110M64.4 / 42.5-74.1 / 62.5
CamemBERT (Martin et al., 2020)340M68.9 / -N/AN/A
MiniLM+synth66M58.6 / 34.552.1 / 39.071.3 / 58.0
MiniLM+synth-trans66M63.9 / 40.660.0 / 48.874.5 / 62.0
XLM-R+synth-trans340M72.1 / 47.163.0 / 52.880.4 / 67.6
+ +Table 4: Zero-shot results (F1 / EM) on PIAF, KorQuAD and SQuAD-it for our different QA models, compared to various baselines. For mBert on SQuAD-it, we report the score from Croce et al. (2018). Note that CamemBERT is a French version of RoBERTa, an architecture widely outperforming BERT. + +more languages are made available during training. This shows that when all the languages are present in the synthetic data, the model immediately develops cross-lingual abilities. + +However, it appears that even with only one language pair present, the model is able to develop a cross-lingual ability that brings benefits on other languages: of Figure 2, we can see that most of the improvement is happening given only one cross-lingual language pair (i.e. English and Spanish). + +Unseen Languages To measure the benefit of our approach on unseen languages (i.e. not present in the synthetic data from MLQA/XQuAD), we test our models on three QA evaluation sets: PIAF (fr), KorQuAD and SQuAD-it (see Section 3.3). The results are consistent with the previous experiments on MLQA and XQuAD. Our MiniLM $^+$ synth-trans model outperforms its baseline by more than 4 Exact Match points, while XLM- $\mathbf{R}_{+}$ synth-trans obtains a new state-of-the-art.Notably, our multilingual XLM- $\mathbf{R}_{+}$ synth-trans outperforms CamemBERT on PIAF, even if the latter is a pure monolingual, in-domain language model. + +On the correlation between BLEU4 and QA scores To measure the impact of the quality of the generated questions on the QA performance, we computed the Pearson correlation between the BLEU4 and the QA scores. The coefficient is equal to 0.65 $(p < .001)$ . When we observe the correlations grouping the samples w.r.t. their language question (i.e. the rows in Table 2), we obtain: en 0.94; es 0.84; de 0.46; ar 0.36; hi 0.33; vi 0.73; zh 0.92. We observe stronger correlation for languages with higher BLEU scores (i.e en & zh), and lower for the Arab that had the lowest BLEU, indicating an impact on the final QA score in par to the quality of the synthetic questions. + +Differences with Shakeri et al. (2020) A very recent work has addressed multilingual QA with a very similar approach. However, we note a major difference in our respective experiments regarding the choice for the QA and QG models. Shakeri et al. (2020) choose mBert for QA and T5-m for QG. We would like to emphasize that because T5-m significantly outperforms mBert it is not clear where the improvement comes from: is it due to the proposed approach, or simply from a distillation effect from T5-m to mBert? In our case, we + +![](images/e0bc2f4edff868bb608bbf4f1f056ea3b01e68abd83c1e6dd5be3e1cf1a63b5c.jpg) +Figure 1: Left: F1 score on MLQA, for models with different number of synthetic data in two setups: for All Languages, the synthetic questions are sampled among all the five languages in MLQA; for Not All Languages, the synthetic questions are sampled progressively from only one language, two, ..., to all five for the last point, which corresponds to All Languages. We report the standard deviation over five different permutations of the language ordering. Note that, as expected, the more the synthetic data, the lower the variance in the results. Right: same as on the left, but evaluated on XQuAD. + +![](images/1c8c660af3185bc615f6ccba2af52911dca91ac4897855ba3e191c7214c6ab39.jpg) + +![](images/48c7dfc516d0c69aeecf87716821c1d640a466ed450353d2c1435e9f120f43fa.jpg) +Figure 2: The relative variation in performance for the models in Figure 1. + +deliberately used MiniLM for both QA and QG: this allows a fairer investigation about the benefits of the proposed approach. + +Hidden distillation effect The relative improvement for our best synthetic configuration $+$ synthtrans, over the baseline, is above $60\%$ EM for MiniLM (from 29.5 to 49.5 on XQuAD and from 26.0 to 41.4 on MLQA). Significantly higher than that observed for XLM-R $(+11.7\%)$ on XQuAD and $+2.71\%$ on MLQA), it indicates that XLM-R provides superior cross-lingual transfer abilities than MiniLM, a fact that we hypothesize due to distillation. Such loss of generalisation can be difficult to identify, and opens questions for future work. + +QA, an unsolved task for lower resource languages Factoid QA tasks have been criticized for + +being a too easy task: the answer can often be identified given simple heuristics: e.g. a "When" question is answered by one of the "date" spans in the context (Kočisky et al., 2018; Kwiatkowski et al., 2019). SQuAD-v2 was for instance introduced to increase the difficulty of the task by adding unanswerable questions. The research community is now moving towards the construction of long context questions and non-factoid QA datasets (Dulceanu et al., 2018; Hashemi et al., 2019; Fan et al., 2019; Lewis et al., 2020b). In any case, the motivation of this work was to cope for the lack of training data for under-served languages in the QA domain which was severely impacting models performance. Therefore, potential criticisms regarding the simplicity of the task do not apply if seen from a lower-resource language scenario: our work deals with alleviating the lack of native training data, allowing us to focus our future work on further important issues such as domain adaptation, robustness and explainability in low-resource contexts. + +# 6 Conclusion + +In this work, we presented a method to generate synthetic QA dataset in a multilingual fashion, showing how QA models can benefit from it and reporting large improvements over the baselines. The proposed approach contributes to fill the gap between English and other languages, and is shown to generalize for languages not present in the synthetic corpus (e.g. French, Italian, Korean). + +In future work, we plan to investigate whether the proposed data augmentation method could be applied to other multilingual tasks, such as classification. We will also experiment more in depth with different strategies to control the target language of a model, and extrapolate on unseen ones. + +# 7 Acknowledgments + +Djamé Seddah was partly funded by the French Research National Agency via the ANR project ParSiTi (ANR-16-CE33-0021), Arij Riabi was partly funded by Benoit Sagot's chair in the PRAIRIE institute as part of the French national agency ANR "Investissements d'avir" programme (ANR-19-P3IA-0001) and by the Counter H2020 European project (grant 101021607). + +# References + +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. +Mikel Artetxe, Sebastian Ruder, and Dani Yogatama. 2020. On the cross-lingual transferability of monolingual representations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4623–4637, Online. Association for Computational Linguistics. +Houda Bouamor, Hanan Alshikhabobakr, Behrang Mohit, and Kemal Oflazer. 2014. A human judgement corpus and a metric for arabic mt evaluation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 207-213. +Laurie Burchell, Jie Chi, Tom Hosking, Nina Markl, and Bonnie Webber. 2020. Querent intent in multi-sentence questions. arXiv preprint arXiv:2010.08980. +Alexander Buslaev, Vladimir I Iglovikov, Eugene Khvedchenya, Alex Parinov, Mikhail Druzhinin, and Alexandr A Kalinin. 2020. *Albumentions: fast and flexible image augmentations.* Information, 11(2):125. +Zewen Chi, Li Dong, Furu Wei, Wenhui Wang, Xian-Ling Mao, and Heyan Huang. 2020. Cross-lingual natural language generation via pre-training. In AAAI, pages 7570-7577. +Eunsol Choi, He He, Mohit Iyyer, Mark Yatskar, Wentau Yih, Yejin Choi, Percy Liang, and Luke Zettlemoyer. 2018. QuAC: Question answering in context. In Proceedings of the 2018 Conference on + +Empirical Methods in Natural Language Processing, pages 2174-2184, Brussels, Belgium. Association for Computational Linguistics. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishray 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, pages 8440-8451, Online. Association for Computational Linguistics. +Danilo Croce, Alexandra Zelenanska, and Roberto Basili. 2018. Neural learning for question answering in Italian. In AI*IA 2018 - Advances in Artificial Intelligence, pages 389-402, Cham. Springer International Publishing. +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. +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 13063-13075. +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 Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2368-2378, Minneapolis, Minnesota. 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, Copenhagen, Denmark. Association for Computational Linguistics. +Andrei Dulceanu, Thang Le Dinh, Walter Chang, Trung Bui, Doo Soon Kim, Manh Chien Vu, and Seokhwan Kim. 2018. PhotoshopQuiA: A corpus of non-factoid questions and answers for why-question answering. 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. +Germain Forestier, François Petitjean, Hoang Anh Dau, Geoffrey I Webb, and Eamonn Keogh. 2017. Generating synthetic time series to augment sparse datasets. In 2017 IEEE international conference on data mining (ICDM), pages 865-870. IEEE. +David Golub, Po-Sen Huang, Xiaodong He, and Li Deng. 2017. Two-stage synthesis networks for transfer learning in machine comprehension. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 835-844, Copenhagen, Denmark. Association for Computational Linguistics. +Helia Hashemi, Mohammad Aliannejadi, Hamed Zamani, and W. Bruce Croft. 2019. Antique: A non-factoid question answering benchmark. +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. +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. arXiv preprint arXiv:2003.11080. +Rachel Keraron, Guillaume Lancrenon, Mathilde Bras, Frédéric Allary, Gilles Moyse, Thomas Scialom, Edmundo-Pavel Soriano-Morales, and Jacopo Staiano. 2020. Project PIAF: Building a native French question-answering dataset. In Proceedings of the 12th Language Resources and Evaluation Conference, pages 5481-5490, Marseille, France. European Language Resources Association. +Nitish Shirish Keskar, Bryan McCann, Lav R Varshney, Caiming Xiong, and Richard Socher. 2019. Ctrl: A conditional transformer language model for controllable generation. arXiv preprint arXiv:1909.05858. + +Tomáš Kocisky, Jonathan Schwarz, Phil Blunsom, Chris Dyer, Karl Moritz Hermann, Gábor Melis, and Edward Grefenstette. 2018. The NarrativeQA reading comprehension challenge. Transactions of the Association for Computational Linguistics, 6:317-328. +Vishwajeet Kumar, Nitish Joshi, Arijit Mukherjee, Ganesh Ramakrishnan, and Preethi Jyothi. 2019. Cross-lingual training for automatic question generation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4863–4872, Florence, Italy. 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. +Dongyub Lee, Myeongcheol Shin, Taesun Whang, Seungwoo Cho, Byeongil Ko, Daniel Lee, Eunggyun Kim, and Jaechoon Jo. 2020. Reference and document aware semantic evaluation methods for korean language summarization. In Proceedings of COLING 2020, the 30th International Conference on Computational Linguistics: Technical Papers. The COLING 2020 Organizing Committee. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2019. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461. +Patrick Lewis, Barlas Oguz, Rudy Rinott, Sebastian Riedel, and Holger Schwenk. 2020a. MLQA: Evaluating cross-lingual extractive question answering. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7315-7330, Online. Association for Computational Linguistics. +Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. 2020b. Retrieval-augmented generation for knowledge-intensive nlp tasks. arXiv preprint arXiv:2005.11401. +Seungyoung Lim, Myungji Kim, and Jooyoul Lee. 2019. Korquad1. 0: Korean qa dataset for machine reading comprehension. arXiv preprint arXiv:1909.07005. +Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suárez, Yoann Dupont, Laurent Romary, Éric de la Clergerie, Djamé Seddah, and Benoit Sagot. 2020. CamemBERT: a tasty French language model. + +In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7203-7219, Online. Association for Computational Linguistics. +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, Copenhagen, Denmark. Association for Computational Linguistics. +Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry Winograd. 1999. The pagerank citation ranking: Bringing order to the web. Technical report, Stanford InfoLab. +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, 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. +Vasile Rus, Brendan Wyse, Paul Piwek, Mihai Lintean, Svetlana Stoyanchev, and Christian Moldovan. 2010. The first question generation shared task evaluation challenge. In Proceedings of the 6th International Natural Language Generation Conference. +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, Florence, Italy. Association for Computational Linguistics. +Thomas Scialom, Serra Sinem Tekiroglu, Jacopo Staiano, and Marco Guerini. 2020. Toward stance-based personas for opinionated dialogues. arXiv preprint arXiv:2010.03369. +Siamak Shakeri, Noah Constant, Mihir Sanjay Kale, and Linting Xue. 2020. Multilingual synthetic question and answer generation for cross-lingual reading comprehension. arXiv preprint arXiv:2010.12008. +Robert F Simmons. 1965. Answering english questions by computer: a survey. Communications of the ACM, 8(1):53-70. +Elior Sulem, Omri Abend, and Ari Rappoport. 2018. BLEU is not suitable for the evaluation of text simplification. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 738-744, Brussels, Belgium. Association for Computational Linguistics. + +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. +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. +Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. 2020. Minilm: Deep self-attention distillation for task-agnostic compression of pre-trained transformers. arXiv preprint arXiv:2002.10957. +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. + +# Appendix + +# A On target language control for text generation + +When relying on the translated versions of SQuAD, the target language for generating synthetic questions can easily be controlled, and results in fluent and relevant questions in the different languages. However, one limitation of this approach is that synthetic questions can only be generated in the languages that were available during training: the $<\text{LANG}>$ prompts are special tokens that are randomly initialised when fine-tuning QG on SQuAD $trans;qq$ : before fine-tuning, they bear no semantic relation with the corresponding language names ("English", "Espanol" etc.), thus the learned representations for the $<\text{LANG}>$ tokens are limited to the languages present in the training set. + +To the best of our knowledge, no method allows so far to generalize this target control to an unseen language. It would be valuable, for instance, to be able to generate synthetic data in Korean, French and Italian, without having to translate the entire SQuAD—en dataset in these three languages to then fine-tune the QG model. + +To this purpose, we report – alas, as a negative result – the following attempt: instead of controlling the target language with a special, randomly initialised, token, we used a token semantically related to the language-word: “English”, “Espanol” for Spanish, or “中文” for Chinese. The intuition is that the model might adopt the correct language at inference, even for a target language unseen during training. A similar intuition has been explored in GPT-2: the authors report an improvement for summarization when the input text is followed by “TL;DR” (i.e. Too Long Didn’t Read). + +At inference time, we evaluated this approach on French with the prompt language=François. Unfortunately, the model did not succeed to generate text in French. Controlling the target language in the context of multilingual text generation remains under-explored, and progress in this direction could have direct applications to improve this work, and beyond. + +# B Question Generation Scores + +We report the BLEU-4 scores for MLQA on $\mathrm{QG}_{\mathrm{synth + trans}}$ on Table 5 and $\mathrm{QG}_{\mathrm{synth}}$ on Table 6. + +
q/cenesdearhivizh
en14.58.97.25.96.58.46.0
es9.010.6.64.25.96.34.6
de6.24.86.33.13.75.03.2
ar2.82.22.43.32.02.32.1
hi7.96.76.65.88.36.65.2
vi9.17.37.26.06.512.36.1
zh9.28.07.86.17.28.015.0
+ +Table 5: BLEU4 scores on MLQA test for $\mathrm{QG}_{\mathrm{synth + trans}}$ model. + +
q/cenesdearhivizh
en21.74.734.582.472.583.023.11
es0.81.230.380.00.00.220.11
de1.40.851.320.00.00.220.0
ar0.00.00.00.00.00.00.0
hi0.00.210.00.00.00.00.0
vi0.550.50.250.00.00.340.0
zh0.00.00.00.00.00.00.0
+ +Table 6: BLEU-4 scores on MLQA test for $\mathrm{QG}_{\mathrm{synth}}$ model. + +
q/cenesdearhivizh
en83.974.870.167.872.374.169.3
es78.074.368.163.667.467.669.1
de75.672.970.165.067.568.570.4
ar61.358.456.866.757.756.569.8
hi70.962.158.956.870.961.369.2
vi71.064.160.559.763.774.769.9
zh67.162.559.056.760.763.269.3
+ +Table 7: F1 score on MLQA for XLM-R model finetuned on $\mathrm{SQuAD_{en}}$ . + +
q/cenesdearhivizh
en83.975.470.968.972.875.666.8
es81.074.471.866.670.272.565.7
de81.475.270.869.370.274.465.1
ar76.368.967.366.665.470.461.7
hi78.570.564.563.670.871.163.2
vi78.072.066.465.268.574.764.5
zh77.870.167.064.968.171.867.7
+ +Table 8: F1 score on MLQA for XLM- $\mathbf{R}_{+\mathrm{synth - trans}}$ model. + +In addition, we report the F1 scores for XLM-R finetuned on SQuADen and XLM- $\mathbf{R}_{+\mathrm{synth - trans}}$ on all the language pairs, on both MLQA and XQuAD in Tables 7, 8, 9 and 10. + +# C Qualitative Evaluation + +We report in Tables 11, 12, and 13 different examples that we analysed in our manual qualitative analysis, discussed at the end of section 5.1 in the main paper. + +
q/cenesdearhivizhruthtrel
en87.482.080.775.679.078.173.079.073.274.879.9
es80.684.276.271.372.772.867.576.469.670.675.8
de79.876.483.571.072.972.468.175.668.371.475.5
ar65.363.162.077.864.161.958.863.962.857.465.2
hi72.964.865.763.775.864.061.866.963.559.667.2
vi74.569.870.767.767.780.666.970.566.664.870.6
zh70.765.864.164.165.667.481.867.464.860.866.9
ru79.878.076.770.272.574.667.381.169.670.775.6
th49.642.144.149.851.949.053.950.474.937.148.8
tr72.664.968.565.568.164.162.470.364.376.771.3
el70.869.169.363.365.665.063.070.864.262.381.3
+ +Table 9: F1 score on XQuAD for XLM-R model finetuned on SQuADen. + +
q/cenesdearhivizhruthtrel
en87.082.981.677.881.581.077.580.977.774.881.4
es83.584.179.274.978.078.776.578.976.372.778.8
de82.880.383.175.177.378.375.178.475.772.978.3
ar78.477.275.677.572.874.372.174.272.569.574.2
hi80.677.576.471.677.575.273.976.373.670.275.9
vi81.379.677.573.075.680.774.776.574.571.876.0
zh80.278.376.972.174.376.185.177.074.170.175.7
ru82.280.478.874.175.978.476.580.875.472.978.6
th79.176.775.171.073.575.173.675.377.268.874.1
tr80.277.776.471.974.674.274.777.873.375.275.6
el82.080.178.573.877.377.375.478.675.372.280.1
+ +Table 10: F1 score on XQuAD for XLM- $\mathbf{R}_{+\mathrm{synth - trans}}$ model. + +Paragraph Kochi was the centre of Indian spice trade for many centuries, and was known to the Yavanas (Greeks and Romans) as well as Jews, Syrians, Arabs, and Chinese since ancient times. It rose to significance as a trading centre after the port Muziris around Kodungallur (Cranganore) was destroyed by massive flooding of Periyar in 1341. The earliest documented references to Kochi occur in books written by Chinese voyager Ma Huan during his visit to Kochi in the 15th century as part of Admiral Zheng He's treasure fleet. There are also references to Kochi in accounts written by Italian traveller Niccolò Da Conti, who visited Kochi in 1440. + +Answer massive flooding of Periyar + +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $=$ de) Welche Veranstaltung hat den Angriff auf Kochi im Jahr 1341 verursacht? (tr: Which event caused the attack on Kochi in 1341?) + +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $= \mathbf{ar}$ ) $\S \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山} \text{山}$ (tr: What event caused the destruction of Kathmandu?) + +Answer Ma Huan + +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $=$ de) Welcher chinesische traveller hat die frühesten Erinnerungen an Kochi geschrieben? (tr: Which Chinese traveler wrote the earliest memories of Kochi?) + +$\mathbf{QG}_{\mathrm{synth + trans}}$ (target language $=$ ar) $\S 15$ JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ + +Table 11: Paragraph 1 and different questions analysed during out human evaluation. + +
Paragraph Portuguese navigator, Pedro Álvares Cabral founded the first European settlement in India at Kochi in 1500. From 1503 to 1663, Fort Kochi (Fort Emmanuel) was ruled by Portugal. This Portuguese period was a harrowing time for the Saint Thomas Christians and the Jews, as the Inquisition was active in Portuguese India. Kochi hosted the grave of Vasco da Gama, the first European explorer to set sail for India, who was buried at St. Francis Church until his remains were returned to Portugal in 1539. The Portuguese rule was followed by that of the Dutch who renamed Fort Immanuel as Fort Stormsburg. In meantime, the Royal Family of Kochi relocated the capital of Kochi Kingdom to Thrissur, leaving nominal authority over Islands of Kochi. In 1664, Fort Kochi Municipality was established by Dutch, making it the first municipality in Indian subcontinent, which got dissolved when Dutch authority got weaker in the 18th century. The remaining part of Kochi were governed by governors of Kochi Kingdom. By 1773, the Mysore ruler Hyder Ali extended his conquest in the Malabar region to Kochi forcing it to become a tributary of Mysore. The hereditary Prime Ministership of Kochi held by the Paliath Achans ended during this period.
Answer Pedro Álvares Cabral +QGsynth+trans (target language = de) Wer hat die ersten europäische Siedlung in Kochi gegrundet? (tr: Who founded the first European settlement in Kochi?) +QGsynth+trans (target language = ar) §1500 würdig führte insgesamt 2.000 tätte währliche Obergrenzungen (tr: Who founded the first European settlement in India in the year 1500?)
Answer St. Francis Church +QGsynth+trans (target language = de) Wo wurde Vasco da Gama begaben? (tr: Where was Vasco da Gama buried?) +QGsynth+trans (target language = ar) § da Gama ländert dem Schlüssel führte insgesamt 2.000 tätte währliche Obergrenzungen (tr: Where was Vazaw da Gama buried?)
Answer Hyder Ali +QGsynth+trans (target language = de) Wer war der Herrscher von Mysore im Jahr 1773? (tr: Who was the ruler of Mysore in 1773?) +QGsynth+trans (target language = ar) §1773 würdig führte insgesamt 2.000 tätte währliche Obergrenzungen (tr: Who was the ruler of Mysore in 1773?)
+ +Table 12: Paragraph 2 and different questions analysed during out human evaluation. + +
Paragraph Taiwan is an island country in East Asia. The main island, known historically as Formosa, makes up 99% of the area controlled by the ROC, measuring 35,808 square kilometres (13,826 sq mi) and lying some 180 kilometres (112 mi) across the Taiwan Strait from the southeastern coast of mainland China. The East China Sea lies to its north, the Philippine Sea to its east, the Luzon Strait directly to its south and the South China Sea to its southwest. Smaller islands include a number in the Taiwan Strait including the Penghu archipelago, the Kinmen and Matsu Islands near the Chinese coast, and some of the South China Sea Islands.
Answer 99% +QGsynth+trans (target language = de) Welcher Prozentsatz der Gebiete von Taiwan wird von der ROK kontrolliert? +(tr: What percentage of the areas of Taiwan is controlled by the ROK?) +QGsynth+trans (target language = ar) §(dω) ∑LJ LLa (tr: What is the percentage of lands controlled by the (Divan)?
Answer 35,808 square kilometres +QGsynth+trans (target language = de) Wie groß ist die RAF? (tr: How big is the RAF?) +QGsynth+trans (target language = ar) §(dω) ∑LJ LZ (tr: How many square miles is the island?)
Answer Luzon Strait +QGsynth+trans (target language = de) Welcher Fluss ist direkt zum Süden von Taiwan? (tr: Which river is directly to the south of Taiwan?) +QGsynth+trans (target language = ar) §(dω) ∑LJ LLa (tr: What is the name of the nearby railway?)
Answer South China Sea +QGsynth+trans (target language = de) Welches Meer ist im Südwesten von Taiwan? (tr: Which sea is in southwest of Taiwan?) +QGsynth+trans (target language = ar) §(dω) ∑LJ LZ (tr: What is the ocean seen on the western side of Taiwan?)
Answer 180 kilometres +QGsynth+trans (target language = de) Wie welt ist die RAF von Taiwan aus der sudlichen Küste von China? (tr: How far is the RAF from Taiwan from the southern coast of China?) +QGsynth+trans (target language = ar) §(dω) ∑LJ LZ (tr: How long are the Taiwan Islands from the coast of China?)
+ +Table 13: Paragraph 3 and different questions analysed during out human evaluation. + +![](images/41f77198f1bb7421866275cc0f773ce8823252c806790bd23f5d7f0468369129.jpg) +Figure 3: SQuAD-it + +![](images/cfa0981b19d572632d569aede272a24f72881fb28339d5a431d220bf37dc0808.jpg) +Figure 4:PIAF (fr) + +![](images/938224a2bf00d4240cf1a86f0287ea86243809059463bea41594ebb17add43f5.jpg) +Figure 5: KorQuAD + +# D Learning Curves for Unseen Languages + +We show on Figures 3,4,5 the results of three learning curves for respectively SQuAD-it, PIAF (fr) and KorQuad where the models are trained on different amount of synthetic questions in our All Languages setting. + +The synthetic questions are sampled among all the five languages in MLQA. The standard deviation over four different seeds for the sampling are displayed through the confidence interval (light blue) around the averaged main curves. We observe that for SQuAD-it and KorQuAD the performances increase significantly at the beginning, then remain mostly stable, while for PIAF (fr) the best performances are obtained with 100k of additional synthetic data, a slight improvement from 50k additional questions before starting to decrease. \ No newline at end of file diff --git a/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/images.zip b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..255d83593c04524caa3d3f91a3ce269645bda707 --- /dev/null +++ b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:500b629bb60e693e303484f69c60d51b810beb2cf1c539ef61b32194fb6fc279 +size 892820 diff --git a/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/layout.json b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a8a122d5ff339f1b5789bd10dfe47b677024fd7a --- /dev/null +++ b/syntheticdataaugmentationforzeroshotcrosslingualquestionanswering/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ec5c348dd1ab4e4fc514e2a6d9c7d4881337397f17659e00fb73200b51399dd +size 451048 diff --git a/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_content_list.json b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..813ca00dc15c5cd854c6ab7c9b16d6b8fef371c8 --- /dev/null +++ b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6727590a76465282e798f333716fd1ed185392a5679537eb5a32d9316bbfbc13 +size 81289 diff --git a/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_model.json b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_model.json new file mode 100644 index 0000000000000000000000000000000000000000..cee173901721ffeccf8b934bad4df5acc29179a3 --- /dev/null +++ b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:978a63dfd63fa0d5f143bcfe457ce9a11cfe3226f78f5dc25dda2cd70df675d3 +size 97023 diff --git a/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_origin.pdf b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..35c43eee93880bcf2aef93f11b6e345d6b4de7e8 --- /dev/null +++ b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/4eabcb84-bd8b-447d-948e-95d6f1362586_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a44d5e0493aac6436a7ced65b71c183c92c0c17dee5b4cbc7366e21a497eb8a +size 463011 diff --git a/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/full.md b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/full.md new file mode 100644 index 0000000000000000000000000000000000000000..35bf96ea1f61938b6b0af2b0b4b0aed25038f815 --- /dev/null +++ b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/full.md @@ -0,0 +1,289 @@ +# Synthetic Textual Features for the Large-Scale Detection of Basic-level Categories in English and Mandarin + +Yiwen Chen and Simone Teufel + +Department of Computer Science and Technology + +University of Cambridge + +CB3 0FD JJ Thomson Road UK + +{yc429,sht25}@cl.cam.ac.uk + +# Abstract + +Basic-level categories (BLC) are an important psycholinguistic concept introduced by Rosch et al. (1976); they are defined as the most inclusive categories for which a concrete mental image of the category as a whole can be formed, and also as those categories which are acquired early in life. Rosch's original algorithm for detecting BLC (called cue-validity) is based on the availability of semantic features such as 'has tail' for 'cat', and has remained untested at large. An at-scale algorithm for the automatic determination of BLC exists, but it operates without Rosch-style semantic features, and is thus unable to verify Rosch's hypothesis. We present the first method for the detection of BLC at scale that makes use of Rosch-style semantic features. For both English and Mandarin, we test three methods of generating such features for any synset within Wordnet (WN): extraction of textual features from Wikipedia pages, Distributional Memory (DM) and BART. The best of our methods outperforms the current SoA in BLC detection, with an accuracy of English BLC detection of $75.0\%$ , and of Mandarin BLC detection $80.7\%$ on a test set. When applied to all of WordNet, our model predicts that 1,118 synsets in English Wordnet $(1.4\%)$ are BLC, far fewer than existing methods, and with a precision improvement of over $200\%$ over these. As well as confirming the usefulness of Rosch's cue validity algorithm, we also developed and evaluated our own new indicator for BLC, which models the fact that BLC features tend to be BLC themselves. + +# 1 Introduction + +Rosch et al. (1976) introduced the concept of Basic Level Categories (BLC) to the psycholinguistic literature. She defined basic-level categories as the most general (inclusive) categories for which a concrete image can be formed, and hypothesised that the definition of concrete categories during + +![](images/f2f52cf5ff06e4a6f4cee539180b8524c24122e1545a1bb6d86c911579db4d1b.jpg) +Figure 1: Simplified Taxonomy of Concepts and Features. + +child development is based on semantic features of each individual in the child's perception. She performed separate human prediction experiments on shape, affordance (what she called motor program) and semantic features. Rosch also presented an algorithm for finding the level in a hierarchy where BLC concepts are located, based on an information-theoretically defined property called cue validity, which is calculable if one has access to semantic features for each concept. + +BLC categories are those that are maximally distinguished from their sibling categories by many features with strong distinctiveness. For example, in Fig. 1, the sibling BLC categories dog and cat have features such as good sense of smell and meows. Higher-level categories ("super") are more general and contain features such as uses metabolic exchange and does not perform photosynthesis, which are less distinctive because they apply to + +many individuals. When we look at the children of BLC ("sub"), we see that the features they contain are also less distinctive, but for the opposite reason: they are very specific and apply to few individuals. For instance, bulldog has few additional features that are not already covered by dog. This coincides with Rosch et al's definition of BLC as the highest category that allows for a visual image to be formed: we can hold an image of a dog in our mind, but not a single image of animal; animal is far too general. Rosch et al also connect BLC with an early age of acquisition, a claim that we will use operationally in this paper. + +Her discovery was enthusiastically followed up in the fields of psychology (Langacker, 1988; Barsalou, 1991), psycholinguistics (McRae et al., 2005), and sparked a plethora of theoretical (Mervis, 1987; Murphy, 2004; Győri, 2013) and experimental work (Roberts and Horowitz, 1986; Markman and Wisniewski, 1997; Green, 2003). In addition, modern NLP and computer vision research have also found the concept of BLC useful. Orhan et al. (2020) improved the accuracy of video categorisation, using a dataset containing 12 BLC. Mathews et al. (2015) applied BLC to visual concepts, which achieved good performance in the task of picture-to-word generation. Recently, the concept of BLC has also been used in word sense disambiguation (Legrand, 2006), visual object recognition (Wang and Cottrell, 2015) and transfer learning (Min et al., 2020). + +However, Rosch's work did not lend itself to experimental verification, as least not on a large scale. Rosch tested various "grounded" properties of BLC experimentally, for instance shape recall and recognition by semantic features, but her (carefully controlled) dataset only contained 9 superordinate categories and 27 BLC (90 concepts in total), its hierarchy being based on category norms (Battig and Montague, 1969; Van Overschelde et al., 2004). But what if we want to detect BLC in the large, say within most concepts occurring in a language? This would require a large-scale taxonomy such as WordNet (WN)(Miller, 1995), and indeed WN has been used for the only extant large-scale BLC study to date. But one of the challenges in verifying Rosch's theoretical property cue validity is the general unavailability of semantic features for all concepts used in language. + +Another obstacle to the automatic detection of BLC is the vague definition of the concept itself. + +While people's intuition tells us that BLC must exist, there is no fixed definition of exactly what makes a BLC. All that a researcher has to go by are a few dozen obvious examples for BLC. For instance, the original definition of "most abstract category for which a distinct image exists" is hard to operationalise. Therefore, there is no generally agreed-upon, large-scale set of BLC available to downstream research like video classification (Orhan et al., 2020). In this work, we address this gap by proposing a method of large-scale detection of BLC which is based on synthetic textual features. + +Since the 1970s, an empirically-defined source of potential features was introduced in the form of semantic feature norms (Rosch and Mervis, 1975; Ashcraft, 1978; McRae et al., 2005; Vinson and Vigliocco, 2008; Devereux et al., 2014; Buchanan et al., 2019). In this methodology, semantic features connected to a concept are elicited and collated from many human subjects. + +With the advent of distributional semantics methods, it has become possible to automatically generate semantic features resembling human features. Frassinelli and Keller (2012) showed that features generated from models such as Strudel (Baroni et al., 2010) are cognitively plausible; such features are able to represent the semantic context well enough to enable priming. More recently, powerful neural language models such as BERT and GPT have been shown to capture large-scale semantic contexts even better. The availability of different distributional semantic models allows us to empirically test whether Rosch et al.'s idea of cue validity holds true for a large set of concepts, as opposed to some clear-cut toy examples. We present an algorithm which has the ability to determine for each WN synset whether it is BLC or not, and compare three methods for generating synthetic features that are used in our algorithm. + +This is not a new task: Mills et al. (2018) were the first researchers to perform at-scale BLC classification of all synsets in WordNet. They used several features to do so, including the depth of a concept in WN. But solution differs from theirs because we create synthetic features and can thus directly use Rosch's original idea of cue validity to detect BLC. The features we create are rather different from those chosen by humans in semantic norm studies, and it is an empirical question whether our somewhat compromised form of cue + +validity is nevertheless able to identify BLC to a satisfactory degree. The answer given in this paper is that this is definitely so – for English, the precision of the algorithm more than doubles when our synthetic features are used, in comparison to the current state-of-the-art algorithm in BLC detection (Mills et al., 2018); for Mandarin, the results are numerically even better, although there is less evaluation data available yet. Overall, we interpret our results to mean that the features must capture important aspects of the concept. + +We also introduce a new indicator, which is based on the idea that if BLC are acquired in early childhood, then it's plausible that many of the features defining BLC could be BLC themselves, as these might be cognitively available to the child. We call this new indicator BLC/PageRank (BLC-PR), and realise it by a random walk in the WN graph. Section 4 presents our experiments for two languages: English, and Mandarin, where to our knowledge we are the first to present a BLC detection algorithm. + +# 2 Related work + +Cue validity (Brunswik, 1956) (CV) is defined as the conditional probability of a category given a feature. The cue validity of a specific category is the sum of all cue validity scores for each attribute of this category. Rosch et al. (1976) hypothesized that BLC have higher cue validity scores compared to other categories. + +There is some disagreement in the literature as to the borderline between BLC and other categories (Tanaka and Taylor, 1991) and the order of acquisition of BLC and superordinate categories. Rosch claimed that children learn BLC concepts earlier than other concepts, but Mandler produced evidence that only partially supports this statement. While the best performance in children across all ages was indeed for BLC, Mandler also found that some children were responsive to the superordinate and contextual categories (e.g. kitchen) very early on, even at only 12 months old. Our own study of the AoA list by (Kuperman et al., 2012) confirms that some superordinate categories such as "plant" and "furniture" are learnt before the age of 5. Other factors may play a role too: Langacker (1988) claimed that objects that lend themselves best to becoming BLC are those that are complex and possess structured information. There is also disagreement in the literature about the BLC-like + +superordinates in natural kinds such as fish, tree and bird, which Rosch counts as superordinates, but several researchers including ourselves consider BLC (Markman and Wisniewski, 1997). + +We will in this work rely on existing semantic feature norms derived experimentally. McRae et al. (2005) provided norms for 541 concepts (living and non-living objects) which they consider BLC. The norms were collected using 725 participants. Buchanan et al. (2019) extended these feature norms into 4,436 concepts with combination of terms from Vinson and Vigliocco (2008), who collected norms of verbs as well; however, Buchanan et al's list no longer attempts to include only BLC, but additionally included both superordinates and subordinates. Bulat et al. (2017) used 2,526 features from McRae et al. (2005)'s semantic norms to build semantic representations for metaphor identification. + +Motivated by the lack of large-scale feature norms, Frassinelli and Keller (2012) tested the performance of distributional semantic vector space (Baroni et al., 2010) for the task of generating properties for concepts in a visual world experiment. They measured eye fixations when participants looked at target concepts and established distracting contexts designed for priming participants. To create the contexts, they used three features generated by a distributional model. They observed that participants fixate on the target concept when listening to both the target and competitor word, and were thereby able to prove that the features automatically generated successfully biased the participants and therefore expressed the desired contexts sufficiently well. + +Mills et al. (2018) introduced a rule-based system for the detection of BLC via WordNet (Miller, 1995) and external knowledge such as frequency of words in Brown and Gutenberg corpora. When measured on a small test set of obvious cases from the literature, their model achieved an accuracy of $77\%$ . However, when run on the entire WN, it predicted that 13,082 synsets out of the total 82,115 synsets $(16\%)$ are BLC. This number seems far too high, and indeed, when they estimated the accuracy of their BLC detection on a subset of those 13,082 synsets, it was found that only $10.4\%$ are true positives. Their prediction was therefore that the entire WN contains only around 1,620 synsets. We can see from this experiment that the true difficulty in the BLC detection task may lie in achieving high + +
IndicatorHypothesis
Word 2 VecBLC might profit from a representation of their semantic context.
Word Length in charactersBLC are expected to be expressed in short words, as they were presumably forged early in human cultural development.
Corpus FrequencyBLC should be overall frequent in language.
Age of AcquisitionBLC are expected to be acquired early in life.
Depth in WNBLC have been hypothesised to be at medium level in WN (Mills et al., 2018).
Concreteness RatingBLC must be concrete concepts.
Number of Sem. FeaturesBLC should have more semantic features than their subcategories or superordinate categories.
Cue-ValidityBLC should have high cue validity values (Rosch et al., 1976).
BLC/PageRank ValueThe features of BLC should of- ten be BLC themselves (our novel claim).
Number of strokes(Mandarin only): Characters expressing BLC concepts should have fewer brush strokes.
+ +Table 1: Our Bilingual Indicators for BLC detection. + +precision. + +# 3 Approach + +We aim to identify BLC in English and Mandarin by more closely following Rosch's theoretical approach; our target is to directly test whether using the properties suggested by her helps in large-scale BLC detection. We recast the problem as a supervised ML task, in contrast to the rule-based system by Mills et al. (2018). We also want to test whether other theoretical hypotheses about BLC can be tested if suitable semantic features are available. We use the indicators listed in Tab. 1, six of which have been used in earlier work or are obvious. The remaining two indicators are somewhat more involved in independently worthy of study: one indicator simulates Rosch's cue validity concept, and the remaining one called BLC-PR is due to us. It follows the notion that if BLC are central, early-learnt concepts, then maybe the features associated with them could also be BLC themselves, which might help and reinforce the early acquisition of these concepts. We simulate this indicator using the PageRank algorithm. + +The indicators word length, corpus frequency, age of acquisition (AoA), concreteness rating and WN depth can be derived for English as well as for Mandarin, and do not require any semantic features. Word length means the number of letters + +and characters, for English and Mandarin respectively. Number of brushstrokes is only defined for Mandarin and expresses the intuition that culturally older, more important concepts would exhibit fewer brush strokes. We extracted the English frequency data from the American part of the Google Books corpus and Chinese one from the Tencent AI Lab embedding corpus (Song et al., 2018). Concreteness ratings were drawn from a list of 3 million rated word forms (Köper and im Walde, 2017), where each word has been given a 10-point rating from abstract (1) to concrete (10). We expect this to help in classification as BLC are by definition never abstract. We also use a 300-dimension standard Word2Vec representation (Mikolov et al., 2013) for English and 200-dimension one for Mandarin (Song et al., 2018). Despite not having interpretable dimensions, we hypothesise that such representations may capture context in an indirect manner. + +We applied Chinese Open WordNet (COW) (Wang and Bond, 2013), which was built on top of the synsets of English WN, to match Mandarin concepts to their English counterparts. COW contains 42,312 synsets, 27,888 of which are nouns, compared to the 82,115 nouns in WN. The acquisition age indicator we use is based on test-based age of acquisition norms of 30,000 words/senses with information of the age when children learned this word/sense (Kuperman et al., 2012)1 We successfully matched 22,138 of our (bilingual) WN synsets to the AoA test words/senses, as well to their concreteness ratings. + +The remaining indicators depend on our method of generating semantic features. We will therefore first describe how we generate the synthetic semantic features. + +# 3.1 Generation of Synthetic Features + +We test three feature generation methods against each other: Wikipedia Contexts, Features generated by DM, and BART. In all three methods, we only keep those semantic features which are nouns. + +The online encyclopedia Wikipedia has become one of the world's foremost sources of any kind of knowledge on anything, and it therefore provides a mirror of how humans understand (and maybe + +
sharkhouse
Wikipediagroup, skeleton, gill, side, head, fin, clade, selachiibuilding, complexity, hut, structure, wood, masonry, concrete, material, plumbing, heating
DMwhale, grouperview, office, countryside, croft, museum, family, estate, builder, gable
BARTgill, egg, whisker, swim, slime, tail, fish, scale, animal, fin, waterrelax, family, place, live, friend
Humananimal, carnivore, danger, fin, fish, ocean, predator, tooth, seabathroom, bedroom, brick, door, family, home, kitchen, place, roof, room
+ +Figure 2: Synthetic features generated by three models, and human features. + +form) concepts. We exploit this in using particular areas of the web pages which describe the concepts a Wikipedia page is dedicated to. We extract from these contexts all nouns except the concept itself2. + +The second type of synthetic feature we use comes from the distributional space Distributional Memory (DM), which is a more recent, larger and better-performing version of the afore-mentioned Strudel (Baroni and Lenci, 2010). DM uses relations and co-occurrence between words to describe words. It extracts distributional information from corpora (which are POS tagged and parsed) based on a set of weighted word-link-word tuples. Given a concept, DM outputs a series of triples, consisting of the concept itself, the generated feature, and the relation between the concept and the feature. + +BART provides our third set of synthetic features. Having access to the parallel data of concepts and their human-provided features (McRae et al., 2005; Buchanan et al., 2019), we can fine-tune the pretrained BART base model (Lewis et al., 2019) as a neural machine translation task to generate semantic features for words directly. + +How many such synthetic features we should use for our research is unclear. BART is able to learn how many features should be generated, but for the other two sources, we have to intervene by approximating the number of features using the only source we have available for this, the feature norms. We use the distributions of feature norms in Buchanan et al. (2019) to approximate the number of our synthetic features for Wikipedia (by thresholding the number of words) and for DM (by thresholding the scores given, after softmax-normalising them). + +Examples of the synthetic features created by our English method for concepts "shark" and "house" are shown in Fig. 2, and contrasted with those created by humans (from Buchanan's feature norms). + +We see that the features are very different in nature, but still appear to capture some important information about the concepts. We notice that Wikipedia often defines biological concepts by referring to technical terminology and formal zoological classifications; for example, "cetacea" and "Delphinidae" are features of the concept "dolphin". Such features are not commonly known and would be unlikely produced by a human in an elicitation experiments such as Buchanan et al's. Apart from these technical terms, Wikipedia features tend to contain a small number of high-quality features. + +DM, in contrast, favours paradigmatic concepts as features, i.e. those where the features and concept are likely to appear in a same context in a sentence. For instance, "whale" is a paradigmatic feature of "shark". At first glance, BART's synthetic features seem to be of the highest quality, although there are still some features that are less useful for our task, such as very abstract ones which carry little information, such as "noun" and "one". + +Even if the synthetic features appear to be quite unlike human-generated features, they can still capture information that is valuable for subsidiary tasks. In the fully automatic evaluation reported in section 4.2 using different data, we measure to which degree they contribute towards the final task of learning to detect BLC in the wild. + +# 3.2 Generation of Indicators for ML + +Once we have the list of features for each method, we calculate the feature-dependent indicators as follows: + +Number of Features - This can be directly read off. + +Cue Validity (CV) - If a category has $n$ features, $f_{i} \subset \{f_{1}, f_{2}, \dots, f_{n}\}$ , the cue validity for the given category is the sum of probability of $f_{i}$ . + +BLC-PR - Each concept and feature are treated as a node, and an edge is connected between nodes if the feature belongs to one concept. We set the initial weight of each node is 1 and the damping + +factor is set to 0.85. By calculating PageRank using a random walk, the importance (or "BLC-ness") of nodes are estimated. + +We will now sanity-check the quality of the synthetic features in isolation, under the assumption that the human features in combination with Cue Validity and BLC-PR should work best at determining BLC (and the assumption that CV and BLC-PR work). Keeping all other aspects constant, we want to find out which of the synthetic features, if any, is the most useful at learning BLC at large. To do so, we use a carefully constructed development set with 40 English concepts, shown in Table 2. For this set, we have human features available. Following our own intuitions, we hand-picked 10 concepts each for abstract, subordinate, superordinate and BLC concepts from the concepts provided by Buchanan et al. (2019). + +Of course, as we treat senses and not word forms, WSD is an issue for us. For the small development dataset, we perform manual WSD on all 340 features and 40 concepts, but in the automatic mode, we perform WSD by always choosing the first-sense synset for each concept3. + +We can use the small dataset of 40 concepts to find out how much the synthetic features resemble the human features, which we consider our gold standard, and each other. We use the Jacquard Distance for doing so (Jaccard, 1912). This confirms BART's relative advantage; its features are closest to the human GS by this metric (0.069), more than Wikipedia (0.054) and DM (0.015), but overall we have to concede that neither of the synthetic features is close to the humans. Compared to each other, BART is most dissimilar to DM (0.007), and most similar to Wikipedia (0.036), whereas DM + +
SourceCategoryCue ValidityBLC-PR
HumanSub6.78 ± 3.864.51 ± 0.14
Basic13.14 ± 6.344.72 ± 0.37
Super4.16 ± 2.904.51 ± 0.14
Abstract3.09 ± 1.624.45 ± 0.08
WikiSub8.04 ± 2.123.51 ± 0.73
Basic8.86 ± 2.014.05 ± 0.96
Super7.55 ± 2.444.03 ± 1.10
Abstract7.83 ± 2.384.02 ± 1.03
DMSub9.33 ± 14.284.62 ± 6.17
Basic5.30 ± 3.132.97 ± 1.45
Super7.01 ± 2.423.63 ± 1.09
Abstract12.44 ± 13.115.93 ± 5.72
BARTSub5.23 ± 5.033.88 ± 3.08
Basic7.02 ± 4.615.49 ± 3.10
Super3.61 ± 1.842.85 ± 1.12
Abstract3.60 ± 1.732.79 ± 1.18
+ +and Wikipedia resemble each to a degree of 0.016. + +We next perform a sanity check based on our development set4 What we expect to see in this sanity check is that BLC categories should receive the highest values in both of our features tested here, CV and BLC-PR. Tab. 3 shows that indeed the human features best exhibit this advantage of BLC for both features, and for CV, the performance is even significantly5 better than all other categories, despite the small size of this dataset. This is reassuring. + +Of the synthetic features, BART performs best in distinguishing BLC, although the difference between BLC and sub is not significant here, whereas differences between BLC and abstract/super are significant. + +Wikipedia's performance is adequate; it at least ranks BLC highest values in both CV and BLC-PR, although without significance to the other concept categories. By this measure, DM is disastrous as it often making the wrong predictions, in some cases even significantly so. + +From the human results, we see that PR and CV are good indicators, and from the synthetic results we see that while Wikipedia and BART work well, DM is inadequate for detecting BLC. However, Wikipedia-created features are only available if the concept has its own Wikipedia page, which is not the case for $9.8\%$ of all WN synsets. + +We therefore decided to use BART to perform the synthetic feature generation in the following experiments. For our Mandarin experiment, we + +Table 3: CV and BLC-PR Scores (Development Set). + +
SubBLCSuperAbstract
sharkhousemachinevacation
zebradooranimalpatience
cactusshoesportapology
squirreltrainplantrhyme
backpacktreetoyyear
couchhammerfruitfreedom
submarinebirdmusical instrumentlove
castlebicyclevegetablechemistry
windmillsnakefoodenvironment
dolphinchairfurnitureexperiment
+ +Table 2: Our BLC development set. + +automatically translated the Buchanan norms into Mandarin using Google Translate and found it to be accurate enough for our purposes (A manual check of 20 pairs of concepts and features (145 words in total) achieved an accuracy is $95.3\%$ .) We use the multi-lingual version of BART called mBART (Liu et al., 2020), together with the Mandarin Buchanan list, to generate features for Mandarin concepts; examples are given in Fig. 3. We measured the similarity of features between our gold standard (Buchanan et al.'s list) and synthetic Chinese features by using Song et al's (2018) Word2Vec method, which resulted in a value of 0.8298. + +
鲨鱼shark房子house
狩猎hunt, 水water, 鱼fish, 游泳swim, 吃eat, 墨水ink, 海sea, 咸水saltwater, 射击shoot, 海鲜seafood, 人human, 煮cook生活life, 属性attribute, 草grass, 人类human, 泥mud, 滑雪skate, 酒店hotel, 木材wood, 地方place, 稻草straw, 首页home, 生成generate
gill, egg, whisker, swim, slime, tail, fish, scale, animal, fin, water
+ +Figure 3: Mandarin (top) vs English (bottom) features. + +It is reassuring that there is an overlap in features between the languages, and these features happen to be very central to the concepts ("swim, water, fish" for "shark" and "place", "life/live" for "house". Nevertheless, there can be large differences in the number of features generated. Although both systems were fine-tuned with near-identical data (the Buchanan list and its translation), they were pretrained differently: BART only with English data; mBART with data from 25 languages. mBART's training possibly resulted in more synthetic features as different cultures relate a concept to a more varied set of features. + +# 4 Experiment + +We perform an experiment in learning the BLC status for every noun synset in WN based on the set of indicators introduced in section 3, using different generation methods for the synthetic features. Our baseline is the method by (Mills et al., 2018), which uses no semantic features. The working hypothesis is that the use of semantic features should help BLC detection, even if the generation of the features is sub-optimal. + +Evaluation is performed in two ways: 1. for a small test/train set, BLC detection is reported in + +terms of F-measure 2. for all synsets in WN, we perform a separate precision study using human subjects, in the same way as Mills et al. (2018). + +# 4.1 Classifier + +We use SVM (Cortes and Vapnik, 1995) to create a classifier. As indicators, we use those listed in Table 1; this results in a 309 indicator vector, most of which come from the raw W2V vector. We classify into the 4 target classes BLC, Abstract, Sub, Super. We convert these into what is effectively a binary classification BLC vs. Non-BLC and report the F-measure of BLC. We could have also performed binary classification directly with our SVM, but we empirically found that the 4-way classifier achieved a better performance. As baseline, we use the original implementation by Mills et al. (2018) on our dataset. + +# 4.2 First Evaluation: Test/Train Data + +We built a separate dataset of 433 concepts for fully automatic training and testing (cf. Tab. 4). This dataset is larger than our sanity-check dataset, but does not have the advantage of having human features in all cases. To create this larger dataset, we combined the BLC based on previous psychological experiments by Rosch et al. (1976) and Markman and Wisniewski (1997), with our own subordinate and superordinate terms, as these are not available from the literature beyond a handful of examples. For subordinate terms we distinguish animals and plants (we used biological concepts from lower-level biological classifications) and artifacts (here, we used the bottom level of the Google Product Taxonomy6). Superordinate terms are hardest to find as the number of collective terms at a high level of abstraction is limited. We expanded the superordinate concepts from Mills et al. (2018) by 26 additional collective categories such as spices and furniture, which we derived by inspecting the top-levels of the Google Product Taxonomy areas and thinking of collective terms in areas such as cooking, food, hobbies and engineering, as well as animal and plant categories. We then added 192 abstract concepts based on the Concreteness Rating list. Other than these abstract concepts, no information from the indicators went into the creation of the dataset. We then used BART to compile synthetic features for each concept as explained in + +
CategoryTrainDevTestTotal
Subordinate204540105
Basic32262886
Superordinate14171950
Abstract484698192
Total114134185433
+ +Table 4: BLC test/train dataset (English). + +
MethodPrecisionRecallF1-score
Mill et al's0.860.530.66
Ours (English)0.860.670.75
Ours (Mandarin)0.820.810.81
+ +section 3. The only manual work we performed on the test/train dataset is that we sense-disambiguated concepts by linking them to WN synsets, as before, although we did not do so for the synthetic features. + +On the English test/data set, our best system achieves an F-score of $75\%$ , compared to $65.75\%$ by Mills et al., cf. Tab. 5; the difference is significant7. Our best model uses all features except Word2Vec and brush strokes. Our system gains its advantage by having a far higher precision, while lagging somewhat behind on recall. Overall, these results show that BLC detection can be substantially improved by using synthetic features, in particular by increasing precision. + +# 4.3 Second Evaluation: Full WN + +When run on the entire WN, our system classifies 1,118 synsets as BLC, 48,033 as abstract, 3,710 as superordinate terms, and 29,254 as subordinate terms. The number of our BLC predictions is far below that of Mills et al. at 13,082. + +In order to evaluate the precision of the classifier, we follow the methodology in Mills et al. (2018) and run the classifier and baseline on all synsets in WN. From the lists of synsets labelled as BLC by the two classifiers, we then randomly choose 250 concepts each, and ask three English native speakers to consider each concept and label them as BLC or not. Our instructions tell annotators that a BLC concept should fulfill both of the following two conditions: + +- You should be able to create a clear visual image of the concept in your mind. +- A 4-year-old child should in your opinion be likely to know the concept. + +Tab. 6 contains 20 randomly chosen examples of the lists the annotators saw; bold face means that at least one annotator marked as BLC. The agreement + +${}^{7}$ Significance was determined using a two-tailed permutation test with $\mathrm{R} = {10},{000}$ and significance level $\alpha = {0.01}$ . + +Table 5: Performance of BLC detection on Test Set. + +
Our method (7/20): +sweater, trooper, dumbbell, flute, Chihuahua, amusement park, mohair, house, airfield, mulled wine, car, passenger, cage, pig, cab, handkerchief, wallet, pasta, headlight, videocassette
Mills et al.'s method (4/20): +attendance, inconsistency, membrane, contact dermatitis, call, egg, flower, red blood cell, infix notation, ringside, bud, conscription, mender, carving, capacitance, gametophyte, spittle insect, megapode, rock, wisteria
+ +on English BLC among the judges was measured at $\mathrm{K} = 0.58$ ( $\mathrm{N} = 500$ , $\mathrm{n} = 2$ , $\mathrm{k} = 3$ ), which can be considered as substantial, particularly as there was no annotator training and as the concept of BLC is not well-defined in the literature. Amongst the three annotators, the best pair of annotators showed agreement at $\mathrm{K} = 0.64$ ( $\mathrm{N} = 500$ , $\mathrm{n} = 2$ , $\mathrm{k} = 2$ ). The agreement on Mandarin BLC was slightly lower than for English at $\mathrm{K} = 0.55$ ( $\mathrm{N} = 250$ , $\mathrm{n} = 2$ , $\mathrm{k} = 3$ ). + +The precision achieved by our system is $45.0\%$ vs. $21.0\%$ achieved by Mills et al's, an improvement of over $200\%$ . Our algorithm is substantially better at removing non-BLC from our BLC predictions. In an informal assessment of the non-BLC predictions that were encountered on both lists, most of them are subordinate terms, but our list contains fewer of these. + +# 5 Further Analyses and Discussion + +We next performed some ablation studies (Tab. 7) to investigate which indicators performed better than others. All features on their own are significantly different from the baseline (no features). Concreteness on its own performs well, but this is somewhat uninteresting as BLC are never concrete (and as the list of concrete distractors was created from this indicator). We also see that BLC-PR on its own performs well, while Cue Validity on its own does not. Word2Vec stands out because while quite strong on its own, it is the only feature that decreases results. Because it tends to group + +Table 6: BLC prediction examples; bold = correct. + +
MethodLeft OutOn Own
- Word Length70.044.4
- Corpus Frequency70.035.8
- Acquisition Age73.029.4
- Depth in WN69.839.2
- Concreteness62.561.5
- Number of Features68.814.3
- Cue Validity66.717.0
- BLC-PR64.547.3
+ W2V66.764.0
Best system: all except W2V: 75.0
+ +Table 7: Results of Two Ablation Studies, in F1% + +words under similar context, subordinate categories are likely to have high similarity score with their respective BLC, which actually hurts the performance of our classifier. BLC-PR also plays a beneficial role in detecting BLC as we expected, proving that BLC concepts tend to overall have more BLC features. Tab. 10 (appendix) shows the top 20 performing set of synsets for BLC-PR, which reveals that 7 out of these are abstract. This may be caused by the fact that abstract concepts have many abstract features. + +We are particularly interested in the performance of cue validity, as it has never before been tested in a large-scale experiment. On its own, cue validity performs rather disappointingly and in particular misclassifies abstract concepts as BLC (cf. Tab. 9), but it manages to increase results in tandem with the other features. Rosch devised cue validity as a metric in taxonomies of concrete objects; she never considered abstract concepts. Therefore, cue validity may only work well in the categorization of concrete objects, not in the distinction between abstract and BLC concepts. This is a particular project with experiments in WN, as abstract concepts also occupy a large part of nouns in WN (48,033 abstract synsets according to our classifier). + +Given that BLC definition is debated in the literature, our inclusion of the likely age of acquisition into the definition given to the judges deserves some justification. Mills et al. (2018) used only the first part of Rosch et al. (1976)'s original definition of BLC, concerning the concrete image of the category and inclusivity, but left out the second part of her definition concerning early age of acquisition. We included the second part of her definition because we wanted a definition that is easier to convey to judges. In a separate experiment, we verified the link between Age of acquisition and BLC in order to empirically estimate the age we would use in our instructions. Using the list provided by Kuperman et al. (2012) we were able to verify that most of the concrete concepts a 4 year old child learns are BLC, if we take the list of 86 BLC defined by Rosch as our gold standard: $88\%$ of these Rosch-BLC are known to children of that age, although only $26\%$ recall is achieved. Higher ages of acquisition are listed in Tab. 8. We are therefore fairly confident that the definition of BLC we employed in our experiment is easily understandable and realistic. + +
AgePrecisionRecall
488%26%
584%50%
681%67%
771%74%
+ +Table 8: Coverage of Rosch's BLC list at different ages in vocabulary. + +# 6 Conclusion + +How to determine what is a BLC and what not, from first principles, is a long-standing problem in computational psychology. We have presented here the beginning of a methodology for studying which aspects of BLC might contribute to their BLC-ness: the fact that they are universally recognised, learned early in language development, and have certain information-theoretic properties about categorisation as a language-wide phenomenon. In particular, we studied the generation of synthetic semantic features resembling human semantic norms from corpora, and which relationship these features have to BLC. We showed that even imperfect features as available with current NLP techniques could serve to improve the detection of BLC. + +We find that BART, a methodology borrowed from neural machine translation, is capable of generating indicators that are able to improve the detection of BLC. This also contributes a potential solution to the general problem of providing feature norms automatically at scale, although that would also necessitate additional experiments about the stand-alone quality of the features. What we were able to empirically validate, however, is that they are good enough to substantially improve the SoA in BLC detection. + +We were also able to substantiate some longstanding claims in psycholinguistics about the validity of cue validity, first proposed by Rosch (1973). Our own hypothesis, that BLC concepts tend to be described by semantic features that themselves are BLC, was also validated to a certain degree. We hope that the current work opens the door for much-needed further research into synthetic semantic features. In future work, we plan to include visual features into our BLC detection system. Landau et al. (1988) found that in early child vocabulary development, the shape of objects is more important than other features such as size, colors and texture. We also plan to pay more attention to methods that can distinguish subordinate terms from BLC. + +# Acknowledgements + +We would like thank Guy Aglionby, James Thorne, Yimai Fang, Kangyu Ji and anonymous judges for their participation in the evaluation. + +# References + +Mark H Ashcraft. 1978. Property norms for typical and atypical items from 17 categories: A description and discussion. Memory & Cognition, 6(3):227-232. +Marco Baroni and Alessandro Lenci. 2010. Distributional memory: A general framework for corpus-based semantics. Computational Linguistics, 36(4):673-721. +Marco Baroni, Brian Murphy, Eduard Barbu, and Massimo Poesio. 2010. Strudel: A corpus-based semantic model based on properties and types. Cognitive science, 34(2):222-254. +Lawrence W Barsalou. 1991. Deriving categories to achieve goals. Psychology of learning and motivation, 27:1-64. +William F Battig and William E Montague. 1969. Category norms of verbal items in 56 categories: a replication and extension of the connecticut category norms. Journal of experimental Psychology, 80(3p2):1. +Egon Brunswik. 1956. Perception and the representative design of psychological experiments. Univ of California Press. +Erin M Buchanan, Kathrene D Valentine, and Nicholas P Maxwell. 2019. English semantic feature production norms: An extended database of 4436 concepts. Behavior research methods, 51(4):1849-1863. +Luana Bulat, Stephen Clark, and Ekaterina Shutova. 2017. Modelling metaphor with attribute-based semantics. +Corinna Cortes and Vladimir Vapnik. 1995. Support-vector networks. Machine learning, 20(3):273-297. +Barry J Devereux, Lorraine K Tyler, Jeroen Geertzen, and Billi Randall. 2014. The centre for speech, language and the brain (cslb) concept property norms. Behavior research methods, 46(4):1119-1127. +Diego Frassinelli and Frank Keller. 2012. The plausibility of semantic properties generated by a distributional model: Evidence from a visual world experiment. In Proceedings of the Annual Meeting of the Cognitive Science Society, volume 34. +Rebecca Green. 2003. Vocabulary alignment via basic level concepts. Final Report. +Gábor Győri. 2013. Basic level categorization and meaning in language. Argumentum, 9:149-161. + +Paul Jaccard. 1912. The distribution of the flora in the alpine zone. 1. New phytologist, 11(2):37-50. +Maximilian Köper and Sabine Schulte im Walde. 2017. Improving verb metaphor detection by propagating abstractness to words, phrases and individual senses. In Proceedings of the 1st Workshop on Sense, Concept and Entity Representations and their Applications, pages 24-30. +Victor Kuperman, Hans Stadthagen-Gonzalez, and Marc Brysbaert. 2012. Age-of-acquisition ratings for 30,000 english words. Behavior research methods, 44(4):978-990. +Barbara Landau, Linda B Smith, and Susan S Jones. 1988. The importance of shape in early lexical learning. Cognitive development, 3(3):299-321. +Ronald W Langacker. 1988. Women, fire, and dangerous things: What categories reveal about the mind. +Steve Legrand. 2006. Word sense disambiguation with basic-level categories. Advances in Natural Language Processing. Ed. Alexander Gelbukh, Research in Computing Science, 18:71-82. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2019. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461. +Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. 2020. Multilingual denoising pre-training for neural machine translation. Transactions of the Association for Computational Linguistics, 8:726-742. +Arthur B Markman and Edward J Wisniewski. 1997. Similar and different: The differentiation of basic-level categories. Journal of Experimental Psychology: Learning, Memory, and Cognition, 23(1):54. +Alexander Mathews, Lexing Xie, and Xuming He. 2015. Choosing basic-level concept names using visual and language context. In 2015 IEEE Winter Conference on Applications of Computer Vision, pages 595-602. IEEE. +Ken McRae, George S Cree, Mark S Seidenberg, and Chris McNorgan. 2005. Semantic feature production norms for a large set of living and nonliving things. Behavior research methods, 37(4):547-559. +Carolyn B Mervis. 1987. Child-basic object categories and early lexical development. *Concepts and conceptual development: Ecological and intellectual factors in categorization*, pages 201-233. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Distributed representations of words and phrases and their compositionality. arXiv preprint arXiv:1310.4546. + +George A Miller. 1995. Wordnet: a lexical database for english. Communications of the ACM, 38(11):39-41. +Chad Mills, Francis Bond, and Gina-Anne Levow. 2018. Automatic identification of basic-level categories. In Proceedings of the 9th Global WordNet Conference (GWC 2018), page 301. +Shaobo Min, Hongtao Xie, Hantao Yao, Xuran Deng, Zheng-Jun Zha, and Yongdong Zhang. 2020. Hierarchical granularity transfer learning. Advances in Neural Information Processing Systems, 33. +Gregory Murphy. 2004. The big book of concepts. MIT press. +Roberto Navigli and Mirella Lapata. 2009. An experimental study of graph connectivity for unsupervised word sense disambiguation. IEEE transactions on pattern analysis and machine intelligence, 32(4):678-692. +A Emin Orhan, Vaibhav V Gupta, and Brenden M Lake. 2020. Self-supervised learning through the eyes of a child. arXiv preprint arXiv:2007.16189. +Kenneth Roberts and Frances Degen Horowitz. 1986. Basic level categorization in seven-and nine-month-old infants. Journal of Child Language, 13(2):191-208. +Eleanor Rosch and Carolyn B Mervis. 1975. Family resemblances: Studies in the internal structure of categories. Cognitive psychology, 7(4):573-605. +Eleanor Rosch, Carolyn B Mervis, Wayne D Gray, David M Johnson, and Penny Boyes-Braem. 1976. Basic objects in natural categories. Cognitive psychology, 8(3):382-439. +Eleanor H Rosch. 1973. Natural categories. Cognitive psychology, 4(3):328-350. +Yan Song, Shuming Shi, Jing Li, and Haisong Zhang. 2018. Directional skip-gram: Explicitly distinguishing left and right context for word embeddings. 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 175–180, New Orleans, Louisiana. Association for Computational Linguistics. +J. Tanaka and M. Taylor. 1991. Object categories and expertise: Is the basic level in the eye of the beholder? Cognitive Psychology, 23:457-482. +James P Van Overschelde, Katherine A Rawson, and John Dunlosky. 2004. Category norms: An updated and expanded version of the norms. Journal of memory and language, 50(3):289-335. +David P Vinson and Gabriella Vigliocco. 2008. Semantic feature production norms for a large set of objects and events. Behavior Research Methods, 40(1):183-190. + +Panqu Wang and Garrison W Cottrell. 2015. Basic level categorization facilitates visual object recognition. arXiv preprint arXiv:1511.04103. +Shan Wang and Francis Bond. 2013. Building the chinese open wordnet (cow): Starting from core synsets. In Proceedings of the 11th Workshop on Asian Language Resources, pages 10-18. + +# A Appendix + +
SynsetCV score
depletion.n.016.44
starvation.n.016.44
nourishment.n.026.44
rationing.n.016.44
convenience.n.026.44
meal.n.026.44
diet.n.016.44
game.n.016.44
cook.n.01 + 113 others6.44
hit.n.014.16
underachievement.n.014.16
ennoblement.n.024.16
impression.n.094.16
handover.n.014.16
lynching.n.014.16
indemnification.n.024.16
dehumanization.n.014.16
body_english.n.014.16
child_neglect.n.014.16
cruelty.n.01 + 386 others4.16
+ +Table 9: Top cue validity values with example concepts. + +
SynsetTypeBLC-PR
person.n.01BLC1566
food.n.01Super935
animal.n.01Super564
type.n.01Abstract537
beak.n.01BLC445
fly.n.01BLC443
semliance.n.01Abstract427
feather.n.01BLC417
state.n.01Abstract384
bird.n.01BLC375
metallic_element.n.01Super360
pet.n.01Super345
seed.n.01Super330
zhou.n.01?321
fictional_character.n.01Abstract313
topographic_point.n.01Abstract307
chirp.n.01Abstract306
talk.n.01Abstract256
man.n.01.BLC251
wood.n.01BLC237
+ +Table 10: Top 20 Synsets ranked by BLC-PR; middle column shows our assessment of true category. \ No newline at end of file diff --git a/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/images.zip b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..30b1008d22ee4fec71562e74c969cb9496262766 --- /dev/null +++ b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:738178ad950ccde46501c2b4c32b547ea7255011c742d95191bf196373bc364a +size 532022 diff --git a/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/layout.json b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..02231cd647a259fadf9422544ee5d51e58f62e86 --- /dev/null +++ b/synthetictextualfeaturesforthelargescaledetectionofbasiclevelcategoriesinenglishandmandarin/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2f5a8c6d8786720a1eb0857dea4c563bad9907d0aeb0e352eedfd9628f25775 +size 319931 diff --git a/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_content_list.json b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e663544568bd7427b0821b21d520f49810b5db2f --- /dev/null +++ b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:511d6b47f3c2bf119cacadb4e3de48a3bc99407d21758b4f61186c7fe89449bc +size 62989 diff --git a/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_model.json b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_model.json new file mode 100644 index 0000000000000000000000000000000000000000..b6d8788dc6284f36505da0ce52b9d307df5f6a04 --- /dev/null +++ b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5855396db07de1bcefbf3b548b3640edeca5dbc1dfdbc2d16e53de521142192c +size 77297 diff --git a/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_origin.pdf b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..79076132db9bdda53a6314207ccb67d03ea83872 --- /dev/null +++ b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/2e8a442c-4932-4a58-b389-e769f76c23cb_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:299adcf384d774c8e755065b7d4510e4902a6364504093bca58c116aaa48eee3 +size 3776661 diff --git a/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/full.md b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/full.md new file mode 100644 index 0000000000000000000000000000000000000000..368e1b9bfe8fcf2273f3bea7628382885f50db77 --- /dev/null +++ b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/full.md @@ -0,0 +1,251 @@ +# Systematic Generalization on gSCAN: What is Nearly Solved and What is Next? + +Linlu Qiu $^{1*}$ Hexiang Hu $^{1\ddagger}$ Bowen Zhang $^{2}$ Peter Shaw $^{1}$ Fei Sha $^{1}$ + +$^{1}$ Google Research $^{2}$ USC + +# Abstract + +We analyze the grounded SCAN (gSCAN) benchmark, which was recently proposed to study systematic generalization for grounded language understanding. First, we study which aspects of the original benchmark can be solved by commonly used methods in multimodal research. We find that a general-purpose Transformer-based model with cross-modal attention achieves strong performance on a majority of the gSCAN splits, surprisingly outperforming more specialized approaches from prior work. Furthermore, our analysis suggests that many of the remaining errors reveal the same fundamental challenge in systematic generalization of linguistic constructs regardless of visual context. Second, inspired by this finding, we propose challenging new tasks for gSCAN by generating data to incorporate relations between objects in the visual environment. Finally, we find that current models are surprisingly data inefficient given the narrow scope of commands in gSCAN, suggesting another challenge for future work. + +# 1 Introduction + +Systematic generalization refers to the ability to understand new compositions of previously observed concepts and linguistic constructs. While humans exhibit this ability, neural networks often struggle. To study systematic generalization, several synthetic datasets have been proposed. Lake and Baroni (2018) introduced SCAN, a dataset composed of natural language instructions paired with action sequences, and splits in various ways to assess systematic generalization. Recently, Ruis et al. (2020) introduced the grounded SCAN (gSCAN) benchmark, which similarly pairs natural language instructions with action sequences, but further requires that instructions are interpreted within the context of a grid-based visual navigation environment. In this work, we analyze which aspects of + +gSCAN can currently be solved by general-purpose models, and propose new tasks and evaluation metrics for future research of systematic generalization on gSCAN. + +First, to understand which aspects of gSCAN can be addressed by a general-purpose approach, we evaluate a Transformer-based model with cross-modal attention. Cross-modal attention has been proven effective for other multi-modal tasks (Lu et al., 2019; Tan and Bansal, 2019; Chen et al., 2020). It achieves strong performance on a majority of the splits, surprisingly outperforming several "specialist" approaches designed for gSCAN (Heinze-Deml and Bouchacourt, 2020; Gao et al., 2020; Kuo et al., 2020). We analyze the remaining errors, finding that many of the errors appear to be related to the same fundamental challenge in systematic generalization of linguistic constructs studied in datasets such as SCAN, regardless of the visual context. + +Our analysis motivates the creation of an additional gSCAN task, which features a greater degree of complexity in how natural language instructions are grounded in the visual context. In this task, the agent needs to reason about spatial relations between objects expressed in language. We find this new task to be challenging for existing models. + +Finally, we also assess the data efficiency of our cross-modal attention model on gSCAN. We find that despite the simplicity of the world state and the grammar used to generate instructions, model performance on most splits declines significantly when provided with less than $\sim 40\%$ of the 360,000 original training examples. This suggests that we should consider sample complexity for future work. + +# 2 Cross-modal Attention Solves gSCAN, Almost + +Experimental Setup gSCAN has two types of generalization tasks: compositional generalization (CG) and length generalization. We focus on CG splits, which consist of a shared training set, 1 ran- + +
SplitSeq2Seq (2020)GECA (2020)Kuo (2020)Heinze (2020)Gao (2020)FiLM (2018)RN (2017)Ours
A97.69 ± 0.2287.6 ± 1.1996.73 ± 0.5894.19 ± 0.7198.60 ± 0.9598.83 ± 0.3297.38 ± 0.3399.95 ± 0.02
B54.96 ± 39.3934.92 ± 39.3094.91 ± 1.3087.31 ± 4.3899.08 ± 0.6994.04 ± 7.4149.44 ± 8.1999.90 ± 0.06
C23.51 ± 21.8278.77 ± 6.6367.72 ± 10.8381.07 ± 10.1280.31 ± 24.5160.12 ± 8.8119.92 ± 9.8499.25 ± 0.91
D0.00 ± 0.000.00 ± 0.0011.52 ± 8.18-0.16 ± 0.120.00 ± 0.000.00 ± 0.000.00 ± 0.00
E35.02 ± 2.3533.19 ± 3.6976.83 ± 2.3252.8 ± 9.9687.32 ± 27.3831.64 ± 1.0442.17 ± 6.2299.02 ± 1.16
F92.52 ± 6.7585.99 ± 0.8598.67 ± 0.05-99.33 ± 0.4686.45 ± 6.6796.59 ± 0.9499.98 ± 0.01
G0.00 ± 0.00-1.14 ± 0.30--0.04 ± 0.030.00 ± 0.000.00 ± 0.00
H22.70 ± 4.5911.83 ± 0.3120.98 ± 1.38-33.6 ± 20.8111.71 ± 2.3418.26 ± 1.2422.16 ± 0.01
+ +Table 1: Percentage of exact matches by various methods on gSCAN's compositional splits. + +
SplitHeld-out Examples
A: RandomRandom
B: Yellow squaresYellow squares referred with color and shape
C: Red squaresRed squares as target
D: Novel directionTargets are located south-west of the agent
E: RelativityCircles with size 2 and referred as small
F: Class inferenceSquares with size 3 and need to be pushed twice
G: Adverb k = 1Commands with cautiously
H: Adverb to verbCommands with while spinning and pull
+ +Table 2: Held-out examples on gSCAN's compositional splits. + +dom test set, and 7 test sets of specifically designed held-out examples such that examples differ from the training set in various ways, cf. Table 2. The input commands (e.g. walk to a red circle hesitantly) are synthetically generated. The agent observes the world state which is a $d \times d$ grid ( $d = 6$ in our case) with objects in various visual attributes. The output is an action sequence in the grid world (e.g. turn left, walk, walk, stay). We use exact match of the entire sequence as evaluation metric and report the mean and standard deviation across 5 runs. + +Our Model We implement a seq2seq model with 6 Transformer layers for the encoder and the decoder each. The architecture is similar to ViL-BERT (Lu et al., 2019), a popular multi-modal model for visual and text information fusion. On a high-level, the encoder's text stream reads the commands while its visual stream encodes the world states. There are cross-modal attention between the two streams. The details are in Appendix A. + +Results Table 1 shows the results by various models. Among them, FiLM and Relation Networks (RN) have achieved strong performance on other synthetic datasets for similar multi-modal tasks (Perez et al., 2018; Santoro et al., 2017). We also compare to models with specialized designs for CG or even gSCAN: a seq2seq model using data augmentation (Andreas, 2020), auxiliary loss (Heinze-Deml and Bouchacourt, 2020), task-specific architecture (Kuo et al., 2020; Gao + +![](images/5a2353eadb9700211993e6ce5059765475c9a8270f2ea1455db8bb08522e0fba.jpg) +Prediction:L_turnL_turnL_turnL_turn walk pull pull +Figure 1: A failure case from the H split (Adverb to verb). Prediction (left) differs from target (right) in action sequences, while correct object is identified. Missing actions are in red. + +![](images/5d357c5354c7136afd4a33c8d9e673fca0f6bd3418ae291314c975e937cf6ef2.jpg) +Target: L_turn L_turn L_turn L_turn walk L_turn L_turn L_turn L_turn pull L_turn L_turn L_turn pull + +et al., 2020). + +The cross-modal attention model outperforms others on 5 out 8 splits. We hypothesize it is more effective as we leverage cross-modal attention to allow bi-directional interaction between language instruction and visual environment, in contrast to prior works that only have uni-directional attention from text to visual context (Ruis et al., 2020; Kuo et al., 2020; Gao et al., 2020; Heinze-Deml and Bouchacourt, 2020). The additional attention from visual context to text improves grounding natural language instructions to the visual environment. However, on the "hard" splits (D, G and H), all methods struggle. + +Analysis First, we analyze in details the "hard" splits. Certain aspects of interpreting instructions are highly dependent on visual grounding. Most prominently, every instruction requires resolving the location of a referred object. However, adverbs such as cautiously or while spinning have the same meaning regardless of the visual context. Figure 1 shows one such example from the H split. The agent can successfully locate the target object but fails to combine the seen verb pull and adverb while spinning to generate the correct action sequence. Therefore, to assess the degree to which errors are caused by incorrect visual grounding, we calculate + +
SplitCol Match↑Row Match↑Full Match↑No Match↓
D32.91 ± 3.0245.30 ± 6.460.00 ± 0.0021.78 ± 3.58
G98.43 ± 3.4098.82 ± 2.5297.91 ± 4.500.66 ± 1.42
H91.23 ± 8.5392.90 ± 6.5488.16 ± 11.404.04 ± 3.71
+ +![](images/f5d05c1cdd76782c01fa8717906681a8915bc758ea88ea5c1c3940c46b85340e.jpg) +Command: pull a green small square hesitantly +Prediction: R_turn walk stay pull stay pull stay +Target: L_turn L_turn walk stay L_turn walk stay + +![](images/b6c103969f51f5849f2603b97a9929e3121b59b895b559fa3352202cf14af64e.jpg) +Command: walk to a blue square +Prediction: R_turn walk +Target: L_turn L_turn walk L_turn walk + +the exact match between the target position and the agent's final position. The results are shown in Table 3. Despite the low exact match of entire sequences, the agent can find the correct targets more than $90\%$ of time for two adverb splits (G, H). For the novel direction split (D), the direction "south west" is not seen during training. Similarly to Ruis et al. (2020), we find that the correct row or column is often selected, but not both. By analyzing attention weights, Ruis et al. (2020) attribute this as a failure to generate novel combinations of actions, not necessarily to identify the correct target object location, similar to our findings from visualizing attention weights in Figure 2. Therefore, we hypothesize that for these three splits (D, G, and H), the primary remaining challenge for the cross-modal attention model is not necessarily related to visual grounding. + +Next, we analyze the splits (A, B, C, E, and F) where the cross-modal attention model performs well. Table 4 contrasts several variants of our model. We notice that removing decoder's textual attention (i.e., $-\mathrm{T}$ ) has virtual no significant change. On the other end, removing visual attention $(-V)$ causes significantly worsened performance on E split. Removing cross-modal attention $(-X)$ significantly degrades all splits, highlighting the benefit of cross-modal attention. + +Table 3: Percentage of exact matches of target position on splits the cross-modal attention model fails. For the novel direction split (D), the agent can end up at correct row or column around $80\%$ of the time. For the adverb splits (G, H), the agent can usually find the object, but fails to generate action sequence with correct manner. + +
SplitOurs-V-T-X
A99.95 ± 0.0299.73 ± 0.2799.96 ± 0.0196.69 ± 4.32
B99.90 ± 0.0697.55 ± 2.5795.65 ± 5.4831.42 ± 11.39
C99.25 ± 0.9197.71 ± 1.6996.07 ± 4.6132.39 ± 6.95
E99.02 ± 1.1687.67 ± 10.6996.04 ± 5.1543.19 ± 22.82
F99.98 ± 0.0199.85 ± 0.2499.98 ± 0.0196.50 ± 4.72
+ +Table 4: Ablation studies of our model on gSCAN (-V, -T, and -X: removing decoder's visual, decoder's textual, and encoder's cross-modal attentions respectively). + +![](images/e32b62a343ec9cb944d8a1454041c6f230efeffaaa25ee74331b645f7f766a5d.jpg) +Figure 2: Visualizations of predictions with attention weights for novel direction (D) split. The darker the grid, the higher the attention score. + +![](images/5fbbcc6d10d267b6334a4dd366341b8f5ce8f169246b798ad8c0febe8502b129.jpg) +Figure 3: Training and testing examples for spatial relation splits. The agent is shown as a pink triangle. The agent has seen relative position "west" (left) and "south", "east", "south east" (in other examples) during training and needs to generalize to "south west" (right) during testing. + +# 3 Grounded Spatial Relation CG + +Proposed Task Given our analysis suggesting that many of the remaining challenges for gSCAN may not necessarily be related to visual grounding, we propose an additional task that features a greater degree of complexity in how natural language instructions are grounded in the visual environment. We hope this will complement the original gSCAN tasks as a useful assessment of systematic generalization in grounded language understanding. + +The new data we create will contain language expressions that refer to target objects along with their relations to a second referenced object. We use two types of relations: next to and relative positions such as north and west. As an example, we can have expressions such as a blue square next to a red circle or a blue square north of a red circle. + +To ensure that interpreting the spatial relation is necessary to correctly identify the target object, we create visual distractors in the environment. In the above examples, a blue square that is north of a magenta circle would be a distractor to the intended blue square which is next to the red circle. The existence of visual distractors will force the agent to examine the correspondence between the visual information and the (compositional) lan + +
SplitHeld-out Examples
I: RandomRandom
II: VisualRed squares as target or reference
III: RelationGreen squares and blue circles combinations
IV: ReferentYellow squares referred as target
V: Relative position 1Targets are north of their references
VI: Relative position 2Targets are south west of their references
+ +guage expression to disambiguate and locate the correct target object. + +Similar to the gSCAN setup, we use a shared training set and hold-out specific examples to evaluate generalization abilities for learning the visually grounded spatial relation reasoning as in Figure 3. In addition to random split (I: Random), we create new test splits including novel object properties (II: Visual), novel target and reference combinations (III: Relation), novel referent (IV: Referent), and novel relative positions (V, VI: Relative position). + +Table 5 shows detailed descriptions of the held-out examples for each test split. In total, we generated about 260,000 examples for the new task, using 18 templates and about 32,000 unique instructions. Details are included in Appendix B. + +Results We evaluate the cross-modal attention model on this new task and show results in Table 6. The model outperforms the baseline methods by a large margin on 4 out of 6 splits, but performs surprisingly worse on splits V and VI. The model performs unexpectedly well on the III. We conduct ablation studies and report the results in Table 7. III is also robust to various ways of removing attention, similar to the F split we observed in Table 4. On the other end, the splits II and IV are affected negatively very much, while V and VI are surprisingly improved with removing the cross-modal attention. However, there is not a single model that excels at all splits at the same time. + +We hypothesize that the cross-modal attention model overfits to certain aspects of the training distribution, leading to worse out of distribution performance on V and VI splits. We compute the exact match of our models on examples of seen relations from the random test split, to verify the in-domain generalization. Particularly, this in-domain settings evaluate situations where targets are "north west/north east" (in-domain V) and "south/west" (in-domain VI) to their references. It + +Table 5: Held-out examples for spatial relation learning task. + +
SplitSeq2Seq (2020)FiLM (2018)RN (2017)Ours
I86.48 ± 0.6488.85 ± 0.8285.17 ± 3.8194.66 ± 0.24
II40.10 ± 0.8350.68 ± 0.3238.59 ± 0.7464.41 ± 4.52
III86.08 ± 0.7388.81 ± 1.4285.66 ± 4.3594.89 ± 0.20
IV5.47 ± 0.0910.78 ± 3.474.85 ± 0.8649.58 ± 3.47
V81.41 ± 1.0376.20 ± 2.6479.86 ± 3.1659.29 ± 5.63
VI81.84 ± 1.3875.05 ± 3.6380.93 ± 2.7649.50 ± 6.49
+ +Table 6: Percentage of exact matches by various methods on proposed spatial relation splits. + +
SplitOurs-V-T-X
I94.66 ± 0.2494.70 ± 0.2394.58 ± 0.2692.71 ± 0.90
II64.41 ± 4.5262.42 ± 7.1259.75 ± 4.1846.65 ± 2.20
III94.89 ± 0.2094.90 ± 0.2594.91 ± 0.3092.88 ± 0.79
IV49.58 ± 3.4736.15 ± 16.4235.07 ± 13.7310.76 ± 1.76
V59.29 ± 5.6358.95 ± 6.4859.21 ± 6.3986.34 ± 1.50
VI49.50 ± 6.4949.40 ± 5.6647.91 ± 8.2887.10 ± 2.15
+ +Table 7: Ablation studies of our model on new relation reasoning task (-V, -T, and -X: removing decoder's visual, decoder's textual, and encoder's cross-modal attentions respectively). + +shows that the cross-modal attention model (95.52 on in-domain V and 95.43 on in-domain VI) has better in-domain generalization than its without cross-modal counterpart (93.14 on in-domain V and 93.90 on in-domain VI), but it performs worse in compositional generalization. Regularization techniques could potentially be used to improve the cross-modal attention model, which we leave for future research. + +# 4 Sample Complexity + +One inspiration of studying systematic generalization is to develop techniques that can reduce the sample complexity for learning novel behaviors. While we observe that many models perform well at least on some splits, we ask a natural question that has not been studied before: even on those splits, are our models fulfilling the promise of learning systematic generalization? + +Figure 4 shows that for the original gSCAN and the newly proposed task, performance for the cross-modal attention model starts to significantly drop when trained using less than around $40\%$ of the training data for most splits. The model without cross-modal attention is even more data inefficient; performance starts to significantly drop when trained using less than $70\%$ of the training data for the original compositional splits, or when reducing the training data by any amount for the spatial relation splits. This suggests exploring model architectural priors can help improve data efficiency and provide more benefits for generalization. + +![](images/888899a23552acb27713fe7b869d9c13d38b1d50b578ed8715e39e2def7a1294.jpg) +Figure 4: Data efficiency of the models on compositional splits (top) and spatial relation splits (bottom). The x-axis is the percentage of data (\%) and the y-axis is the exact match (\%). + +To investigate how the number of primitives influences the data efficiency, we re-generate smaller compositional splits and spatial relation splits by reducing the number of primitives. For compositional splits, we exclude one noun (cylinder), one color adjective (blue), and one adverb (while zigzagging). For spatial relation splits, we exclude one noun (cylinder) and one location preposition (next to). This reduces the number of training examples by around 2/3 and leads to around 110,000 and 74,000 training examples for the smaller compositional splits and spatial relation splits respectively. + +![](images/05a24cb8ba5726bad575305a4573caa750c97ae60a4cbeb119f521f8817002e1.jpg) +Figure 5: Data efficiency of the model with cross-modal attention on compositional splits (left) and spatial relation splits (right) with smaller number of primitives. + +We then perform similar experiments with our cross-modal attention model. The results are shown in Figure 5. When the number of primitives decreases, the percentage of training data required to attain satisfactory performance is increased, with more than $80\%$ of training data needed for both splits. One possible explanation is that the total number of training examples is reduced when the number of primitives decreases. Therefore, the model sees fewer combinations during training, thus needs a higher percentage of data to properly learn visual grounding and compositionality. This provides further evidence that current model need extensive training data to achieve systematic generalization, demonstrating the necessity of evaluating sample complexity for future work. + +# 5 Related work + +Many datasets and tasks have been proposed for examining systematic generalization: visual question answering (Johnson et al., 2017; Bahdanau et al., 2019a; Pezzelle and Fernandez, 2019; Bahdanau et al., 2019b), visually grounded navigation instruction following (Hermann et al., 2017; Yu et al., 2018; Chevalier-Boisvert et al., 2019; Chaplot et al., 2018). Many approaches have been proposed too, though a large percentage of them uses task-specific design and only work well for the specific tasks or datasets, for example, learning neural program executions (Andreas et al., 2016; Hu et al., 2017; Johnson et al., 2017; Santoro et al., 2017; Hudson and Manning, 2018; Mao et al., 2019), in addition to the ones we have described previously. + +This work focuses on using a generic cross-modal attention model to probe the gSCAN dataset in the hope of understanding in what aspect the task/dataset is challenging. Ding et al. (2020) also presented new evidences that a neural-based model can solve similar CG tasks. Our interest is to use such models to inspire new task designs that continue to challenge neural models. + +# 6 Conclusion + +In this work, we have demonstrated that a general-purpose cross-modal attention model can achieve strong performance on a majority of gSCAN splits and outperform more specialized prior work. We have proposed a challenging additional task for gSCAN that requires agents to reason over spatial relations between objects in the visual scene, and have highlighted data efficiency as a consideration for future work. + +# Acknowledgements + +We thank Kristina Toutanova and the anonymous reviewers for their helpful feedback and suggestions. + +# References + +Jacob Andreas. 2020. Good-enough compositional data augmentation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7556-7566, Online. Association for Computational Linguistics. +Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. 2016. Neural module networks. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pages 39-48. IEEE Computer Society. +Dzmitry Bahdanau, Harm de Vriesand Shikhar Murty, Aaron C. Courville, and Philippe Beaudoin. 2019a. CLOSURE: assessing systematic generalization of CLEVR models. In Visually Grounded Interaction and Language (ViGIL), NeurIPS 2019 Workshop. +Dzmitry Bahdanau, Shikhar Murty, Michael Noukhovitch, Thien Huu Nguyen, Harm de Vries, and Aaron C. Courville. 2019b. Systematic generalization: What is required and can it be learned? In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. 2018. Gated-attention architectures for task-oriented language grounding. 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 2819-2826. AAAI Press. +Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. 2020. UNITER: universal image-text representation learning. In Computer Vision - ECCV 2020-16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XXX, volume 12375 of Lecture Notes in Computer Science, pages 104-120. Springer. +Maxime Chevalier-Boisvert, Dzmitry Bahdanau, Salem Lahlou, Lucas Willems, Chitwan Saharia, Thien Huu Nguyen, and Yoshua Bengio. 2019. Babyai: A platform to study the sample efficiency of grounded language learning. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +David Ding, Felix Hill, Adam Santoro, and Matt Botvinick. 2020. Object-based attention for spatiotemporal reasoning: Outperforming neuro-symbolic models with flexible distributed architectures. *ArXiv* preprint, abs/2012.08508. +Tong Gao, Qi Huang, and Raymond Mooney. 2020. Systematic generalization on gSCAN with language + +conditioned embedding. In Proceedings of the 1st Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 10th International Joint Conference on Natural Language Processing, pages 491-503, Suzhou, China. Association for Computational Linguistics. +Christina Heinze-Deml and Diane Bouchacourt. 2020. Think before you act: A simple baseline for compositional generalization. ArXiv preprint, abs/2009.13962. +Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojciech Marian Czarnecki, Max Jaderberg, Denis Teplyashin, et al. 2017. Grounded language learning in a simulated 3d world. ArXiv preprint, abs/1706.06551. +Ronghang Hu, Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Kate Saenko. 2017. Learning to reason: End-to-end module networks for visual question answering. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pages 804-813. IEEE Computer Society. +Drew A. Hudson and Christopher D. Manning. 2018. Compositional attention networks for machine reasoning. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Judy Hoffman, Li Fei-Fei, C. Lawrence Zitnick, and Ross B. Girshick. 2017. Inferring and executing programs for visual reasoning. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pages 3008-3017. IEEE Computer Society. +Yen-Ling Kuo, Boris Katz, and Andrei Barbu. 2020. Compositional networks enable systematic generalization for grounded language understanding. *ArXiv* preprint, abs/2008.02742. +Brenden M. Lake and Marco Baroni. 2018. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. 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 2879-2888. PMLR. +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. + +Jiayuan Mao, Chuang Gan, Pushmeet Kohli, Joshua B. Tenenbaum, and Jiajun Wu. 2019. The neurosymbolic concept learner: Interpreting scenes, words, and sentences from natural supervision. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron C. Courville. 2018. Film: Visual reasoning with a general conditioning layer. 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 3942-3951. AAAI Press. +Sandro Pezzelle and Raquel Fernández. 2019. Is the red square big? MALeViC: Modeling adjectives leveraging visual contexts. 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 2865-2876, Hong Kong, China. Association for Computational Linguistics. +Laura Ruis, Jacob Andreas, Marco Baroni, Diane Bouchacourt, and Brenden M. Lake. 2020. A benchmark for systematic generalization in grounded language understanding. +Adam Santoro, David Raposo, David G. T. Barrett, Mateusz Malinowski, Razvan Pascanu, Peter W. Battaglia, and Tim Lillicrap. 2017. A simple neural network module for relational reasoning. 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 4967-4976. +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. +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. +Haonan Yu, Haichao Zhang, and Wei Xu. 2018. Interactive grounded language acquisition and generalization in a 2d world. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. + +# Appendix + +In this appendix, we include more details about our cross-modal attention model (§ A) and data generation procedure (§ B). + +# A Models + +In this section, we include more details about our cross-modal attention model to ensure all results are fully reproducible. We also include details of the baseline methods we implement. + +# A.1 Model details + +We show our model architecture in Figure 6. The model follows the standard encoder-decoder structure in Transformer (Vaswani et al., 2017) and uses cross-modal attention in the encoder similar to ViLBERT (Lu et al., 2019). It is trained via teacher forcing. During test time, it generates output actions in the auto-regressive manner. + +Encoder The model takes input command tokens $\mathbf{x} = \{x_{1}, x_{2}, \dots, x_{n}\}$ and world state $\mathbf{W} \in \mathbb{R}^{d \times d \times c}$ , where $d$ is the grid size and $c$ is world state dimension as in the baseline seq2seq model (Ruis et al., 2020). The encoder maps the world state to visual representation $\mathbf{H}^v$ through multi-scale convolutional networks followed by linear layers. It encodes the input tokens to input embeddings $\mathbf{H}^l = \{\mathbf{h}_1^l, \mathbf{h}_2^l, \dots, \mathbf{h}_n^l\}$ with positional encoding. + +The visual and linguistic representations are passed through $N = 6$ transformer blocks with cross-modal attention. Similar to ViLBERT (Lu et al., 2019), each transformer block consists of two parallel multi-head attention blocks, with the representation of one modality passed as key and value to the multi-head attention block of the other modality. + +Decoder The decoder consists of $N = 6$ stacked blocks similar to the decoder in Transformer (Vaswani et al., 2017). Each block contains one self-attention block and one multi-head attention block over the contextual embeddings $\mathbf{H}^c = [\mathbf{H}^v;\mathbf{H}^l]$ of the encoder. + +# A.2 Implementation Details + +We use $N = 6$ layers of transformer blocks for the encoder and the decoder. Each block has hidden size of 128, intermediate size of 256, and 8 attention heads. The total number of parameters of the model is around 3M for all model variants. We train our model for 40 epochs with batch size + +of 128. We use the Adam optimizer with weight decay. The initial learning rate is set to be 0.0016 for model with cross-modal attention and 0.0008 for model without it. We use linear warmup for the first $10\%$ of training epoch and decrease the learning rate by 10 in the 20th and 30th epoch. The dev set accuracy and exact match are used to validate model performance. + +![](images/54507b10a6fe33440ae621fb02dbf30505820cf92501063ebd329c7caece2eac.jpg) +Figure 6: The architecture of our model. The encoder consists of 6 layers of transformer block with cross-modal attention. The decoder contains 6 layers of transformer block, and each block has one self-attention block and one multi-head attention block over contextual representations of encoder. + +# A.3 Baseline Methods + +We implement FiLM (Perez et al., 2018) and RN (Santoro et al., 2017) as our baselines. The baselines are built upon the seq2seq model. FiLM learns functions to predict a set of $\beta$ , $\gamma$ conditioned on inputs to modulate neural networks. For FiLM, we add a linear layer to predict $\beta$ , $\gamma$ for each convolution layer. For RN, we use 3 relation layers with hidden size of 256 followed by 2 fully-connected layers to predict object relations. The hidden states are then used to initialize the LSTM decoder. We refer the readers to the original FiLM and RN paper for model details. Other hyper-parameters remain the same as the original seq2seq baseline. $^{3}$ + +# B Data Generation + +We build upon the original gSCAN codebase to generate spatial relation data splits. + +2The figure is modified from https://github.com/dair-ai/ml-visuals. +3https://github.com/LauraRuis/multimodal_seq2seq_gSCAN. +4https://github.com/LauraRuis/ groundedSCAN. + +# B.1 Input Commands Generation + +The input commands are generated based on context-free grammar (CFG) in Table 8. We add new grammar rules and lexicon rules to support object relations. Since we focus on evaluating relation reasoning, we exclude templates without any object relation. + +
Grammar Rule
ROOT → VP
VP → VVt' to DP
VP → VVt DP
DP → 'a' NP
NP → JJ NP
NP → NP PP
PP → LOC DP
NP → NN
Lexicon Rule
VVt → {walk}
VVt → {push, pull}
NN → {circle, square, cylinder}
JJ → {red, green, blue, yellow, big, small}
LOC → {next to}
LOC → {east of, north of, west of, south of}
LOC → {north east of, north west of}
LOC → {south east of, south west of}
+ +Table 8: The CFG used to generate input commands. + +# B.2 World State Generation + +We generate the world state with the following constraints: 1) For each target referent $\mathbf{T}$ , there will be one unique reference object $\mathbf{R}$ next to it; 2) There will be up to $n$ visual distractors $\mathbf{V}_1, \mathbf{V}_2, \dots, \mathbf{V}_n$ , which have the same size, shape, and color of the target object $\mathbf{T}$ ; 3) Each visual distractor $\mathbf{V}_i$ will or will not have its own reference object $\mathbf{O}_i$ . + +Additionally, to avoid ambiguity, when generating visual distractor $\mathbf{V}_i$ , we ensure: 1) If the input command contains abstract relative position (i.e. next), $\mathbf{V}_i$ cannot be placed near $\mathbf{R}$ , and $\mathbf{O}_i$ must be distinct from $\mathbf{R}$ ; 2) If the input command contains specific relative position (e.g. north, west, etc.), $\mathbf{V}_i$ can be placed anywhere, and $\mathbf{O}_i$ can be the same as $\mathbf{R}$ . However, $\mathbf{O}_i$ cannot have the same relative position to $\mathbf{V}_i$ as $\mathbf{R}$ to $\mathbf{T}$ . Other procedures remain the same as the original setup. + +# B.3 Data Examples + +We show data examples for each spatial relation split in Figure 7. The systematic difference between the training and test split is highlighted. + +![](images/ec5aea89750ac3b9e3bd0b303e899425bb388a315a91ec6c8f61ccc7b5b8635f.jpg) + +![](images/f2a3978b51afd8b32b53c6eeadf74ca5427e6d54258da87612d30229d429de04.jpg) +Command: walk to a green small square next to a blue circle + +Figure 7: Data examples for each spatial relation test split with the systematic difference highlighted. +![](images/a0277027fe003e26d8cd9acd76156feb6f23d98fba43d03b3a4ccbdad4ff0779.jpg) +Target: walk walk walk walk walk L_turn walk +Command: pull a circle north of a yellow big cylinder +Target: walk walk L_turn walk walk walk pull pull pull + +![](images/e4fa34a72c2420a270bc91be113508570025753820138ff7729a6fa007e312df.jpg) + +![](images/62cb250b4ce848971101486da54241005ecacc966d46b6ffee06d9bb27733f01.jpg) +Command: push a small yellow square west of a green big cylinder + +![](images/14ee0aa9ef494bcc4e7cfa27390897da01d56e159e6f8ca1b4001c31868b62e7.jpg) +Target: L_turn L_turn walk R_turn walk push push +Command: pull a cylinder south west of a circle +Target: walk walk walk walk L_turn walk pull \ No newline at end of file diff --git a/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/images.zip b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..db299d5fad8269358b965b688009b595feb1bd2b --- /dev/null +++ b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8e685902c8af13e8f5a5adfff18c954074a277a57aacc4edf06a336f7ff2a63 +size 525705 diff --git a/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/layout.json b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6cc53a518d0408b9c9928cf22982a15f91879bb6 --- /dev/null +++ b/systematicgeneralizationongscanwhatisnearlysolvedandwhatisnext/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fe43d503d3a9697c93d52ba994a2d97ac8a432f526bffdd34ad1cf3633c4d9b +size 296689 diff --git a/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_content_list.json b/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..400845686b81583a79b7d3b0c6f609e3396858eb --- /dev/null +++ b/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d672652276b4035f245d77e058748f108ea9ef33b48ea5bb588cfecda965e31f +size 97028 diff --git a/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_model.json b/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..63054f982dcf9bf1ef6fa8e2153e013af91e50f8 --- /dev/null +++ b/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de43dc25f9f7628897edef7c7ace9abfd9cfcea39e89a451de03a5b53fd20e5d +size 117032 diff --git a/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_origin.pdf b/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..adc06128a52f1d965f4053085193b926be339729 --- /dev/null +++ b/tadpoletaskadaptedpretrainingviaanomalydetection/b84dc235-1850-4919-b47b-0e347150e38e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f15ae445486d1e8f08442d600c7bcaa927282d47cd0d8fab5395909b17fea454 +size 537995 diff --git a/tadpoletaskadaptedpretrainingviaanomalydetection/full.md b/tadpoletaskadaptedpretrainingviaanomalydetection/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d1e40d96ac7ba0f3243e1eaa7dbf06a8fb0ca0ae --- /dev/null +++ b/tadpoletaskadaptedpretrainingviaanomalydetection/full.md @@ -0,0 +1,342 @@ +# TADPOLE: Task ADapted Pre-training via anOmaLy dEction + +Vivek Madan + +AWS AI Labs + +vivmadan@amazon.com + +Ashish Khetan + +AWS AI Labs + +khetan@amazon.com + +Zohar Karnin + +AWS AI Labs + +zkarnin@amazon.com + +# Abstract + +The paradigm of pre-training followed by fine-tuning has become a standard procedure for NLP tasks, with a known problem of domain shift between the pre-training and downstream corpus. Previous works have tried to mitigate this problem with additional pre-training, either on the downstream corpus itself when it is large enough, or on a manually curated unlabeled corpus of a similar domain. In this paper, we address the problem for the case when the downstream corpus is too small for additional pre-training. We propose TADPOLE, a task adapted pre-training framework based on data selection techniques adapted from Domain Adaptation. We formulate the data selection as an anomaly detection problem that unlike existing methods works well when the downstream corpus is limited in size. It results in a scalable and efficient unsupervised technique that eliminates the need for any manual data curation. We evaluate our framework on eight tasks across four different domains: Biomedical, Computer Science, News, and Movie reviews, and compare its performance against competitive baseline techniques from the area of Domain Adaptation. Our framework outperforms all the baseline methods. On small datasets with less than 5K training examples, we get a gain of $1.82\%$ in performance with additional pre-training for only $5\%$ steps. It also compliments some of the other techniques such as data augmentation known for boosting performance when downstream corpus is small; highest performance is achieved when data augmentation is combined with task adapted pre-training. + +# 1 Introduction + +Pre-trained language models such as ELMo (Peters et al., 2018), GPT (Radford et al., 2018), BERT (Devlin et al., 2018), Transformer-xl (Dai et al., 2019) and XLNet (Yang et al., 2019) have become a key component in solving virtually all natural language tasks. These models are pre-trained on + +large amount of cross-domain data ranging from Wikipedia to Book corpus to news articles to learn powerful representations. A generic approach for using these models consists of two steps: (a) Pretraining: train the model on an extremely large general domain corpus, e.g. with masked language model loss; (b) Finetuning: finetune the model on labeled task dataset for the downstream task. + +Even though the approach of pre-training followed by fine-tuning has been very successful, it suffers from domain shift when applied to tasks containing text from a domain that is not sufficiently represented in the pre-training corpus. An immediate way of solving the problem is to pre-train the model on task domain data instead of the general domain data. For a handful of very popular task domains, the research community invested time and resources to collect a large domain-specific data corpus and pre-train a language model on it. The models include BioBERT pre-trained on biomedical text (Lee et al., 2020), ClinicalBERT pretrained on clinical notes (Huang et al., 2019), SciBERT pre-trained on semantic scholar corpus (Beltagy et al., 2019), and FinBERT pre-trained on financial documents (Araci, 2019). These models achieve significant gain in performance over a model trained on general domain data, when the downstream task belongs to the respective domains. + +These papers demonstrate how useful it can be to shift the domain of the pre-trained model. However, the approach is expensive and time consuming as it requires collecting gigabytes of domain data for each new task. The long-tail of domains remains left behind without a realistic solution. To mitigate this, in absence of the huge task domain data, a different known approach is to collect a medium (MBs, not GBs) amount of unlabeled task data, and adapt the pre-trained (on general data) model by e.g. extending the pre-training procedure on the unlabeled data (Howard and Ruder, 2018; Gururangan et al., 2020). Such task adapted pre + +training approach achieves relatively smaller gain but is less expensive. Although this approach is cheaper in terms of manual labor when compared to domain adapted BERT, it still requires an effort to collect unlabeled data. It requires much more data than what is needed for only fine-tuning. This is often impossible to achieve, for example when data is highly sensitive. In this paper we propose a solution to this challenging problem, providing domain adaptation to the pre-trained model without the need for any manual effort of data collection. + +The high level idea is quite intuitive. Given a generic pre-training data containing text from multiple domains, we filter the available general domain to contain only pieces that are similar to the downstream task corpus. By continuing the pretraining process on this adapted corpus we achieve a better tuned pre-trained model. Figure 1 illustrate the feasibility of this approach with an example downstream task from a medical domain and highlighted text from a news article available in a general domain corpus. The key for a successful implementation is finding the best way of evaluating the similarity of a given snippet to the downstream task. + +# RCT20K TASK DATA + +To investigate the efficacy of 6 weeks of daily low-dose oral prednisolone in improving pain, mobility, and systemic los-grade ...[OBJECTIVE] +A total of 125 patients with primary knee OA were randomize ...[METHODS] +Outcome measures included pain reduction and systemic inflammation markers ...[METHODS] + +# News Article + +For as much as we workout warriors recite that whole "no pain, no gain" mantra, we sure do pop a lot of painkillers. A recent article published in... These popular medicines, known as nonsteroidal anti-inflammatory drugs, or NSAIDs, work by suppressing inflammation... the article kind of blows past is the fact plenty of racers ... + +Figure 1: Identification of task-data (top panel, medical data) in general domain corpus (bottom panel). + +Although not many methods exist to solve the problem of domain shift in the context of pretraining, literature on Domain Adaptation provides several methods for the core task of evaluating the above mentioned similarity. These previous approaches use either a simple language model (LM) (Moore and Lewis, 2010; Axelrod et al., 2011; Duh et al., 2013; Wang et al., 2017b; van der Wees et al., 2017), or a hand crafted similarity score (Wang et al., 2017a; Plank and Van Noord, + +2011; Remus, 2012; Van Asch and Daelemans, 2010). The LM based technique are often both over simplistic, and require a fairly large corpus of task data to create a reasonable LM. The hand crafted similarity scores can be seen as ad-hoc methods for distinguishing inliers from outliers (i.e., anomaly detection); they tend to be focused on individual tasks and do not generalize well. + +We formulate the similarity evaluation task as that of anomaly detection and propose a Task ADapted Pre-training via anOmaLy dEction (TADPOLE) framework. Indeed, anomaly detection methods given a domain of instance are able to provide a score for new instances assessing how likely they are to belong to the input domain. We exploit pre-trained models to get sentence representations that are in turn used to train an anomaly detection model. By using pre-trained models, our method is effective even for small text corpora. By taking advantage of existing anomaly detection methods, we replace hand-crafted rules with techniques proven to generalize well. Our approach does not require any manual data curation. To train the anomaly detection method, we only use the task data which is already available as it is necessary for fine-tuning. + +In what follows we discuss how we implement our technique and compare it with other data selection methods based on extensive experimental results. We start by filtering out the subset of general domain corpus most relevant to the task. To do this, we explore several anomaly detection methods and give a quantitative criterion to identify the best method for a given task data. Then, we start with a pre-trained model on the general domain corpus and run additional pre-training for only $5\%$ more steps on the filtered corpus from different methods. This is followed by the regular finetuning on the labeled task data. We measure the performance gain as an improvement in accuracy of finetuned model with additional pre-training vs the accuracy of finetuned model without additional pre-training. To establish the performance gain of TADPOLE, we evaluate it on eight tasks across four domains: Biomedical, Computer Science, News, and Movie reviews. We investigate all aspects of TADPOLE by comparing its performance with various baselines based on its variants and the competitive methods available in literature. The main highlights of our work are as follows: + +- We provide TADPOLE, a novel anomaly de + +![](images/5a1a093868fa08fb2531ebe2113aff290535eb679538ea96fe4ada62dcf53e7f.jpg) +Figure 2: Average performance gain as function of #training samples available for a task. + +tection based framework for adapting pretraining for the downstream task. The framework is explained in detail and all its steps are justified via extensive ablation studies. + +- TADPOLE is superior to all the baseline methods including (i) LM based relevance score (iii) Distance based relevance score (iii) Continued pre-training on the task data (iv) Data Augmentation while finetuning. +- On tasks with small labeled dataset (less than 5K examples), our method achieves an average $1.82\%$ lift in performance whereas the baselines achieve no more than $0.48\%$ . +- For tasks with large labeled dataset, our method does not depreciate in performance and achieves an average gain of $0.32\%$ . In addition, if only a subset of training samples are available, we observe significantly higher gain. In particular, if only 1000 training samples are available, we observe an average $2.01\%$ gain in performance whereas the baselines achieve no more than $0.24\%$ gain. In all individual tasks, our method is either on par or (statistical) significantly better than all alternatives. +- TADPOLE complements some of the other techniques known for improving performance for small datasets. For instance, TADPOLE performs better than data augmentation and performs even better when combined with data augmentation; Data-Aug $\leq$ TADPOLE $\leq$ TADPOLE + Data-Aug. +- For a task requiring little domain adaptation, GLUE sentiment analysis, our method achieves an improvement of $0.4\%$ in accuracy. + +# 2 Related Work + +Since our focus is on Data Selection Methods, we only discuss the related work on Data Selection in Domain Adaptation here. We discuss the other Domain Adaptation techniques in Appendix A. + +Data Selection: As discussed above, core of data selection is to determine the relevance weights that in turn modify the source domain to become more similar to the target domain. There has been a sequence of works in trying to find the relevance weights via language models (Moore and Lewis, 2010; Wang et al., 2017b; van der Wees et al., 2017). For instance, Moore and Lewis (2010), Axelrod et al. (2011) and Duh et al. (2013) train two language models, an in-domain language model on the target domain dataset (same as task domain in our case) and an out-of-domain language model on (a subset of) general domain corpus. Then, relevance score is defined as the difference in the cross-entropy w.r.t. two language models. These methods achieve some gain but have a major drawback. A crucial assumption they rely on: there is enough in-domain data to train a reasonable in-domain language model. This assumption is not true in most cases. For most tasks, we only have access to a few thousands or in some cases a few hundreds of examples which is not enough to train a reasonably accurate language model. Our techniques rely on text representations based on the available pre-trained model. As such, our similarity score does not rely on models that can be trained with a small amount of data. + +Another line of work defines hand crafted domain similarity measures to assign relevance score and filter out text from a general domain corpus (Wang et al., 2017a; Plank and Van Noord, 2011; Remus, 2012; Van Asch and Daelemans, 2010; Gururangan et al., 2020). For instance, Wang et al. (2017a) define the domain similarity of a sentence as the difference between Euclidean distance of the sentence embedding from the mean of in-domain sentence embeddings and the mean of out-of-domain sentence embeddings. Plank and Van Noord (2011) and Remus (2012) define the similarity measure as the Kullback-Leibler (KL) divergence between the relative frequencies of words, character tetra-grams, and topic models. Van Asch and Daelemans (2010) define domain similarity as Rényi divergence between the relevant token frequencies. These are adhoc measures suitable only for the respective tasks, and can be seen as a manual task-optimized anomaly detection. They fail to generalize well for new tasks and domains. Ruder and Plank (2017) attempts to remedy this issue and tries to learn the correct combination of these metrics for each task. They learn the combination + +weight vector via Bayesian optimization. However, Bayesian optimization is infeasible for deep networks like BERT. Each optimization step of this process amounts to pre-training the model and finetuning it for the task. For Bayesian optimization to work well it requires repeating this process multiple times, which is prohibitively computationally expensive. Thus, they use models such as linear SVM classifier and LDA which do not yield state-of-the-art performance. In contrast, we propose a lightweight method - based on anomaly detection - that can be applied to state-of-the-art deep language models like BERT. + +# 3 TADPOLE: Task ADapted Pre-training via anOmaLy dEction + +Language model and Downstream Tasks. A generic approach for using state-of-the-art language models such as ELMo, GPT, BERT, and XLNet is to pre-train them on an extremely large general domain corpus and then finetune the pretrained model on the downstream labeled task data. There is evident correlation between model's pretraining loss and its performance on the downstream task after finetuning (Devlin et al., 2018). Our design is motivated by an observation, backed by empirical evidence, that the correlation is even stronger if we consider the pre-training loss not on the pre-training data but the downstream task data. + +To make this distinction formal, let $\mathcal{D}$ , $\mathcal{D}_{\mathrm{in}}$ be the pre-training and task data. Let $\Theta$ denote the parameters of the language model and $\ell_{\mathrm{LM}}$ denote the language model loss function. The pre-training loss on pre-training data $(L_{\mathrm{LM}}(\Theta))$ and target data $(L_{\mathrm{LM}}^{\mathrm{in}}(\Theta))$ are defined as follows: $L_{\mathrm{LM}}(\Theta) = \sum_{x\in \mathcal{D}}\ell_{\mathrm{LM}}(x;\Theta), L_{\mathrm{LM}}^{\mathrm{in}}(\Theta) = \sum_{x\in \mathcal{D}_{\mathrm{in}}}\ell_{\mathrm{LM}}(x;\Theta)$ . To show that $L_{\mathrm{LM}}^{\mathrm{in}}(\Theta)$ is better correlated with the performance of the downstream task we consider several BERT language models pre-trained on random combinations of datasets from different domains mentioned in Section 4. Among these we select the BERT models $M_1,\ldots ,M_k$ such that selected models have similar Masked Language Model (MLM) loss on the general domain corpus; $|\ell_{LM}(\Theta_i) - \ell_{LM}(\Theta_j)| < = 0.02$ . MLM loss of these models on the text from task domain $(\ell_{LM}^{in}(\Theta_i))$ is different. For each $M_i$ , we contrast it with the accuracy/f1 score of the finetuned model on the task data. + +We observe in Figure 3 that if we have two equally good language models (similar language + +model loss on general domain), the language model which is better (tailored) for the task domain has significantly better downstream performance. We + +![](images/0d0632b2a697a1f0474b29d119fc5c887059f88974bde3d3736c0c667407d525.jpg) +Figure 3: Masked Language Model (MLM) loss of pre-trained BERT on the task data vs accuracy/f1 score of corresponding finetuned BERT. Different points correspond to different BERT models, pre-trained on random combination of different datasets. MLM loss on the general domain corpus for all the pre-trained BERT models considered here is roughly the same (within 0.02 of each other). + +![](images/61e925adb22f6c7bc4037638c9370660a6bb7e16a50ef714f8a4d6e561998ff4.jpg) + +conclude that in order to ensure success in the downstream task, we should aim to minimize $L_{\mathrm{LM}}^{\mathrm{in}}(\Theta)$ . A first attempt would be to pre-train or finetune the language model on $\mathcal{D}_{\mathrm{in}}$ . However, training a language model such as ELMo, GPT, BERT or XLNet requires a large corpus with several GBs of text and the available domain specific corpus $\mathcal{D}_{\mathrm{in}}$ is often just the task data which has few MBs of text. Training on such a small dataset would introduce high variance. We reduce this variance by taking training examples from the general domain corpus $\mathcal{D}$ , but control the bias this incurs by considering only elements having high relevance to the domain $\mathcal{D}_{\mathrm{in}}$ . Formally, we optimize a weighted pre-training loss function + +$$ +L _ {\mathrm {L M}} ^ {\Lambda} (\Theta) = \sum_ {x \in D} \lambda (x, \mathcal {D} _ {\mathrm {i n}}) \cdot \ell_ {\mathrm {L M}} (x; \Theta), \tag {1} +$$ + +where $\lambda (x,\mathcal{D}_{\mathrm{in}})$ are relevance weights of instance $x$ for domain $\mathcal{D}_{\mathrm{in}}$ . $\lambda (x,\mathcal{D}_{\mathrm{in}})$ is (close to) 1 if $x$ is relevant to $\mathcal{D}_{\mathrm{in}}$ and (close to) 0 otherwise. We compute these weights using an anomaly detection model fitted on $\mathcal{D}_{\mathrm{in}}$ . Note that concept of weighted loss to handle noisy or irrelevant data is well known (Moore and Lewis, 2010; Wang et al., 2017a). Major contribution of our paper is in proposing an anomaly detection based robust approach to find the relevance weights. + +# 3.1 Anomaly Detection to solve the Domain Membership Problem + +Detecting whether an instance $x$ is an in-domain instance is equivalent to solving the following problem: Given task data $\mathcal{T}$ and a sentence $s$ , determine if $s$ is likely to come from the distribution generating $\mathcal{T}$ or if $s$ is an anomaly. + +This view helps us make use of a wide variety of anomaly detection techniques developed in literature (Noble and Cook, 2003; Chandola et al., 2009; Chalapathy and Chawla, 2019). To make use of these techniques, we first need a good numeric representation (embedding) with domain discrimination property. We use pre-trained BERT to embed each sentence into a 768 dimensional vector. Once the data is embedded, we need to decide which among the many anomaly detection algorithms proposed in literature should be applied on the embeddings. To decide the anomaly detection method, we propose an evaluation method ranking the techniques based on their discriminative properties. + +Ranking anomaly detection algorithms: The idea is to treat the anomaly score as the prediction of a classifier distinguishing between in-domain and out-of-domain data. By doing so, we can consider classification metrics such as the f1_score as the score used to rank the anomaly detection algorithm. To do this, we split the in-domain data (the task data) into $\mathcal{D}_{\mathrm{in}}^{\mathrm{train}}$ , $\mathcal{D}_{\mathrm{in}}^{\mathrm{test}}$ using a 90/10 split. We also create out-of-domain data $\mathcal{D}_{\mathrm{out}}$ as a random subset of $\mathcal{D}$ of the same size as $\mathcal{D}_{\mathrm{in}}^{\mathrm{test}}$ . We train an anomaly detection algorithm $A$ with $\mathcal{D}_{\mathrm{in}}^{\mathrm{train}}$ , and evaluate it's f1_score on the labeled test set composed of the union $\mathcal{D}_{\mathrm{in}}^{\mathrm{test}} \cup \mathcal{D}_{\mathrm{out}}$ , where the labels indicate which set the instance originated from. Note that anomaly detection algorithms considered do not require labeled samples for training. Thus, mixing data from $\mathcal{D}_{\mathrm{out}}$ does not add much value. + +Table 1 provides the results of this evaluation on six anomaly detection algorithms. Details of the tasks can be found in Section 4. We can see that Isolation Forest consistently performs well for most of the tasks. Local Outlier Factor performs almost equally well but is slower in prediction. Although it is possible to adaptively choose for every task the anomaly detection algorithm maximizing the f1_score, we chose to use a single algorithm, Isolation Forests, for the sake of having a simpler technique and generalizable results. Due to space constraints, we push the discussion on Isolation Forest to Appendix C. + +Now that we chose the anomaly detection technique, we move to discuss the effectiveness of the algorithm in (i) identifying the domain from the task data (ii) identifying the domain related data from the general domain corpus. + +Figure 4 (left) shows that the anomaly detection + +
TaskRCkNNPCAOCSLOFIF
CHEMPROT0.890.850.920.870.920.96
ACL-ARC0.770.880.900.890.910.88
HYPERPARTISAN0.860.860.950.980.910.98
RCT20K0.850.880.820.760.870.93
IMDB0.880.960.870.810.960.94
SCIERC0.780.840.860.760.880.92
HELPFULNESS0.820.890.830.760.830.92
IMDB0.840.890.800.730.920.87
+ +![](images/c85cb50f83a7e1aaac20013f3cc674362c95c6d4fd91105b55829671c4365117.jpg) +Figure 4: Sentence anomaly scores for SST with anomaly detection algorithm trained on embeddings from Left: pretrained BERT, Right: finetuned BERT. In-task: sentences from the task data, out-of-task: sentences from general domain corpus. + +![](images/d85207b0aec6b48f76ca99b477e066ce67bcabd42dc181e986853f88550b2361.jpg) +Figure 5: Filtering algorithm trained with Bio Abstracts and CS task data. We mix four corpora, filter out $80\%$ of the data and retain the remaining $20\%$ in both cases. + +Table 1: Scores of different anomaly detection algorithms for different tasks. RC: Robust Covariance (Nguyen and Welsch, 2010), kNN: Nearest neighbor (Gu et al., 2019), PCA: Principal Component Analysis (Harrou et al., 2015), OCS: One Class SVM (Schölkopf et al., 2000), LOF: Local Outlier Factor (Breunig et al., 2000), IF: Isolation Forest (Liu et al., 2008) + +
CorpusInput dataFiltered (Bio)Filtered (CS)
News7.1G (21.8%)0.1G (2.0%)0.0G (0.7%)
Finance4.9G (15.0%)0.0G (0.1%)0.0G (0.3%)
CS8.0G (24.5%)1.0G (15.4%)5.1G (78.0%)
Bio12.6G (38.7%)5.3G (82.4%)1.4G (20.9%)
+ +algorithm is able to distinguish between the in-task-domain data and out-of-task domain data. These experiments are done for the Sentiment Analysis task (SST) discussed in Section 4. Interestingly, we noticed in our experiments that a language model pre-trained on a diverse corpus is a better choice when compared to a model finetuned on the target domain. We conjecture that the reason is that a finetuned BERT is overly focused on the variations in the task data which are useful for task prediction and forgets information pertaining to different domains which is useful for domain discrimination. We exhibit this phenomenon more clearly in Figure 4 (right) where it is evident that the discriminating ability of the finetuned model is worse. + +In order to assess the ability of our model to identify related text we perform the following experiment. First, we create a diverse corpus by taking the union of 4 datasets: News, Finance, CS abstracts and Biology abstracts. Figure 5, column + +'Input data' contains their respective sizes. We then train two anomaly score based discriminators, one on CS task data and the other on Bio abstracts. For each model we choose a threshold that would filter out $80\%$ of the data, and observe the data eventually retained by it. The fraction of data retained from each corpus for each model is given in Figure 5, columns 'Filtered (Bio)' and 'Filtered (CS)'. We see that data from the News and Finance corpus is almost completely filtered as it is quite different than the text in abstracts of academic papers. We also see that a non-negligible percent of the filtered data for the Bio model comes from CS and vice versa. Since both corpora are abstracts of academic papers it makes sense that each corpus contains relevant data for the other. The details related to these corpora are given in Appendix B. + +# 3.2 From Anomaly Detection Scores to Domain Adapted Pre-training + +Once the anomaly detection object is trained, we use it to compute the relevance weights i.e. compute $\lambda$ values defined in equation 1. Let the sentences in the pre-training corpus be $s_1,\ldots ,s_N$ with anomaly scores $\{A(s_1),\dots ,A(s_N)\}$ . We explore two different strategies of $\lambda$ value computation. First is when we normalize and transform the scores to compute continuous values and second when we use threshold and compute $0 / 1$ values. + +Continuous $\lambda$ values: We start by normalizing the anomaly scores to be mean zero and variance 1. Let $\mu = (\sum_{i=1}^{N} A(s_i)) / N$ , $\sigma = \sqrt{(\sum_{i=1}^{N} (A(s_i) - \mu)^2) / N}$ . Then, for every $i \in \{1, \dots, N\}$ , normalized score is $\bar{A}(s_i) = (A(s_i) - \mu) / \sigma$ . Using these normalized sentence anomaly scores, we compute the relevance weights as follows: $\lambda(s_i) = \frac{1}{1 + e^{-C(\alpha - \bar{A}(s_i))}}$ where $C$ and $\alpha$ are hyper-parameters. $C$ controls the sensitivity of the weight in terms of anomaly score and $\alpha$ controls the fraction of target domain data present in the general domain corpus. $C \to \infty$ results in $0 / 1$ weights corresponding to discrete $\lambda$ setting whereas $C = 0$ results in no task adaptation setting. + +Discrete $\lambda$ values: We sort the sentences as per anomaly scores, $A(s_{\sigma (1)})\leq A(s_{\sigma (2)})\leq \dots \leq$ $A(s_{\sigma (N)})$ and pick $\beta$ fraction of the sentences with lowest anomaly scores, $\lambda (s_{\sigma (i)}) = 1$ for $i\in$ $\{1,\ldots ,\beta N\}$ and 0 otherwise. Even though this approach is less general than the continuous $\lambda$ values case, it has an advantage of being model independent. We can filter out text, save it and use it to + +train any language model in a black box fashion. It does not require any change in pre-training or finetuning procedure. However, to utilize this option we need to make a change. Instead of filtering out sentences we need to filter out segments containing several consecutive sentences. + +To understand why, suppose we filter out sentence 1 and sentence 10 and none of the sentences in between. When we save the text and construct input instances from it for a language model, then an input instance may contain the end of sentence 1 and the start of sentence 10. This is problematic as sentence 1 and sentence 10 were not adjacent to each other in the original corpus and hence, language model does not apply to them. It distorts the training procedure resulting in worse language models. To resolve this issue, we group sentences into segments and classify the relevance of each segment. Formally, let $\gamma$ be a hyperparameter and for all $j \in 1, \ldots, \lfloor N / \gamma \rfloor$ let the segment score be $y_{j} = \sum_{i = (j - 1)*\gamma + 1}^{j*\gamma} \frac{A(s_{i})}{\gamma}$ . We sort the segments according to their anomaly scores, $y_{\sigma'(1)} \leq \cdots \leq y_{\sigma'(N/\gamma)}$ and select the $\beta$ fraction with lowest anomaly scores; save the sentences corresponding to these segments. To completely avoid the issue, we may set segment length very large. However, this is not feasible as the diverse nature of pre-training corpus makes sure that large enough segments rarely belong to a specific domain, meaning that the extracted data will no longer represent our target domain. We experimented with a handful of options for the segment length, and found the results to be stable with segments of 15 sentences. + +Continued pre-training instead of pre-training from scratch: Once we have computed the relevance weights $\lambda(s_i)$ , we do not start pre-training the language model from scratch as this is not feasible for each new task/domain. Instead, we start with a language model pre-trained on the general domain corpus and perform additional pre-training for relatively fewer steps with the weighted loss function. In our case, we start with a BERT language model pre-trained for one million steps and continued pre-training with updated loss function for either 50,000 or 100,000 steps. + +# 4 Experiments + +We use datasets listed in Table 2 along with a general domain corpus consisting of 8GB of text from Wikipedia articles. We use $\mathrm{BERT}_{\mathrm{BASE}}$ model provided in the GluonNLP library for all our experi + +
TaskTrainDevTestC
HYPERPARTISAN51664652
ACL-ARC16881141396
SCIERC32194559747
CHEMPROT41692427346913
IMDB200005000250002
SST6734987218212
AGNEWS115000500076004
HELPFULNESS1152515000250002
RCT20K18004030212301355
+ +Table 2: Specification of task datasets. $C$ refers to the number of classes. CHEMPROT (Kringelum et al., 2016) and RCT20K (Dernoncourt and Lee, 2017) are from biomedical domain. HYPERPARTISAN (Kiesel et al., 2019) and AGNEWS (Zhang et al., 2015) are from news domain. HELPFULNESS (McAuley et al., 2015) and IMDB (Maas et al., 2011) are from reviews domain. ACL-ARC (Jurgens et al., 2018) and SCIERC (Luan et al., 2018) are from CS domain. SST (Socher et al., 2013) is a general domain sentiment analysis task. + +periments. It has 12 layers, 768 hidden dimensions per token, 12 attention heads and a total of 110 million parameters. It is pre-trained with a sum of two objectives. First is the masked language model objective where model learns to predict masked tokens. Second is the next sentence prediction objective where sentence learns to predict if sentence $B$ follows sentence $A$ or not. We use learning rate of 0.0001, batch size 256 and warm-up ratio 0.01. For finetuning, we pass the final layer [CLS] token embedding through a task specific feed-forward layer for prediction. We use learning rate 3e-5, batch size 8, warm-up ratio 0.1 and finetune the network for five epochs. In all the experiments, we start with a BERT pre-trained for one million steps and continue pre-training for additional 50,000 steps in case of discrete $\lambda$ , and 100,000 steps in case of continuous $\lambda$ . Also, as mentioned in Section 3.2, we filter out segments instead of sentences and save them. We set the segment length to be 15 sentences and filter out $20\%$ of the data. Pseudo-code of the end-to-end algorithm can be found in Appendix B. + +# 4.1 Baseline Methods + +For each baseline data selection method, we start with a BERT pre-trained on general domain corpus for one million steps as in case of TADPOLE. Then, we continue pre-training the baseline method for the same number of steps as in case of our method. In case of baseline methods which filter general domain corpus, we filter the same fraction of text as in case of our method. Due to space constraints, we discuss some of the technical details of Baseline methods in Appendix ?? + +General: Continued pre-training on general do + +main corpus. + +Random: Continued pre-training on random subset of general domain corpus. + +Task (Gururangan et al., 2020): Continued pretraining on task data. Since task data is small, we can not pre-train on the task data for as many steps as in other cases. Instead we do 100 epochs, save the model after every epoch and pick the best one. + +LM (Moore and Lewis, 2010): Continued pretraining on text filtered via language models trained on task data. We train two language models, one on the task data and another on a subset of general domain corpus (same size as the task data). We select sentences with lowest scores given by the function $f(s) = H_I(s) - H_O(s)$ , where $H_I(s)$ and $H_O(s)$ are the cross-entropy between the $n$ -gram distribution and the language model distribution. + +Distance (Wang et al., 2017a): Continued pretraining on data filtered via Euclidean distance scoring function. For each sentence $f$ , we consider BERT embedding $v_{f}$ and compute vector centers $C_{F_{\mathrm{in}}}$ and $C_{F_{\mathrm{out}}}$ of the task data $F_{\mathrm{in}}$ and a random subset of general domain corpus $F_{\mathrm{out}}$ ; $C_{F_{\mathrm{in}}} = \frac{\sum_{f\in F_{\mathrm{in}}}v_f}{|F_{\mathrm{in}}|}, C_{F_{\mathrm{out}}} = \frac{\sum_{f\in F_{\mathrm{out}}}v_f}{|F_{\mathrm{out}}|}$ . We score a sentence $f$ as per the scoring function: $\delta_f = d(v_f, C_{F_{\mathrm{in}}}) - d(v_f, C_{F_{\mathrm{out}}})$ . + +Data-Aug (Xie et al., 2019): Data augmentation via back translation and tfidf based word replacement. In back translation, for each sentence $f$ , we translate it to french and then back into english. In tfidf based word replacement, we replace uninformative words with other uninformative words. Label of the new training example is same as the label of original example. Due to space constraints, we report the average scores of the two data augmentation strategies. Note that data augmentation only applies to task data used while finetuning and does not involve additional pre-training. + +# 4.2 Results + +Table 3 shows the effectiveness of TADPOLE, automatically adapting pre-training to the task domain. Top half contains the result for four small datasets and bottom half contains the results for five large datasets. Since focus of the paper is on small datasets, we take subsamples of large datasets of size 500, 1000, 2000, 5000, 20000. For tasks with less than $5k$ samples, continuing pre-training on the unfiltered corpus (General or Random subset) yields an average gain less than $0.11\%$ . Adapting pre-training by training on the task data only yields + +
TaskBaseGeneralRandomTaskLMDistanceData-AugTADPOLET+ Data-Aug
Small datasets: # training examples < 5K
HPRPARTISAN70.573.0470.972.0371.042.3270.882.6371.472.5672.162.1471.182.8673.582.3973.872.86
ACL-ARC72.314.772.383.9372.423.7172.463.4872.401.8572.472.6472.763.0372.813.8373.312.77
SCIERC82.841.3982.851.3882.811.1383.181.0982.992.7583.402.1783.271.1285.850.9585.760.95
CHEMPROT81.620.7481.590.6781.620.7181.630.8281.830.7481.640.7682.080.8882.410.6282.810.68
Average Gain-0.110.050.150.050.200.040.340.080.340.060.480.021.820.32.10.26
+ +
Average gain over five tasks: SST, RCT20K, HELPFULNESS, IMDB, AGNews with subset of training samples
#Training samplesGeneralRandomTaskLMDistanceData-AugTADPOLET + Data-Aug
5000.20110.21030.18050.220130.4020.21092.16062.01013
10000.04015-0.22070.1305-0.24070.18030.24062.01072.0404
20000.140090.16020.23030.18040.2010.1051.48061.5203
50000.09060.14020.11010.0010.08010.12061.0021.3105
200000.08050.07030.001-0.16030.0010.05050.74090.804
+ +Table 3: Performance of TADPOLE, six baseline methods and TADPOLE combined with Data Augmentation. At top, we list the performance of each task whereas at bottom we list the average performance gain over five tasks such that for each task, we subsample a fixed number of training samples. Base corresponds to the pre-trained model on general domain corpus with no further pre-training. Baseline methods are mentioned in previous subsection. TADPOLE corresponds to our method with discrete relevance weights. T+Data-Aug corresponds to our method combined with data augmentation during finetuning. Keeping in line with the previous works, we use the following metrics: accuracy for SST, micro f1 score for CHEMPROT and RCT20K, macro f1 score for ACL-ARC, SCIERC, HELPFULNESS, HPRPARTISAN, IMDB, and AGNEWS. Each model is finetuned eight times with different seeds and the mean value is reported. Subscript correspond to the standard deviation in the finetuned model performance. Average gain corresponds to the average improvement over Base for each of the baseline methods and TADPOLE. Subscript in Average Gain corresponds to the standard deviation in the estimate of the average gain. + +an average gain of $0.20\%$ . Applying popular data selection methods known for domain adaptation including Language Model based relevance score or Distance based relevance score yields a maximum gain of $0.34\%$ . TADPOLE beats all these methods and achieve an average gain of $1.82\%$ . Data augmentation on task data while finetuning (no additional pre-training) achieves an average gain $0.48\%$ . Combining Data-Augmentation with TADPOLE yields the maximum average gain showing that TADPOLE and Data Augmentation are complimentary methods and TADPOLE is superior to Data Augmentation on it's own. For tasks with more than $5k$ samples, we achieve an average gain of $0.36\%$ . Detailed results can be found in Appendix G. To further test the efficacy of TADPOLE with small number of training samples, we randomly select a subset of training samples from the large task datasets and treat it as a new task. We observe that the gap between performance gain from TADPOLE and baseline methods increase when the number of training samples are low. + +Models pre-trained on each of the four domain specific corpus can achieve a higher gain (3.37%) over the base model. However, unlike these models, our method has the advantage that it does not require access to any large domain specific corpus. Instead we only need a small task datasetalready available for finetuning. So, it is applicable to any + +new task from any new domain. We observe that Performance boost is higher if the corresponding boost via additional pre-training on large domain specific corpus is higher. Results for this comparison can be found in Appendix F. In Table 3, results are presented for the discrete relevant weight case as they are better when the number of steps available to continue pre-training are small. Results for continuous weights case can be found in Appendix E. Results are not very sensitive to the fraction of data filtered as can be seen in Figure 6 in Appendix H. + +# 5 Conclusion + +Domain shift in finetuning from Pre-training can significantly impact the performance of deep learning models. We address this issue in the most reasonable setting when we only have access to the labeled task data for finetuning. We adapt data selection methods from Domain Adaptation to adapt pre-training for the downstream task. The existing methods either require sufficiently large task data, or are based on adhoc techniques that do not generalize well across tasks. Our major contribution is providing a new data selection technique that performs well even with very little task data, and generalizes well across tasks. + +# References + +Steven Abney. 2007. Semisupervised learning for computational linguistics. CRC Press. +Waleed Ammar, Dirk Groeneveld, Chandra Bhagavatula, Iz Beltagy, Miles Crawford, Doug Downey, Jason Dunkelberger, Ahmed Elghohary, Sergey Feldman, Vu Ha, et al. 2018. Construction of the literature graph in semantic scholar. arXiv preprint arXiv:1805.02262. +Dogu Araci. 2019. Finbert: Financial sentiment analysis with pre-trained language models. arXiv preprint arXiv:1908.10063. +Amittai Axelrod, Xiaodong He, and Jianfeng Gao. 2011. Domain adaptation via pseudo in-domain data selection. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pages 355-362. +Iz Beltagy, Kyle Lo, and Arman Cohan. 2019. Scibert: A pretrained language model for scientific text. arXiv preprint arXiv:1903.10676. +Eyal Ben-David, Carmel Rabinovitz, and Roi Reichart. 2020. Perl: Pivot-based domain adaptation for pre-trained deep contextualized embedding models. Transactions of the Association for Computational Linguistics, 8:504-521. +John Blitzer, Ryan McDonald, and Fernando Pereira. 2006. Domain adaptation with structural correspondence learning. In Proceedings of the 2006 conference on empirical methods in natural language processing, pages 120-128. +Markus M Breunig, Hans-Peter Kriegel, Raymond T Ng, and Jörg Sander. 2000. Lof: identifying density-based local outliers. In Proceedings of the 2000 ACM SIGMOD international conference on Management of data, pages 93-104. +Raghavendra Chalopathy and Sanjay Chawla. 2019. Deep learning for anomaly detection: A survey. arXiv preprint arXiv:1901.03407. +Varun Chandola, Arindam Banerjee, and Vipin Kumar. 2009. Anomaly detection: A survey. ACM computing surveys (CSUR), 41(3):1-58. +Xia Cui and Danushka Bollegala. 2019. Self-adaptation for unsupervised domain adaptation. Proceedings-Natural Language Processing in a Deep Learning World. +Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. 2019. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860. +Franck Dernoncourt and Ji Young Lee. 2017. Pubmed 200k rct: a dataset for sequential sentence classification in medical abstracts. arXiv preprint arXiv:1710.06071. + +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. +Kevin Duh, Graham Neubig, Katsuhito Sudoh, and Hajime Tsukada. 2013. Adaptation data selection using neural language models: Experiments in machine translation. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 678-683. +Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Lavi-olette, Mario Marchand, and Victor Lempitsky. 2016. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096-2030. +Xiaoyi Gu, Leman Akoglu, and Alessandro Rinaldo. 2019. Statistical analysis of nearest neighbor methods for anomaly detection. In Advances in Neural Information Processing Systems, pages 10923-10933. +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. arXiv preprint arXiv:2004.10964. +Fouzi Harrou, Farid Kadri, Sondes Chaabane, Christian Tahon, and Ying Sun. 2015. Improved principal component analysis for anomaly detection: Application to an emergency department. Computers & Industrial Engineering, 88:63-77. +Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. arXiv preprint arXiv:1801.06146. +Kexin Huang, Jaan Altosaar, and Rajesh Ranganath. 2019. Clinicalbert: Modeling clinical notes and predicting hospital readmission. arXiv preprint arXiv:1904.05342. +David Jurgens, Srijan Kumar, Raine Hoover, Dan McFarland, and Dan Jurafsky. 2018. Measuring the evolution of a scientific field through citation frames. Transactions of the Association for Computational Linguistics, 6:391-406. +Johannes Kiesel, Maria Mestre, Rishabh Shukla, Emmanuel Vincent, Payam Adineh, David Corney, Benno Stein, and Martin Potthast. 2019. Semeval-2019 task 4: Hyperpartisan news detection. In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 829-839. +Jens Kringelum, Sonny Kim Kjaerulff, Soren Brunak, Ole Lund, Tudor I Oprea, and Olivier Taboureau. 2016. Chemprot-3.0: a global chemical biology diseases mapping. Database, 2016. + +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. +Fei Tony Liu, Kai Ming Ting, and Zhi-Hua Zhou. 2008. Isolation forest. In 2008 Eighth IEEE International Conference on Data Mining, pages 413-422. IEEE. +Yi Luan, Luheng He, Mari Ostendorf, and Hannaneh Hajishirzi. 2018. Multi-task identification of entities, relations, and coreference for scientific knowledge graph construction. arXiv preprint arXiv:1808.09602. +Andrew 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. +Julian McAuley, Christopher Targett, Qinfeng Shi, and Anton Van Den Hengel. 2015. Image-based recommendations on styles and substitutes. In Proceedings of the 38th international ACM SIGIR conference on research and development in information retrieval, pages 43-52. +Robert C. Moore and William Lewis. 2010. Intelligent selection of language model training data. In Proceedings of the ACL 2010 Conference Short Papers, pages 220-224, Uppsala, Sweden. Association for Computational Linguistics. +Tri-Dzung Nguyen and Roy E Welsch. 2010. Outlier detection and robust covariance estimation using mathematical programming. Advances in data analysis and classification, 4(4):301-334. +Caleb C Noble and Diane J Cook. 2003. Graph-based anomaly detection. In Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 631-636. +Sinno Jialin Pan, Xiaochuan Ni, Jian-Tao Sun, Qiang Yang, and Zheng Chen. 2010. Cross-domain sentiment classification via spectral feature alignment. In Proceedings of the 19th international conference on World wide web, pages 751-760. +Nanyun Peng and Mark Dredze. 2016. Multi-task domain adaptation for sequence tagging. arXiv preprint arXiv:1608.02689. +Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. arXiv preprint arXiv:1802.05365. +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. + +Jason Phang, Phu Mon Htut, Yada Pruksachatkun, Haokun Liu, Clara Vania, Katharina Kann, Iacer Calixto, and Samuel R Bowman. 2020. English intermediate-task training improves zero-shot cross-lingual transfer too. arXiv preprint arXiv:2005.13013. +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. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. +Robert Remus. 2012. Domain adaptation using domain similarity-and domain complexity-based instance selection for cross-domain sentiment analysis. In 2012 IEEE 12th international conference on data mining workshops, pages 717-723. IEEE. +Sebastian Ruder and Barbara Plank. 2017. Learning to select data for transfer learning with bayesian optimization. arXiv preprint arXiv:1707.05246. +Bernhard Scholkopf, Robert C Williamson, Alex J Smola, John Shawe-Taylor, and John C Platt. 2000. Support vector method for novelty detection. In Advances in neural information processing systems, pages 582-588. +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, pages 1631-1642. +Vincent Van Asch and Walter Daelemans. 2010. Using domain similarity for performance estimation. In Proceedings of the 2010 Workshop on Domain Adaptation for Natural Language Processing, pages 31-36. +Marlies van der Wees, Arianna Bisazza, and Christof Monz. 2017. Dynamic data selection for neural machine translation. arXiv preprint arXiv:1708.00712. +Rui Wang, Andrew Finch, Masao Utiyama, and Eichiro Sumita. 2017a. Sentence embedding for neural machine translation domain adaptation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 560-566. +Rui Wang, Masao Utiyama, Lemao Liu, Kehai Chen, and Eiichiro Sumita. 2017b. Instance weighting for neural machine translation domain adaptation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1482-1488. + +Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, and Quoc V Le. 2019. Unsupervised data augmentation for consistency training. arXiv preprint arXiv:1904.12848. +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. +Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. 2019. Defending against neural fake news. In Advances in Neural Information Processing Systems, pages 9054-9065. +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. + +# Appendix + +# A Related Work + +Domain Adaptation: A typical set up for Domain Adaptation involves access to labeled data in source domain, very limited or no labeled data in the target domain and unlabeled data in both source and target domains. This is somewhat different than the setup for our paper where we have access to labeled data with no additional unlabeled data in the task domain and our objective is optimize performance for the same domain. Nevertheless, several techniques of Domain Adaptation have similarities or core components useful for our setup. There are two sets of approaches addressing Domain Adaptation problem: model-centric and data-centric. Model-centric approaches redesign parts of the model: the feature space, the loss function or regularization and the structure of the model (Blitzer et al., 2006; Pan et al., 2010; Ganin et al., 2016). A recent such approach, appropriate for our setting is called Pivot-based Domain Adaptation; it has recently been applied to Task Adaptive Pre-training when there is additional unlabeled task data available (Ben-David et al., 2020). In a nutshell, the idea is to distinguish between pivot and non-pivot features, where pivot features behave similarly in both domains. Then, by converting the non-pivot to pivot features, one can make use of a model trained on the source data. This approach does not work well when the target data is small since the mapping of non-pivot to pivot features cannot be trained with a limited size dataset. Since our technique is data-centric and applies to the regime of a small target corpus, we do not further analyze this or any other model-centric approach. + +Data-centric approaches for domain adaptation include pseudo-labeling, using auxiliary tasks and data selection. Pseudo-labeling apply a trained classifier to predict labels on unlabeled instances which are then treated as 'pseudo' gold labels for further training (Abney, 2007; Cui and Bollegala, 2019). Auxiliary-task domain adaptation use labeled data from auxiliary tasks via multi-task learning (Peng and Dredze, 2016) or intermediate-task transfer (Phang et al., 2018, 2020). The methods most relevant to us are those of data selection and are discussed above in detail. + +# B Datasets in accuracy estimation of Anomaly score based data filtration + +CS task data: To train anomaly score discriminator for CS data, we use the tasks data from ACLARC and SCIERC. Details of these datasets are mentioned in Section 4. + +CS and Bio Abstracts: Semantic Scholar corpus (Ammar et al., 2018) contains datasets from a variety of domain. We filter out text based on the domain field and only keep the abstracts from CS and bio domain. + +News: We use REALNEWS (Zellers et al., 2019) corpus containing news articles from 500 news domains indexed by Google News. It is obtained by scraping dumps from Common Crawl. + +Finance: We use the TRC2-financial dataset. This a subset of Reuters TRC24 corpus containing news articles published between 2008 and 2010. It can be obtained by applying here: https://trec.nist.gov/data/reuters/reuters.html + +# C Isolation Forest (Liu et al., 2008) + +Isolation Forest is an unsupervised decision tree ensemble method that identifies anomalies by isolating outliers of the data. It isolates anomalies in data points instead of profiling the normal points. Algorithm works by recursively partitioning the data using a random split between the minimum and maximum value of a random feature. It works due to the observation that outliers are less frequent than the normal points and lie further away from normal points in the feature space. Thus, in a random partitioning, anomalous points would require fewer splits on features resulting in shorter paths and distinguishing from the rest of the points. Anomaly score of a point $x$ is defined as $s(x,n) = 2^{-\frac{E(h(x))}{c(n)}}$ , where $E[h(x)]$ is the expected path length of $x$ in various decision trees, $c(n) = 2H(n - 1) - 2(n - 1)/n$ is the average path length of unsuccessful search in a Binary Tree and $H(n - 1)$ is the $n - 1$ -th harmonic number and $n$ is the number of external nodes. + +# D Pseudo Code + +Algorithm 1 shows the pseudo code for the case of continuous relevance weights. Discrete relevance weight setting is same as $C \to \infty$ . As discussed in 3.2, in case of discrete relevance weights, we filter out segments containing several consec + +# Algorithm 1 Task Adaptive Pre-training + +Input: Pre-trained model $B$ , Pre-training instances $x_{1}, \ldots, x_{N}$ , task data $\mathcal{T}$ , $(C, \alpha)$ , #steps + +# Stage 1: Instance weight computation + +Let the sentences of the task be $s_1, \ldots, s_t$ with sentence embeddings $P = \{\text{Embed}(s_1), \ldots, \text{Embed}(s_t)\}$ . + +Let a random subset of pre-training instances (sentences of these instances) be $s_1', \ldots, s_{t/10}'$ with BERT based sentence embeddings $N = \{ \text{Embed}(s_1'), \ldots, \text{Embed}(s_{t/10}') \}$ + +Train an anomaly detection object, IF $=$ IsolationForest $(P\cup N)$ + +For $i\in [N]$ , let $S(x_{i}) = \mathrm{IF}.\mathrm{score}(\mathrm{Embed}(x_{i}))$ + +Let $\mu = \frac{1}{N}\sum_{i=1}^{N}S(x_i)$ and $\sigma = \sqrt{\frac{1}{N}\sum_{i=1}^{N}(S(x_i) - \mu)^2}$ . + +For every $i\in [N]$ $\bar{S} (x_i) = \frac{S(x_i) - \mu}{\sigma}$ + +For every $i\in [N]$ $\lambda (x_{i}) = \frac{1}{1 + e^{-C(\alpha - \bar{S} (x_{i}))}}$ + +# Stage 2: Adaptation of pre-training to target domain + +Continue training language model $B$ for #steps on instances $x_{1},\ldots ,x_{N}$ with instance weights $\lambda (x_1),\dots ,\lambda (x_N)$ + +Finetune resulting model on the labeled task data $\mathcal{T}$ + +utive sentences. We experimented with several options for the segment length and found the stable segment length to be 15 sentences. Here, a sentence is a consecutive piece of text such that when applied through the BERT tokenizer, it results in 256 sentences. + +# E Continuous relevance weights + +We see in Table 4 that a model additionally pretrained for 50,000 with discrete $\lambda$ values consistently over performs the continuous case even when we train with continuous relevance weights for far higher number of steps. This is because of the fact that many of those steps yield virtually no training at all. For instance, suppose the relevance weights are uniformly distributed between 0 and 1; [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]. Then, in discrete case we pick the top two sentences and thus two steps are sufficient to train on these most relevant sentences (assume batch size is 1). However, in continuous case, we need to train the model for ten steps to train on these top two relevant sentences. Thus, we need many more steps to + +achieve and beat the performance achieved in the Discrete case. An open question is to combine the two settings so as to benefit from the generality of Continuous case and efficiency of the discrete case. + +# F Performance boost with Domain-specific Corpus vs TADPOLE + +We compare the performance boost we achieved due to TADPOLE with the performance boost we achieve if we have access to large pre-training corpus. In Table 5, we list the gain in performance in both cases over eight tasks from four domains. We see that the performance boost is higher with TADPOLE if the corresponding boost is higher with domain specific corpus. Thus if there is a large domain shift between the general domain corpus and the task data, as can be measured by the performance boost via large pre-training corpus, then TADPOLE is able to achieve large performance boost via Task Adaptation. Scale of numbers in the two columns are not directly comparable due to the following two reasons. First is that additional pre-training done is Gururangan et al. (2020) is for almost as many steps as the number of steps required to pre-train a network from scratch. However, in our case additional pre-training is done for only $5\%$ of the number of steps required to pretrain a network from scratch. Second reason is that the model used in (Gururangan et al., 2020) is different, ROBERTA. Also, the general domain corpus is different and thus the domain shift is not exactly the same as in our case. The point however remains the same, which is that as the target domain is further away from the pre-training corpus, the benefits of TADPOLE increase. + +# G Performance gain for large datasets + +Table 6 shows the results for datasets with more than $5k$ training samples. + +# H Different data fraction + +Figure 6 shows that results shown in Table 3 are not very sensitive to the fraction of pre-training data filtered. We can chose anywhere between $2 - 20\%$ of the data. + +
TaskBaseDiscreteContinuous-1Continuous-3
CHEMPROT81.620.7482.410.6281.740.8181.640.83
RCT20K87.520.1687.820.1387.490.2887.560.22
HPRPARTISAN70.573.0473.582.3970.941.9871.292.95
AGNEWS93.990.1394.030.1694.010.1494.010.15
HELPFULNESS69.300.6069.700.9269.350.569.370.44
IMDB88.650.2489.290.2288.630.5188.710.46
ACL-ARC72.314.772.813.8372.262.3372.362.12
SCIERC82.841.3985.850.9583.141.9683.132.65
SST92.020.2992.420.3292.110.3292.130.37
+ +Table 4: Comparison of discrete vs continuous relevance weight setting. Base corresponds to the pre-trained model on general domain corpus with no further pre-training. Discrete refers to TADPOLE with discrete relevance weights/filtered out text and pre-trained additionally for 50000 steps. Continuous-x refers to TADPOLE with continuous relevance weights and pre-trained additionally for $x*100,000$ more steps. Metrics used for different tasks: accuracy for SST, micro f1 score for CHEMPROT and RCT20K, macro f1 score for ACL-ARC, SCIERC, HELPFULNESS, HPRPARTISAN, IMDB, and AGNEWS. Each model is finetuned eight times with different seeds and the mean value is reported. Subscript correspond to the standard deviation in the finetuned model performance. + +
TaskTADPOLEDomain Corpus
CHEMPROT0.792.3
RCT20K0.30.4
HYPERPARTISAN3.011.6
AGNEWS0.040.0
HELPFULNESS0.41.4
IMDB0.645.4
ACL-ARC0.53.5
SCIERC3.0112.4
+ +Table 5: Performance boost via TADPOLE vs pre-training on domain specific corpus. TADPOLE corresponds to our method with discrete relevance weights/filtered out text and pre-trained additionally for 50000 steps. Domain Corpus refers to the model trained in (Gururangan et al., 2020) over the domain same as the downstream task. Metrics used for different tasks: accuracy for SST, micro f1 score for CHEMPROT and RCT20K, macro f1 score for ACL-ARC, SCIERC, HELPFULNESS, HPRPARTISAN, IMDB, and AGNEWS. Each model is finetuned eight times with different seeds. We report the difference in the mean value of performance between the model with additional pre-training and base model with no additional pre-training. + +![](images/fa9cdc261bcbd3ac1b3a1f835130822dc3a04f0612794902733fd1a657d4f456.jpg) +Figure 6: Performance gain as fraction of data filtered for tasks with less than $5k$ training samples. + +
TaskBaseGeneralRandomTaskLMDistanceData-AugTADPOLET+ Data-Aug
Large datasets: # training examples ≥ 5K
IMDB88.650.2488.530.2788.630.2688.770.3988.670.4488.690.4788.750.5289.290.2288.910.17
SST92.020.2992.210.3192.140.2492.210.2492.250.492.150.3591.980.1292.420.3292.670.55
AGNEWS93.990.1394.060.1994.090.1194.040.0894.030.1394.040.1193.970.2894.030.1694.450.3
HELPFULNESS69.300.6069.390.7869.340.5869.410.5069.580.5969.420.6969.305669.700.9269.330.64
RCT20K87.520.1687.570.1687.540.1787.600.1887.850.2387.620.2487.570.1987.820.1387.830.37
Average Gain-0.020.020.040.010.110.010.180.030.090.010.020.010.360.040.340.04
+ +Table 6: Performance of TADPOLE and five Baseline methods. Base corresponds to the pre-trained model on general domain corpus with no further pre-training. Baseline methods are mentioned in previous subsection. TADPOLE corresponds to our method with discrete relevance weights. T+Data-Aug corresponds to our method combined with data augmentation during finetuning. Keeping in line with the previous works, we use the following metrics: accuracy for SST, micro f1 score for CHEMPROT and RCT20K, macro f1 score for ACL-ARC, SCIERC, HELPFULNESS, HPRPARTISAN, IMDB, and AGNEWS. Each model is finetuned eight times with different seeds and the mean value is reported. Subscript correspond to the standard deviation in the finetuned model performance. Average gain corresponds to the average improvement over Base for each of the baseline methods and TADPOLE. Subscript in Average Gain corresponds to the standard deviation in the estimate of the average gain. \ No newline at end of file diff --git a/tadpoletaskadaptedpretrainingviaanomalydetection/images.zip b/tadpoletaskadaptedpretrainingviaanomalydetection/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c4f4a80ca2437a872cc99fcab67a62aa96ed3f7a --- /dev/null +++ b/tadpoletaskadaptedpretrainingviaanomalydetection/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fc02dcf9ed5e0c10835c4a5a18d38906d6970c1b4780ddc05b53bc15bcd7fb1 +size 414069 diff --git a/tadpoletaskadaptedpretrainingviaanomalydetection/layout.json b/tadpoletaskadaptedpretrainingviaanomalydetection/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7509096b35951b7e135840d5bf408a9827b03d06 --- /dev/null +++ b/tadpoletaskadaptedpretrainingviaanomalydetection/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d3ccf0de4d0c1f8667202da27443b02af543617011942ff90a3bc216cc48d1d +size 472985 diff --git a/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_content_list.json b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..1c85f8cb2b1580d5828ef258a21abe8e1438b933 --- /dev/null +++ b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c65e8074cdc7f248748fb89b0aa243ad624f47c22ddca8e8be9ecff619d89c93 +size 70560 diff --git a/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_model.json b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a9843e902a0b64b4fc746fc084ed7a8a561bc980 --- /dev/null +++ b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fabe1d7907ee3b74ee503b49f1dcb51898af05a574bfb68bbb16b6c35a4ff28 +size 83922 diff --git a/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_origin.pdf b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ddc5fb0115949e55fc2e789179fd434e29e80291 --- /dev/null +++ b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/9417ccd6-9b72-4725-bbf7-44b30c98974a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eb864d9bc52e4f8ea2d6d501b8b344148ab4f206c893edfb1824d139628ddc5 +size 540303 diff --git a/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/full.md b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..52cf2a8d3043b57ca2a2b5a098c365a933f4c697 --- /dev/null +++ b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/full.md @@ -0,0 +1,311 @@ +# TDEER: An Efficient Translating Decoding Schema for Joint Extraction of Entities and Relations + +Xianming Li, Xiaotian Luo, Chenghao Dong *Daichuan Yang, Beidi Luan, Zhen He Ant Group, Shanghai + +{niming.lxm,lxt267638,dch166451,beidi.lbd}@antgroup.com {daichuan.ydc,fuyi.hz}@antgroup.com + +# Abstract + +Joint extraction of entities and relations from unstructured texts to form factual triples is a fundamental task of constructing a Knowledge Base (KB). A common method is to decode triples by predicting entity pairs to obtain the corresponding relation. However, it is still challenging to handle this task efficiently, especially for the overlapping triple problem. To address such a problem, this paper proposes a novel efficient entities and relations extraction model called TDEER, which stands for Translating Decoding Schema for Joint Extraction of Entities and Relations. Unlike the common approaches, the proposed translating decoding schema regards the relation as a translating operation from subject to objects, i.e., TDEER decodes triples as subject + relation → objects. TDEER can naturally handle the overlapping triple problem, because the translating decoding schema can recognize all possible triples, including overlapping and non-overlapping triples. To enhance model robustness, we introduce negative samples to alleviate error accumulation at different stages. Extensive experiments on public datasets demonstrate that TDEER produces competitive results compared with the state-of-the-art (SOTA) baselines. Furthermore, the computation complexity analysis indicates that TDEER is more efficient than powerful baselines. Especially, the proposed TDEER is 2 times faster than the recent SOTA models. The code is available at https://github.com/4AI/TDEER. + +# 1 Introduction + +Extraction of entities and relations from unstructured texts is one of the most essential information extraction tasks. It aims to extract entities and their corresponding semantic relations from unstructured texts, which are usually presented in a + +![](images/21babce2e8376aca8f0cf5f1c1de096e7061d71354757f0660c46db490cbb8aa.jpg) +Figure 1: Cases of Normal, EntityPairOverlap (EPO), and SingleEntityOverlap (SEO) overlapping triples. + +triple form of (subject, relation, object), e.g., (Microsoft, co-founder, Bill Gates). It is also a crucial step in building a large-scale KB and exerts an important role in the development of web search (Szumlanski and Gomez, 2010), question answering (Fader et al., 2014), biomedical text mining (Huang and Lu, 2016), etc. + +Traditional approaches (Zelenko et al., 2003; Chan and Roth, 2011; Rink and Harabagiu, 2010) handle this task in a pipeline manner, i.e., extracting the entities first and then identifying their relations. The pipeline framework simplifies the extraction task, but it ignores the relevance between entity identification and relation prediction. To address this problem, several joint learning models have been proposed and can be categorized into feature-based models and end-to-end deep models. Feature-based models (Li and Ji, 2014; Ren et al., 2017) introduce a complex process of feature engineering and profoundly depend on Natural Language Processing tools for feature extraction. More recently, the end-to-end neural network models (Gupta et al., 2016; Zheng et al., 2017; Zeng et al., 2018; Fu et al., 2019; Wei et al., 2020) have become the mainstream method for relation extraction tasks. Such models utilize the learned representation from pre-trained language models and are a more promising approach than manual features. + +More research interests have been concerned with complicated entity and relation extraction problems, such as the overlapping triple problem. + +Zeng et al. (2018) summarized the overlapping triple problem into three categories, i.e. Normal, SEO, and EPO, which are depicted in Figure 1. Many methods have been proposed to address the overlapping issue, for instance, encoder-decoder framework (Zeng et al., 2018) and decomposition approaches (Yu et al., 2020; Wei et al., 2020). However, such approaches still suffer from setbacks when handling the overlapping triple problem. More specifically, the encoder-decoder framework can only resolve the one-word entity overlapping problem and fail to handle the multi-word entity overlapping problem. Meanwhile, the decomposition approaches suffer error accumulation between dependent stages. To address these problems, Wang et al. (2020) presented a one-stage method, TPLinker, that transforms the joint extraction task into a token pair linking problem to resolve the overlapping triple problem. TPLinker does not contain any inter-dependent stages, hence it can alleviate error accumulation. However, processing all token pairs at encoder layers suffers from high computational complexity, which is an obstacle for TPLinker to encode long text. + +We present a novel framework TDEER to jointly extract the entities and relations by a translating decoding schema to handle the overlapping triple problem. More concretely, TDEER interprets the relation as a translating operation from subject entity to object entities, i.e., it decodes triples by subject $+$ relation $\rightarrow$ objects. The proposed translating decoding schema can effectively resolve the overlapping triple problem. TDEER iterates all pairs of subjects and relations to recognize objects (or no object), hence all possible triples, including overlapping or non-overlapping triples, can be considered. We propose a negative sample strategy to detect and alleviate error propagation in different stages. This strategy can enable TDEER to alleviate error accumulation to achieve higher results. TDEER is an efficient approach as it first retrieves all possible relations and entities, then uses distinguished entities and relations to decode triples. By doing this, the search space can be reduced, thus it is more efficient than previous works. The computational complexity of the proposed translating decoding schema is $O(n + sr)$ , where $n$ is the sequence length, $s$ is the number of subjects in the input sentence, $r$ denotes the number of relations in the input sentence. Extensive experiments illustrate that TDEER achieves better results than + +SOTA models in most datasets and is competent in handling the overlapping triple problem. + +In summary, our contributions are as follows: (1) We propose a novel translating decoding schema for joint extraction of entities and relations from unstructured texts. (2) TDEER can handle the intractable overlapping triple problem effectively and efficiently. (3) Notably, TDEER is about 2 times faster than the current SOTA models. + +# 2 Related Work + +The pipeline approach and joint approach are the two mainstream methods for extracting entities and relations from unstructured texts. + +Traditionally, extracting entities and relations to form triples has been studied as two separated independent tasks: Named Entity Recognition (NER) and Relation Extraction. Mintz et al. (2009) introduced a distant supervision model, and Hoffmann et al. (2011) used a weak supervision method to extract entities and relations. The features of distant supervision and weak supervision approaches are often derived from Natural Language Processing (NLP) tools. It suffers from data labeling errors that inevitably exist in NLP tools. To address this problem, Zeng et al. (2015) employed a multi-instance learning approach to tackle the problem of data labeling errors. Qin et al. (2018) applied reinforcement learning for extraction of entities and relations. Although the pipeline models produced promising results, they neglect the triple-level dependencies between entities and relations. Recently, Zhong and Chen (2021) presented a pipeline approach incorporating entity information for entity and relation extraction. + +To exploit the dependencies between entities and relations, multiply joint extraction models have been proposed. Zheng et al. (2017) introduced a unified tagging scheme and transformed the relationship extraction problem into a sequence labeling problem. Zeng et al. (2018) applied a sequence-to-sequence model with a copy mechanism to solve the overlapping triple problem. Trisedya et al. (2019) employed the encoder-decoder framework to jointly extract triples from sentences and map them into an existing KB. Fu et al. (2019) applied graph convolutional networks to jointly learn named entities and relations. Dai et al. (2019) presented a unified joint extraction model to tag entity and relation labels directly according to a query word position, which can simultaneously extract + +all entities and their types. Wei et al. (2020) proposed a cascade binary tagging framework. Wang et al. (2020) formulated the joint extraction as a token pair linking problem. + +Moreover, some knowledge representation models (Bordes et al., 2013; Weston et al., 2013; Wang et al., 2014; Tu et al., 2017) are adopted to refine the triple extraction model via scoring candidate facts by knowledge graph embedding. Although some of them also use the "translation" idea, the function is different from ours. In their setting, they use the "translation" idea to construct rank-based knowledge graph embedding models. They cannot be used to extract entities and relations from texts directly. In our setting, the "translation" idea is applied to end-to-end joint extract entities and relations from text. + +The proposed translating decoding schema is a novel approach to solve the overlapping triple problem effectively and efficiently, which makes our model crucially different from previous works. + +# 3 Methodology + +This paper proposes a three-stage model, TDEER. In the first stage, TDEER uses a span-based entity tagging model to extract all subjects and objects. In the second stage, TDEER employs the multi-label classification strategy to detect all relevant relations. In the third stage, TDEER iterates the pairs of subjects and relations to identify respective objects by the proposed translating decoding schema. Figure 2 shows the generic framework of TDEER. In subsequent sections, we will describe the three stages of TDEER in detail. + +# 3.1 Input Layer + +The input of TDEER is a sentence $T$ . We pad the sentence to keep a uniform length $n$ for all sentences. For an LSTM-based model, we first map each word into a $k$ -dimensional continuous space and obtains the word embedding $\mathbf{t}_i \in \mathbb{R}^k$ . Then we concatenate all word vectors to form a $k \times n$ matrix as model input: $\mathbf{t} = [\mathbf{t}_1, \mathbf{t}_2, \dots, \mathbf{t}_n]$ . We employ LSTM on the embedding matrix to produce latent semantic feature map $\mathbf{X}$ : + +$$ +\mathbf {X} = \operatorname {L S T M} (\mathbf {t}). \tag {1} +$$ + +As for a BERT-based model, TDEER extracts feature map via the pre-trained BERT (Devlin et al., 2019) over text input: + +$$ +\mathbf {X} = \operatorname {B E R T} (T). \tag {2} +$$ + +# 3.2 Entity Tagging Model + +To obtain entities and their positions efficiently, we adopt a span-based tagging model following prior works (Yu et al., 2020; Wei et al., 2020). We apply two binary classifiers to predict the start and end position of entities respectively. The operations on each token in a sentence are as follows: + +$$ +p _ {i} ^ {\text {s t a r t}} = \sigma \left(\mathbf {W} _ {\text {s t a r t}} \mathbf {X} _ {i} + \mathbf {b} _ {\text {s t a r t}}\right), \tag {3} +$$ + +$$ +p _ {i} ^ {e n d} = \sigma \left(\mathbf {W} _ {e n d} \mathbf {X} _ {i} + \mathbf {b} _ {e n d}\right), \tag {4} +$$ + +where $p_i^{start}$ and $p_i^{end}$ stand for the probabilities of recognizing the $i$ -th token in input sequence as the start and end position of an entity, respectively. $\sigma(\cdot)$ denotes a sigmoid activation function. + +The entity tagging model is trained by minimizing the following loss function: + +$$ +\mathcal {L} ^ {e} = - \frac {1}{n} \left(\log p _ {\theta} ^ {\text {s t a r t}} (s | \mathbf {X}) + \log p _ {\theta} ^ {\text {e n d}} (s | \mathbf {X})\right), \tag {5} +$$ + +where $p_{\theta}(s|\mathbf{X}) = \prod_{i=1}^{n} p_i^{\mathbb{I}\{y_i = 1\}}(1 - p_i)^{\mathbb{I}\{y_i = 0\}}$ , $p_{\theta}^{start}$ is the likelihood for the start positions, and $p_{\theta}^{end}$ is the likelihood for the end positions. + +We apply the entity tagging model to obtain all subjects and objects in one sentence. Detected subjects and objects are denoted as $\Omega_s$ and $\Omega_o$ , respectively. The extracted entity is presented into a tuple like (start, end). + +# 3.3 Relation Detector + +In general, more than one relation can be detected in a sentence. For example, there are four relations Star In, Direct Movie, Live In, and Capital Of in the sentence in Figure 2. To identify related relations in a sentence, we adopt a multi-label classification strategy. For the BERT-based/LSTM-based model, we project the "[CLS]" token/last output (LO) representation into a relation-detection space for multi-label classification, as follows: + +$$ +\mathbf {r} = \sigma \left(\mathbf {W} _ {r e l} \mathbf {X} _ {C L S / L O} + \mathbf {b} _ {r e l}\right), \tag {6} +$$ + +where $\sigma (\cdot)$ denotes sigmoid function. + +The relation detector minimizes the following binary cross-entropy loss function to detect relations: + +$$ +\mathcal {L} ^ {r} = - \frac {1}{n} \sum_ {i = 1} ^ {n} \left[ y _ {i} \log \left(r _ {i}\right) + \left(1 - y _ {i}\right) \log \left(1 - r _ {i}\right) \right], \tag {7} +$$ + +![](images/961515481a034cbd9807e8829a47451add738f8fadf71c73bb59bafca285df5e.jpg) +Figure 2: The generic framework of TDEER. In this example, TDEER first identifies Jackie Chan and Beijing as subjects and recognizes Beijing, China, and Police Story as objects. Then TDEER detects four involved relations: Star In, Direct Movie, Live In, and Capital Of. Finally, TDEER decodes triples by iterating all pairs of subjects and relations to recognize objects: (Jackie Chan, Star In) $\rightarrow$ Police Story, (Jackie Chan, Direct Movie) $\rightarrow$ Police Story (So far, the EPO problem can be resolved.), (Jackie Chan, Live In) $\rightarrow$ (Beijing, China), ..., (Beijing, Capital Of) $\rightarrow$ China (by now, the SEO problem can be resolved). + +where $y_{i}\in \{0,1\}$ indicates the ground truth label of relations. We denote the detected relations in a sentence as $\Omega_r$ + +# 3.4 Translating Decoding Schema + +We iterate the pairs of detected subjects $\Omega_s$ and relations $\Omega_r$ to predict the start positions of objects. For each subject and relation pair, we first combine the representation of subject and relation. Next, we use the attention mechanism to obtain a selective representation, which is expected to assign higher weights to possible positions of objects. Finally, we pass the selective representation to a fully-connect layer to get the output, i.e. the positions of objects. + +More concretely, for the $i$ -th subject in $\Omega_s$ and $j$ -th relation in $\Omega_r$ , TDEER takes the averaged vector span representation between the start and end tokens of the subject as $\mathbf{v}_{sub}^i$ . TDEER maps the relation into a continuous space with the same feature dimension as $\mathbf{v}_{sub}^i$ to produce the relation embedding vector $\mathbf{e}_{rel}^j$ . Then TDEER applies a fully-connect layer to encode the relation: + +$$ +\mathbf {v} _ {r e l} ^ {j} = \mathrm {F u l l y C o n n e c t} (\mathbf {e} _ {r e l} ^ {j}). \qquad (8) +$$ + +TDEER links subject and relation via addition op + +eration, as follows: + +$$ +\mathbf {u} = \mathbf {v} _ {s u b} ^ {i} + \mathbf {v} _ {r e l} ^ {j}. \tag {9} +$$ + +We adopt the addition operation because it is intuitive, and it does not change the tensor shape of inputs, which is convenient for attention computation. + +Next, TDEER applies the attention mechanism to obtain the selective representation. + +$$ +\mathbf {A} = \mathrm {s o f t m a x} (\frac {\mathbf {Q K} ^ {T}}{\sqrt {d _ {k}}}) \mathbf {V} +$$ + +$$ +\mathbf {Q} = \mathbf {W} _ {\text {q u e r y}} (\mathbf {X} + \mathbf {u}) + \mathbf {b} _ {\text {q u e r y}} \tag {10} +$$ + +$$ +\mathbf {K} = \mathbf {W} _ {k e y} (\mathbf {X} + \mathbf {u}) + \mathbf {b} _ {k e y} +$$ + +$$ +\mathbf {V} = \mathbf {W} _ {\text {v a l u e}} (\mathbf {X} + \mathbf {u}) + \mathbf {b} _ {\text {v a l u e}}, +$$ + +where $d_{k}$ is the dimension of the attention key. Furthermore, TDEER adopts a binary classifier to identify the start positions of objects given the current subject and relation. + +$$ +p _ {i} ^ {\text {o b j - s t a r t}} = \sigma \left(\mathbf {W} _ {\text {t r a n s}} \mathbf {A} _ {i} + \mathbf {b} _ {\text {t r a n s}}\right), \tag {11} +$$ + +where $p_i^{obj\_start}$ indicates the probability of identifying the $i$ -th token in input sequence as the start position of an object entity. + +In this stage, TDEER minimizes the following loss function to discern the start positions of object entities. + +$$ +\begin{array}{l} \mathcal {L} ^ {t} = - \frac {1}{n} \sum_ {i = 1} ^ {n} \left[ \mathbb {I} \left\{y _ {i} = 1 \right\} \log \left(p _ {i} ^ {\text {o b j} _ {-} \text {s t a r t}}\right) + \right. \tag {12} \\ \mathbb {I} \{y _ {i} = 0 \} \mathrm {l o g} (1 - p _ {i} ^ {o b j \_ s t a r t}) \Big ], \\ \end{array} +$$ + +where $\mathbb{I}$ is the indicator function. After obtaining the start positions of objects, TDEER takes the corresponding entities from the $\Omega_o$ which has the same start position as the final objects. If no start positions match, there is no triple for the current subject and relation. + +# 3.5 Negative Sample Strategy + +Most entities and relations extraction models consisting of multiple components suffer from error accumulation. Errors from upstream components will propagate to downstream components because of the dependency between components. In TDEER, the translating decoder is dependent on the entity tagger and relation detector, hence the translating detector may receive error entities or relations from upstream components. Therefore, we introduce a negative sample strategy to detect and alleviate errors from upstream components. For each sentence, we produce incorrect triples as negative samples by replacing the correct subject/relation with other inappropriate subjects/relations during the training phase. We do not assign any objects to negative samples, namely the probabilities of start positions of Eq.(11) are all expected to be 0. This strategy enables TDEER to handle noisy inputs of subjects and relations at the decoding phase. + +# 3.6 Joint Training + +We jointly train the span-based entity tagging model, the relation detector, and the translating decoder. The joint loss function is defined as follows: + +$$ +\mathcal {L} = \alpha \mathcal {L} ^ {e} + \beta \mathcal {L} ^ {r} + \lambda \mathcal {L} ^ {t}, \tag {13} +$$ + +where $\alpha, \beta$ and $\lambda$ are constants. In our experiment, we set 1.0, 1.0, and 5.0, respectively. The values are obtained by grid search on the validation set. + +# 4 Experiment + +# 4.1 Datasets and Evaluation Metrics + +We conduct experiments on widely used datasets. NYT (Riedel et al., 2010) dataset was produced by + +distant supervision method from New York Times news articles. WebNLG was created for Natural Language Generation and adapted by Zeng et al. (2018) for relational triple extraction. For a fair comparison, we apply the two datasets released by Zeng et al. (2018). Apart from evaluating the model on standard splitting, we follow (Wei et al., 2020) to partition the test sentences according to different overlapping categories, different triple numbers for experiments on overlapping triples, and various triple numbers. Furthermore, we also conduct experiments on NYT11-HRL (Takanobu et al., 2019), in which most test sentences belong to Normal, to demonstrate that the proposed model can handle not only the overlapping triple problem but also the general problem. The adopted public datasets with summary statistics in Table 1. + +We report the standard micro Precision, Recall, and F1-score following the same setting in Fu et al. (2019). + +# 4.2 Baselines + +We compare the proposed model with following SOTA models: NovelTagging (Zheng et al., 2017) incorporates both entity and relation roles and models relational triple extraction problem as a sequence labeling problem; CopyR (Zeng et al., 2018) applies a sequence-to-sentence architecture; GraphRel (Fu et al., 2019) uses graph convolutional networks to jointly learn named entities and relations; OrderCopyR (Zeng et al., 2019) applies the reinforcement learning into an sequence-to-sequence model to generate triplets; CasRel (Wei et al., 2020) employs a cascade binary tagging framework; TPLinker (Wang et al., 2020) iterates all token pairs and use matrices to tag token links to recognize relations between token pair. + +# 4.3 Implementation Details + +We adopt the Adam (Kingma and Ba, 2015) optimizer. The hyper-parameters are tuned by grid search on the validation set. The learning rate is set to $1\mathrm{e} - 3 / 5\mathrm{e} - 5$ and the batch size is set to $32 / 8$ in the backbone as LSTM/BERT. For the LSTM-based model, we apply the 300-dimension pre-trained GloVe embedding (Pennington et al., 2014) $^{1}$ . For the BERT-based model, we use the pre-trained Cased BERT-base $^{2}$ as the backbone. + +
CategoryTrainValidTestOverlapping PatternNumber of triplesRel.
Norm.SEOEPO= 1= 2= 3= 4≥ 5
NYT5619550005000326612979783244104531229110824
WebNLG5019500703246457262661711319045216*
NYT11.62648-36936810368100012
+ +Table 1: Statistics of datasets. NYT11. denotes NYT11-HRL, Norm. stands Normal triples, and Rel. stands Relations. Note that the relation number of WebNLG was miswritten as 246 in (Zeng et al., 2018; Wei et al., 2020). We correct the number in the statistics and use $\star$ to mark the accurate number. + +# 4.4 Results & Discussion + +# 4.4.1 Main Results + +The main results of the proposed models and baseline models are reported in Table 2. CasRel, TPLinker, and TDEER achieve absolute improvements on NYT and WebNLG datasets against the rest baselines. Especially, TDEER produces competitive results compared with the previous SOTA model TPLinker and achieves 7 out of 9 best results. Moreover, TDEER outperforms baseline models over the F1 score on all datasets. From Table 1, we can observe that the data size of WebNLG is small while it consists of a large number of predefined relations. It is difficult to make improvements on WebNLG, as existing models can achieve an F1 score over $90\%$ , which has already exceeded human-level performance (Wang et al., 2020). Even though, TDEER achieves around $1.2\%$ gain to $93.1\%$ on WebNLG against TPLinker, which verifies the effectiveness of the proposed framework. Apart from F1, we find that TDEER performs better on precision score than baselines models in most results. + +Although without a pre-trained language model as the backbone, TDEER $_{\text{LSTM}}$ still performs well. TDEER $_{\text{LSTM}}$ achieves a higher F1 score on NYT against baseline models except for BERT-Based CasRel and TPLinker. Furthermore, TDEER $_{\text{LSTM}}$ outperforms baseline models on WebNLG and NYT11-HRL over precision against all baseline models except for BERT-Based CasRel. Therefore, the proposed framework is efficacious even though without a powerful pre-trained language model. + +NYT and WebNLG contain a large number of overlapping-triple instances. Therefore, the results on NYT and WebNLG indicate that TDEER can address the overlapping triple problem. Almost all triples in NYT11-HRL belong to Normal. TDEER achieves better results than baselines on NYT11-HRL, which shows that TDEER can solve the gen + +eral extraction problem. + +# 4.4.2 Results of Ablation Study + +We conduct ablation studies on different strategies to explore the effect of the negative sample strategy. It shows that negative samples from subjects achieve better results than negative samples from relations. TDEER performs better by combining the two types of negative sample strategy than adopting each strategy individually or without negative samples. This evidence illustrates that negative samples are helpful to alleviate error accumulation. We also conduct ablation studies on TDEER without the relation detector or attention. It also shows that the results of TDEER are better than TDEER without the relation detector or attention. We notice that the model will malfunction without the relation detector. This evidence suggests that the relation detector and attention are crucial for TDEER. + +To investigate the effect of the attention mechanism, we pick up a sample from the NYT test set which contains a triple (Netherlands, /location/country/administrative_division, Utrecht). We visualize the attention heatmap of different subject and relation pairs as depicted in Figure 3. The heatmap indicates that when the extracted subject and relation pair are proper, the attention weights on object positions are higher than others. If the weights are close to each other, then the extracted subject and relation pair can not be decoded to form a valid triple. + +# 4.4.3 Discussion on Triple Numbers + +In general, the more triples in a sentence, the more complicated the sentence is. To explore the model performance regarding different sentence complexities, we also conduct experiments on sentences with different triple numbers. The results are reported in Table 4. From the results, we can find that TDEER outperforms baseline models except for four triple numbers in NYT. Notably, TDEER + +
ModelNYTWebNLGNYT11-HRL
Prec.Rec.F1Prec.Rec.F1Prec.Rec.F1
NovelTagging62.431.742.052.519.328.346.948.947.9
CopyR61.056.658.737.736.437.134.753.442.1
OrderCopyR77.967.272.163.359.961.6---
GraphRel63.960.061.944.741.142.9---
CasRelLSTM84.283.083.686.980.683.7---
CasRelBERT89.789.589.693.490.191.850.158.453.9
TPLinkerLSTM83.883.483.690.890.390.5---
TPLinkerBERT91.392.591.991.892.091.9---
TDEERLSTM85.582.483.992.186.989.457.743.349.5
TDEERBERT93.092.192.593.892.493.163.555.759.3
+ +Table 2: Results of baseline models on NYT, and WebNLG datasets. The results of baselines are retrieved from original papers respectively. + +
ModelF1
NYTWebNLG
w/o neg.69.567.7
w/o neg sub.81.186.1
w/o neg rel.82.386.8
w/o rel.13.52.7
w/o attn.82.787.3
TDEER LSTM83.989.4
+ +Table 3: Results of ablation study. w/o neg. stands for TDEER $_{\text{LSTM}}$ without negative samples. w/o neg sub. stands for TDEER $_{\text{LSTM}}$ without negative samples from subjects. w/o neg rel. denotes TDEER $_{\text{LSTM}}$ without negative samples from relations. w/o rel. denotes TDEER $_{\text{LSTM}}$ without relation detector. w/o attn. means TDEER $_{\text{LSTM}}$ without attention. + +achieves $2.8\%$ gain in NYT and $0.7\%$ gain in WebNLG against TPLinker for complicated sentences containing five or more triples. This evidence illuminates that TDEER is effective to model sentences with multiple triples. + +# 4.4.4 Discussion on Overlapping Patterns + +To further investigate the performance of different overlapping patterns, we conducted extensive experiments and report the results on different overlapping patterns on NYT and WebNLG in Table 5. The results suggest that TDEER outperforms baseline models, which demonstrates the advantages of TDEER in processing the overlapping triple problem. + +![](images/afdbb1da6d91c8e8c9287713fbcb08acdc05a4d27e0fd47824d8572a5637c429.jpg) + +![](images/5035183fe69140ab6de5173587a902d50562e57af479f49c297fb1ff21df78a8.jpg) +(a) (Netherlands, /location/country/administrative_divisions) + +![](images/0ee396d7dac85f3f9ca00c5c48b26849386d9f8e7b6078f9634536e69fdfc30d.jpg) +(b) (Netherlands, /people/person/ethnicity) +(c) (father, /location/country/administrative_divisions) +Figure 3: Attention heatmap of different pairs of subject and relation. The attention weight is higher when the color is deeper. + +# 4.4.5 Discussion on Computation Complexity + +Computation efficiency is an important problem that is not paid enough attention to by most previous works. We compare TDEER with baselines in computational complexity and inference time on the test set. The results are shown in Table 6. + +Pipeline approaches usually use NER tools to detect entities. NER tools usually apply the Viterbi algorithm to decode sequences with $O(nK^2)$ complexity, where $n$ denotes the input length and $K$ is the tag size. Pipeline approaches recognize relations from each entity pair. Thus, the computation complexity of pipeline approaches is $O(nK^2 + e^2)$ , where $e$ denotes the number of entities in the input. + +Despite the successes of CasRel (Wei et al., 2020) and TPLinker (Wang et al., 2020), they still struggle with computation efficiency. CasRel jointly decodes relations and objects. The com + +
ModelNYTWebNLG
N=1N=2N=3N=4N≥5N=1N=2N=3N=4N≥5
\( CopyR^{\dagger} \)67.158.652.053.630.059.242.531.724.230.0
\( GraphRel^{\dagger} \)71.061.557.455.141.166.048.337.032.132.1
\( OrderCopyR^{\dagger} \)71.772.672.577.945.963.462.264.457.255.7
\( CasRelBERT \)88.290.391.994.283.789.390.894.292.490.9
\( TPLinkerBERT \)90.092.893.196.190.088.090.194.693.391.6
\( TDEERBERT \)90.892.894.195.992.890.593.294.693.892.3
+ +Table 4: F1-score on sentences with different triple numbers. † stands results retrieve from (Wei et al., 2020). The results of the rest of the baselines are obtained from the respective original paper. + +
ModelNYTWebNLG
NormalSEOEPONormalSEOEPO
CopyR66.048.655.059.233.036.6
OrderCopyR71.269.472.865.460.167.4
GraphRel69.651.258.265.838.340.6
CasRelBERT87.391.492.089.492.294.7
TPLinkerBERT90.193.494.087.992.595.3
TDEERBERT90.894.194.590.793.595.4
+ +Table 5: Results of models in Normal, EntityPairOverlap and SingleEntityOverlap patterns in NYT and WebNLG datasets. Results of baselines are obtained from respective original paper. + +
ModelComplexityTime (ms)
NYTWebNLG
PipelineO(nK2 + e2)--
CasRelO(n + sro)54.0*76.8*
TPLinkerO(n2)82.7*112.6*
TDEERO(n + sr)31.436.9
+ +Table 6: Computation efficiency. $\star$ denotes results retrieve from (Wang et al., 2020). $e$ denotes the number of entities in input, $s/o$ stands for the number of subjects/objects in input, $r$ denotes the number of relations in input, $K$ denotes the tag size, and $n$ stands input length. Inference time presents the average time BERT-based models take to process a sample. + +putational complexity of CasRel is $O(n + sro)$ , where $n$ is the input length, $s / r / o$ is the number of subjects/relations/objects in the input, respectively. TPLinker iterates all token pairs and uses matrices to tag token links to recognize relations. The main computation overhead is on the encoder with $O(n^2)$ complexity, where $n$ is the input length. + +The computation complexity of TDEER is $O(n +$ + +$sr$ ), where $n$ is the input length, $s$ denotes the number of subjects in input, and $r$ is the number of relations in the input sentence. It is 0.7 times faster than CasRel and 1.6 times faster than TPLinker on NYT, and 1.1 times faster than CasRel and 2.1 times faster than TPLinker on WebNLG from Table 6. Therefore, we can conclude that TDEER is more efficient than baselines, which makes TDEER competent in constructing a large-scale KB. + +# 5 Conclusion & Future work + +In this paper, we have proposed a novel translating decoding schema for joint extraction of entities and relations, namely TDEER. It models the relation as a translating operation from subjects to objects, which can handle the overlapping triple problem naturally. We have conducted extensive experiments on widely used datasets to demonstrate the effectiveness and efficiency of the proposed model. The proposed negative sample strategy is used to alleviate the error accumulation problem. Though it is effective, it may increase training time. For future work, we plan to explore more efficient approaches to alleviate error accumulation. + +# References + +Antoine Bordes, Nicolas Usunier, Alberto García-Durán, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In Proceedings of the 27th Annual Conference on Neural Information Processing Systems, pages 2787-2795. +Yee Seng Chan and Dan Roth. 2011. Exploiting syntactic-semantic structures for relation extraction. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies., pages 551-560. +Dai Dai, Xinyan Xiao, Yajuan Lyu, Shan Dou, Qiao-qiao She, and Haifeng Wang. 2019. Joint extraction of entities and overlapping relations using position-attentive sequence labeling. In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence, pages 6300–6308. +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, pages 4171-4186. +Anthony Fader, Luke Zettlemoyer, and Oren Etzioni. 2014. Open question answering over curated and extracted knowledge bases. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1156-1165. +Tsu-Jui Fu, Peng-Hsuan Li, and Wei-Yun Ma. 2019. GraphRel: Modeling text as relational graphs for joint entity and relation extraction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1409-1418. +Pankaj Gupta, Hinrich Schütze, and Bernt Andrassy. 2016. Table filling multi-task recurrent neural network for joint entity and relation extraction. In Proceedings of the 26th International Conference on Computational Linguistics, pages 2537-2547. +Raphael Hoffmann, Congle Zhang, Xiao Ling, Luke Zettlemoyer, and Daniel S. Weld. 2011. Knowledge-based weak supervision for information extraction of overlapping relations. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 541-550. +Chung-Chi Huang and Zhiyong Lu. 2016. Community challenges in biomedical text mining over 10 years: success, failure and the future. Briefings Bioinform., 17(1):132-144. +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations. + +Qi Li and Heng Ji. 2014. Incremental joint extraction of entity mentions and relations. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics, pages 402-412. +Mike Mintz, Steven Bills, Rion Snow, and Daniel Jurafsky. 2009. Distant supervision for relation extraction without labeled data. In Proceedings of the 47th Annual Meeting of the Association for Computational Linguistics, pages 1003-1011. +Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. Glove: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, pages 1532-1543. +Pengda Qin, Weiran Xu, and William Yang Wang. 2018. Robust distant supervision relation extraction via deep reinforcement learning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 2137-2147. +Xiang Ren, Zeqiu Wu, Wenqi He, Meng Qu, Clare R. Voss, Heng Ji, Tarek F. Abdelzaher, and Jiawei Han. 2017. Cotype: Joint extraction of typed entities and relations with knowledge bases. In Proceedings of the 26th International Conference on World Wide Web, pages 1015-1024. +Sebastian Riedel, Limin Yao, and Andrew McCallum. 2010. Modeling relations and their mentions without labeled text. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 148-163. +Bryan Rink and Sanda M. Harabagiu. 2010. UTD: classifying semantic relations by combining lexical and semantic resources. In Proceedings of the 5th International Workshop on Semantic Evaluation, SemEval@ACL 2010, pages 256-259. +Sean R. Szumlanski and Fernando Gomez. 2010. Automatically acquiring a semantic network of related concepts. In Proceedings of the 19th ACM Conference on Information and Knowledge Management, pages 19-28. +Ryuichi Takanobu, Tianyang Zhang, Jiexi Liu, and Minlie Huang. 2019. A hierarchical framework for relation extraction with reinforcement learning. In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence, pages 7072-7079. +Bayu Distiawan Trisedya, Gerhard Weikum, Jianzhong Qi, and Rui Zhang. 2019. Neural relation extraction for knowledge base enrichment. In Proceedings of the 57th Conference of the Association for Computational Linguistics, pages 229-240. +Cunchao Tu, Zhengyan Zhang, Zhiyuan Liu, and Maosong Sun. 2017. Transnet: Translation-based network representation learning for social relation extraction. In Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, pages 2864-2870. + +Yucheng Wang, Bowen Yu, Yueyang Zhang, Tingwen Liu, Hongsong Zhu, and Limin Sun. 2020. Tplinker: Single-stage joint extraction of entities and relations through token pair linking. In Proceedings of the 28th International Conference on Computational Linguistics, pages 1572-1582. +Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. 2014. Knowledge graph embedding by translating on hyperplanes. In Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, pages 1112-1119. +Zhepei Wei, Jianlin Su, Yue Wang, Yuan Tian, and Yi Chang. 2020. A novel cascade binary tagging framework for relational triple extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1476-1488. +Jason Weston, Antoine Bordes, Oksana Yakhnenko, and Nicolas Usunier. 2013. Connecting language and knowledge bases with embedding models for relation extraction. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1366-1371. +Bowen Yu, Zhenyu Zhang, Xiaobo Shu, Tingwen Liu, Yubin Wang, Bin Wang, and Sujian Li. 2020. Joint extraction of entities and relations based on a novel decomposition strategy. In Proceedings of the 24th European Conference on Artificial Intelligence, pages 2282-2289. +Dmitry Zelenko, Chinatsu Aone, and Anthony Richardella. 2003. Kernel methods for relation extraction. Journal of machine learning research, 3:1083-1106. +Daojian Zeng, Kang Liu, Yubo Chen, and Jun Zhao. 2015. Distant supervision for relation extraction via piecewise convolutional neural networks. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1753-1762. +Xiangrong Zeng, Shizhu He, Daojian Zeng, Kang Liu, Shengping Liu, and Jun Zhao. 2019. Learning the extraction order of multiple relational facts in a sentence with reinforcement learning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing, pages 367-377. +Xiangrong Zeng, Daojian Zeng, Shizhu He, Kang Liu, and Jun Zhao. 2018. Extracting relational facts by an end-to-end neural model with copy mechanism. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 506-514. +Suncong Zheng, Feng Wang, Hongyun Bao, Yuexing Hao, Peng Zhou, and Bo Xu. 2017. Joint extraction of entities and relations based on a novel tagging scheme. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 1227-1236. + +Zexuan Zhong and Danqi Chen. 2021. A frustratingly easy approach for entity and relation extraction. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics. \ No newline at end of file diff --git a/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/images.zip b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a053a685d1ce9b8df28cb5f8123efda890f75f57 --- /dev/null +++ b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33b9e8e9086a30a7bf2559f6e8985420a20c85fd9820ddebe1775f494f18d0e0 +size 483360 diff --git a/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/layout.json b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..039c10a73ea3dd11f12b857fbf8ba297b5f30231 --- /dev/null +++ b/tdeeranefficienttranslatingdecodingschemaforjointextractionofentitiesandrelations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b51bd277303057cf921f3b7deb4c0e85de006129004050e1b0fbded1d3824ca +size 335194 diff --git a/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_content_list.json b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6627b21671de45b23a62d869dfd3a4426d4e1812 --- /dev/null +++ b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9869c1ed73245050635497280eb7e9e5edc42b0276e3fe411f0eb5711156ace1 +size 65641 diff --git a/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_model.json b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_model.json new file mode 100644 index 0000000000000000000000000000000000000000..25cbcd683fe8a3f01688baf05b0a05f715efed09 --- /dev/null +++ b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2328c308616a1b0b8d0080647ca587f1be2cae5200480a74703ba874a8c612e9 +size 83025 diff --git a/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_origin.pdf b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..03b94bac9b1fefe3728d991724ed12fe26a616ee --- /dev/null +++ b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/f7ff7a38-60c4-4301-b246-fb0b4afce477_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:573d89b8fd02ae5fe45d719c88664a5fdf1ac9f3547c109319d6331bd92ce73c +size 1445317 diff --git a/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/full.md b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d6ab7f28b55c2d261920c7018c8d5c3469718b03 --- /dev/null +++ b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/full.md @@ -0,0 +1,273 @@ +# TEBNER: Domain Specific Named Entity Recognition with Type Expanded Boundary-aware Network + +Zheng Fang $^{1,2}$ , Yanan Cao $^{1,2*}$ , Tai Li $^{3}$ , Ruipeng Jia $^{1,2}$ , Fang Fang $^{1,2}$ , Yanmin Shang $^{1,2}$ and Yuhai Lu $^{1,2*}$ + +$^{1}$ Institute of Information Engineering, Chinese Academy of Sciences + +$^{2}$ School of Cyber Security, University of Chinese Academy of Sciences + +3Bytedance + +1.2{fangzheng, caoyanan, jiaruiipeng, fangfang0703, shangyanmin + +luyuhai $@$ iie.ac.cn, $^3$ litai.vincent@bytedance.com + +# Abstract + +To alleviate label scarcity in Named Entity Recognition (NER) task, distantly supervised NER methods are widely applied to automatically label data and identify entities. Although the human effort is reduced, the generated incomplete and noisy annotations pose new challenges for learning effective neural models. In this paper, we propose a novel dictionary extension method which extracts new entities through the type expanded model. Moreover, we design a multi-granularity boundary-aware network which detects entity boundaries from both local and global perspectives. We conduct experiments on different types of datasets, the results show that our model outperforms previous state-of-the-art distantly supervised systems and even surpasses the supervised models. + +# 1 Introduction + +Named Entity Recognition (NER) is the task of detecting mentions from text and classifying them into predefined types. It is a fundamental task in the field of natural language processing (NLP), which can facilitate many other tasks, such as entity linking (Fang et al., 2020), machine translation (Gekhman et al., 2020), and question answering (Li et al., 2020a). However, most of existing NER methods require large amounts of manually annotated texts for training supervised models, which is difficult to implement in the specific domain because domain-expert annotation is expensive and time-consuming. + +To alleviate the label scarcity problem, distant supervision methods (Fries et al., 2017; Shang et al., 2018b; Liang et al., 2020) have been applied to automatically generate labeled data and recognize entities. Given a raw corpus and a dictionary, above methods firstly label entities by exact string matching, and then use the annotated dataset to train the + +well-designed neural models to recognize entities. Although the human effort is reduced, the labels generated by the string matching method pose two challenges. + +The first challenge is incomplete annotations. Because most of existing dictionaries have limited coverage on domain entities, just using the given dictionary will make many out-of-dictionary entities unmatched and generate a large number of false-negative labels. By analyzing several commonly used datasets (e.g., BC5CDR, NCBI, MeSH), we find that the original dictionary only covers about $50\%$ of domain entities, which may weaken the performance of subsequent NER model. To increase the number of label entities, previous works (Fries et al., 2017; Liu et al., 2020) attempt to expand the dictionary by heuristic rules. However, these rule-based methods are difficult to migrate to other domains. So, how to extend the dictionary with more general pattern is the first problem we need to solve. + +The second challenge is the difficulty of recalling new entities. Actually, even for the supervised models, new entities that have not been annotated are also difficult to be recalled (Shang et al., 2018b) because of the limited model capability. Most of previous NER methods, such as sequential label models (Chiu and Nichols, 2016; Ma and Hovy, 2016), and boundary detection models (Wang et al., 2018; Li et al., 2020b), only utilize the context information to recognize entities. However, the tight internal connection among entities and the global statistical features in domain corpus, which could contribute to identifying entities, are usually ignored by previous methods. Therefore, how to recall new entities with multi-granularity information is the second problem we need to solve. + +To address two issues mentioned above, we propose a new distantly supervised method named TEBNER (Type Expanded Boundary-aware NER) in specific domains. To expand the original dictio + +nary, we try to extract high-quality phrases from the raw corpus and view them as potential entities. Considering that these mined phrases lack corresponding type information and even contain noisy results, we use an entity typing model to classify and filter them based on their context information. Then these typed phrases are added to the original dictionary to resolve the incomplete annotation problem. For the purpose of recalling more new entities, we design multi-granularity boundary labeling strategies, which can capture boundary information from different perspectives. Specifically, we utilize the token interaction tagger to find the internal connection between entity tokens, the sequence labeling strategy to distinguish explicit entity boundaries in sentence and global statistical features of the whole corpus to recall potential entities. After getting the boundary results, we reuse the trained entity typing model to further classify entities and filter the noise results. In this way, we will get the trade-off between recall and precision for new entity detection. + +In summary, the main contributions of this paper are listed as follows: + +- We propose a novel dictionary extension method, which rely on semantic context, neither on ambiguous strings nor on artificial rules. Experiments show that our dictionary extension method significantly improves the quality of distantly supervised annotations. +- We propose a multi-granularity boundary-aware network which integrates the information at word, sentence and corpus level. Experiments show that fusing different granularity boundary results can significantly improve the recall rate of NER model. +- We conduct extensive experiments on three benchmark datasets and our TEBNER model achieves the best performance with dictionaries only and no human efforts. On several datasets, our approach is even better than the supervised models. + +# 2 Related Work + +As a fundamental task, named entity recognition (NER) has drawn much attention of researchers. Most previous approaches model the NER problem as a sequence labeling task and use popular architectures like NN-CRF (Ma and Hovy, 2016; + +Chiu and Nichols, 2016). Recently, to recognize nested entities, many studies also propose to detect each entity boundaries individually (Wang et al., 2018; Zheng et al., 2019; Li et al., 2020b). With the burgeoning popularity of pre-training methods, large-scale language models such as ELMo (Peters et al., 2018) and BERT (Devlin et al., 2019) are also utilized in NER task, yielding state-of-the-art performances. However, all of above supervised models require a great quantity of manually annotated data, which are usually labor-intensive and time-consuming. + +To alleviate human efforts, distant supervision methods are widely used in NER task (Shang et al., 2018b; Cao et al., 2019; Liu et al., 2020; Xue et al., 2020; Liang et al., 2020; Lison et al., 2020). For example, Shang et al. (Shang et al., 2018b) marks out-of-dictionary phrases as potential entities with a special "unknown" type and propose a neural model AutoNER with a token interaction tagger. However, these untyped phrases are less helpful to identify new entities. HAMNER (Liu et al., 2020) expands the dictionary with headwords and design a span-level model, which predicts entity boundaries by an entity classification model. But for sentences with complex structures, it is difficult to detect boundaries by just using entity type information. Unlike these works, TEBNER annotates phrases with semantic context and distinguishes entity boundaries by fusing multi-granularity information, which can generate labels with high precision and recall rate. + +# 3 Problem Definition + +Formally, given a sequence of words $X = [x_{1}, x_{2}, \ldots, x_{n}]$ , we denote an entity as $e_{t} = [x_{i}, \ldots, x_{j}] (0 \leq i \leq j \leq n)$ , where $< i, j >$ represents its boundary and $t$ indicates the entity type. Specifically, entity types include pre-defined types (e.g., Disease, Chemical) and none type which denotes non-entity. In distant supervision NER task, we only need a dictionary $D$ as input in addition to the original text. Each dictionary entry contains the surface name and the entity type. In the training phase, we use dictionary matching method to generate annotations on the training corpus. + +# 4 The Proposed Method + +The overall structure of our TEBNER model is shown in Figure 1. The proposed framework mainly includes two parts: Dictionary Extender + +![](images/0daf0e1317ae8d90bf4d13329842181c8a0ce2df3d4b5e4c582b90c455f512ff.jpg) +Figure 1: The process of our distant supervision method. Blue arrows show the dictionary expansion procedures, including high-quality phrase extraction, entity classification, and entity filtering. Red arrows show the entity recognition procedures, including annotation generation, entity boundary detection and entity type prediction. + +which enriches entities by assigning types to extracted high-quality phrases, Entity Recognizer which identifies entity boundaries by fusing multigranularity information and predicts entity types through the trained classifier. In the following, we will introduce the technical details of these modules. + +# 4.1 Dictionary Extender + +As the training annotations in the distantly supervised NER task are only generated from the entity dictionary, the coverage and quality of the dictionary become the key factors to improve the model performance, especially for the neural network. Therefore, we use a dictionary extender module to generate high-quality labels with high coverage to the target corpus. Our dictionary extender mainly consists of three parts: high-quality phrase extraction, entity classification and entity filtering. + +High-quality phrase extraction As in previous work(Shang et al., 2018b; Liu et al., 2020), we utilize the AutoPhrase (Shang et al., 2018a) to extract high-quality phrase from domain corpus. AutoPhrase is a distantly supervised phrase mining tool, which generates frequent phrase candidates according to popularity requirement and estimates phrase quality based on features about concordance and informativeness. The main input to the tool is a corpus and a dictionary, and the output is a ranked list of phrases with decreasing quality score. To obtain the high-quality phrases, we only select phrases with score higher than a certain threshold (e.g., 0.5 for multi-word phrase and 0.9 for single-word phrase). After getting the out-of-dictionary + +phrases, we treat them as potential entities and propose an entity classification model to predict phrase types. + +Entity classification The entity classification model is used to classify and filter the mined phrases and candidate entities. It is trained on annotated corpus generated by the original dictionary matching. Considering that some mined phrases are not real entities, we further add non entities to the training corpus to help the classification model recognize noisy entities. Specifically, we label the phrases in the corpus with lower scores (e.g., less than 0.3) as none entity type. We use pre-trained language model BERT as the backbone, which has been proven to be able to capture rich language information from text. Given an entity $e_t = [x_i, \dots, x_j]$ and its context, we construct the input of each entity as: + +$$ +[ C L S ] c t x t _ {l} [ x _ {i} ] \dots [ x _ {j} ] c t x t _ {r} [ S E P ] +$$ + +where $[x_i], [x_j]$ denote the token at the beginning and the end of the entity respectively. $[x_i] \ldots [x_j]$ are the word-piece tokens of the entity. $ctxt_{l}$ and $ctxt_{r}$ denote the context before and after the entity respectively. After getting the BERT output of each token in the sentence, we concatenates the representations of $[CLS], [x_i], [x_j]$ and input them into a fully-connected layer. Then the representation of the entity will be sent into a softmax layer to predict the type label: + +$$ +V _ {h} = V _ {[ c l s ]} \oplus V _ {[ x _ {i} ]} \oplus V _ {[ x _ {j} ]} \tag {1} +$$ + +$$ +V _ {e} = \operatorname {R e l u} \left(W _ {t} ^ {1} V _ {h} + b _ {t} ^ {1}\right) \tag {2} +$$ + +$$ +P (y _ {t} | e _ {t}) = \operatorname {s o f t m a x} \left(W _ {t} ^ {2} V _ {e} + b _ {t} ^ {2}\right) \tag {3} +$$ + +where $W_{t}^{1}, W_{t}^{2}$ and $b_{t}^{1}, b_{t}^{2}$ are trainable parameters, $P(y_{t}|e_{t})$ denotes the probability of entity $e_{t}$ being predicted to the type $t$ . Generally, we compute the loss of type label prediction as follows: + +$$ +L _ {t y p e} = - \sum_ {i = 1} ^ {n} y _ {i} \log \left(P \left(y _ {i} \mid e _ {i}\right)\right) \tag {4} +$$ + +After training the entity typing model, we back-track and reconstruct the annotation data by out-of-dictionary phrases, and assign each phrase with the highest probability type. + +![](images/af8edd1fd147801a27c7f123ba9e6e05b82e4501941d6534d951e959eae8d5ee.jpg) +Figure 2: The two-stage pipeline framework. In Stage I, "Break or Tie" schema, "BIO" schema and "Phrase Matching" schema are utilized to identify entity boundaries at the word, sentence and corpus level separately, where the entity marked in red represents the result correctly predicted by the model. On the contrary, the entity marked in blue indicates that it is not recognized correctly. In Stage II, the entity classification model trained in the dictionary expansion procedure is used to predict entity types. + +Entity filtering We first filter the phrases that are predicted as none type by the entity classification model. Moreover, there are some phrases predicted as several different types. We skip the phrases that are identified as multiple categories during the entity recognizer module training. As for phrases with consistent results, we add them to original dictionary to improve the entity coverage. Finally, the extended dictionary will be used to generate more annotations for the training of entity recognizer. + +# 4.2 Entity Recognizer + +Previous works (Ma and Hovy, 2016; Shang et al., 2018b; Cao et al., 2019; Wang et al., 2020) always jointly model the entity boundary detection and classification tasks. In general, it is effective for the supervised model using manual annotation data. However, there are many labeling errors in the data annotated by distantly supervised method. The joint learning method can easily lead to overfitting of the NER model, which makes it difficult to identify unlabeled entities. With this in mind, we utilize a pipeline framework which learns entity boundary and entity type separately. The overall structure of our framework is shown in Figure 2. + +Our entity recognizer contains two components: boundary detector and entity classifier. As the final results in NER are only generated from the boundary detector, we will recall candidate entities as comprehensively as possible to ensure that + +the target entity can be input into the entity classifier. To achieve this goal, three kinds of tagging schemas are utilized to identify entity boundaries at the word, sentence and corpus level. In the following, we will describe each tagging schema in detail. + +"Break or Tie" Tagging Schema To capture boundary information at word granularity, we construct a token interaction tagger to distinguish whether two adjacent tokens are tied in the same entity mention or not. The key motivation is that domain entities usually contain the specific words, modeling the connection between adjacent tokens can help to find new entities with the same domain words. For example, in the field of biology, many disease entities may contain kidney, lung and other organ nouns; in the field of finance, many institutional entities may contain insurance, bank, etc. Inspired by this intuition, we utilize a "Break or Tie" tagging schema to recognize domain entities. As shown in Figure 2, (i) $\mathbf{T}$ (Tie) indicates that both of the two adjacent tokens belong to the same entity. (ii) $\mathbf{B}$ (Break) means that the ties between adjacent tokens are broken into two parts. + +Specifically, we build a binary classifier to distinguish whether current token is connected to the next one in the sentence. Given the output from BERT, the representation of $i$ -th token and $i + 1$ -th token are concatenated to a new feature vector, + +which is referred as $V_{i}^{\prime}$ for the $i$ -th token. The model predicts the probability of each token being connected with next one as follows: + +$$ +P \left(c _ {i} \mid V _ {i} ^ {\prime}\right) = \frac {\exp \left(c _ {i} ^ {T} V _ {i} ^ {\prime}\right)}{\sum c _ {k} \in C \exp \left(c _ {k} ^ {T} V _ {i} ^ {\prime}\right)} \tag {5} +$$ + +where $c_{i}$ is the label between the $i$ -th and its next tokens, and $C$ is the set of connection modes (e.g., "Tie" and "Break"). To train the model, we adopt the following cross entropy loss function: + +$$ +L _ {\text {w o r d}} = - \frac {1}{n} \sum_ {x} \left[ y \ln y ^ {\prime} + (1 - y) \ln \left(1 - y ^ {\prime}\right) \right] \tag {6} +$$ + +where $y \in \{0,1\}$ represents the label of each token, and $y' \in [0,1]$ indicates the predicted result of our model. In the inference stage, we connect the tokens between every two consecutive "Break" to form a candidate entity. + +"BIO" Tagging Schema It is worth noting that above token interaction tagger cannot detect entities which just contain single token. Moreover, besides the tight internal connection between words, context information is also important for identifying entities. Therefore, we follow the sequence labeling framework using "BIO" tagging scheme to detect entities at sentence level. Concretely, we tag the beginning token of an entity by "B", the other token of this entity by "T", and the non-entity tokens by "O". As shown in Figure 2, we first tokenize each word in sentence and pass it through BERT Transformer stacks. Then we use a Dense layer with the softmax activation function as the entity classifier to get probability of the labels from the contextualized representation. Similar to the token interaction tagger mentioned above, we use the cross entropy loss function in the model training process and connect the tokens between "B" and "O" to form a candidate entity in the inference process. + +"Phrase Matching" Tagging Schema Most of the previous distantly supervised models (Shang et al., 2018b; Cao et al., 2019; Liu et al., 2020) use deep neural network to identify entity boundaries at the word or sentence level. However, the statistical features of domain entities in the corpus are often ignored by them. For example, the part-of-speech tagging, the term frequency, and the probabilities of an entity in quotes and brackets are all helpful to identify boundaries. Therefore, we use a phrase mining tool which can capture multiple features + +# Algorithm 1 The Process of TEBNER + +# Input: Domain Corpus, Dictionary $D$ + +Output: The named entities $\Gamma = \{e_1,\dots,e_N\}$ in test dataset $\mathcal{T}$ + +1: Extract high-quality phrases $P$ by AutoPhrase +2: Based on $D$ , detect all entities by string matching, and extract noise entities from corpus. + +3: for epoch $\leftarrow 1$ to $n$ do +4: Update $W_{t}^{1}, W_{t}^{2}$ and $b_{t}^{1}, b_{t}^{2}$ w.r.t. $L_{type}$ +5: end for +6: Extend $D$ to $D_{ext}$ by assigning types to $P$ +7: Reconstruct the annotation data $S = \{S_1, \dots, S_m\}$ by $D_{ext}$ +8: for $S$ in $\mathcal{S}$ do +9: Update $\theta_w$ of token interaction model $M_w$ +10: Update $\theta_{s}$ of sequence label model $M_{s}$ + +# 11: end for + +# 12: for $S$ in $\mathcal{T}$ do + +13: Predict candidate entities $\mathbf{E}_{word}$ by $M_w$ +14: Predict candidate entities $\mathbf{E}_{sent}$ by $M_{s}$ +15: Get candidate entities $\mathbf{E}_{\text{corp}}$ by phrases $P$ +16: Combine $\mathbf{E}_{word},\mathbf{E}_{sent},\mathbf{E}_{corp}$ as $\mathbf{E}_{all}$ +17: Assign types to $\mathbf{E}_{all}$ +18: end for + +to extract high-quality phrases and detect candidate entities from the testing data set through exact string matching. + +Finally, the results of the above three methods are fused and input into the entity classification model (mentioned in 4.1). In this stage, the entity classification model is trained on annotated corpus labeled by the extended dictionary. If the candidate entity does belong to a given entity type (not none), we output it as the final result. The details of the overall process of our model are presented in Algorithm 1. + +# 5 Experiments + +To evaluate the effectiveness of our method, we conduct experiments on a series of popular distantly supervised NER datasets which are also used by (Fries et al., 2017; Shang et al., 2018b; Liu et al., 2020). The results show that our model achieves the state-of-the-art performance. + +# 5.1 Experiment Setup + +Dataset We train and evaluate our model on three benchmark datasets. The statistics of the datasets are shown in Table 1. + +
DatasetBC5CDRNCBI-DiseaseLaptopReview
DomainBiomedicalBiomedicalTechnical
Entity Num28,7876,8813,012
Dictionary Size2,482931272
Phrase Num6,8772,7281,399
+ +Table 1: The statistical results on experimental datasets. There are duplicate items in the entity set. + +- BC5CDR (Li et al., 2016) consists of 1,500 PubMed articles, including 15,935 Chemical and 12,852 Disease mentions. It is split into three subsets: 500 each for the training, development and test sets. +- NCBI-Disease (Dogan et al., 2014) consists of 793 PubMed abstracts, including 6,881 Disease mentions. It is separated into three subsets: 593 for training, 100 for validation and 100 for testing. +- LaptopReview (Pontiki et al., 2014) consists of 3,845 review sentences, including 3,012 AspectTerm mentions. As in previous work (Giannakopoulos et al., 2017; Liu et al., 2020), it is split into three subsets: 2,445 for training, 600 for validation and 800 for testing. + +Dictionary and High-Quality Phrase For a fair comparison with the previous methods, we use the same dictionary and high-quality phrase as (Shang et al., 2018b; Liu et al., 2020). Specifically, for the BC5CDR and NCBI-Disease datasets, the dictionary is a combination of both the MeSH database ${}^{1}$ and the CTD Chemical and Disease vocabularies ${}^{2}$ . For the LaptopReview dataset, the dictionary is crawled from the public website ${}^{3}$ . Moreover,the phrase mining tool AutoPhrase is pre-trained on a same domain text and then applied to small datasets. In the biomedical domain, it is pre-trained on the titles and abstracts of 686,568 PubMed papers. In the laptop review domain, it is pre-trained on Amazon laptop review dataset (Wang et al., 2011). + +Training Details In the boundary detection and entity classification models, we use a fine-tuned BERT to encode entity context. During the finetuning process, we use "biobert-base-cased-v1.1" (Lee et al., 2020) and "bert-base-cased" (Devlin + +et al., 2019) as our pre-trained models for biomedical and technical domain separately. We set a maximum sentence length of 256 tokens. The dimension of hidden representations is set to 768, the learning rate is set to 3e-5, the probability of dropout is set to 0.15, and the AdamW (Loshchilov and Hutter, 2019) is utilized as optimizer. The multi-layer perceptron in the entity classifier has a depth of 2 and a hidden size of 256. All above modules are trained on Nvidia Tesla V100 GPU and implemented in the PyTorch framework. + +# 5.2 Comparing with Previous Work + +Baselines We compare TEBNER with a series of NER models which report state-of-the-art results on the test datasets. There are two types of baselines methods, including supervised model (BiLSTM-CRF, ELMo-NER, BERT-NER) and distantly supervised model (Dictionary Match, SwellShark, AutoNER, HAMNER). + +- BiLSTM-CRF (Lample et al., 2016) adopts bi-directional LSTM with character-based representations to produce token embeddings, which are fed into a CRF layer to predict token labels. +- ELMo-NER (Liu et al., 2020) uses pretrained word embeddings, a character-based CNN representation, two BiLSTM layers with ELMo to train the NER model. +- BERT-NER adopts BERT-base model with sequence labeling framework to perform token-level prediction. +- Dictionary Match recognizes entities by performing string matching with given dictionary. It can be viewed as the baseline of distantly supervised model to test the improvement of other methods over the distant supervision itself. +- SwellShark (Fries et al., 2017) is a distantly supervised method designed for the biomedical domain. It needs regular expressions, and hand-tuning for special cases. +- AutoNER (Shang et al., 2018b) uses a BiLSTM network to learn connection between adjacent tokens and extracts high-quality phrases to reduce false-negative labels. + +
MethodDescriptionBC5CDRNCBI-DiseaseLaptopReview
PreRecF1PreRecF1PreRecF1
BiLSTM-CRF88.8485.1686.9686.1185.4985.8084.8066.5174.55
ELMo-NERGold Annotations88.1788.3988.2885.3490.9488.0585.1480.5882.80
BERT-NER87.2490.7588.9685.9090.1087.9579.2682.4280.81
Dictionary Matchsource95.9450.8266.4492.2049.6464.5482.4339.4553.36
extended92.5768.8678.9790.0767.0876.9069.5460.4064.65
SwellSharkRegex Design (RD)84.9883.4984.2364.769.767.1---
RD + Case Tuning86.1182.3984.2181.680.180.8---
AutoNER+ELMo83.0882.1682.7076.9874.6575.7868.7259.3963.70
+BERT82.8983.1783.0380.2487.9783.9362.7562.1962.47
HAMNER-86.0186.3486.1782.0383.5682.7974.0262.0267.46
TEBNER88.0590.3689.1986.3291.3588.7770.8280.8975.52
+ +- HAMNER (Liu et al., 2020) is the best distantly supervised method in the past. It extends the dictionary with headword-based matching and infers the entity spans with an entity typing model. + +Results The comparative results on three benchmark datasets are shown in Table 2. We observe that TEBNER achieves the best performance on all datasets. It should be emphasized that we use the same dictionary and phrases as the AutoNER and HAMNER. Due to the differences in data processing methods, our dictionary matching results are slightly different from them. Although SwellShark is designed for the biomedical domain and utilizes much more expert effort, TEBNER can easily surpasses it without human effort. Since the original AutoNER model uses all the raw texts for training (i.e., the training dataset is the union of the training, development, and test sets), Liu et al. (Liu et al., 2020) retrained the model with ELMo. To make a fair comparison with them, we use the AutoNER+ELMo (trained on the training set only) results reported in (Liu et al., 2020), which are slightly lower than original results in (Shang et al., 2018b). Moreover, we also train the AutoNER model with BERT and report the evaluation results in our paper. Compared with our proposed model that integrates multi-granularity boundary information, AutoNER only focuses on the ties between adjacent tokens and has poor performance on benchmark datasets. In particular, TEBNER outperforms the previous state-of-the-art method + +Table 2: Performance comparison of supervised and distantly supervised NER on three test datasets. + +
DictionaryBC5CDR
PreRecF1
Source97.4066.1578.79
Extended (based HAMNER)91.8984.4888.03
Extended (based KNN)92.8287.2689.95
Extended (based TEBNER)93.9495.3294.63
+ +Table 3: Distantly supervised annotation quality on the training set. + +HAMNER by $\{3.02\%, 5.98\%, 8.06\% \}$ in terms of F1 score and surpasses the supervision model on the BC5CDR and NCBI datasets, which demonstrates the significant superiority of our proposed model. + +# 5.3 Impact of Different Modules + +To analyze the performance of different modules and investigate their impact on the final results, we also conduct experiments on following aspects. + +Effectiveness of Dictionary Extension To evaluate the effectiveness of our dictionary extender, we compare three extension methods and report their distantly supervised annotation quality on the training set. As shown in Table 3, our dictionary extension method can greatly increase the entity recall while slightly reducing the precision. For example, on the BC5CDR dataset, our method significantly boosts the recall from $66.15\%$ to $95.32\%$ with an acceptable precision loss from $97.40\%$ to + +![](images/2b415e61d7f1c4843e3cea3f0986393ebdf7a218d49a142a9293aeffbf460511.jpg) +Figure 3: Influence of annotated data size on the distantly supervised model. + +93.94%. Compare to the (Liu et al., 2020), our method significantly achieves $10.84\%$ and $6.60\%$ relative improvements on recall and F1 scores. It is worth noting that previous methods utilize complex strategies (i.e., headword matching, semantic similarity calculation, annotation weight setting) to improve the entity recall rate. Unlike them, our method mainly depends on contextual semantic information, which can be applied to any domain corpus. Moreover, we also try to extend the dictionary with a KNN model. Specifically, for each phrase, a closest entity will be recalled from the source dictionary based on the cosine similarity between the corresponding word embeddings. Then the type of the recalled entity will be assigned to the phrase. Limited by the size of the original dictionary, some entities with similar semantics but different types are easy to be recalled by KNN model, which leads to a decline in F1 score. + +Influence of the number of Annotations To evaluate the robustness of our model, we study the influence of the annotated data size on the final results. Concretely, we randomly select sentences from the distant annotations and evaluate our model trained on the selected texts. From Figure 3, we can observe that increasing the size of annotations will generally improve the performance of the model, and the improvement tends to flatten out with $80\%$ data. In particular, our model achieve $86.70\%$ test F1 score on the BC5CDR dataset with only $60\%$ data, which demonstrates that our TEBNER model can significantly reduce the human efforts to create NER taggers. + +
ModelF1(%)
TotalΔ
Full Model89.19-
- Dictionary Extension85.303.89
- BERT("Break or Tie" tagging scheme)87.771.42
- BERT("BIO" tagging scheme)86.652.54
- Phrase Matching86.442.75
+ +Table 4: Results on the BC5CDR dataset to investigate the influence of different model components. + +Ablation studies To better explore the contribution of different modules to the overall performance, we conduct the ablation studies on BC5CDR dataset. From the results shown in table 4, we can observe that: (1) Dictionary extender is a necessary component that contributes $3.89\%$ gain of F1 to the ultimate performance, we attribute this gain to the context semantic information. (2) Removing "Break or Tie" tagging scheme degrades the performance by $1.42\%$ F1, which shows that the connection information reflecting the interdependence between adjacent tokens is useful for NER. (3) The "BIO" tagging scheme contributes much to the overall performance, since the F1 drops by $2.54\%$ if it is removed. (4) When we remove phrase matching result, the score drops by $2.75\%$ , which indicates that the participation of multi-aspect statistical information is important for our model. + +# 6 Conclusion + +In this paper, we propose a new dictionary extension method and design a boundary-aware model in specific domains using distant supervision. Our dictionary extender combines phrase mining method with entity classification model, which can be easily applied to any other domain corpus. By utilizing different tagging schemes to extract candidate entities from sentence and introducing AutoPhrase tool to extract high-quality phrases from corpus, our distantly supervised NER model can detect entities from both local and global perspectives. In experiments, we evaluate our method on different domain datasets and the results demonstrate the effectiveness of our model. + +# Acknowledgements + +This research is supported by the National Key Research and Development Program of China + +(NO.2017YFC0820700) and National Natural Science Foundation of China (No.61902394). We thank all authors for their contributions and all anonymous reviewers for their constructive comments. + +# References + +Yixin Cao, Zikun Hu, Tat-Seng Chua, Zhiyuan Liu, and Heng Ji. 2019. Low-resource name tagging learned with weakly labeled data. 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, pages 261-270. +Jason P. C. Chiu and Eric Nichols. 2016. Named entity recognition with bidirectional LSTM. Trans. Assoc. Comput. Linguistics, 4:357-370. +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, pages 4171-4186. +Rezarta Islamaj Dogan, Robert Leaman, and Zhiyong Lu. 2014. NCBI disease corpus: A resource for disease name recognition and concept normalization. J. Biomed. Informatics, pages 1-10. +Zheng Fang, Yanan Cao, Ren Li, Zhenyu Zhang, Yanbing Liu, and Shi Wang. 2020. High quality candidate generation and sequential graph attention network for entity linking. In The Web Conference 2020, WWW 2020, pages 640-650. +Jason A. Fries, Sen Wu, Alexander Ratner, and Christopher Re. 2017. Swellshark: A generative model for biomedical named entity recognition without labeled data. CoRR, abs/1704.06360. +Zorik Gekhman, Roee Aharoni, Genady Beryozkin, Markus Freitag, and Wolfgang Macherey. 2020. Kobe: Knowledge-based machine translation evaluation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, EMNLP 2020, pages 3200-3207. +Athanasios Giannakopoulos, Claudiu Musat, Andreea Hossmann, and Michael Baeriswyl. 2017. Unsupervised aspect term extraction with B-LSTM & CRF using automatically labelled datasets. In Proceedings of the 8th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis, WASSA@EMNLP 2017, pages 180-188. +Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. 2016. Neural architectures for named entity recognition. + +In NAACL HLT 2016, The 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 260-270. +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. Bioinform., pages 1234-1240. +Belinda Z. Li, Sewon Min, Srinivasan Iyer, Yashar Mehdad, and Wen-tau Yih. 2020a. Efficient one-pass end-to-end entity linking for questions. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, pages 6433-6441. +Jiao Li, Yueping Sun, Robin J. Johnson, Daniela Sciaky, Chih-Hsuan Wei, Robert Leaman, Allan Peter Davis, Carolyn J. Mattingly, Thomas C. Wiegers, and Zhiyong Lu. 2016. Biocreative VCDR task corpus: a resource for chemical disease relation extraction. Database J. Biol. Databases Curation. +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, ACL 2020, pages 5849-5859. +Chen Liang, Yue Yu, Haoming Jiang, Siawpeng Er, Ruijia Wang, Tuo Zhao, and Chao Zhang. 2020. BOND: bert-assisted open-domain named entity recognition with distant supervision. In The 26th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, SIGKDD 2020, pages 1054-1064. +Pierre Lison, Jeremy Barnes, Aliaksandr Hubin, and Samia Touileb. 2020. Named entity recognition without labelled data: A weak supervision approach. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, pages 1518-1533. +Shifeng Liu, Yifang Sun, Bing Li, Wei Wang, and Xi-ang Zhao. 2020. HAMNER: headword amplified multi-span distantly supervised method for domain specific named entity recognition. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, pages 8401-8408. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019. +Xuezhe Ma and Eduard H. Hovy. 2016. End-to-end sequence labeling via bi-directional LSTM-cnns-crf. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, ACL 2016. + +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, pages 2227-2237. +Maria Pontiki, Dimitris Galanis, John Pavlopoulos, Harris Papageorgiou, Ion Androutsopoulos, and Suresh Manandhar. 2014. Semeval-2014 task 4: Aspect based sentiment analysis. In Proceedings of the 8th International Workshop on Semantic Evaluation, SemEval@COLING 2014, pages 27-35. +Jingbo Shang, Jialu Liu, Meng Jiang, Xiang Ren, Clare R. Voss, and Jiawei Han. 2018a. Automated phrase mining from massive text corpora. IEEE Trans. Knowl. Data Eng., 30. +Jingbo Shang, Liyuan Liu, Xiaotao Gu, Xiang Ren, Teng Ren, and Jiawei Han. 2018b. Learning named entity tagger using domain-specific dictionary. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, EMNLP 2018, pages 2054-2064. +Bailin Wang, Wei Lu, Yu Wang, and Hongxia Jin. 2018. A neural transition-based model for nested mention recognition. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, EMNLP 2018, pages 1011-1017. +Hongning Wang, Yue Lu, and ChengXiang Zhai. 2011. Latent aspect rating analysis without aspect keyword supervision. In Proceedings of the 17th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2011, pages 618-626. +Yu Wang, Yun Li, Hanghang Tong, and Ziye Zhu. 2020. 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 2020, pages 6027-6036. +Mengge Xue, Bowen Yu, Zhenyu Zhang, Tingwen Liu, Yue Zhang, and Bin Wang. 2020. Coarse-to-fine pre-training for named entity recognition. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, pages 6345-6354. +Changmeng Zheng, Yi Cai, Jingyun Xu, Ho-fung Leung, and Guandong Xu. 2019. A boundary-aware neural model for nested named entity recognition. 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, pages 357-366. \ No newline at end of file diff --git a/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/images.zip b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..087cab3dc06b17fdd706c6af7c4373fe6e84ec0b --- /dev/null +++ b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fbe1e2c198da62c5abe3cbf4205f1a50f70e7dda5d0565fc7a5556485dd6f00 +size 337926 diff --git a/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/layout.json b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..0f498678677d043e2c069cdfa0ff954aebeb354b --- /dev/null +++ b/tebnerdomainspecificnamedentityrecognitionwithtypeexpandedboundaryawarenetwork/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec54303373fc850f7b8792089d1df8aa210577144ebe1e5085be9d04756d211e +size 334407 diff --git a/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_content_list.json b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..705575314a08921da8f8d0492b5de323e87027d5 --- /dev/null +++ b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1740686a7d6d64171a0eaa8d403471124f2530881f15c02eb880a5b53d91ba45 +size 65134 diff --git a/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_model.json b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_model.json new file mode 100644 index 0000000000000000000000000000000000000000..fdf720da6ce71a2314e75cecae528cf4e7af5f78 --- /dev/null +++ b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c09c3dccc541690756175e36cf316a641e58ab37c4dc03849d6b637b4dbcfd76 +size 81329 diff --git a/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_origin.pdf b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..90885460d3e1c14f8e645e6f162b48d45c3f37d6 --- /dev/null +++ b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/379b4f98-c50f-49bb-84bb-a8c797cedfa3_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:010707cf40bd97c4f0aa0df7c266ddf0771efbbb54ceba37d3131c6b9624d73f +size 315157 diff --git a/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/full.md b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7bdc19b18e4f358ec3c170db3d2be6846aa1604b --- /dev/null +++ b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/full.md @@ -0,0 +1,280 @@ +# TEMP: Taxonomy Expansion with Dynamic Margin Loss through Taxonomy-Paths + +Zichen Liu $^{1}$ , Hongyuan Xu $^{1}$ , Yanlong Wen $^{1}$ , Ning Jiang $^{2}$ , Haiying Wu $^{2}$ , Xiaojie Yuan $^{1}$ + +$^{1}$ TKLNDST, College of Computer Science, Nankai University, China + +$^{2}$ Mashang Consumer Finance Co, Ltd + +{liuzichen, xuhongyuan, wenyl, yuanxj}@dbis.nankai.edu.cn + +{ning.jiang,haiying.wu02}@msxf.com + +# Abstract + +As an essential form of knowledge representation, taxonomies are widely used in various downstream natural language processing tasks. However, with the continuously rising of new concepts, many existing taxonomies are unable to maintain coverage by manual expansion. In this paper, we propose TEMP, a self-supervised taxonomy expansion method, which predicts the position of new concepts by ranking the generated taxonomy-paths. For the first time, TEMP employs pre-trained contextual encoders in taxonomy construction and hypernym detection problems. Experiments prove that pre-trained contextual embeddings are able to capture hypernym-hyponym relations. To learn more detailed differences between taxonomy-paths, we train the model with dynamic margin loss by a novel dynamic margin function. Extensive evaluations exhibit that TEMP outperforms prior state-of-the-art taxonomy expansion approaches by $14.3\%$ in accuracy and $15.8\%$ in mean reciprocal rank on three public benchmarks. + +# 1 Introduction + +Taxonomies, tree-structured semantic hierarchies that organize entities by hypernym-hyponym (is-a) relations, play an important role in many NLP tasks such as question answering (Yang et al., 2017), query understanding (Hua et al., 2016) and information extraction (Demeester et al., 2016). + +Manually curated taxonomies usually face the limited coverage issue, especially when new concepts arise continuously. A low coverage taxonomy can largely hurt the performance of downstream tasks relied on it. Moreover, for maintaining and expanding existing taxonomies, the curation process that requires domain experts is expensive and time-consuming. Thus, we study the automatic taxonomy expansion task (Figure 1): given an existing taxonomy, a text corpus, and a set of concepts, the + +goal is to expand the taxonomy by inserting concepts into it. + +Two common strategies used to study taxonomy construction and expansion are pattern-based methods (e.g. the Hearst pattern (Hearst, 1992)) and distributional methods (Yu et al., 2015). Recent evidence suggests that the semantic information or structural features encoding in the representation is an effective way to solve the task, especially probability statistics from a large corpus (Mikolov et al., 2013), semantic information extracted from text data (Yin and Roth, 2018), and properties of hypernym-hyponym relations such as strict partial order (Dash et al., 2020). + +Since taxonomies can be formulated as directed acyclic graphs (DAGs), the graph structure has been seen as important information for taxonomy expansion and construction in recent works (Shang et al., 2020; Shen et al., 2020). However, according to our observation, the path composed of ancestor nodes in a taxonomy is a more appropriately encoded object in hypernym-hyponym relations. In a tree-structured taxonomy, all the ancestor nodes have an $is-a$ relation with the child node. In Figure 1, for example, "Science" - "Systematics" - "Biosystematics" is the taxonomy-path of word "Biosystematics". "Biosystematics" not only "is-a" "Systematics" but also "is-a" "Science". In addition, the serial structure of taxonomy-path is also more appropriate than the graph structure for transformers to encode. + +As far as we know, there has been no attempt to take pre-trained contextual encoders (such as BERT (Devlin et al., 2019)) as the core of taxonomy expansion or construction model. Pre-trained contextual encoders have been proved powerful in various NLP tasks such as Question Answer(QA)(Yang et al., 2019), Information Retrieval (IR) (Nogueira and Cho, 2019), Document Classification (Adhikari et al., 2019), etc. Compared with previous encoding approaches, pre-trained contextual en + +![](images/7e6579b19bab6311c629645888bcf457f5680eef375217260f4b8d803fe19e2d.jpg) +Figure 1: An example of expanding taxonomy. The dash boxes outline two candidates of all possible taxonomies to be predicted. + +![](images/d8882a2aa8baee83ea670aced17d49f58fc7e47ac62b38321730bc069762eed4.jpg) + +coders have two main advantages. First, they are capable of deeply encoding textual content and capturing long distance dependencies. Second, most of them have been pre-trained on large text corpora to naturally support tasks using text features. Our proposed method, $\mathrm{TEMP}^1$ , is the first to show that fine-tuned pre-trained contextual encoders are able to identify hypernym-hyponym relations. To enhance the understanding of concepts, the model takes the query concept's definition as input besides the taxonomy-path. + +The diversity and heterogeneity of hypernym-hyponym relations is another reason for the difficulty of expanding taxonomies (Fu et al., 2014; Manzoor et al., 2020), which makes it hard for the model to learn the similarities and differences between relations on limited datasets. Inspired by the success of ARBORIST (Manzoor et al., 2020), we train the model with dynamic margin ranking loss (MRL) to handle this problem. Previous studies show that margin loss can optimize the model to learn the discriminative deep features (Lin and Xu, 2019) and that dynamic margins set by handcrafted rules can lead the model to learn more similarity information (Feng et al., 2020). Therefore, we design a margin function to calculate the margin between taxonomy-paths based on their semantic similarity. + +Contributions. In summary, our major contributions include: + +- We propose TEMP, a self-supervised taxonomy expansion method, that is the first to take contextual encoders (such as BERT) as the core of the model for the taxonomy expansion problem. + +- We employ the dynamic margin-based ranking loss with a novel dynamic margin function in the TEMP to make the model learn the discriminative difference between taxonomy-paths. +- We take word definitions and taxonomy-paths generated in the existing taxonomy as the input of our model, which means that TEMP doesn't require large-scale corpora but only the definitions of concepts. + +Experiments on three benchmarks show that TEMP improves the previous state-of-the-art performance by $14.3\%$ in accuracy and $15.8\%$ in mean reciprocal rank on average. + +# 2 Related Work + +Automatic taxonomy construction has been a long-term task in literature in the last few decades. Most existing methods follow the paradigm of constructing taxonomy from scratch. They firstly extract $<$ Hypernym, Hyponym $>$ pairs from raw resources (Gupta et al., 2017) and organize them into a noisy hierarchy to further prune it via constraints like DAG (Fu et al., 2014; Liang et al., 2017b,a). These approaches exploit semantic information and structural features such as lexical-patterns (Hearst, 1992; Nakashole et al., 2012) or distributional embeddings (Yu et al., 2015; Shwartz et al., 2016; Le et al., 2019; Wang and He, 2020) to automatically construct taxonomies. However, recent practical applications have revealed that it is laborious to construct taxonomies from scratch when facing the continuously rising of new concepts, so solutions to the taxonomy expansion task are in urgent need. + +![](images/5bdc44b8a2bd3119bbb5386d3b4ec15baca89e6b47d511506f9eadec4859bae9.jpg) +Figure 2: Overview of TEMP structure. Given one node in the existing taxonomy, a pair of positive and negative taxonomy-paths is generated. Through the generated taxonomy-paths, dynamic margin function returns a margin. + +Recently, numerous methods have been proposed to solve the aforementioned problem (Shen et al., 2018; Mao et al., 2020; Shen et al., 2020; Yu et al., 2020; Manzoor et al., 2020; Zhang et al., 2021). For example, Shen et al. (2020) proposes a position-enhanced graph neural network framework to encode the local structure of an anchor concept with a noise-robust training objective. Yu et al. (2020) converts candidate anchor positions from the whole existing taxonomy to mini-paths, in which way can better capture and integrate multiple sources of information via a multi-view co-training procedure. Manzoor et al. (2020) first designs a realistic approach to demonstratively model unobserved and heterogeneous edge semantics. Zhang et al. (2021) generalizes expansion task to the more general "one-to-pair" completion task and applies primal and auxiliary scorers based on the neural tensor network to rank candidate anchor positions. + +As far as we know, all the existing methods attempt to determine the attachment position by scoring between several nodes, we are the first to take the path as the unit for encoding and calculating scores. Besides, to the best of our knowledge, few state-of-the-art expansion approaches encode information out of supervision information in the existing taxonomy, we take pre-trained contextual encoder as core to aggregate more valuable information and resources such as word definition to improve performance. + +# 3 The TEMP Method + +In this section, we describe our proposed method TEMP. First, we introduce taxonomy-path, an im + +important concept in our method (Section 3.1). Our model takes concept definitions and taxonomy-pathas input and relies on the pre-trained contextual encoders as its core (Section 3.2). The parameters of the model are trained by margin ranking loss (MRL) with a dynamic margin function designed for taxonomy expansion (Section 3.3). Finally, we discuss how to sample self-supervision data and fine-tune the model with dynamic margin loss (Section 3.4). + +# 3.1 Taxonomy Paths + +The essence of taxonomy expansion is to attach a new concept to the correct position in the existing taxonomy. Therefore, most previous works (Shen et al., 2020; Manzoor et al., 2020; Shen et al., 2018) treat this task as finding the optimum hypermnym node for the new concept by measuring the taxonomic relatedness of candidate node-pairs. However, in taxonomies, not only the directed attached node has a hypermnym relation with the new concept but also every ancestor node of it does. To preserve more comprehensive information, TEMP finds the correct position by evaluating the generated taxonomy-paths. + +Taxonomy-Path: A taxonomy-path $P =$ [root, $n_1, n_2, \dots, n_D$ ], where $D$ is the depth of $n_D$ , root is the root node in the taxonomy. $n_{i-1}$ is the parent node of $n_i$ in the taxonomy. + +In a tree-structured taxonomy, each node has its unique corresponding taxonomy-path. For a new term, the framework generates the same number of candidate taxonomy-paths as nodes in the existing taxonomy. Then, TEMP ranks all the candidate + +![](images/147b7fab62f9370a80227ed1f76e04abbee6c3704be9893be5cdea9fddf780bd.jpg) +Figure 3: The backbone of TEMP + +taxonomy-paths by scoring each of them. + +# 3.2 Model Backbone + +We use the pre-trained contextual encoder as the backbone of our model. We exploit the model to encode the definition of the last node in the taxonomy-path besides the taxonomy-path such that the model can capture more semantic information of the query term. The text encoding of TEMP refers to the encoding way in question answering task, with word definition as the question and taxonomy-path as the passage. Take the Word-Piece tokenization (Schuster and Nakajima, 2012) used by BERT as an example, to be in line with contextual encoders, the words in taxonomy-path $P$ and the definition sentence $S$ of the last node are concatenated to form the input string as shown in Figure 3. Given the input string, the contextual encoder returns a sequence of vectors: + +$\operatorname{Encoder}(S, P) = v_{[\mathrm{CLS}]}, v_1, \ldots, v_{[\mathrm{SEP}]}, v_{p_d}, \ldots, v_{\mathrm{root}}$ + +where $v_{[CLS]}$ is the representation vector of the special [CLS] token. We feed the [CLS] representation into a multilayer perceptron (MLP) output layer to evaluate the taxonomy-path. + +Compared with the previous methods (Shwartz and Dagan, 2016; Panchenko et al., 2016; Yu et al., 2020) that normally designed lexical features like Ends with, Contains, Suffix match, Occurrence frequency, and so on, we believe that contextual encoders are sufficient to obtain the hierarchical information for the following two reasons: (1) Contextual encoders use subword algorithms for text encoding, such as WordPiece (Schuster and Nakajima, 2012) and Byte-Pair Encoding (Sennrich et al., 2016). So after the taxonomy-path is tokenized, the substring information among terms is intuitively showed to the model. (2) Contextual encoders are pre-trained in large corpora, which makes them empirically powerful even without explicit frequency information. + +# 3.3 Dynamic Margin Loss + +We train the model with Margin Ranking Loss (MRL) such that the optimum taxonomy-path is ranked higher than others. Margin Ranking Loss is defined as follows: + +$$ +\mathcal {L} = \sum_ {P \in \mathcal {P} ^ {+}} \sum_ {P ^ {\prime} \in \mathcal {P} ^ {-}} \max (0, f \left(P ^ {\prime}\right) - f (P) + \gamma \left(P, P ^ {\prime}\right)) \tag {1} +$$ + +where $\mathcal{P}^{+}$ is the set of taxonomy-paths in the taxonomy, $\mathcal{P}^{-}$ is the set of negative samples, and $\gamma(P, P')$ is a function designed for the margin between positive and negative taxonomy-paths. In traditional MRL, the output of the margin function is a constant value, which is manually set via cross-validation. All the negative taxonomy-paths will be roughly scored the same, which ignores the subtle similarity that is proved useful in both face recognition (Feng et al., 2020) and lexical entailment (Manzoor et al., 2020). To capture the semantic similarity of different taxonomy-paths, we set a dynamic margin function based on the semantic similarity as follows: + +$$ +\gamma (P, P ^ {\prime}) = \left(\frac {| P \cup P ^ {\prime} |}{| P \cap P ^ {\prime} |} - 1\right) * k \tag {2} +$$ + +where $k$ is a parameter used to adjust margins (usually between 0.1 and 1). + +This function is inspired by the word meaning similarity measure proposed by Wu and Palmer (1994). In a tree-structured taxonomy, the intersection of two different taxonomy-paths is the set of common super-concepts at the beginning of both paths. Minimizing the loss also minimizes the number of different nodes between the highest-ranked prediction and the true taxonomy-path. Therefore, the training with the margin function encourages negative taxonomy-paths that are more irrelevant to the last nodes in them to get a lower score. Such a design also fits the Wu&P metric which is introduced in Section 4.1. + +# 3.4 Sampling and Training + +In this section, we introduce how TEMP learns using self-supervision from the existing taxonomy. + +Sampling. Figure 2 shows an example of generating self-supervision data. Given one leaf node $n_q$ in the existing taxonomy, we take its corresponding + +taxonomy-path as a positive sample. Then, we randomly select one node $n_r$ (except its parent) with its corresponding taxonomy-path $P_r$ in the taxonomy. By adding $n_q$ to $P_r$ as its last node, we obtain a negative taxonomy-path $P_n$ . For each leaf node in the existing taxonomy, we generate a pair of positive and negative taxonomy-path. By repeating the above process (with different random choices) for each epoch, we obtain the full self-supervision dataset. + +Training. When training, the mini-batch consists of pairs of samples, which means the positive and corresponding negative taxonomy-paths must be fed into the model in the same batch. With the pair of taxonomy-paths as input, the margin function returns the corresponding margin. Then, we calculate the margin loss and update the model parameters. + +# 4 Experiments + +In this section, we first introduce the experimental setup (Section 4.1) and report the overall performance compared with baselines (Section 4.2). Then, we study the effectiveness of the key choices in TEMP by ablation experiments (Section 4.3). Furthermore, we discuss the factors that can affect the performance of TEMP (Section 4.4). + +# 4.1 Experimental Setup + +
DatasetEnvironmentSciencefood
|N|2614291486
L|2013121184
D|688
Δ|3.785.165.36
+ +Table 1: Statistics of the taxonomy datasets for evaluation. $|\mathcal{N}|$ and $|\mathcal{L}|$ are the number of nodes and leaf nodes in the taxonomy. $|\mathcal{D}|$ and $|\Delta|$ indicate the depth of the taxonomy and the average depth of leaf nodes respectively. + +Datasets. We evaluate TEMP using all the three English datasets in Semeval-2016 task $13^{2}$ (Bordea et al., 2016). These datasets correspond to human-curated concept taxonomies of three different domains: environment, science, food (summarized in Table 1). We follow the setup as in Yu et al. (2020) that uses the randomly-grown taxonomies for self-supervised learning and the rest $20\%$ leaf concepts for testing. + +Metrics. When testing, TEMP ranks all candidate taxonomy-paths for each test concept. For the $i$ th node in $n$ testing nodes, We denote the ground truth taxonomy-path and the highest-ranked taxonomy-path as $y_{i}$ and $\hat{y}_i$ respectively. Following previous works (Yu et al., 2020; Shen et al., 2020; Jurgens and Pilehvar, 2016), we use these metrics: + +(1) Accuracy (Acc) measures the counting of the exactly predicted taxonomy-path. + +$$ +\mathrm {A c c} = \frac {1}{n} \sum_ {i = 1} ^ {n} \left(y _ {i} = \hat {y} _ {i}\right) +$$ + +(2) Mean reciprocal rank (MRR) calculates the average of reciprocal ranks of the true taxonomy-path. + +$$ +\mathrm {M R R} = \frac {1}{n} \sum_ {i = 1} ^ {n} \frac {1}{\operatorname {r a n k} (y _ {i})} +$$ + +(3) Wu & Palmer similarity (Wu&P) measures the semantic similarity between the predicted taxonomy-path and the truth taxonomy-path, calculated as + +$$ +\mathrm {W u} \& \mathrm {P} = \frac {1}{n} \sum_ {i = 1} ^ {n} \frac {2 \left| y _ {i} \cap \hat {y} _ {i} \right|}{\left| y _ {i} \right| + \left| \hat {y} _ {i} \right|} +$$ + +Baseline Methods. We compare with the following methods: + +- BERT+MLP: A distributional method that takes terms embeddings from a pre-trained but not fine-tuned BERT and then feeds them into a Multi-Layer Perceptron (MLP) to predict their relations. The experimental results come from Yu et al. (2020). +- TaxoExpan (Shen et al., 2020): A self-supervised method for taxonomy expansion that adopts position-enhanced graph neural networks (GNNs) to encode local structure and InfoNCE loss for robust learning. +- STEAM (Yu et al., 2020): One state-of-the-art taxonomy expansion framework which extracts features for query-anchor pairs from three views based on mini-path anchor format and is trained by a multi-view co-training procedure. +- TMN (Zhang et al., 2021): A one-to-pair matching model which leverages auxiliary and primal signals using the base model neural + +
DatasetEnvironmentScienceFood
MetricAccMRRWu&PAccMRRWu&PAccMRRWu&P
BERT+MLP11.121.547.911.515.743.610.514.947.0
TaxoExpan11.132.354.827.844.857.627.640.554.2
STEAM36.146.969.636.548.368.234.243.467.0
TMN35.043.654.041.953.275.934.747.265.9
TEMP-BERT49.062.075.954.464.684.645.257.178.3
TEMP-ELECTRA49.263.577.757.867.585.347.660.581.0
+ +Table 2: Baseline comparison on the three datasets (in %). + +
DatasetEnvironmentScienceFood
MetricAccMRRWu&PAccMRRWu&PAccMRRWu&P
No Definition48.761.971.934.146.770.532.443.764.8
BCELoss10.526.657.416.431.464.28.018.049.8
Con-Margin33.349.668.744.457.780.742.554.474.0
No Path48.362.176.544.458.278.943.655.374.8
TEMP-BERT49.062.075.954.464.685.345.257.178.3
+ +Table 3: Results of ablation experiments on the three datasets (in %). + +tensor network. It regulates concept embedding via the channel-wise gating mechanism to boost performance. + +Implementation Details. The baseline method experimented by us, TMN, is obtained from the code published by the original authors3. Because the implementation of TMN needs validation data to set the training epochs, we use $10\%$ terms for validating and $10\%$ for testing. For each benchmark, we try various learning rates and report the best performance. To reduce the randomness, we evaluated TEMP five times on five differently divided test sets and training sets for each dataset and report the average performance. The hyperparameter $k$ in Equation 2 is set to 0.2 on the three datasets. In the experiments of TEMP, all the pretrained contextual encoders are of base size with 12 layers4. We fine-tune the model with a batch size of 64 (which means 32 pairs of positive and negative samples). The optimizer is Adam with learning rate 2e-5, $\beta_{1} = 0.9$ , $\beta_{2} = 0.999$ which is recommended by the authors of BERT. + +The definitions of concepts used in training and testing are automatically gathered from the corresponding Wikipedia pages. We use the first line on the page as the word's definition. For each multi-word concept without a corresponding Wikipedia page, the definitions of the words that make the + +concept up are concatenated as its definition. + +# 4.2 Experimental Results + +Table 2 reports the performance of TEMP based on the most representative contextual encoder, BERT and the contextual encoder that achieves the best performance, ELECTRA, and the baseline methods on the three benchmarks. + +We summarize the evaluation results of the expansion task on the datasets in Table 2. As shown, TEMP-ELECTRA achieves the best performance on the three datasets and improves the state-of-the-art TMN model by $14.3\%$ , $15.8\%$ and $16.1\%$ for Acc, MRR, Wu&P on average. + +# 4.3 Ablation Studies + +We perform ablation studies to analyze the effectiveness of the key choices in TEMP: (1) optimizing the margin loss by semantic similarity dynamic margin function; (2) using word definitions for taxonomy expansion; and (3) predicting the attachment by encoding taxonomy-paths. Since BERT is currently the most representative contextual encoder, all the experiments in ablation studies are based on BERT. We design the following experiments and report the results in Table 3. + +The Effect of Dynamic Margin Function. We restrict TEMP to use a constant margin (Con-Margin). We experiment with different margin values and report the best performance. In the ex + +![](images/df60e9c84cfca82d576a3d97d66287a03b17e71cb6820882962cfd9daa02fbb2.jpg) +(a) Environment + +![](images/6e009272f63cbddc85a61e86de443bfd1e77dab84de13e2e4b5f063888b964e9.jpg) +(b) Science + +![](images/ee1fd4fe532a9707400825bb731230345fe2eda50aa2843e55a2085ca00cd7a8.jpg) +(c) Food +Figure 4: Results for different contextual encoders over three datasets. + +experimental results, the dynamic margin function doesn't greatly improve the performance in the food dataset as it does in the other datasets. For this result, there are two possible reasons: (1) Semantic similarity is more important on a small dataset. In other words, with large training data, the model can learn the discriminative features with a constant margin. (2) The function can't improve a lot on flat datasets. The food dataset has the same depth as the science dataset but its number of nodes is more than three times the number of nodes in the science dataset, which means that the food dataset is very flat. + +The Effect of Margin Loss. We modify TEMP to minimize Binary Cross-Entropy Loss (BCELoss). We find that the usage of margin loss is the main reason for the performance of TEMP. + +$$ +\begin{array}{l} B C E L o s s = \\ - \frac {1}{n} \sum_ {i = 1} ^ {n} \left[ y _ {i} \log \left(\hat {y} _ {i}\right) + \left(1 - y _ {i}\right) \log \left(1 - \hat {y} _ {i}\right) \right] \tag {3} \\ \end{array} +$$ + +The Effect of Definition. We remove the definition from the input of TEMP (No Definition). From the results, one can see that the definitions improve the performance a lot on science and food datasets but not on the environment dataset. The poor quality definitions of the environment dataset may lead to this result. There are more than half of the words that are multi-words without a Wikipedia page in the dataset. Besides, the performance of TEMP without word definitions is also closed to the performance of prior state-of-the-art methods. It proves that BERT captures the hypernym-hyponym relations between terms to a relatively good degree. + +The Effect of Encoding Paths. We modify the input of TEMP from taxonomy paths to the rela + +tion pairs (No Path). The experiments show that the effect of encoding the taxonomy-paths is more significant on the deeper taxonomies. + +# 4.4 Discussions + +In this subsection, we discuss the following three factors that affect the effect of the model: (1) pretrained encoders (2) parameter $k$ (3) the number of sibling nodes of test terms. + +Effect of Pre-trained Encoder. Figure 4 shows the preformance of TEMP on three datasets based on different pre-trained contextual encoders with the same experiment setup included ALBERT (albert-base-v2; Lan et al. (2019)), RoBERTa (roberta-base; Liu et al. (2019)), BERT (bert-base-uncased), ELECTRA(electra-base-discriminator). The performance of different encoders on different domain datasets shows consistency, and ELECTRA achieves the best performance on all datasets among the experimented contextual encoders. Another observation is that RoBERTa doesn't achieve better performance than BERT like it did on other tasks. The possible reason for it is that the text encoding algorithm used by RoBERTa, Byte-Pair Encoding is weaker in its ability to capture the substring information than WordPiece, the algorithm used by the other three encoders. + +Effect of $k$ . $k$ is the parameter in dynamic margin function (equation 2). Figure 5 shows the effect of $k$ on the Science dataset with BERT as the context encoder. As observed, when $0.1 \leq k \leq 1$ , there is little difference in performance among various $k$ . The obtained performance for different $k$ also indicates that TEMP is not sensitive to the parameter $k$ and has the advantage of robustness. We also try to use some larger $k$ , experiments show that when $k > 10$ , the loss doesn't converge. + +![](images/c1f1b74fe30fa3f19c0a1f5b91cbe27f98211841ab35c15246b9264ee8c8ddc2.jpg) +Figure 5: The performance of TEMP-BERT on the science dataset when varying $k$ . + +Effect of Sibling Nodes. To evaluate the effect of sibling nodes of test nodes in the self-supervised training data, we do the experiment in which the parent node of each test node retains a constant number of child nodes in the training taxonomy. In the $>5$ experiment, all the parents of test nodes have more than 5 child nodes in training data. Figure 6 shows the experimental results on the science dataset with BERT as the contextual encoder. From the experimental results, we get the following observations and conclusions: (1) As the number of sibling nodes in the training data increases, the performance of TEMP generally increases, which means that the sibling nodes in the test data make the model better learn the hypernym-hyponym relations. (2) When there is no sibling node in the training data, the performance in Acc and MRR is very low. However, compared with the other results with similar performance in Acc and MRR, it gets a higher score in Wu&P. This means that in this case, TEMP doesn't rank the ground-truth high, but the highest-ranked term is similar to the ground-truth in the taxonomy, such as the parent node of the ground-truth. + +# 5 Conclusion + +We proposed TEMP, a self-supervised method for taxonomy expansion, that relies on the pre-trained contextual encoder as its core. TEMP takes the definition of the query concept and the generated taxonomy-path as input to predict the attachment position. The model is trained by a margin ranking loss with a novel dynamic margin function to better capture the semantic similarity between taxonomy- + +![](images/b3a9d819c0b764503b26e82e322aebbc8720501fbbc1a1788b6a4f674352832f.jpg) +Figure 6: The performance of TEMP-BERT on the science dataset when varying the number of sibling nodes of test terms. + +paths. Experiments on three datasets from different domains show that TEMP outperforms state-of-the-art methods. Further ablation studies show that our key choices in TEMP have an effect on the performance in varying degrees especially the use of margin loss. + +For future work, we plan to design sampling methods for TEMP to improve its performance and robustness. We also want to do interpretability studies about the effect of margin loss in model training. + +# Acknowledgements + +This research is supported by Chinese Scientific and Technical Innovation Project 2030 (No. 2018AAA0102100), National Natural Science Foundation of China (No. 62077031, 61772289, U1936206). We thank the reviewers for their constructive comments. + +# References + +Ashutosh Adhikari, Achyudh Ram, Raphael Tang, and Jimmy Lin. 2019. Docbert: Bert for document classification. arXiv preprint arXiv:1904.08398. +Georgeta Bordea, Els Lefever, and Paul Buitelaar. 2016. Semeval-2016 task 13: Taxonomy extraction evaluation (texeval-2). In Proceedings of the 10th international workshop on semantic evaluation (semeval-2016), pages 1081-1091. +Sarthak Dash, Md Faisal Mahbub Chowdhury, Alfio Gliozzo, Nandana Mihindukulasooriya, and Nicolas Rodolfo Fauceglia. 2020. Hypernym detection using strict partial order networks. In Proceedings of + +the AAAI Conference on Artificial Intelligence, volume 34, pages 7626-7633. +Thomas Demeester, Tim Rocktäschel, and Sebastian Riedel. 2016. Lifted rule injection for relation embeddings. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1389-1399. +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. +Yushu Feng, Huan Wang, Haoji Roland Hu, Lu Yu, Wei Wang, and Shiyan Wang. 2020. Triplet distillation for deep face recognition. In 2020 IEEE International Conference on Image Processing (ICIP), pages 808-812. IEEE. +Ruiji Fu, Jiang Guo, Bing Qin, Wanxiang Che, Haifeng Wang, and Ting Liu. 2014. Learning semantic hierarchies via word embeddings. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1199-1209. +Amit Gupta, Rémi Lebret, Hamza Harkous, and Karl Aberer. 2017. Taxonomy induction using hypernym subsequences. In Proceedings of the 2017 ACM on Conference on Information and Knowledge Management, pages 1329-1338. +Marti A Hearst. 1992. Automatic acquisition of hyponyms from large text corpora. In *Coling* 1992 volume 2: The 15th international conference on computational linguistics. +Wen Hua, Zhongyuan Wang, Haixun Wang, Kai Zheng, and Xiaofang Zhou. 2016. Understand short texts by harvesting and analyzing semantic knowledge. IEEE transactions on Knowledge and data Engineering, 29(3):499-512. +David Jurgens and Mohammad Taher Pilehvar. 2016. Semeval-2016 task 14: Semantic taxonomy enrichment. In Proceedings of the 10th international workshop on semantic evaluation (SemEval-2016), pages 1092-1102. +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. +Matthew Le, Stephen Roller, Laetitia Papaxanthos, Douwe Kiela, and Maximilian Nickel. 2019. Inferring concept hierarchies from text corpora via hyperbolic embeddings. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3231-3241. + +Jiaqing Liang, Yanghua Xiao, Yi Zhang, Seung-won Hwang, and Haixun Wang. 2017a. Graph-based wrong is a relation detection in a large-scale lexical taxonomy. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 31. +Jiaqing Liang, Yi Zhang, Yanghua Xiao, Haixun Wang, Wei Wang, and Pinpin Zhu. 2017b. On the transitivity of hypernym-hyponym relations in data-driven lexical taxonomies. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 31. +Ting-En Lin and Hua Xu. 2019. Deep unknown intent detection with margin loss. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5491-5496. +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. +Emaad Manzoor, Rui Li, Dhananjay Shrouty, and Jure Leskovec. 2020. Expanding taxonomies with implicit edge semantics. In Proceedings of The Web Conference 2020, pages 2044-2054. +Yuning Mao, Tong Zhao, Andrey Kan, Chenwei Zhang, Xin Luna Dong, Christos Faloutsos, and Jiawei Han. 2020. Octet: Online catalog taxonomy enrichment with self-supervision. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2247-2257. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Distributed representations of words and phrases and their compositionality. In Proceedings of the 26th International Conference on Neural Information Processing Systems-Volume 2, pages 3111-3119. +Ndapandula Nakashole, Gerhard Weikum, and Fabian Suchanek. 2012. Patty: A taxonomy of relational patterns with semantic types. In Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pages 1135-1145. +Rodrigo Nogueira and Kyunghyun Cho. 2019. Passage re-ranking with bert. arXiv preprint arXiv:1901.04085. +Alexander Panchenko, Stefano Faralli, Eugen Ruppert, Steffen Remus, Hubert Naets, Cedrick Fairon, Simone Paolo Ponzetto, and Chris Biemann. 2016. TAXI at SemEval-2016 task 13: a taxonomy induction method based on lexico-syntactic patterns, substrings and focused crawling. In Proceedings of the 10th International Workshop on Semantic Evaluation (SemEval-2016), pages 1320-1327, San Diego, California. Association for Computational Linguistics. + +Mike Schuster and Kaisuke Nakajima. 2012. Japanese and korean voice search. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5149-5152. IEEE. +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. +Chao Shang, Sarthak Dash, Md Faisal Mahbub Chowdhury, Nandana Mihindukulasooriya, and Alfio Gliozzo. 2020. Taxonomy construction of unseen domains via graph-based cross-domain knowledge transfer. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2198-2208. +Jiaming Shen, Zhihong Shen, Chenyan Xiong, Chi Wang, Kuansan Wang, and Jiawei Han. 2020. Taxoexpan: Self-supervised taxonomy expansion with position-enhanced graph neural network. In Proceedings of The Web Conference 2020, pages 486-497. +Jiaming Shen, Zeqiu Wu, Dongming Lei, Chao Zhang, Xiang Ren, Michelle T Vanni, Brian M Sadler, and Jiawei Han. 2018. Hiexpan: Task-guided taxonomy construction by hierarchical tree expansion. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2180-2189. +Vered Shwartz and Ido Dagan. 2016. CogALex-V shared task: LexNET - integrated path-based and distributional method for the identification of semantic relations. In Proceedings of the 5th Workshop on Cognitive Aspects of the Lexicon (CogALex - V), pages 80-85, Osaka, Japan. The COLING 2016 Organizing Committee. +Vered Shwartz, Yoav Goldberg, and Ido Dagan. 2016. Improving hypernymy detection with an integrated path-based and distributional method. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2389-2398. +Chengyu Wang and Xiaofeng He. 2020. Birre: learning bidirectional residual relation embeddings for supervised hypernymy detection. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3630-3640. +Zhibiao Wu and Martha Palmer. 1994. Verb semantics and lexical selection. In 32nd Annual Meeting of the Association for Computational Linguistics, pages 133-138. +Shuo Yang, Lei Zou, Zhongyuan Wang, Jun Yan, and Ji-Rong Wen. 2017. Efficiently answering technical questions—a knowledge graph approach. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 31. + +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. +Wenpeng Yin and Dan Roth. 2018. Term definitions help hypernymy detection. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pages 203-213. +Yue Yu, Yinghao Li, Jiaming Shen, Hao Feng, Jimeng Sun, and Chao Zhang. 2020. Steam: Self-supervised taxonomy expansion with mini-paths. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1026-1035. +Zheng Yu, Haixun Wang, Xuemin Lin, and Min Wang. 2015. Learning term embeddings for hypernymy identification. In Twenty-Fourth International Joint Conference on Artificial Intelligence. +Jieyu Zhang, Xiangchen Song, Ying Zeng, Jiaze Chen, Jiaming Shen, Yuning Mao, and Lei Li. 2021. Taxonomy completion via triplet matching network. In AAAI. \ No newline at end of file diff --git a/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/images.zip b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d158f2c8b582d26ff3c8eb483d15a1022887ad0c --- /dev/null +++ b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e159d26fe9446e1bfd0bfd8669c61cc18388d9873288337c528225d567ee6522 +size 355338 diff --git a/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/layout.json b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1c9f51baab6a4c57794d0c0fe3f9a5cab16e8812 --- /dev/null +++ b/temptaxonomyexpansionwithdynamicmarginlossthroughtaxonomypaths/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e754cb888e966e04d5e74da0702005bd81ec65ebcd34714edef23fd6d0a0987e +size 320794 diff --git a/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_content_list.json b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..eb7351f50de92cf35700e30b2f8237b9d1e08945 --- /dev/null +++ b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ada2d9777bdffa9175e8f6fe7139d9e71d5b2ddd088cc35c723dfa3c0539765 +size 85073 diff --git a/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_model.json b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3c635cc32e1acf5051e66f448c3cd8711173e82e --- /dev/null +++ b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14077e0308ca91fa3a2af664d1715f734f4cf644f2e421de6d543240cbdb614d +size 107663 diff --git a/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_origin.pdf b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5513e26d3e5ea0546d9691421317c97d48934ee5 --- /dev/null +++ b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/84b1db57-a952-46e4-9830-4f209a8f08a2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a1a0b7fa4811f8c5abb726668697d18e84b73fc5bfb280525818ed25b28ca44 +size 1094817 diff --git a/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/full.md b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/full.md new file mode 100644 index 0000000000000000000000000000000000000000..55a6a8b8404e887741ae0a46aff6ec4bb96f69ab --- /dev/null +++ b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/full.md @@ -0,0 +1,356 @@ +# Text2Mol: Cross-Modal Molecule Retrieval with Natural Language Queries + +Carl Edwards, ChengXiang Zhai, Heng Ji + +University of Illinois Urbana-Champaign + +{cne2, czhai, hengji}@illinois.edu + +# Abstract + +We propose a new task, Text2Mol, to retrieve molecules using natural language descriptions as queries. Natural language and molecules encode information in very different ways, which leads to the exciting but challenging problem of integrating these two very different modalities. Although some work has been done on text-based retrieval and structure-based retrieval, this new task requires integrating molecules and natural language more directly. Moreover, this can be viewed as an especially challenging cross-lingual retrieval problem by considering the molecules as a language with a very unique grammar. We construct a paired dataset of molecules and their corresponding text descriptions, which we use to learn an aligned common semantic embedding space for retrieval. We extend this to create a cross-modal attention-based model for explainability and reranking by interpreting the attentions as association rules. We also employ an ensemble approach to integrate our different architectures, which significantly improves results from 0.372 to 0.499 MRR. This new multimodal approach opens a new perspective on solving problems in chemistry literature understanding and molecular machine learning. $^{1}$ + +# 1 Introduction + +Discovering new properties and applications of different molecules is critical for accelerating discovery in medicine and science. Existing databases contain tens of millions of molecules; PubChem (Kim et al., 2016, 2019) alone has 110 million compounds. Many information retrieval (IR) tools for chemistry rely on queries based on natural language descriptions of the molecules and existing chemical reactions. Hundreds of millions of possible molecules cannot all possibly undergo laboratory + +Water is an oxygen hydride consisting of an oxygen atom that is covalently bonded to two hydrogen atoms. + +1. + +![](images/f61f5b73e85cdcc4e42dc6e661b7768e03c70558128494f5c6eb11c87da89c02.jpg) +2. + +![](images/74d6b255bcc87afc9dea14b956779d1125f706a94a98c6d7f634bbbe5898c4b4.jpg) +Figure 1: Given a natural language description of water, we want to rank the corresponding molecule $\mathrm{H}_2\mathrm{O}$ first among all the possible molecules. + +![](images/a89fd7098f4aaec78cb1ad0053cd6b312b67e983d9d5e749a904d60b9a0f91de.jpg) + +experimentation and be given attention by experts in order to create a description. To address this issue, it is critical to retrieve molecules directly from natural language descriptions. This approach allows newly discovered molecules to be easily integrated into the proposed IR framework. Our framework also allows for semantic-level search between natural language descriptions and molecules as well as for query expansion within traditional chemistry information retrieval systems. + +Over the past several years, chemists have begun to rely increasingly on computational techniques for cataloging molecules and predicting chemical reactions, products, and properties, such as yield, toxicity, and water solubility (Wu et al., 2018; Glavatskikh et al., 2019; Coley et al., 2017; Ahneman et al., 2018; Fooshee et al., 2018). However, natural language and molecules are very different modalities of data, which makes integrating them together a challenging task. We argue that these two modalities are complementary and should be considered together. + +Much current work focuses on images and language (Mogadala et al., 2020), but it is beneficial for the community to consider modalities beyond traditional ones, increasing their work's impact and efficacy. For example, integrating NLP and + +1The programs and data are publicly available at github.com/cnedwards/text2mol for research purposes. + +
MoleculeAn electrically neutral group of atoms bonded together.
CompoundTwo or more elements held together by chemical bonds.
Chemical fingerprintRepresents a molecule or substructure using a bitstring. This allows for efficient substructure search and similarity calculation.
Morgan fingerprintA specific type of chemical fingerprint also known as ECFP.
SMILES stringA character-based sequence representation of a molecule. +(for example, C1=CC=CC=C1 is the SMILES string for benzene)
Canonical SMILESA unique SMILES string for a molecule.
+ +Table 1: Relevant Terminology + +molecules could improve drug discovery and design. + +In pursuit of this goal, we propose a multimodal embedding approach for constructing an aligned semantic space between these two types of data to allow for cross-modal retrieval. No previous work has studied this retrieval problem. The closest is (Zhou et al., 2010), which uses a hybrid approach to document retrieval by replacing chemicals in text with canonical keywords in order to standardize different chemical synonyms. However, this does not take the semantic information of the molecule (properties beyond the atoms and graph structure, such as being a pollutant or hydrophobic) into account. + +Additionally, incorporating cross-modal attention can lead to insights on the relations between molecule substructures and text keywords. For example, we find that given "pollutant," the model focuses on the substructure F - C. This contributes to higher-level explainability between molecules and their descriptions. + +Our molecular encoder is based on the Mol2vec (Jaeger et al., 2018) algorithm, which creates "sentences" of substructure identifiers from molecules; we frame Text2Mol as a new, particularly challenging type of cross-lingual information retrieval (CLIR). This problem is much more challenging than traditional CLIR since the gap between the query and target is much larger. It also provides a useful benchmark for extending CLIR to incorporate multiple data modalities. Molecules are essentially a different language with a uniquely challenging grammar. In fact, several techniques apply models developed for natural language processing to SMILES strings—machine-readable character-based representations for molecules (Weininger, 1988; Weininger et al., 1989). + +The major novel contributions of this paper are: + +- A new task Text2Mol: Cross-modal Text + +Molecule Information Retrieval directly from natural language descriptions to molecules. + +- Cross-modal attention-based association rules between molecules and text are used to improve results and for explainability. +- A new benchmark dataset with 33,010 text-compound pairs for cross-modal text-molecule IR which can be used for cross-lingual, multimodal, and explainable IR. + +# 2 Task Definition + +To push the boundaries of multimodal models, we present a new IR task: Text2Mol. + +Given a text query and list of molecules without any reference textual information (represented, for example, as SMILES strings, graphs, or other equivalent representations) retrieve the molecule corresponding to the query. Figure 1 shows an example of this task. From a text description of a molecule, the model must incorporate the information in the description into a semantic representation which can be used to directly retrieve the molecule. + +This requires the integration of two very different types of information: the structured knowledge represented by text and the chemical properties present in molecular graphs. We assume there is only one correct (relevant) molecule for each description, so we consider two measures for this task: Hits@1 and mean reciprocal rank (MRR). + +# 3 Related Work + +# 3.1 Multimedia Representation + +Much recent work in this area has fallen into the category of vision-language models which leverage transformers (Chen et al., 2019; Su et al., 2020; Lu et al., 2019). There are also more fine-grained + +multimedia embedding approaches, such as integrating events from images and their descriptions (Li et al., 2020) or multimodal pattern mining (Li et al., 2016). CLIP (Radford et al., 2021) uses natural language to train a zero-shot image classifier which can be easily applied to different datasets. Specifically, their loss function, which follows Sohn (2016), serves as a very efficient version of binary cross-entropy loss by comparing all samples in a mini-batch with each other. To our knowledge, we are the first to apply this technique to molecules and text, and we also extend this loss function to incorporate negative samples to allow for cross-modal attention between the two encoders. + +# 3.2 Molecule Representation + +One critical problem in the field of molecular machine learning is molecule representation. Fingerprinting methods have long been employed in cheminformatics to featurize molecule structural representations (Cereto-Massague et al., 2015; Sandfort et al., 2020). However, this approach does not allow these representations to be learned from the data. Other representations include techniques such as kernel PCA using Tanimoto similarity (Rensi and Altman, 2017; Mallory et al.). Recent advances in machine learning have begun to be applied to this problem. Jaeger et al. (2018) use the Morgan fingerprinting algorithm to convert each molecule into a 'sentence' of its substructures. A dataset of molecules can be interpreted as a corpus, and Mol2vec then applies Word2vec (Mikolov et al., 2013a,b) to create molecule representations. Additionally, other recent advances such as BERT (Devlin et al., 2019) have been applied to the domain such as MolBERT (Fabian et al., 2020) and ChemBERTa (Chithrananda et al., 2020), which use SMILES strings (Weininger et al., 1989) as inputs to pretrain a BERT-esque model. + +# 3.3 Substructure or Description Retrieval + +Although the biomedical domain has been more popular than chemistry (Zheng et al., 2014; Li et al., 2019; Li and Ji, 2019; Islamaj Dogan et al., 2019; Zhang et al., 2021; Lai et al., 2021), information retrieval in chemistry has long been studied and is summarized by Krallinger et al. (2017). Most work has focused on only a single modality: text or molecules. Text-based retrieval includes tasks such as finding relevant papers for a chemical or reaction and chemical entity recognition. Much work has also been done in graph and molecule + +based retrieval (Hagadone, 1992; Barnard, 1993; Yan et al., 2005; Kratochvil et al., 2018; Qu et al., 2019; Kratochvil, 2019; Goyal et al., 2020). Hybrid approaches have also been attempted; Zhou et al. (2010) replace chemical entities in text with a unique canonical key (thus standardizing synonyms). This also allows them to perform query expansion by including similar molecules from their database. In contrast to this, we perform direct semantic cross-modal retrieval task in our approach, as opposed to just augmenting queries. Work in chemical entity recognition has also incorporated hybrid approaches, mostly as chemical name to structure converters such as ChemSpot (Roktäschel et al., 2013) and OPSIN (Lowe et al., 2011). + +# 3.4 Cross-Lingual Retrieval + +Cross-lingual information retrieval (CLIR) is a technique to retrieve documents from a target language given a query in a different source language. Two common strategies are either translating the query into the target language or translating the document corpus into the source language (Zhang and Zhao, 2020). Further, work exists combining these approaches using interlingual semantics, such as via bilingual word embeddings (Vulic and Moens, 2015) or word embeddings and a dictionary (Bhattacharya et al., 2016). + +Our problem, cross-modal molecule retrieval from text, can be considered as a CLIR task which we approach using an interlingual semantic approach. The model is trained on a parallel corpus of molecules and descriptions. + +# 4 Methodology + +# 4.1 Model + +To accomplish this retrieval task, we need to connect text to molecules. To do so, we build an aligned semantic embedding space. Our approach consists of two distinct submodels: a text encoder and a molecule encoder. Both submodels create an embedding in the aligned space, and cosine similarity is used to rank the embeddings. A description embedding can be compared against a database of existing molecule embeddings, and this process scales easily using an approximate nearest neighbor search algorithm such as (Johnson et al., 2017). For the text encoder, we use SciBERT (Beltagy et al., 2019) and a linear projection to the embedding space followed by layer normalization (Ba + +![](images/b5c9e1f543ebc299d80438399825becae9bf0cb573a1c7ed0c493d5e331095f6.jpg) +Figure 2: Example of Morgan Fingerprinting from (Rogers and Hahn, 2010) for Butyramide. The algorithm updates the identifiers from radius $r = 0$ to $r = 1$ , as shown by the green circles. + +et al., 2016). For the molecule encoder, we consider two architectures. First, we use a multi-layer perceptron (MLP) that takes Mol2vec embeddings as input. Second, we integrate a graph convolutional network (GCN) (Kipf and Welling, 2017) into Mol2vec. + +Mol2vec (Jaeger et al., 2018) converts molecule graph structures into "sentences" of substructures. These substructures are created using Morgan fingerprinting (Rogers and Hahn, 2010), which is a type of topological fingerprint, which were historically used for quick substructure lookup. Morgan fingerprints incorporate a number of molecular properties based on the Daylight atomic invariants rule (Weininger et al., 1989). Atomic invariants such as the number of connections, number of non-hydrogen bonds, and atomic number are used to create the initial identifier for an atom. By using a circular hashing technique, they are able to create a unique identifier for a molecular substructure of some radius $r$ centered around a central atom, as shown in Figure 2. The algorithm starts with a radius of zero which is iteratively increased until the desired substructure size is obtained. In Mol2vec, these fingerprints are used as tokens for each atom. In this work, we use a default value of $r = 1$ , which gives two tokens for each atom ( $r = 0$ and $r = 1$ ). This set of tokens is canonicalized in the same way as the canonical SMILES representation (Weininger et al., 1989). This list of tokens can be interpreted as a "sentence", and Mol2vec builds a + +corpus of such sentences. It then uses the Word2vec skip-gram (Mikolov et al., 2013a,b) algorithm to create "word" embeddings, which it averages together to create molecule representations. We use a two-layer MLP followed by a linear projection and layer normalization to create a trainable representation from the Mol2vec embedding, followed by layer normalization. + +While the Morgan fingerprints (substructure tokens) incorporate some implicit graph information, we explicitly introduce the molecule graph structure using a GCN that takes a molecular graph as input with Mol2vec token embeddings as features. For example, rings are very important substructures in molecules. If the description mentions "aromatic ring" or "phenyl group," we want to be able to match this substructure in the molecule. We could potentially do so by increasing the maximum radius of the Morgan fingerprinting algorithm, but then there might not be enough examples of the resulting large-radius tokens to create a good representation given our corpus size. Particularly for large molecules, to capture the global structural information, we might need a very large radius which will create a lot of rare tokens (that get replaced by the UNK token). Instead, we explicitly incorporate the graph structure by using a GCN. + +The Mol2vec token features are input to a three-layer GCN to create node representations for each atom in the molecule. These representations are combined using global mean pooling, and passed through two more hidden layers to produce a molecule representation. Since Mol2vec produces multiple tokens based on Morgan fingerprints of different radii, we select the corresponding token with the largest radius. + +# 4.2 Cross-Modal Attention Model + +To improve the explainability of our approach, we introduce a model with cross-modal attention by modifying the base model to use a transformer decoder (Vaswani et al., 2017). This decoder uses the SciBERT output as a source sequence and the node representations from the Mol2vec GCN model as a target sequence, and the attentions can be used to learn multimodal association rules. The architecture is shown in Figure 3. + +# 4.3 Loss + +To optimize the models, we base our loss on the symmetric contrastive loss presented by Radford et al. (2021). The loss takes the output embed + +![](images/93f396be35595d1a998fd473d7476b3c2aa99a2058550ae97efe859327c12876.jpg) +Figure 3: Model architecture for the cross-modal attention extension and association rules. + +dings of both submodels, multiplies by the exponent of a learned temperature parameter, $\tau$ , and then takes the outer product of the mini-batch. The identity matrix $I$ is used as labels. Categorical cross-entropy (CCE) is then applied along both axes, and the two losses are summed. This improves efficiency by allowing all the other samples in a mini-batch to serve as negatives. It corresponds to cosine similarity because the normalized dot product is minimized or maximized, for positives and negatives respectively. For batch embedding $m$ and $t$ of length $n$ , + +$$ +L (m, t) = C C E \left(e ^ {\tau} m t ^ {T}, I _ {n}\right) + C C E \left(e ^ {\tau} t m ^ {T}, I _ {n}\right) +$$ + +We find this loss to be ineffective for training the cross-modal attention model because it encourages the model to ignore the textual information—i.e. information can leak from one encoder to the other. To remedy this problem, we modify this loss function to incorporate a matching task by introducing negative samples. We randomly sample new descriptions and replace their respective ones in the diagonal of the identity matrix with zeros, creating a binary classification task—does the description match the molecule? Since the rows with all zeros are no longer probability distributions, we instead use binary cross-entropy loss. This modified loss provides more signal than a pure matching task since it also receives signal from the other negatives, and it enforces the constraint that the model consider both the molecule and text description. + +# 4.4 Cross-Modal Reranking + +We want to better understand how the base networks work, so we introduce a modified model with cross-modal attention, which we also use to rerank the output of the base models. Given a training set of molecule-text pairs, $P$ , we first train the + +cross-modal matching model. We collect the attention weights of the final layer for each of these pairs. Next, the attention weights for molecule token, $m$ , and text token, $t$ , are aggregated to create association rules. We define the support for a rule $r$ from $t$ to $m$ as the sum of all attentions, + +$$ +supp(r) = \sum_{p\in P}\sum_{\substack{t^{\prime}\in p_{t}\\ m^{\prime}\in p_{m}}}\mathbb{1}_{\substack{t = t^{\prime}\\ m = m^{\prime}}}a_{t^{\prime},m^{\prime}} +$$ + +where $a_{i,j}$ is the attention weight between tokens $i$ and $j$ and $p_t$ and $p_m$ are the multisets of text and molecule tokens in $p$ , respectively. + +This produces association rules from every text token $t$ to every molecule token $m$ . We calculate the confidence for each of these rules by taking the support of the rule and dividing by the support of all the rules using $t$ , + +$$ +\operatorname {c o n f} (t \Rightarrow m) = \frac {\operatorname {s u p p} (t , m)}{\sum_ {t ^ {\prime} \in T} \operatorname {s u p p} (t ^ {\prime} , m)} +$$ + +where $T$ is the set of all text tokens. + +Following this, given a molecule and text pair, we consider all association rules that can produce it, and we take the average of the top $k$ confidence values. For association-rule based reranking, Bharadwaj et al. (2014) takes the average of all confidence values. However, they have a comparatively smaller number of confidence rules. On the other hand, AnyBURL (Meilicke et al., 2019, 2020) finds maximum aggregation to be most effective. It also shows rule-based approaches can be very efficient (Ott et al., 2021). For our approach, we want to consider multiple one-to-one rules because we only use rules from one text token to one molecule token since the computational costs scale significantly due to the combinatorial number of many-to-many rules. By taking an average of only the top confidence values, we incorporate multiple one-to-one rules but ignore unimportant rules. This combines the two approaches to reranking while keeping in mind efficiency. We calculate a score by interpolating between the cosine similarities with association rule-based scores ( $AR$ ) linearly, + +$$ +S (a, b) = \alpha \cos (a, b) + (1 - \alpha) A R (a, b) +$$ + +where $\alpha \in [0,1]$ is selected on the validation set. + +# 4.5 Ensemble Approach + +Upon investigation of the baseline models, we found that the correct molecule was very frequently found in the top molecules. However, many of the molecules ranked above the correct molecule did not occur in the top results of the same model trained with different parameter initialization. We found that by taking an average of these rankings, the correct molecule's average rank would stay roughly the same, but the average rank of false positives increases. When these average ranks are used to reorder the results, the order of the incorrect and correct molecule switches. We find this method to be surprisingly effective, and we connect this to committee of neural networks (Drucker et al., 1994) in ensemble learning (Polikar, 2012). Additionally, we draw comparisons to Mixture of Experts-based models (Masoudnia and Ebrahimpour, 2014) such as Fan et al. (2006) and the Switch Transformer which contains 1.6 trillion parameters (Fedus et al., 2021). We compute the score, $S$ , as a weighted average, + +$$ +S (m) = \sum_ {i} w _ {i} R _ {i} (m) \qquad s. t. \sum_ {i} w _ {i} = 1 +$$ + +for some molecule $m$ where $R_{i}$ is the rank assigned to that molecule by model $i$ and $w_{i}$ is the model weight. A lower score is more desirable. + +# 5 Experiments + +# 5.1 Data and Evaluation + +For our task, we create a dataset using PubChem (Kim et al., 2016, 2019) and Chemical Entities of Biological Interest (ChEBI) (Hastings et al., 2016). We collect ChEBI annotations of compounds scraped from PubChem, which consists of 102,980 compound-description pairs. Using this data, we create a dataset consisting of 33,010 pairs, which we call ChEBI-20, that contains descriptions of more than 20 words. We find that longer descriptions tend to be less noisy and more informative. We remove compounds which cannot be processed by RDKit (Landrum, 2021). + +We separate these datasets into $80\% / 10\% / 10\%$ train-validation-test splits. The alignment models are trained on the training data, and the results are evaluated by searching all molecules in the dataset. The molecules in the training set are processed by Mol2vec using default parameters: a radius of 1, a + +threshold for unknown tokens of 3, an embedding dimension of 300, and a window size of 10. + +# 5.2 Results + +To train the models, we use Adam optimizer (Kingma and Ba, 2015) and two different learning rates. The SciBERT model uses a finetuning learning rate of 3e-5, as used by Devlin et al. (2019). The rest of the model uses 1e-4 as used by Vaswani et al. (2017). We use a linear annealing rate for the learning rate with 1,000 steps of warmup. We train for 40 epochs with a batch size of 32. We also use a temperature value of 0.07 as suggested by Radford et al. (2021). We use the first 256 text tokens for the text encoder. + +# 5.2.1 Baseline Models + +The MLP and GCN encoder models both show similar performance. Three results for both are shown in Table 2. We believe the performance similarity between MLP and GCN is because the description is a bottleneck. However, they appear to be effective at different tasks. In the test set, the mean rank is significantly lower for the MLP models than the GCN models; however, the MRR values are fairly similar. This indicates that these two architectures have different strengths. Further, the difference in mean rank is much smaller in the validation set; the validation mean rank is 30.60 and 28.89 for the MLP and GCN ensembles respectively. This indicates that the GCN architecture is more effective for retrieving the most difficult examples in the validation set (since there are not outlier ranks to increase the mean), but the MLP is more effective at difficult examples in the test set. We further examine this in Section 5.4. + +# 5.2.2 Ensemble + +We find that the ensemble method shows significant performance improvements. The ensemble of the three GCN models increases Test Hits@1 by roughly $8\%$ from the baseline models. It is notable that the hyperparameters for these models are exactly the same, and the models are learning different ways of ranking which are complementary. To combine the different models, we find the heuristic of using uniform weights to be very effective. + +A further advantage of the ensemble approach is that it can incorporate different encoder architectures and retrieval schemes, which may have different understandings of how to solve the problem. We find that combining both architectures is + +
TrainingTest
ModelMean RankMRRHits@1Hits@10Mean RankMRRHits@1Hits@10
MLP19.550.42826.5%77.5%30.380.37222.4%68.6%
MLP29.820.42526.4%77.1%30.720.36922.3%68.9%
MLP39.530.43126.9%77.8%36.300.37222.3%67.9%
GCN110.220.43227.2%76.5%42.280.36621.7%68.2%
GCN29.670.42326.7%77.4%41.900.37122.3%68.9%
GCN310.120.42025.8%76.7%39.110.36622.3%67.9%
MLP-Ensemble5.810.52035.1%86.4%20.780.45229.4%77.6%
GCN-Ensemble6.090.51635.0%86.1%28.770.44729.4%77.1%
All-Ensemble4.670.56840.2%89.8%20.210.49934.4%81.1%
MLP1+Attn30.370.37522.8%68.7%
MLP1+FPGrowth30.370.37422.6%68.6%
+ +![](images/56a5c1758b67433967e4bef070a4e9d74acdd85064b29cef55a62d7a090426de.jpg) +Figure 4: Validation MRR values for different combinations of architectures. The axes indicate the number of each architecture used. Ensembles with both architectures are more effective. + +more effective than either alone; this is shown in Figure 4. Ensembles that only incorporate one architecture are consistently outperformed by models that incorporate both. For example, using 3 MLP models has an MRR of 0.442 but using 2 MLP and 1 GCN model has an MRR of 0.449. + +# 5.3 Cross-Modal Attention and Reranking + +To better understand the behavior of the model, we apply cross-modal attention using a transformer decoder with 3 layers, and we rerank the top 10 of MLP1 using the 10 most confident association rules. We find cross-modal reranking to slightly improve our baseline model and to outperform traditional association rule mining, which can be accomplished by the FPGrowth algorithm (Han and Pei, 2000). Hits@1 for the baseline MLP model is + +Table 2: Results. FPGrowth is the frequent pattern growth algorithm (Han and Pei, 2000). Models 1, 2, and 3 only differ in initial parameter initialization. + +
TokenSubstructureSuppConf
TitaniumTi=O1.290.65
AluminiumAl3+4.310.23
ManganeseMn2+10.080.30
TolueneC – C=C12.930.231
TolueneC7H823.790.425
##chloroCl – C18.810.207
pollutantF – C3.0970.208
chromatographyC – Si2.9760.271
acidC – O – H2398.70.078
crownC – C – O4.180.325
+ +Table 3: Examples of interesting learned association rules from token to substructure. $\mathrm{C}_7\mathrm{H}_8$ is the chemical formula of toluene. + +increased by about $0.4\%$ , but normal association rules only improve it by $0.2\%$ . + +Mining these rules using attention also allows us to understand the connections the model is making. Examples of these rules are shown in Table 3. We primarily examine one-to-one rules; however, these one-to-one rules will often "split" the confidence among themselves. For example, toluene is a ring containing different substructures, so there will be multiple one-to-one rules required to capture the substructure. The rule from toluene to the three common substructure tokens in toluene has an increased confidence and support. Since we average the confidence values of all applicable rules, this is accounted for in reranking. + +One interesting phenomenon we find is that the model is very interested in O-H structures (hydroxyl groups). It is also interested in positively charged metal ions in salts. The token "acid" has many different rules; however, the most confident + +![](images/37950db4485f620fbe06ebafd27b140904e2ec114ff07b4a67514dae38b54b33.jpg) +Inositol: Myo-inositol is an inositol having myo-configuration. It has a role as a member of compatible osmolytes, a nutrient, an EC 3.1.4.11 (phosphoinositide phospholipase C) inhibitor, a human metabolite, a Daphnia magna metabolite, [...] + +![](images/d1a5efc9c5caee75f4a958db33eb261c739d10a9f098e7ec85ad135dc956ce97.jpg) + +![](images/48c9d701b6d0e1ce82cce699cd75a270f2c25b975b5f0b2b577f610495b7db15.jpg) +Cannabidiolate is a dihydroxybenzoate that is the conjugate base of cannabidiolic acid, obtained by deprotonation of the carboxy group. It derives from an olivetolate. It is a conjugate base of a cannabidiolic acid. +Figure 5: Example queries that are predicted correctly by All-Ensemble. +Figure 6: Example queries that are ranked incorrectly by All-Ensemble. + +is a hydroxyl (-OH) group, which matches basic chemical properties of acids. Rules involving rare tokens can result in high confidence values. For example, the rule "crown" implies $\mathrm{C} - \mathrm{C} - \mathrm{O}$ has a confidence of 0.325. This is because the dataset contains two "crown ether" molecules which have multiple occurrences of $\mathrm{C} - \mathrm{C} - \mathrm{O}$ . + +# 5.4 Qualitative Analysis + +Our technique is capable of retrieving large, complicated molecules as well as small ones. For example, it successfully retrieves both Argyssfrywff $(\mathrm{C_{79}H_{99}N_{19}O_{17}})$ and Inositol $(\mathrm{C_6H_{12}O_6})$ , shown in Figure 5. Argyssfrywff shows that the model is capable of composing molecules from constituent parts mentioned in the description. + +The MLP and GCN models capture different aspects of the molecules leading to different rankings. For example, MLP-ensemble ranks an alpha-mycolic acid $(\mathrm{C}_{15}\mathrm{H}_{26}\mathrm{O}_3)$ at 43; GCN-ensemble ranks it 3. The compound contains cyclopropyl + +![](images/7d0862b835cb0224640842c74a58e7cdd5e558e9b05472cdbec094d844869330.jpg) +Fura red is a 1-benzofuran substituted at position 2 by a (5-oxo-2-thioxoimidazolidin-4-ylidene)methyl group, and at C-5 and C-6 by heavily substituted oxygen and nitrogen functionalities [...] +Clondronate(2-) is the dianion resulting from the removal of two protons from clondronic acid. It is a conjugate base of a cladronic acid. + +![](images/60ca7fe0031ccac5850e984b5eea8ee5d45838f28edc8e768e28875594facadc.jpg) + +![](images/e4d388ec369cd5f6c0bc98e58cf9b470bc7dff615527b6834f28bce789941a11.jpg) +An alpha-mycolic acid is a class of mycolic acids characterized by the presence of two cis cyclopropyl groups in the meromycolic chain. It is an organic molecular entity and a mycolic acid. [...] + +groups (the triangles), shown in Figure 6, which the GCN captures. On the other hand, Clondronate(2-) $(\mathrm{CH}_2\mathrm{Cl}_2\mathrm{O}_6\mathrm{P}_2^{-2})$ is ranked 4,915 by the GCN but 61 by the MLP, showing large differences exist between the architectures. The models are also mutually beneficial; 2-Methylideneglutaric acid $(\mathrm{C}_6\mathrm{H}_8\mathrm{O}_4)$ is ranked 2nd by MLP and 3rd by GCN, but it is ranked 1st by All-Ensemble. Individual models trained identically (but with different initial parameters) also show this phenomenon. GCN 1, 2, and 3 rank Pierreione C $(\mathrm{C}_{27}\mathrm{H}_{28}\mathrm{O}_6)$ 2nd. GCN1 ranks Aspernidine A 1st, but it is ranked 49 and 64 by GCN 2 and 3, respectively. The average rank of Aspernidine A becomes 38, so GCN-Ensemble ranks Pierreione C 1st. + +The model is able to ignore irrelevant description information. For example, MLP achieves rank 1 for Rostratin D $(\mathrm{C_{18}H_{20}N_2O_6S_4})$ , whose description includes the unique and likely unuseful section "isolated from the whole broth of the marine-derived fungus Exserohilum rostratum." Instead, the model successfully identifies it from the following attributes: "bridged compound, a cyclic ketone, a lactam, an organic disulfide, an organic heterohexacyclic compound, a secondary alcohol, a dithiol and a diol." + +There are some very challenging queries where multiple molecules are very similar. For example, Pro-Arg and Arg-Pro share the same chemical formula $\mathrm{C_{11}H_{21}N_5O_3}$ . Fura red $(\mathrm{C_{41}H_{44}N_4O_{20}S})$ is the most challenging query for the model; it is ranked at 8,320 by All-Ensemble. Its entire description is based off of 1-benzofuran, but the substitutions are each larger than the original molecule and poorly defined. + +# 5.5 Remaining Challenges + +One further challenge is integrating external domain knowledge. Many current errors can be eliminated by applying this information, such as assuming "oxide" means the molecule should contain an oxygen. Although our association rule approach learns some of these, external knowledge can provide stronger rules. We observe that descriptions appear to be the limiting factor in this model, which is consistent with the similar performance of the GCN and MLP encoders. Comprehensive techniques for extracting information from external knowledge could lead to significant improvements, which we leave for future work. + +# 6 Conclusions and Future Work + +In this work, we present Text2Mol: a novel and challenging cross-modal information retrieval task to retrieve molecules using natural language descriptions. To tackle this problem, we apply contrastive representation learning to a BERT-based text encoder and both MLP and GCN-based molecule encoders. We show that these models are complementary and that an ensemble approach combines them very effectively. We also show that the ensemble approach is effective for combining identically trained neural networks (with different parameter initialization), and we consider attention-based association rules. Improved encoder architectures will likely yield improvements, and further investigation of how model architectural choices affect these rules and their interactions for reranking may be interesting as well. In the future, we plan to further improve results by integrating external knowledge as constraints. It should also be noted that this task is possible in the reverse direction, from molecules to descriptions. This has many possible applications, such as finding relevant descriptions for newly discovered molecules. + +# Acknowledgements + +This research is based upon work supported by the Molecule Maker Lab Institute: An AI Research Institutes program supported by NSF under Award No. 2019897 and NSF No. 2034562. 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 the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein. + +# References + +Derek T. Ahneman, Jesus G. Estrada, Shishi Lin, Spencer D. Dreher, and Abigail G. Doyle. 2018. Predicting reaction performance in c–n cross-coupling using machine learning. Science, 360(6385):186-190. +Jimmy Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. 2016. Layer normalization. arXiv preprint arXiv:1607.06450. +John M. Barnard. 1993. Substructure searching methods: Old and new. Journal of chemical information and computer sciences, 33(4):532-538. +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. +Samarth Bharadwaj, Mayank Vatsa, and Richa Singh. 2014. Aiding face recognition with social context association rule based re-ranking. In IEEE International Joint Conference on Biometrics, pages 1-8. IEEE. +Paheli Bhattacharya, Pawan Goyal, and Sudeshna Sarkar. 2016. Using word embeddings for query translation for Hindi to english cross language information retrieval. Computación y sistemas, 20(3):435-447. +Adrià Cereto-Massague, María J. Ojeda, Cristina Valls, Miquel Mulero, Santiago Garcia-Vallé, and Gerard Pujadas. 2015. Molecular fingerprint similarity search in virtual screening. Methods, 71:58-63. +Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. 2019. Uniter: Learning universal image-text representations. + +Seyone Chithrananda, Gabe Grand, and Bharath Ramsundar. 2020. Chemberta: Large-scale self-supervised pretraining for molecular property prediction. arXiv preprint arXiv:2010.09885. +Connor W. Coley, Regina Barzilay, Tommi S. Jaakkola, William H. Green, and Klavs F. Jensen. 2017. Prediction of organic reaction outcomes using machine learning. ACS central science, 3(5):434-443. +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. +Harris Drucker, Corinna Cortes, Lawrence D. Jackel, Yann LeCun, and Vladimir Vapnik. 1994. Boosting and other ensemble methods. *Neural Computation*, 6(6):1289-1301. +Benedek Fabian, Thomas Edlich, Hélène Gaspar, Marwin Segler, Joshua Meyers, Marco Fiscato, and Mohamed Ahmed. 2020. Molecular representation learning with language models and domain-relevant auxiliary tasks. arXiv preprint arXiv:2011.13230. +Weiguo Fan, Michael Gordon, and Praveen Pathak. 2006. On linear mixture of expert approaches to information retrieval. Decision Support Systems, 42(2):975-987. +William Fedus, Barret Zoph, and Noam Shazeer. 2021. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961. +David Fooshee, Aaron Mood, Eugene Gutman, Mohammadamin Tavakoli, Gregor Urban, Frances Liu, Nancy Huynh, David Van Vranken, and Pierre Baldi. 2018. Deep learning for chemical reaction prediction. Molecular Systems Design & Engineering, 3(3):442-452. +Marta Glavatskikh, Jules Leguy, Gilles Hunault, Thomas Cauchy, and Benoit Da Mota. 2019. Dataset's chemical diversity limits the generalizability of machine learning predictions. Journal of Cheminformatics, 11(1):1-15. +Kunal Goyal, Utkarsh Gupta, Abir De, and Soumen Chakrabarti. 2020. Deep neural matching models for graph retrieval. 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 1701-1704. ACM. +Thomas R. Hagadone. 1992. Molecular substructure similarity searching: efficient retrieval in two-dimensional structure databases. Journal of chemical information and computer sciences, 32(5):515-521. + +Jiawei Han and Jian Pei. 2000. Mining frequent patterns by pattern-growth: methodology and implications. ACM SIGKDD explorations newsletter, 2(2):14-20. +Janna Hastings, Gareth Owen, Adriano Dekker, Marcus Ennis, Namrata Kale, Venkatesh Muthukrishnan, Steve Turner, Neil Swainston, Pedro Mendes, and Christoph Steinbeck. 2016. Chebi in 2016: Improved services and an expanding collection of metabolites. *Nucleic acids research*, 44(D1):D1214–D1219. +Rezarta Islamaj Dogan, Sun Kim, Andrew Chatur-Aryamontri, Chih-Hsuan Wei, Donald C. Comeau, Rui Antunes, Sergio Matos, Qingyu Chen, Aparna Elangovan, Nagesh C. Panyam, et al. 2019. Overview of the biocreative vi precision medicine track: mining protein interactions and mutations for precision medicine. Database, 2019. +Sabrina Jaeger, Simone Fulle, and Samo Turk. 2018. Mol2vec: unsupervised machine learning approach with chemical intuition. Journal of chemical information and modeling, 58(1):27-35. +Jeff Johnson, Matthijs Douze, and Hervé Jégou. 2017. Billion-scale similarity search with gpus. arXiv preprint arXiv:1702.08734. +Sunghwan Kim, Jie Chen, Tiejun Cheng, Asta Gindulyte, Jia He, Siqian He, Qingliang Li, Benjamin A. Shoemaker, Paul A. Thiessen, Bo Yu, et al. 2019. Pubchem 2019 update: improved access to chemical data. *Nucleic acids research*, 47(D1):D1102-D1109. +Sunghwan Kim, Paul A. Thiessen, Evan E. Bolton, Jie Chen, Gang Fu, Asta Gindulyte, Lianyi Han, Jane He, Siqian He, Benjamin A. Shoemaker, et al. 2016. Pubchem substance and compound databases. *Nucleic acids research*, 44(D1):D1202-D1213. +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. +Thomas N. Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net. +Martin Krallinger, Abdulia Rabal, Analia Lourenco, Julien Oyarzabal, and Alfonso Valencia. 2017. Information retrieval and text mining technologies for chemistry. Chemical reviews, 117(12):7673-7761. +Miroslav Kratochvil, Jiří Vondrášek, and Jakub Galgonek. 2018. Sachem: a chemical cartridge for high-performance substructure search. Journal of cheminformatics, 10(1):1-11. + +Miroslav Kratochvil. 2019. Accelerating structure search in small-molecule databases. Master's thesis. +Tuan Lai, Heng Ji, ChengXiang Zhai, and Quan H. Tran. 2021. Joint biomedical entity and relation extraction with knowledge-enhanced collective inference. 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 6248-6260, Online. Association for Computational Linguistics. +Greg Landrum. 2021. Rdkit: Open-source cheminformatics software. +Diya Li, Lifu Huang, Heng Ji, and Jiawei Han. 2019. Biomedical event extraction based on knowledge-driven tree-LSTM. 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 1421-1430, Minneapolis, Minnesota. Association for Computational Linguistics. +Diya Li and Heng Ji. 2019. Syntax-aware multi-task graph convolutional networks for biomedical relation extraction. In Proceedings of the Tenth International Workshop on Health Text Mining and Information Analysis (LOUHI 2019), pages 28-33, Hong Kong. Association for Computational Linguistics. +Hongzhi Li, Joseph G. Ellis, Heng Ji, and Shih-Fu Chang. 2016. Event specific multimodal pattern mining for knowledge base construction. In Proceedings of the 2016 ACM Conference on Multimedia Conference, MM 2016, Amsterdam, The Netherlands, October 15-19, 2016, pages 821-830. +Manling Li, Alireza Zareian, Qi Zeng, Spencer Whitehead, Di Lu, Heng Ji, and Shih-Fu Chang. 2020. Cross-media structured common space for multimedia event extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2557-2568, Online. Association for Computational Linguistics. +Daniel M. Lowe, Peter T. Corbett, Peter Murray-Rust, and Robert C. Glen. 2011. Chemical name to structure: Opsin, an open source solution. Journal of Chemical Information and Modeling, 51(3):739-753. PMID: 21384929. +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. +Emily K. Mallory, Ambika Acharya, Stefano E. Rensi, Peter J. Turnbaugh, Roselie A. Bright, and Russ B. + +Altman. Chemical reaction vector embeddings: towards predicting drug metabolism in the human gut microbiome. In Biocomputing 2018, pages 56-67. +Saeed Masoudnia and Reza Ebrahimpour. 2014. Mixture of experts: a literature survey. Artificial Intelligence Review, 42(2):275-293. +Christian Meilicke, Melisachew W. Chekol, Manuel Fink, and Heiner Stuckenschmidt. 2020. Reinforced anytime bottom up rule learning for knowledge graph completion. arXiv preprint arXiv:2004.04412. +Christian Meilicke, Melisachew W. Chekol, Daniel Ruffinelli, and Heiner Stuckenschmidt. 2019. Anytime bottom-up rule learning for knowledge graph completion. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 3137-3143. ijcai.org. +Tomás Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013a. Efficient estimation of word representations in vector space. In 1st International Conference on Learning Representations, ICLR 2013, Scottsdale, Arizona, USA, May 2-4, 2013, Workshop Track Proceedings. +Tomás Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. 2013b. Distributed representations of words and phrases and their compositionality. 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 3111-3119. +Aditya Mogadala, Marimuthu Kalimuthu, and Dietrich Klakow. 2020. Trends in integration of vision and language research: A survey of tasks, datasets, and methods. arXiv preprint arXiv:1907.09358. +Simon Ott, Christian Meilicke, and Matthias Samwald. 2021. SAFRAN: An interpretable, rule-based link prediction method outperforming embedding models. In 3rd Conference on Automated Knowledge Base Construction. +Robi Polikar. 2012. Ensemble learning. In Ensemble machine learning, pages 1-34. Springer. +Jingwei Qu, Penghui Sun, Xin Li, Bei Wang, Xiaqing Lu, Zhi Tang, and Chengcui Zhang. 2019. A retrieval system of medicine molecules based on graph similarity. IEEE MultiMedia, 26(4):17-27. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. 2021. Learning transferable visual models from natural language supervision. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of + +Proceedings of Machine Learning Research, pages 8748-8763. PMLR. +Stefano Rensi and Russ B. Altman. 2017. Flexible analog search with kernel pca embedded molecule vectors. Computational and structural biotechnology journal, 15:320-327. +Tim Rocktäschel, Torsten Huber, Michael Weidlich, and Ulf Leser. 2013. WBI-NER: The impact of domain-specific features on the performance of identifying and classifying mentions of drugs. In Second Joint Conference on Lexical and Computational Semantics (*SEM), Volume 2: Proceedings of the Seventh International Workshop on Semantic Evaluation (SemEval 2013), pages 356-363, Atlanta, Georgia, USA. Association for Computational Linguistics. +David Rogers and Mathew Hahn. 2010. Extended-connectivity fingerprints. Journal of chemical information and modeling, 50(5):742-754. +Frederik Sandfort, Felix Strieth-Kalthoff, Marius Kühnemund, Christian Beecks, and Frank Glorius. 2020. A structure-based platform for predicting chemical reactivity. Chem, 6(6):1379-1390. +Kihyuk Sohn. 2016. Improved deep metric learning with multi-class n-pair loss objective. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pages 1849-1857. +Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. 2020. VL-BERT: pretraining of generic visual-linguistic representations. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +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. +Ivan Vulic and Marie-Francine Moens. 2015. Monolingual and cross-lingual information retrieval models based on (bilingual) word embeddings. In Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval, Santiago, Chile, August 9-13, 2015, pages 363-372. ACM. +David Weininger. 1988. Smiles, a chemical language and information system. 1. introduction to methodology and encoding rules. Journal of chemical information and computer sciences, 28(1):31-36. +David Weininger, Arthur Weininger, and Joseph L. Weininger. 1989. Smiles. 2. algorithm for generation of unique smiles notation. Journal of chemical information and computer sciences, 29(2):97-101. + +Zhenqin Wu, Bharath Ramsundar, Evan N. Feinberg, Joseph Gomes, Caleb Geniesse, Aneesh S. Pappu, Karl Leswing, and Vijay Pande. 2018. Molecularnet: a benchmark for molecular machine learning. Chemical science, 9(2):513-530. +Xifeng Yan, Philip S. Yu, and Jiawei Han. 2005. Substructure similarity search in graph databases. In Proceedings of the 2005 ACM SIGMOD international conference on Management of data, pages 766-777. +Liang Zhang and Xiaobing Zhao. 2020. An overview of cross-language information retrieval. In International Conference on Artificial Intelligence and Security, pages 26-37. Springer. +Zixuan Zhang, Nikolaus Parulian, Heng Ji, Ahmed Elsayed, Skatje Myers, and Martha Palmer. 2021. Fine-grained information extraction from biomedical literature based on knowledge-enriched Abstract Meaning Representation. 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 6261-6270, Online. Association for Computational Linguistics. +Jin Guang Zheng, Daniel Howsmon, Boliang Zhang, Juergen Hahn, Deborah McGuinness, James Hendler, and Heng Ji. 2014. Entity linking for biomedical literature. In *BMC Medical Informatics and Decision Making*. +Yingyao Zhou, Bin Zhou, Shumei Jiang, and Frederick J. King. 2010. Chemical-text hybrid search engines. Journal of chemical information and modeling, 50(1):47-54. + +![](images/d25817c58e6c9a04ca7e194dc010a7061c600d0f69b8e043fe1127d9e9f2875d.jpg) +A Supporting Figures +Figure 7: This figure shows the ensemble validation MRR from different weighted averages of the three GCN models. GCN3_weight = 1 - GCN1_weight - GCN2_weight. The MRR is clearly lower in the corners, where only rankings from one model are used because the others have zero weight. This figure illustrates that using uniform weights is an effective heuristic. + +# B Reproducibility + +The MLP and GCN models were each run three times. The GCN and MLP use 600 hidden units. The mol2vec input and the model outputs are 300-dimensional. GCN uses the substructure representations with the largest radius. MLP contains 110,871,865 parameters. GCN contains 111,953,665 parameters. The cross-modal attention model contains 128,978,441 parameters and attends the first 512 molecule substructures. It achieves about $97\%$ classification accuracy for the matching task from the negative samples. The number of one-to-one association rules with confidence greater than 0.1 and support greater than 2 is 1,835. The MLP and GCN take approximately 7 hours on a NVIDIA V100 and the cross-modal attention model takes approximately 9 hours. We find that early stopping is not useful and that layer normalization increases training speed. The value of $\alpha$ for reranking was selected by grid search for high validation MRR. For the metrics, given a list of rankings $R$ , + +$$ +\begin{array}{l} M e a n R a n k = \frac {1}{n} \sum_ {i = 1} ^ {n} R _ {i} \\ M R R = \frac {1}{n} \sum_ {i = 1} ^ {n} \frac {1}{R _ {i}} \\ \end{array} +$$ + +Validation + +
ModelMean RankMRRHits@ 1Hits@10
MLP143.660.37422.5%68.8%
MLP247.420.36022.1%68.9%
MLP341.150.37621.2%68.2%
GCN141.780.36722.2%68.4%
GCN241.230.36722.1%68.9%
GCN342.190.36021.2%68.2%
MLP-Ensemble30.600.44228.7%76.5%
GCN-Ensemble28.890.43527.7%76.6%
All-Ensemble24.950.47931.7%80.2%
+ +Table 4: Reproducibility results for the validation set. + +$$ +\text {H i t s} @ m = \frac {1}{n} \sum_ {i = 1} ^ {n} \mathbb {1} _ {R _ {i} \leq m} +$$ \ No newline at end of file diff --git a/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/images.zip b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..226c41d8a9154b00b403e9333d59619c0b224f77 --- /dev/null +++ b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3315574edc3e3d1de82d79f828778a6292d47b254e66145fb8dcb894d2f92a76 +size 496810 diff --git a/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/layout.json b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..376cb2e195c4f1e65eb77edb26e7d7961b1cbf7d --- /dev/null +++ b/text2molcrossmodalmoleculeretrievalwithnaturallanguagequeries/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59b8dbaf3a44681ee0f4b51c083fa4095a27dc999a497e7f624f9fedbbfd3552 +size 396905 diff --git a/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_content_list.json b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e8aa52c2e8f93fe2a54b5e1c815b62b59e9aaac0 --- /dev/null +++ b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46fcdb01b117028003e55b953ebdfa6a2bc1d0a63525bf640d2ebf5897da9e01 +size 106063 diff --git a/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_model.json b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_model.json new file mode 100644 index 0000000000000000000000000000000000000000..4de303e4e652f058427d87334a05945d3dd41f96 --- /dev/null +++ b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d5c44e944bbf88566ad2cc1f0c67b6e888ab371e676aa7e3305009b032cc2ff +size 124936 diff --git a/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_origin.pdf b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..82d9a9c5c4491d256d4b814b2a5c77a3738c9cde --- /dev/null +++ b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/64916dec-2a89-41be-a4d6-c317e6836386_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfa72c295537386263674a424465105cfc9efa1fe0f53188d52bfd48d4126d96 +size 720077 diff --git a/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/full.md b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..dd2ec4588a1f9bb319fab30526f6f1de972bfd53 --- /dev/null +++ b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/full.md @@ -0,0 +1,420 @@ +# Text AutoAugment: Learning Compositional Augmentation Policy for Text Classification + +Shuhuai Ren $^{1}$ , Jinchao Zhang $^{3}$ , Lei Li $^{1}$ , Xu Sun $^{1,2}$ , Jie Zhou $^{3}$ + +1MOE Key Lab of Computational Linguistics, School of EECS, Peking University + +$^{2}$ Center for Data Science, Peking University + +$^{3}$ Pattern Recognition Center, WeChat AI, Tencent Inc, China + +{shuhuai_ren, lilei}@stu.pku.edu.cn, xusun@pku.edu.cn + +{dayerzhang, jiezhou}@tencent.com + +# Abstract + +Data augmentation aims to enrich training samples for alleviating the overfitting issue in low-resource or class-imbalanced situations. Traditional methods first devise task-specific operations such as Synonym Substitute, then preset the corresponding parameters such as the substitution rate artificially, which require a lot of prior knowledge and are prone to fall into the sub-optimum. Besides, the number of editing operations is limited in the previous methods, which decreases the diversity of the augmented data and thus restricts the performance gain. To overcome the above limitations, we propose a framework named Text AutoAugment (TAA) to establish a compositional and learnable paradigm for data augmentation. We regard a combination of various operations as an augmentation policy and utilize an efficient Bayesian Optimization algorithm to automatically search for the best policy, which substantially improves the generalization capability of models. Experiments on six benchmark datasets show that TAA boosts classification accuracy in low-resource and class-imbalanced regimes by an average of $8.8\%$ and $9.7\%$ , respectively, outperforming strong baselines. $^{1}$ + +# 1 Introduction + +Model performance on Natural Language Processing (NLP) tasks, such as text classification, often heavily depends on the size and the quality of the training data. However, it is time-consuming and labor-intensive to obtain sufficient training instances, and models face low-resource regimes most of the time. Data augmentation (Simard et al., 1996; Szegedy et al., 2015; Wei and Zou, 2019) aims to enlarge the training dataset by synthesizing additional distinct and label-invariant instances based on raw instances to improve the model per + +![](images/5763eb13de48a1d802bfb85c128414099c901d62a547ea86edfe2a8d0e3e7ffc.jpg) +Figure 1: Test accuracy on IMDB dataset with different editing operations and parameters for data augmentation. The operations and parameters without elaborate selection lead to a degrade of performance. + +formance. Data augmentation approaches demonstrate their superiority in many scenarios, especially when data resources are insufficient (Hu et al., 2019b; Anaby-Tavor et al., 2020; Chen et al., 2021) and class-imbalanced (Ren et al., 2018; Hu et al., 2019b). + +Previous data augmentation methods can be roughly divided into two categories: generation-based (Sennrich et al., 2016; Imamura et al., 2018; Kobayashi, 2018; Anaby-Tavor et al., 2020; Quteineh et al., 2020) and editing-based methods (Wei and Zou, 2019; Xie et al., 2020). Generation-based methods utilize conditional generation models (Sutskever et al., 2014; Ott et al., 2019) to synthesize the paraphrases (Kumar et al., 2019; Hu et al., 2019a) of the original sentences, which have advantages in instance fluency and label preservation but suffer from the heavy cost of model pre-training and decoding. Editing-based methods instead apply label-invariant sentence editing operations (swap, delete, etc.) on the raw instance, which are simpler and more efficient in practice. However, the editing-based methods are + +![](images/6ee70780d4b9c917d60dceb5abeb1646721ef0cca758bc68910c9681ecc1e529.jpg) +Figure 2: The structure and usage of augmentation policy $\mathcal{P}$ . A policy $\mathcal{P}$ consists of $N$ atomic editing operations $\mathcal{O} = \langle t, p, \lambda \rangle$ . Given a text, we randomly pick $N^*$ operations from $\mathcal{P}$ then apply the operations sequentially. In this case, $N = 4$ and $N^* = 2$ . Red operation $\mathcal{O}$ indicates it is finally applied to the text according to probability $p$ . The modification to the original text caused by it is also showed in Red. We use RS (Random Swap), RD (Random Delete), TI (TF-IDF Insert), TS (TF-IDF Substitute) for abbreviation. Best viewed in color. + +sensitive to the preset hyper-parameters including the type of the applied operations and the proportion of words to be edited. As shown in Figure 1, we probe the classification accuracy on IMDB dataset (Maas et al., 2011) with different editing operations and magnitudes (proportion of edited words). We find that inappropriate hyper-parameter settings, e.g. TF-IDF Substitute (Xie et al., 2020) with a magnitude larger than 0.4, lead to inferior results. Therefore, heuristic hyper-parameter setting is prone to fall into the sub-optimum and lacks effectiveness. Besides, most of the editing-based methods (Kobayashi, 2018; Hu et al., 2019b; Sennrich et al., 2016; Imamura et al., 2018; Andreas, 2020) only apply a single operation on the sentence once a time, which restrict the diversity of the augmented dataset and thus limit the performance gain. + +To overcome the limitations above, we propose a framework named Text AutoAugment (TAA) to establish a learnable and compositional paradigm for the data augmentation. Our goal is to automatically learn the optimal editing-based data augmentation policy for obtaining a higher quality augmented dataset and thus enhancing the target text classification model. We design an augmentation policy as a set of various editing operations: policy $= \{\mathrm{op}_1,\dots ,\mathrm{op}_N\}$ and each operation is defined with a parameter triplet: $\mathrm{op} = \langle \mathrm{type}t$ , probability $p$ , magnitude $\lambda \rangle$ . Such a compositional structure allows more than one operation to be applied to the original sentence and can improve the diversity of the synthetic instances. In conclusion, a policy solution consists of two kinds of knowledge to learn: the operation set and the editing parameters for each operation. To search the optimal policy, we propose a novel objective function and utilize the sequential Model-based + +Global Optimization (SMBO) (Bergstra et al., 2011), an efficient and widely used method in AutoML (Yao et al., 2018), to learn the optimal configuration of the compositional policy. + +Given a target dataset, our algorithm learns an augmentation policy automatically and adaptively. The implementation based on distributed learning frameworks can efficiently obtain promising results in several GPU hours. To summarize, our contribution is two-fold: + +- We present a learnable and compositional framework for data augmentation. Our proposed algorithm automatically searches for the optimal compositional policy, which improves the diversity and quality of augmented samples. +- In low-resource and class-imbalanced regimes of six benchmark datasets, TAA significantly improves the generalization ability of deep neural networks like BERT and effectively boosts text classification performance. + +# 2 Text AutoAugment + +In this section, we introduce the Text AutoAugment framework to search for the optimal augmentation policy automatically. Our augmentation policy is composed of various operations and forms a hierarchical structure, which is first detailed in Section 2.1. Then we give an overview of the proposed learnable augmentation method and establish a global objective function for it (Section 2.2). The specific policy optimization algorithm is presented at last (Section 2.3). + +# 2.1 Compositional Augmentation Policy + +To generate a much broader set of augmentations, we introduce a compositional policy instead of a single operation. Figure 2 shows the structure and usage of the policy $\mathcal{P}$ . Specifically, our policy is a set of $N$ various editing operations: + +$$ +\mathcal {P} = \{\mathcal {O} _ {1}, \dots , \mathcal {O} _ {i}, \dots , \mathcal {O} _ {N} \} +$$ + +The operation $\mathcal{O}$ is an atomic component and is responsible for applying an editing transformation on a text $x$ to synthesize an augmented instance $x_{\mathrm{aug}}$ . Each operation $\mathcal{O}_i$ is defined as a triplet: + +$$ +\mathcal {O} _ {i} = \langle t _ {i}, p _ {i}, \lambda_ {i} \rangle +$$ + +with three parameters: (1) Type $t \in \{\text{Random Swap, Random Delete, TF-IDF Insert, TF-IDF Substitute, WordNet Substitute}\}$ .2 (2) Probability $p \in [0,1]$ of being applied. (3) Magnitude $\lambda \in [0,0.5]$ which determines the proportion of the words to be edited. + +The augmented text after an operation can be formulated as: + +$$ +\mathcal {O} _ {i} \left(x; \langle t _ {i}, p _ {i}, \lambda_ {i} \rangle\right) = \left\{ \begin{array}{l l} \mathcal {O} _ {i} \left(x; \langle t _ {i}, \lambda_ {i} \rangle\right) & \text {w i t h} p _ {i} \\ x & \text {w i t h} 1 - p _ {i} \end{array} \right. \tag {1} +$$ + +It means that for a given text $x$ , it has probability $p_i$ to be applied with the operation $\mathcal{O}_i$ for synthesizing the transformed text $x_{\mathrm{aug}} = \mathcal{O}_i(x; \langle t_i, \lambda_i \rangle)$ under the magnitude $\lambda_i$ , while has probability $1 - p_i$ to remain identical, i.e., $x_{\mathrm{aug}} = x$ . + +To further increase the diversity of augmented data and enlarge the support of the training distribution, our policy applies more than one operation to the original sentence in a recursive way. Specifically, we randomly sample $N^{*}$ editing operations from the policy $\mathcal{P}$ and apply them to a given text consecutively. The $N^{*}$ atomic operations can be combined as a compositional operation with the recursive depth equals $N^{*}$ . For example, when $N^{*} = 2$ and the sampled operations are $[\mathcal{O}_i, \mathcal{O}_j]$ , the final augmented instance can be denoted as: + +$$ +x _ {\mathrm {a u g}} = \mathcal {O} _ {j} \left(\mathcal {O} _ {i} \left(x; \langle t _ {i}, p _ {i}, \lambda_ {i} \rangle\right); \langle t _ {j}, p _ {j}, \lambda_ {j} \rangle\right). +$$ + +In other words, one policy can synthesize up to $A_{N}^{N^{*}} \times 2^{N^{*}}$ augmented instances, where $A$ denotes a permutation. Note that our policy is determined by only $N \times 3$ parameters, which does NOT cause + +the problem of search space explosion. As discussed before, the setting of these parameters in a policy has a great impact on the quality of augmented data and the model performance, which motivates us to devise a learnable framework for automatically selecting the optimal parameters instead of a naive grid search or cumbersome manual tuning. + +# 2.2 Learnable Data Augmentation Policy + +In this subsection, we first review the data augmentation and model training with the traditional objective function. We then propose a new objective function to learn the optimal policy for obtaining a augmented dataset with higher quality and improving the model performance. + +Given an input space $\mathcal{X}$ and output space $\mathcal{Y}$ of the text classification task, a model $f$ is responsible for learning a mapping from input texts $x\in \mathcal{X}$ to target labels $y\in \mathcal{Y}$ . In some scenarios, the training set $\mathcal{D}_{\mathrm{train}}$ is extremely small or imbalanced, which leads to a large generalization error on the test set. Therefore, data augmentation is incorporated as an implicit regularizer (Hernandez-Garcia and Konig, 2018) to help models learn better patterns (Simard et al., 1996) and further improve the generalization ability. Let $\mathcal{D}_{\mathrm{aug}}(\mathcal{P})$ be the augmented dataset containing both training set and the synthetic data generated by the policy $\mathcal{P}$ , the loss function $\mathcal{L}$ of model training on the augmented dataset can be formulated as a sum of instance-level loss $l$ such as cross-entropy: + +$$ +\mathcal {L} = \sum_ {(x, y) \in \mathcal {D} _ {\mathrm {a u g}} (\mathcal {P})} l (f (x), y). \tag {2} +$$ + +In traditional methods, the parameters of data augmentation are preset before training then tuned on the validation set $\mathcal{D}_{\mathrm{val}}$ , which is similar to the paradigm of hyper-parameters tuning. For this reason, we cast the problem of augmentation policy optimization as the Combined Algorithm Selection and Hyper-parameter (CASH) optimization problem (Thornton et al., 2013; Feurer et al., 2019) in AutoML (Yao et al., 2018). Formally, let $\mathbb{F}$ and $\mathbb{P}$ be the search space of models and policies, respectively. Each model $f$ is trained on $\mathcal{D}_{\mathrm{aug}}(\mathcal{P})$ augmented by the policy $\mathcal{P}$ . We propose a novel metric to measure the loss of a policy and a model: + +$$ +\mathcal {J} := \mathcal {J} (f, \mathcal {D} _ {\text {a u g}} (\mathcal {P}), \mathcal {D} _ {\text {v a l}}) \tag {3} +$$ + +Here, $\mathcal{J}\left(f,\mathcal{D}_{\mathrm{aug}}(\mathcal{P}),\mathcal{D}_{\mathrm{val}}\right)$ denotes the loss that the model $f$ achieves on the validation set $\mathcal{D}_{\mathrm{val}}$ + +![](images/f1bbd58c8d5aadcffb190d332a42d9a190f7dcaf3ec57937434289952981aa9b.jpg) +Figure 3: The overview of the optimization procedure in the Text AutoAugment algorithm. In each iteration, the optimizer samples a policy and trains a corresponding model on the augmented training set. After that, the loss on the validation set is calculated to update the policy optimizer then execute the next iteration. + +after trained on the augmented set $\mathcal{D}_{\mathrm{aug}}(\mathcal{P})$ . It quantifies the generalization ability of the model after augmentation thus reflects the quality of the augmented data. Consequently, the objective function of our policy optimization can be written as + +$$ +f ^ {*}, \mathcal {P} ^ {*} = \underset { \begin{array}{c} f \in \mathbb {F} \\ \mathcal {P} \in \mathbb {P} \end{array} } {\arg \min } \mathcal {J} (f, \mathcal {D} _ {\text {a u g}} (\mathcal {P}), \mathcal {D} _ {\text {v a l}}). \tag {4} +$$ + +Through minimizing the validation loss of the model, we can find the optimal configuration of the policy $\mathcal{P}$ and improve the quality of the augmented data. + +# 2.3 Augmentation Policy Optimization + +Like the optimization of hyper-parameters of a deep learning model, our objective function for policy optimization depends on the validation loss, which can not be solved by gradient-based methods such as back-propagation. To tackle this problem, we introduce Sequential Model-based Global Optimization (SMBO) (Bergstra et al., 2011), a kind of Bayesian optimizer widely used in AutoML, to our TAA framework. Our optimization procedure is illustrated in Figure 3. In a nutshell, the SMBO optimizer builds a probability model of the objective function as a surrogate and uses it to samples the most promising policy, then evaluates the policy in the true objective function. In practice, we use Tree-structured Parzen Estimator (TPE) (Bergstra et al., 2011) as a surrogate agent $M$ to model the function between the policy and the objective loss in Eq. 7. + +# Algorithm 1: TAA Algorithm + +Input: Number of iterations $T$ +Input: Training set $D_{\mathrm{train}}$ +Input: Validation set $D_{\mathrm{val}}$ $\mathcal{H} \gets \emptyset$ // Initialize history +for $i = 1$ to $T$ do + $\mathcal{P}_i \gets \arg \max_{\mathcal{P}} \operatorname{EI}(\mathcal{P})$ // Eq. 8 +Train $f_i$ // Eq. 2 +Evaluate $\mathcal{I}_i$ // Eq. 7 + $\mathcal{H} \gets \mathcal{H} \cup (f_i, \mathcal{P}_i, \mathcal{I}_i)$ +Update surrogate model $M$ to fit $\mathcal{H}$ +end + $f^*, \mathcal{P}^* = \arg \min_{\substack{f \in \mathcal{H} \\ \mathcal{P} \in \mathcal{H}}} \mathcal{I}$ // Eq. 4 +return $f^*$ and $\mathcal{P}^*$ + +This process is carried out in an iterative manner. At each iteration, the SMBO optimizer samples an augmentation policy $\mathcal{P}_i$ to synthesize the augmented set $\mathcal{D}_{\mathrm{aug}}(\mathcal{P}_i)$ , and then trains a model $f_i$ based on it. The loss $\mathcal{I}_i$ of the policy $\mathcal{P}_i$ is then evaluated by Eq. 7 and merged into the observation history $\mathcal{H}$ to help update the surrogate model. + +The specific updating procedure of TPE is introduced in Appendix B. After that, we employ the following Expected Improvement (EI) criterion as an acquisition function to sample the next promising policy: + +$$ +\operatorname {E I} (\mathcal {P}) = \mathbb {E} \left[ \max \left(\mathcal {J} ^ {\dagger} - \mathcal {J}, 0\right) \right] \tag {5} +$$ + +Here, $\mathcal{I}^{\dagger}$ is a threshold calculated by the observation history and the surrogate model. Eq. 8 is the expectation under the surrogate model that the loss $\mathcal{I}$ of a policy will exceed (negatively) the threshold $\mathcal{I}^{\dagger}$ . Note that our target is to find the policy that minimizes the loss $\mathcal{I}$ , the policy that maximizes the expected improvement will be chosen in the next iteration. The TAA framework is summarized in Algorithm 1. $^3$ + +# 3 Experiments + +# 3.1 Benchmark Datasets + +We conduct experiments on six benchmark datasets, including IMDB (Maas et al., 2011), SST-2, SST-5 (Socher et al., 2013), TREC (Li and Roth, 2002), YELP-2 and YELP-5 (Zhang et al., 2015). The statistics of the datasets are listed in Appendix C. + +# 3.2 Baselines + +We compare our TAA method with the following representative baselines: + +Back Translation (BT) (Sennrich et al., 2016; Imamura et al., 2018). We utilize WMT'19 English-German translation models (Ng et al., 2019) based on Transformer (Vaswani et al., 2017) to translate the text from English to German, and then translate it back to English. We use random sampling for decoding as recommended by (Xie et al., 2020; Edunov et al., 2018), and set the temperature to 0.8 to generate more diverse paraphrases. + +Contextual Word Substitute (CWS) (Kobayashi, 2018). CWS masks some words in the original text stochastically, then predicts new words for substitution using a label-conditional language model (LM). The proportion $\alpha$ of words to be masked and predicted is 0.15. + +Easy Data Augmentation (EDA) (Wei and Zou, 2019). Given a text from the training set, EDA randomly applies one of four simple editing operations including Synonym Replacement, Random Insertion, Random Swap, and Random Deletion. We set the proportion of words to be edited to 0.05 according to the recommendations in the paper. + +Learning Data Manipulation (LDM) (Hu et al., 2019b). LDM is also a learnable data augmentation method, but uses only one operation: aforementioned CWS. LDM establishes a reinforcement learning system to iteratively optimize the parameters of the task model and label-conditional LM. + +The main characteristics of the baselines are summarized in Table 1. + +# 3.3 Experimental Settings + +We choose large-scale pre-trained BERT (base, uncased version) (Devlin et al., 2019) as the backbone model. We adopt the Adam optimizer (Kingma and Ba, 2015) and a linear warmup scheduler with an initial learning rate of 4e-5. The training epoch is 20 for TREC and 10 for the reset datasets. We pick the best checkpoint according to the validation loss. Note that the validation loss is also the criterion for policy optimization, so we split out two validation sets with the same size during the phase of policy optimization. One is used for evaluating the model checkpoints, and the other is for evaluating the sampled policy. All experiments are conducted with 8 Tesla P40 GPUs. Following previous works (Hu et al., 2019b; Xie et al., 2020; Wei and Zou, 2019), + +
BaselinesLearnableCompositionalOp. Level
BTXXSentence
CWSXXWord
EDAX✓Word
LDM✓XWord
TAA (Ours)✓✓Word
+ +Table 1: Comparison of baselines. + +we verify the performance of all data augmentation baselines in two special data scenarios: + +Low-resource Regime. For every dataset in Section 3.1, we constrain the amount of available labeled data by sub-sampling a smaller training and validation set. In order to maintain the distribution of the original dataset, we apply Stratified ShuffleSplit (Esfahani and Dougherty, 2014) to split the training and validation set. The final datasets IMDB, SST-5, TREC, YELP-2, and YELP-5 have 80, 200, 120, 80, 200 labeled training samples, respectively, which pose significant challenges for learning a well-performing classifier. The number of validation samples is 60, 150, 60, 60, 150, respectively. In low-resource regime, we introduce a parameter $n_{\mathrm{aug}}$ , representing the magnification of augmentation. For example, $n_{\mathrm{aug}} = 16$ means that we synthesize 16 samples for each given sample. + +Class-imbalanced Regime. For binary sentiment classification datasets IMDB and SST-2, we subsample the training samples from an imbalanced class distribution. After sub-sampling, the negative class of the training set has 1000 samples, while the positive class has only 20/50/100 training samples respectively in three experiments. In this regime, we only augment the samples in positive class by 50/20/10 times, so that the final data amount of the positive and negative class are the same. We set up another baseline Over-Sampling (OS) for this scenario, which over-samples the training samples in the positive class by 50/20/10 times. Following the settings of the previous work (Ren et al., 2018; Hu et al., 2019b), the validation set for training and policy optimization is balanced. + +In both low-resource and class-imbalanced regimes, the test set for final evaluation is balanced and intact without any reduction, which indicates that accuracy is a fair metric for evaluation. The size of policy $N$ and the number of the operations sampled for each text $N^*$ is 8 and 2, respectively. For a fair comparison, we use 3 random seeds for data sub-sampling and run 5 times under each seed. + +
MethodIMDB (80)SST-5 (200)TREC (120)YELP-2 (80)YELP-5 (200)Average
No Aug64.74±3.4136.14±3.9969.31±5.3773.87±4.2236.62±4.6756.14±4.33
CWS73.44±3.5639.22±2.6674.31±5.0178.87±3.9643.05±2.1861.77±3.47
EDA73.93±1.8839.72±1.9371.59±4.3977.46±4.7843.17±2.7661.17±3.15
LDM70.39±3.6140.25±1.4875.33±4.7779.70±2.8543.85±0.9661.90±2.73
BT74.13±3.1039.40±3.8778.08±4.0778.97±2.9542.19±2.5362.55±3.30
TAA(Ours)75.68*±3.2740.28±1.8081.47**±3.8781.75*±3.5745.29*±1.7664.89±2.85
+ +Table 2: Test accuracy (\%) with standard deviation of different augmentation methods in low-resource regime. IMDB (80) means the number of training samples after sub-sampling is 80. * and ** indicate statistically significant $(\mathrm{p} < .05$ and $\mathrm{p} < .01)$ improvements over the best baseline. Here $n_{\mathrm{aug}} = 16$ . + +Finally, we report the results on the average of 15 runs with standard deviation (denoted as $\pm$ ). + +# 3.4 Main Results + +We train the model on the training set augmented by baselines in Section 3.2, then conduct evaluations on the balanced and intact test set. + +Low-resource Regime. Table 2 shows the test accuracy of TAA on five datasets. In the low-resource regime, the model suffers from a severe overfitting problem. For example, the accuracy on the subtraining set of TREC is as high as $98.06\% \pm 1.34\%$ , while only obtains $69.3\% \pm 5.4\%$ on the test set. Several kinds of data augmentation baselines have greatly improved the generalization ability of the model. As shown in Figure 1, however, the performance of the augment operations is very sensitive to their parameters like the magnitude. The heuristic-based approaches such as EDA and CWS are likely to be trapped in sub-optimum because of the manually parameters setting. On the contrary, our Text AutoAugment algorithm with a learnable and compositional policy outperforms all the baselines by a considerable margin. Compared to the model without augmentation, TAA boosts the accuracy by $8.8\%$ averagely. Note that it does not cost too much time of computation to achieve such performance. When the number of iterations $T$ (see Algorithm 1) is 200, it only requires $4.24 \pm 0.10$ GPU hours on 8 NVIDIA Tesla P40 GPUs to finish the optimization. + +Class-imbalanced Regime. To verify that TAA can also improve the performance of the model in class-imbalanced regime, we conduct experiments based on the settings in Section 3.3. As illustrated in Table 3, the over-sampling method alleviates the overfitting problem to some extent but is not as efficient as augmentation baselines. In contrast, + +![](images/71787f5d9992c068e3ea935601c88e8f6838c4564096b02b3b69c9dd08ed43fa.jpg) +Figure 4: Transferability of the policies searched by TAA from one source dataset to other target datasets. The number denotes the performance degradation when the policy is transferred to the target dataset. + +our TAA boosts the test accuracy by an average of about $9.7\%$ , which surpasses other algorithms. + +In both low-resource and class-imbalanced regimes, our TAA framework based on multiple learnable operations surpasses BT & CWS based on single unlearnable operation, EDA based on multiple unlearnable operations, and LDM based on single learnable operation. + +# 4 Analysis + +We analyse the learned policies on four aspects including transferability, scalability, magnification and structure. Besides, we evaluate the diversity and semantics preservation of the augmented data, and further conduct a case study. The final policies searched by our TAA algorithm are listed in Appendix D. + +# 4.1 Transferability + +We conduct experiments to study whether the policies searched on one source dataset can be applied to other target datasets. As illustrated in Figure 4, + +
MethodSST-2 (20:1000)SST-2 (50:1000)SST-2 (100:1000)IMDB (20:1000)IMDB (50:1000)IMDB (100:1000)Average
No Aug50.17±1.3055.01±6.3368.01±8.8050.05±0.0051.84±4.5665.81±7.6556.82±4.77
OS52.01±1.8058.58±5.5668.97±3.4852.29±2.6959.08±6.3368.63±4.6759.93±4.09
BT54.05±4.2059.47±5.6771.70±5.2952.24±2.9057.43±6.8567.20±6.8960.35±5.46
EDA52.91±3.8759.53±5.8670.05±5.3457.29±5.7464.09±7.1871.28±4.9462.53±5.49
CWS53.09±1.9864.62±5.0574.67±3.8855.58±3.3464.37±3.5574.33±4.9264.44±3.79
TAA(Ours)56.45*±3.6766.05±4.8575.12±5.2056.92±2.8066.73*±4.2077.87*±3.1866.52±3.98
+ +Table 3: Test accuracy (\%) with standard deviation in class-imbalanced regime. SST-2 (20:1000) means the positive class of SST-2 has 20 training samples while the negative class has 1000 training samples. * indicates statistically significant $(p < .05)$ improvements over the best baseline. + +
DatasetNo AugTAAImprovement (↑)
IMDB88.7789.370.60
SST-552.2952.550.26
TREC96.4097.070.67
YELP-295.8596.040.19
YELP-565.5565.730.18
Average79.7780.150.38
+ +Table 4: Test accuracy $(\%)$ of TAA on full datasets. Here $n_{\mathrm{aug}} = 4$ for IMDB, SST-5 and TREC. $n_{\mathrm{aug}} = 2$ for YELP-2 and YELP-5. + +the transfer of the policy to other datasets only results in a slight performance degeneration of $1.1\%$ on average and can boosts the test accuracy by $7.7\%$ comparing to no augmentation. The policies maintain better transferability when the gap of class number and sequence length is smaller between the source and target datasets. + +# 4.2 Scalability + +In order to investigate whether the TAA policy is still helpful as the amount of training data increases, we apply the policies searched in the low-resource regime to the corresponding full datasets. Note that the only difference between the experimental setting here and that in the low-resource and class-imbalanced regimes is the amount of the training data. The test sets are intact and balanced in all three situations. As shown in Table 4, the policies searched on a subset with only 2k training samples on average have great scalability. Such policies can improve the quality and diversity of the full training set, and further, improve the model performance by an average of 0.38. + +![](images/9d28765d5f1e552127b44009144fdaf063ec49150956728b86099718e562e4b0.jpg) +Figure 5: Test accuracy $(\%)$ with different $n_{\mathrm{aug}}$ on SST-5 and TREC, respectively. Each curve in the sub-figure denotes a kind of baseline. Shaded regions indicate standard deviation over 15 trials. + +![](images/9e1d93bc52f3535e9697610683b62b69cc72449b74a18a0e8dd3f34607e513bf.jpg) + +# 4.3 Impact of Augment Magnification + +Figure 5 shows the results of each method with different augment magnification $n_{\mathrm{aug}}$ . We find that CWS and LDM achieve their best performance on SST-5 when $n_{\mathrm{aug}} = 4$ , but the accuracy drops sharply as $n_{\mathrm{aug}}$ continues to increase. The performance improvement from methods with a single operation cannot scale with more augmented samples, presumably because of the lack of novel information. Worsely, EDA, which is based on unlearnable multiple operations, even harms the model training on TREC, due to its inappropriate parameter setting with human experience (Wei and Zou, 2019). In virtue of the compositional and learnable policy, the augmented data synthesized by TAA are effective and perform well in most cases. + +# 4.4 Impact of the Policy Structure + +We change the size of the policy $N$ and the number of the operations sampled for each text $N^{*}$ and re-execute the experiments to explore the impact of the policy structure. The left panel in Figure 6 shows the results with different $N^{*}$ . As $N^{*}$ increases, the original text is likely to be applied with more operations sequentially, which causes slight + +![](images/12141b63677b65d7a2eb848fbc7afa829153ed0b260d3aaa61355044bb166377.jpg) +Figure 6: Performance of TAA with respect to the structure of augmentation policy. + +
MethodIMDB (80)SST-5 (200)TREC (120)YELP-2 (80)YELP-5 (200)Average
CWS0.3020.7310.8270.3900.3930.529
EDA0.3040.7470.8390.3970.3990.537
BT0.3450.7450.8490.4390.4400.564
TAA(Ours)0.3450.7510.8410.4450.4460.566
+ +Table 5: Distinct-2 of different augmentation methods in low-resource regimes. + +damage to the performance of TAA. While the right panel shows that the more operations a policy contains, the better TAA performs. Therefore, for the compositional data augmentation algorithm, it is helpful to generate more diverse samples. Other ablation studies on operation type and searching algorithm can be found in Appendix E. + +# 4.5 Diversity of Augmented Data + +We evaluate the diversity of the augmented data by computing the Dist-2 (Li et al., 2016), which measures the number of distinct bi-grams in generated sentences. The metric is scaled using the total number of bi-grams in the generated sentence, which ranges from 0 to 1 where a larger value indicates higher diversity. As shown in Table 5, TAA achieves the best overall performance, even slightly outperforms the generation-based method, i.e., back-translation. The results validate the effectiveness of applying various editing operations in the compositional augmentation policy, and demonstrate the superiority of our well-designed algorithm for automatic hyper-parameters tuning. + +# 4.6 Semantics Preservation of Augmented Data + +The augmented sentence are supposed to preserve the semantic meaning of the original sentence, for enriching rather than deviating from the original data set support. We propose to evaluate semantic similarity between the generated sentences and + +the original ones, based on sentence embedding cosine similarity. In more detail, for the sentence pair $(x, x_{\mathrm{aug}})$ consists of the original sentence $x$ and the corresponding augmented text $x_{\mathrm{aug}}$ , we utilize Sentence-BERT (Reimers and Gurevych, 2019) library, which achieves the state-of-the-art performance on various semantic textual similarity benchmarks, to obtain dense vector representations of sentences $(\mathbf{x}, \mathbf{x}_{\mathrm{aug}})$ . The semantic preservation score $\mathrm{SP}(x, x_{\mathrm{aug}})$ is defined as: + +$$ +\mathrm {S P} (x, x _ {\mathrm {a u g}}) = \frac {\mathbf {x} \cdot \mathbf {x} _ {\mathrm {a u g}}}{\| \mathbf {x} \| \| \mathbf {x} _ {\mathrm {a u g}} \|}. \tag {6} +$$ + +We compute the average semantic preservation score for the whole augmented datasets using different augmentation methods, and the results are listed in Table 6. It can be found that our TAA achieves the best results, comparable with the generation-based method back-translation. We note that our method achieves the highest semantic preservation score when the number of training samples is relatively small, which demonstrates that our method can generalize to extreme low-resource scenarios. + +# 4.7 Case Study + +Figure 7 shows some cases of augmented texts generated by TAA. Given the original text with the label "positive", the modifications applied by TAA distort the semantics and sentence structure at the beginning. As the number of iteration $T$ increases, TAA captures the feature of the dataset adaptively, helping it achieve a better balance between diversity and quality on augmented samples. + +# 5 Related Work + +Previous data augmentation algorithms in NLP can be categorized into generation-based and editing-based methods. For generation-based methods, back-translation (Sennrich et al., 2016; Imamura et al., 2018; Luque, 2019; Zhang et al., 2020) generates the paraphrase of a text by translating it to an intermediate language and back. Kobayashi (2018) masks some words then uses a label-conditional language model to predict them. Anaby-Tavor et al. (2020) and Kumar et al. (2020) leverage various language models such as GPT-2 (Radford et al., 2019) and BART (Lewis et al., 2020) to generate a continuation of the original sentences. For editing-based methods, Wei and Zou (2019) propose the Easy Data Augmentation (EDA) technique, which randomly selects editing operations from four candidates for the augmentation. Xie et al. (2020) + +
MethodIMDB (80)SST-5 (200)TREC (120)YELP-2 (80)YELP-5 (200)Average
CWS0.6980.7960.7840.7390.7360.751
EDA0.7380.6650.6100.7850.7850.717
BT0.7380.7990.8920.7410.7470.783
TAA(Ours)0.7710.7760.8470.7940.7260.783
+ +Table 6: Cosine similarity of sentence embeddings between the augmented sentence and the original one. IMDB (80) means the number of training samples after sub-sampling is 80. Here $n_{\mathrm{aug}} = 16$ and number of iterations $T$ is 200. + +
Label: Positive Original text: A deeply felt and vividly detailed story about newcomers in a strange new world.
IterationSampled operationsSynthetic text
T=1<WS, 0.9, 0.4>A deeply felt and vividly detailed story about newcomers in a strange new world.
<RS, 0.2, 0.5>A deeply felt and vividly depression detailed story about newcomers in a strange new world.
T=100<WS, 0.5, 0.8>A deeply felt vividly and about elaborate tale in newcomer earth a young unknown.
<TI, 0.2, 0.8>A deeply felt and vividly detailed story about newcomers in a strange new world.
T=200<TS, 0.7, 0.1>A deeply felt and vividly detailed story particularly about newcomers in a strange new world.
<WS, 0.4, 0.2>A deeply felt and vividly elaborate story about newcomers in a foreign new world.
+ +Figure 7: Examples of augmented texts generated by TAA on SST-5 after 1/100/200 iteration of exploration. Red operation $\mathcal{O} = \langle t,p,\lambda \rangle$ indicates it is finally applied according to probability $p$ . We use RS (Random Swap), RD (Random Delete), TI (TF-IDF Insert), TS (TF-IDF Substitute) and WS (WordNet Substitute) for abbreviation. + +propose to substitute uninformative words with low TF-IDF scores. These methods require a lot of prior knowledge to preset their parameters and are prone to fall into the sub-optimum. + +Recently, some algorithms are proposed for automatically learning augmentation policy in the field of Computer Vision (Cubuk et al., 2019; Ho et al., 2019; Lim et al., 2019; Hataya et al., 2020; Li et al., 2020) and NLP (Cai et al., 2020; Miao et al., 2021). However, their modelings are different from ours. Specifically, AutoAugment (Cubuk et al., 2019) establishes a Reinforcement Learning (RL) framework to search for the best augmentation policy. In order to reduce the time of policy exploration, Ho et al. (2019) replace the RL framework with a population-based algorithm. Lim et al. (2019) leverage 5-fold cross-validation and augments the validation set instead of the training set. While in our proposed approach, the objective function for policy optimization is designed as the loss that models achieve on the validation set after trained on the augmented set. Besides, we utilize SMBO as the optimization algorithm, which can return a promising result efficiently. In the field of NLP, TAA surpasses both EDA (Wei and Zou, 2019) and LDM (Hu et al., 2019b) via a learnable and compositional augmentation policy. + +# 6 Conclusion + +In this paper, we propose an effective method called Text AutoAugment (TAA) to establish a compositional and learnable paradigm for data augmentation. TAA regards a combination of various editing operations as an augmentation policy and utilizes SMBO for policy learning. Experiments show that TAA can substantially improve the generalization ability of models as well as lighten the burden of artificial augmentation designing. + +# Acknowledgements + +We thank all the anonymous reviewers for their constructive comments, and Xuancheng Ren and Guangxiang Zhao for their valuable suggestions in preparing the manuscript. This is a joint work between Pattern Recognition Center, WeChat AI, Tencent Inc. and Peking University, and is partly supported by Beijing Academy of Artificial Intelligence (BAAI). Xu Sun is the corresponding author of this paper. + +# References + +Ateret Anaby-Tavor, Boaz Carmeli, Esther Goldbraich, Amir Kantor, George Kour, Segev Shlomov, Naama Tepper, and Naama Zwerdling. 2020. Do not have + +enough data? deep learning to the rescue! 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 7383-7390. AAAI Press. +Jacob Andreas. 2020. Good-enough compositional data augmentation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 7556-7566. Association for Computational Linguistics. +James Bergstra, Rémi Bardenet, Yoshua Bengio, and Balázs Kégl. 2011. Algorithms for hyper-parameter optimization. In Advances in Neural Information Processing Systems 24: 25th Annual Conference on Neural Information Processing Systems 2011. Proceedings of a meeting held 12-14 December 2011, Granada, Spain, pages 2546-2554. +Hengyi Cai, Hongshen Chen, Yonghao Song, Cheng Zhang, Xiaofang Zhao, and Dawei Yin. 2020. Data manipulation: Towards effective instance learning for neural dialogue generation via learning to augment and reweight. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 6334-6343. Association for Computational Linguistics. +Jiaao Chen, Derek Tam, Colin Raffel, Mohit Bansal, and Diyi Yang. 2021. An empirical survey of data augmentation for limited data learning in NLP. CoRR, abs/2106.07499. +Ekin D. Cubuk, Barret Zoph, Dandelion Mané, Vijay Vasudevan, and Quoc V. Le. 2019. Autoaugment: Learning augmentation strategies from data. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pages 113-123. Computer Vision Foundation / 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, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. Association for Computational Linguistics. +Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. 2018. Understanding back-translation at scale. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium, October 31 - November 4, 2018, pages 489-500. Association for Computational Linguistics. + +Mohammad Shahrokh Esfahani and Edward R. Dougherty. 2014. Effect of separate sampling on classification accuracy. Bioinform., 30(2):242-250. +Matthias Feurer, Aaron Klein, Katharina Eggensperger, Jost Tobias Springenberg, Manuel Blum, and Frank Hutter. 2019. *Auto-sklearn: Efficient and robust automated machine learning.* In *Automated Machine Learning - Methods, Systems, Challenges*, The Springer Series on Challenges in Machine Learning, pages 113-134. Springer. +Ryuichiro Hataya, Jan Zdenek, Kazuki Yoshizoe, and Hideki Nakayama. 2020. Faster autoaugment: Learning augmentation strategies using backpropagation. In Computer Vision - ECCV 2020 - 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XXV, volume 12370 of Lecture Notes in Computer Science, pages 1-16. Springer. +Alex Hernández-García and Peter König. 2018. Data augmentation instead of explicit regularization. CoRR, abs/1806.03852. +Daniel Ho, Eric Liang, Xi Chen, Ion Stoica, and Pieter Abbeel. 2019. Population based augmentation: Efficient learning of augmentation policy schedules. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pages 2731-2741. PMLR. +J. Edward Hu, Rachel Rudinger, Matt Post, and Benjamin Van Durme. 2019a. PARABANK: monolingual bitext generation and sentential paraphrasing via lexically-constrained neural machine translation. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 6521-6528. AAAI Press. +Zhiting Hu, Bowen Tan, Ruslan Salakhutdinov, Tom M. Mitchell, and Eric P. Xing. 2019b. Learning data manipulation for augmentation and weighting. 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 15738-15749. +Kenji Imamura, Atsushi Fujita, and Eiichiro Sumita. 2018. Enhancement of encoder and attention using target monolingual corpora in neural machine translation. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, NMT@ACL 2018, Melbourne, Australia, July 20, 2018, pages 55-63. 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. +Sosuke Kobayashi. 2018. Contextual augmentation: Data augmentation by words with paradigmatic relations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 2 (Short Papers), pages 452-457. Association for Computational Linguistics. +Ashutosh Kumar, Satwik Bhattachamishra, Manik Bhandari, and Partha P. 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, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 3609-3619. Association for Computational Linguistics. +Varun Kumar, Ashutosh Choudhary, and Eunah Cho. 2020. Data augmentation using pre-trained transformer models. CoRR, abs/2003.02245. +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, ACL 2020, Online, July 5-10, 2020, pages 7871-7880. Association for Computational Linguistics. +Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. 2016. A diversity-promoting objective function for neural conversation models. In *NAACL HLT* 2016, The 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, San Diego California, USA, June 12-17, 2016, pages 110-119. The Association for Computational Linguistics. +Xin Li and Dan Roth. 2002. Learning question classifiers. In 19th International Conference on Computational Linguistics, COLING 2002, Howard International House and Academia Sinica, Taipei, Taiwan, August 24 - September 1, 2002. +Yonggang Li, Guosheng Hu, Yongtao Wang, Timothy M. Hospedales, Neil Martin Robertson, and Yongxing Yang. 2020. DADA: differentiable automatic data augmentation. CoRR, abs/2003.03780. +Sungbin Lim, Ildoo Kim, Taesup Kim, Chiheon Kim, and Sungwoong Kim. 2019. Fast autoaugment. 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 6662-6672. +Franco Martin Luque. 2019. Atalaya at TASS 2019: Data augmentation and robust embeddings for sentiment analysis. In Proceedings of the Iberian Languages Evaluation Forum co-located with 35th Conference of the Spanish Society for Natural Language Processing, IberLEF@SEPLN 2019, Bilbao, Spain, September 24th, 2019, volume 2421 of CEUR Workshop Proceedings, pages 561-570. CEUR-WS.org. +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 The 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, Proceedings of the Conference, 19-24 June, 2011, Portland, Oregon, USA, pages 142-150. The Association for Computer Linguistics. +Zhengjie Miao, Yuliang Li, and Xiaolan Wang. 2021. Rotom: A meta-learned data augmentation framework for entity matching, data cleaning, text classification, and beyond. In SIGMOD '21: International Conference on Management of Data, Virtual Event, China, June 20-25, 2021, pages 1303-1316. ACM. +Jonas Mueller and Aditya Thyagarajan. 2016. Siamese recurrent architectures for learning sentence similarity. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA, pages 2786-2792. AAAI Press. +Nathan Ng, Kyra Yee, Alexei Baevski, Myle Ott, Michael Auli, and Sergey Edunov. 2019. Facebook fair's WMT19 news translation task submission. In Proceedings of the Fourth Conference on Machine Translation, WMT 2019, Florence, Italy, August 1-2, 2019 - Volume 2: Shared Task Papers, Day 1, pages 314-319. Association for Computational Linguistics. +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: Human Language Technologies*, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Demonstrations, pages 48-53. Association for Computational Linguistics. +Husam Quteineh, Spyridon Samothrakis, and Richard Sutcliffe. 2020. Textual data augmentation for efficient active learning on tiny datasets. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pages 7400-7410. 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. +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 2019, Hong Kong, China, November 3-7, 2019, pages 3980-3990. 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, ICML 2018, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pages 4331-4340. PMLR. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Improving neural machine translation models with monolingual data. 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. +Patrice Y. Simard, Yann LeCun, John S. Denker, and Bernard Victorri. 1996. Transformation invariance in pattern recognition-tangent distance and tangent propagation. In Neural Networks: Tricks of the Trade, volume 1524 of Lecture Notes in Computer Science, pages 239-27. Springer. +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. +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. +Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. 2015. Going deeper with convolutions. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2015, Boston, MA, USA, June 7-12, 2015, pages 1-9. IEEE Computer Society. +Chris Thornton, Frank Hutter, Holger H. Hoos, and Kevin Leyton-Brown. 2013. Auto-weka: combined + +selection and hyperparameter optimization of classification algorithms. In The 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD 2013, Chicago, IL, USA, August 11-14, 2013, pages 847-855. ACM. +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. +Jason W. 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 2019, Hong Kong, China, November 3-7, 2019, pages 6381-6387. Association for Computational Linguistics. +Qizhe Xie, Zihang Dai, Eduard H. Hovy, Thang Luong, and Quoc Le. 2020. Unsupervised data augmentation for consistency training. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual. +Quanming Yao, Mengshuo Wang, Hugo Jair Escalante, Isabelle Guyon, Yi-Qi Hu, Yu-Feng Li, Wei-Wei Tu, Qiang Yang, and Yang Yu. 2018. Taking human out of learning applications: A survey on automated machine learning. CoRR, abs/1810.13306. +Xiang Zhang, Junbo Jake Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pages 649-657. +Yi Zhang, Tao Ge, and Xu Sun. 2020. Parallel data augmentation for formality style transfer. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 3221-3228. Association for Computational Linguistics. + +# A Editing Operations for Augmentation + +We use five simple and effect operations including Random Swap (Wei and Zou, 2019), Random Delete (Wei and Zou, 2019), WordNet Substitute (Zhang et al., 2015; Mueller and Thyagarajan, 2016; Wei and Zou, 2019), TF-IDF Substitute (Xie et al., 2020) and TF-IDF Insert (Xie et al., 2020) as the basic component of our augmentation policy. All operations used here are word-level, considering their low complexity and high effectiveness. The detailed description is shown in Table 7. + +# B Sequential Model-based Global Optimization (SMBO) + +Recall the TAA framework in Section 2, our objective is to search for the optimal augmentation policy $\mathcal{P}$ that minimizes the following loss: + +$$ +\mathcal {J} = \mathcal {J} (f, \mathcal {D} _ {\mathrm {a u g}} (\mathcal {P}), \mathcal {D} _ {\mathrm {v a l}}). \tag {7} +$$ + +We leverage the Sequential Model-based Global Optimization (SMBO) as our optimizer for the policy learning. The optimization procedure is carried out in an iterative manner. To build the relation between the policy $\mathcal{P}$ and the objective loss $\mathcal{J}$ and sample the most promising policy at each iteration, we use the Tree-structured Parzen Estimator (TPE) (Bergstra et al., 2011) as a surrogate agent $M$ to model the conditional probability $p_{M}(\mathcal{J} \mid \mathcal{P})$ . Besides, we employ the following Expected Improvement (EI) criterion as an acquisition function for policy sampling in the current iteration: + +$$ +\begin{array}{l} \operatorname {E I} (\mathcal {P}) = \mathbb {E} \left[ \max \left(\mathcal {J} ^ {\dagger} - \mathcal {J}, 0\right) \right] \\ = \int_ {- \infty} ^ {\mathcal {I} ^ {\dagger}} \left(\mathcal {I} ^ {\dagger} - \mathcal {I}\right) p _ {M} (\mathcal {I} \mid \mathcal {P}) d \mathcal {I} \tag {8} \\ \end{array} +$$ + +Here, $\mathcal{I}^{\dagger}$ is a threshold and Eq. 8 stands for the expectation under the surrogate model that the loss $\mathcal{I}$ of a policy will exceed (negatively) the threshold $\mathcal{I}^{\dagger}$ . We expect the loss of the sampled policy in each iteration to be smaller than the current threshold, thus the policy that maximizes the Expected Improvement will be chosen in the next iteration. + +Instead of directly representing $p_{M}(\mathcal{I}\mid \mathcal{P})$ for calculating the Expected Improvement, the TPE builds a model of $p_M(\mathcal{P}\mid \mathcal{I})$ by applying Bayes rule. The TPE splits the historical observations of policies in two groups: the best performing one (e.g., the upper quartile) and the rest. The threshold $\mathcal{I}^{\dagger}$ is defined as the splitting value for the two + +groups and the likelihood probability for being in each of these groups is modeled as: + +$$ +p _ {M} (\mathcal {P} \mid \mathcal {J}) = \left\{ \begin{array}{l l} l (\mathcal {P}) & \text {i f} \mathcal {J} < \mathcal {J} ^ {\dagger} \\ g (\mathcal {P}) & \text {i f} \mathcal {J} > \mathcal {J} ^ {\dagger} \end{array} \right. \tag {9} +$$ + +Here, $l(\mathcal{P})$ models the distribution of previous sampled policies whose loss is less than the threshold, and $g(\mathcal{P})$ models the distribution of the other policies whose loss is greater than the threshold. The two densities $l$ and $g$ are modeled using Parzen estimators (also known as kernel density estimators), which are a simple average of kernels centered on existing data points. With Bayes Rule, we can prove that the Expected Improvement which we are trying to maximize is proportional to the ratio $l(\mathcal{P}) / g(\mathcal{P})$ : + +$$ +\begin{array}{l} \operatorname {E I} (\mathcal {P}) = \int_ {- \infty} ^ {\mathcal {I} ^ {\dagger}} \left(\mathcal {J} ^ {\dagger} - \mathcal {J}\right) p _ {M} (\mathcal {J} \mid \mathcal {P}) d \mathcal {J} \\ = \int_ {- \infty} ^ {\mathcal {I} ^ {\dagger}} \left(\mathcal {J} ^ {\dagger} - \mathcal {J}\right) \frac {p _ {M} (\mathcal {P} \mid \mathcal {J}) p (\mathcal {J})}{p (\mathcal {P})} d \mathcal {J} \\ = \frac {l (\mathcal {P})}{p (\mathcal {P})} \int_ {- \infty} ^ {\mathcal {I} ^ {\dagger}} \left(\mathcal {J} ^ {\dagger} - \mathcal {J}\right) p (\mathcal {J}) d \mathcal {J} \\ = \frac {l (\mathcal {P})}{p (\mathcal {P})} \left[ \gamma \mathcal {J} ^ {\dagger} - \int_ {- \infty} ^ {\mathcal {J} ^ {\dagger}} p (\mathcal {J}) d \mathcal {J} \right] \\ = \frac {l (\mathcal {P})}{\gamma l (\mathcal {P}) + (1 - \gamma) g (\mathcal {P})} \left[ \gamma \mathcal {J} ^ {\dagger} - \int_ {- \infty} ^ {\mathcal {J} ^ {\dagger}} p (\mathcal {J}) d \mathcal {J} \right] \\ \propto \left(\gamma + \frac {g (\mathcal {P})}{l (\mathcal {P})} (1 - \gamma)\right) ^ {- 1} \tag {10} \\ \end{array} +$$ + +Accordingly, the maximization of the Expected Improvement can be achieved by maximizing the ratio $l(\mathcal{P}) / g(\mathcal{P})$ . In other words, we should sample the polices which are more likely under $l(\mathcal{P})$ than under $g(\mathcal{P})$ . The TPE works by drawing sample polices from $l(\mathcal{P})$ , evaluating them in terms of $l(\mathcal{P}) / g(\mathcal{P})$ , and returning the set that yields the highest value under $l(\mathcal{P}) / g(\mathcal{P})$ corresponding to the greatest expected improvement. These policies are then evaluated on the objective function and the results are merged into the observation history. The algorithm builds $l(\mathcal{P})$ and $g(\mathcal{P})$ using the history to update the probability model $M$ of the objective function that improves with each iteration. + +# C Statistics of Datasets + +We conduct experiments on six popular datasets including IMDB (Maas et al., 2011), SST-2, SST-5 (Socher et al., 2013), TREC (Li and Roth, 2002), YELP-2 and YELP-5 (Zhang et al., 2015). The statistics of datasets used are listed in Table 8. + +
Operation NameDescription
Random Swap (RS)Swap two adjacent words randomly.
Random Delete (RD)Delete words randomly.
WordNet Substitute (WS)Substitute words with their synonyms according to WordNet.
TF-IDF Substitute (TS)Substitute uninformative words with low TF-IDF scores.
TF-IDF Insert (TI)Insert informative words with high TF-IDF.
+ +Table 7: Description of all the augment operations in the search space. + +
Dataset# Classes# Train samples# Test samplesAverage lengthTask
IMDB225,00025,000326Sentiment Analysis
SST-227,7911,82118Sentiment Analysis
SST-559,6432,21019Sentiment Analysis
TREC65,45250010Question Classification
YELP-22560,00038,000139Review Classification
YELP-55650,00050,000141Review Classification
+ +Table 8: Statistics on the datasets. + +
PolicyIMDB (80)SST-5 (200)TREC (120)YELP-2 (80)YELP-5 (200)
Op1<TS, 0.77, 0.07><RD, 0.44, 0.22><WS, 0.75, 0.44><TS, 0.95, 0.26><RD, 0.34, 0.32>
Op2<TS, 0.50, 0.31><WS, 0.59, 0.50><WS, 0.33, 0.26><RD, 0.08, 0.49><WS, 0.69, 0.19>
Op3<RD, 0.72, 0.05><TI, 0.66, 0.11><RS, 0.60, 0.02><WS, 0.57, 0.41><RD, 0.70, 0.15>
Op4<TI, 0.66, 0.09><TS, 0.11, 0.25><WS, 0.59, 0.36><RD, 0.85, 0.02><RD, 0.85, 0.27>
Op5<TI, 0.69, 0.13><WS, 0.69, 0.09><TI, 0.59, 0.17><RS, 0.30, 0.15><TS, 0.72, 0.35>
Op6<RS, 0.26, 0.05><WS, 0.41, 0.07><WS, 0.63, 0.34><TS, 0.55, 0.05><RD, 0.58, 0.47>
Op7<TS, 0.77, 0.50><TS, 0.69, 0.02><TS, 0.22, 0.37><TS, 0.63, 0.34><RS, 0.48, 0.22>
Op8<TS, 0.36, 0.25><WS, 0.99, 0.22><RS, 0.96, 0.03><WS, 0.13, 0.28><TS, 0.72, 0.50>
+ +Table 9: TAA policies searched in the low-resource regime. Each policy finally consists of 8 atomic editing operations and each operation satisfies the form of $\mathcal{O} = \langle t,p,\lambda \rangle$ . We use RS (Random Swap), RD (Random Delete), WS (WordNet Substitute), TI (TF-IDF Insert), TS (TF-IDF Substitute) for simplification. + +# D Searched Policy + +The policies searched by our TAA algorithm are listed in Table 9. Each policy finally consists of 8 atomic editing operations and each operation satisfies the form of $\mathcal{O} = \langle t,p,\lambda \rangle$ . All the policies can be used directly to augment the full training set to further boost the model performance on the corresponding downstream tasks. + +# E Ablation Study of TAA Policy + +# E.1 Searching Algorithm Ablation + +To verify the effectiveness of our optimization algorithm, we re-execute the experiment on the same search space described in Section 2.1, but do NOT conduct any policy optimization. For each text in the training set, a random policy is sampled to synthesize the augmented data. We call this method Text AutoAugment-Random (TAA-R). Table 10 + +illustrates the results of TAA and TAA-R. Generally, the augmentation policy after optimization performs better than the random policy by $1.92\%$ . Note that we incorporate prior knowledge in Section 2.1 to constrain the range of the operation magnitude, which ensures the performance of the operation and avoids generating bad samples. + +# E.2 Operation Type Ablation + +We conduct operation type ablation study to examine the effect of the operation types search space. Specifically, we eliminate one operation type while keeps others for searching the optimal policy, and evaluate the task performance using the learned policy. The task performance difference with different ablated operations on IMDB and SST-2 dataset are shown in Table 11. We find that the elimination of operation type generally leads to a decrease of task performance, indicating that the effect of differ + +
MethodLow-resource RegimeClass-imbalanced RegimeOverall
IMDB (80)SST-5 (200)TREC (120)IMDB (20:1000)IMDB (50:1000)IMDB (100:1000)Average
TAA-R72.64±5.5538.60±2.1277.72±4.0155.72±3.7463.60±5.7174.37±4.2263.78±4.23
TAA75.68*±3.2740.28**±1.8081.47**±3.8756.92±2.8066.73*±4.2077.87*±3.1866.49±3.19
+ +Table 10: Test accuracy (%) for TAA-R and TAA in low-resource and class-imbalanced regime. * and ** indicate statistically significant (p < .05 and p < .01) improvements over TAA-R. + +
DatasetFull Spacew/o RSw/o RDw/o TIw/o TSw/o WS
IMDB(80)75.68-0.12-1.03+0.89-0.07-1.47
SST-2(50:1000)66.05-2.09-1.64-0.94-0.47+1.27
+ +Table 11: Test accuracy (%) in the ablation study of operation type. We use RS (Random Swap), RD (Random Delete), WS (WordNet Substitute), TI (TF-IDF Insert), TS (TF-IDF Substitute) for simplification. + +ent operations are complementary with each other. We attribute it to that more operations types will improve the diversity of the combinations of text manipulation, thus boosting the dataset quality and benefiting the generalizability of the model. \ No newline at end of file diff --git a/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/images.zip b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..60988f33661488464e1f954341f43499e80ad4e0 --- /dev/null +++ b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59401b2727ea06a7f63fc0107d5b888b01ea1c890ff829ffcde7dff59fad3885 +size 804304 diff --git a/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/layout.json b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e97c18219481518d37164e6429b5c8a06ef5dcd4 --- /dev/null +++ b/textautoaugmentlearningcompositionalaugmentationpolicyfortextclassification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4e527d54ee70b2bcb2eac97e876acaafd8964a504fd9955381d6beba8899542 +size 521076 diff --git a/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_content_list.json b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fc61fff222bfacec3fd5f19dba47b49fa5876a29 --- /dev/null +++ b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7252fad758a6ace0d872ce502a798439d5cebef634a2463848e057b2fd64d887 +size 102901 diff --git a/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_model.json b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f8ec0a6f50a0174334f39eb4c7cd37441386bb6a --- /dev/null +++ b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2feed670ea189522c1ec23f68e0c9c044e4c27490dd8414a601fb8bd60f49a2 +size 121612 diff --git a/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_origin.pdf b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1859343f913d55224fef614ba2fc46413f140548 --- /dev/null +++ b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/57981e35-a9e8-45a2-88de-f0e1ec617543_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50f759a2241dc0e210bb625b45929749f580996aa1e9531084c8abd666b4310d +size 559035 diff --git a/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/full.md b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/full.md new file mode 100644 index 0000000000000000000000000000000000000000..c654b045828abe44e3cef093e192c14112c593f0 --- /dev/null +++ b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/full.md @@ -0,0 +1,438 @@ +# Text Counterfactuals via Latent Optimization and Shapley-Guided Search + +Quintin Pope and Xiaoli Z. Fern + +School of Electrical Engineering and Computer Science + +Oregon State University + +popeq, xfern@oregonstate.edu + +# Abstract + +We study the problem of generating counterfactual text for a classifier as a means for understanding and debugging classification. Given a textual input and a classification model, we aim to minimally alter the text to change the model's prediction. White-box approaches have been successfully applied to similar problems in vision where one can directly optimize the continuous input. Optimization-based approaches become difficult in the language domain due to the discrete nature of text. We bypass this issue by directly optimizing in the latent space and leveraging a language model to generate candidate modifications from optimized latent representations. We additionally use Shapley values to estimate the combinatoric effect of multiple changes. We then use these estimates to guide a beam search for the final counterfactual text. We achieve favorable performance compared to recent white-box and black-box baselines using human and automatic evaluations. Ablation studies show that both latent optimization and the use of Shapley values improve success rate and the quality of the generated counterfactuals. + +# 1 Introduction + +Deep neural networks have achieved state-of-the-art performances for many natural language processing (NLP) tasks (Otter et al., 2020; Ruder et al., 2019). When applying such models in real world applications, understanding their behavior can be challenging — the ever-increasing complexity of such models makes it difficult to understand and debug their predictions. A human can explain why an example belongs to a specific concept class by constructing a counterfactual of an example that is minimally altered but belongs to a different class. Contrasting the original example with its counterfactual highlights the critical aspects signifying the concept class. We study a similar approach to understand deep NLP models' classification criteria. + +Given a classifier and an input text, our goal is to generate a counterfactual by making a set of minimal modifications to the text that change the label assigned by the classifier. Additionally, our goal is to understand the model's behavior when processing naturally occurring inputs, hence we wish to generate grammatically correct and semantically plausible counterfactuals. + +Automatic generation of text counterfactuals has been studied in different settings. Qin et al. (2019) considered counterfactual story rewriting which aims to minimally rewrite an original story to be compatible with a counterfactual event. Wu et al. (2021) used a fine-tuned GPT-2 model to generate general purpose counterfactuals that are not tied to a particular classification model. Yang et al. (2020) aim to generate plausible-sounding counterfactuals that flip a classification model's decision for financial texts. + +Related, textual adversaries also aim to change the model prediction (with modifications resembling natural text). The difference is that adversaries further aim to escape human detection (not changing a human's classification), whereas counterfactuals do not have such requirement. + +Another line of related work is style transfer (Sudhakar et al., 2019; Wang et al., 2019; Hu et al., 2017), which aim to modify a given text according to a target style. It differs from adversary or counterfactual generation in that it seeks to fully change all style-related phrases, as opposed to minimally perturbing a text to change a classifier's decision. + +White-box approaches have been widely used to generate adversaries or counterfactuals for vision tasks where the continuous inputs can be optimized to alter model predictions (Goodfellow et al., 2014; Carlini and Wagner, 2017; Neal et al., 2018). Such optimization based approaches are difficult to apply to language due to the discrete nature of text. We circumvent this difficulty by directly optimizing in the latent space of the input towards the desired + +classification. We then exploit the language generation capability of pre-trained language models, available for most state-of-the-art NLP models such as BERT (Devlin et al., 2019) or RoBERTa (Liu et al., 2019), to generate semantically plausible substitutions from the optimized latent representations. We further introduce Shapley values to estimate the combinatoric effect of multiple simultaneous changes, which are then used to guide a beam search to generate the final counterfactual. + +Leveraging pre-trained language models to generate alternative texts has been a popular black-box approach in the recent literature on text adversaries (Li et al., 2020b; Garg and Ramakrishnan, 2020; Li et al., 2020a). Our work presents a first attempt to combine the strength of white-box optimization and the power of pre-trained language models. While Shapley values have been widely studied for the problem of feature importance (Lundberg and Lee, 2017; Sundararajan and Najmi, 2020) and data valuation (Jia et al., 2020), this is the first effort demonstrating their usefulness for text generation. + +We compare our method to several white-box and black-box baselines on two different text classification tasks. Automatic and human evaluation results show that our method significantly improves the success rate of counterfactual generation, while reducing the fraction of input tokens modified and enhancing the semantic plausibility of generated counterfactuals. We also show through ablation studies that both counterfactual optimization of the latent representations and Shapley value estimates contribute to our method's strong performance. + +# 2 Proposed Method + +Problem statement. We are given a text classification model, $M$ , an initial input token sequence, $X = \{x_0,\dots,x_{n - 1}\}$ , with vocabulary $V$ . Model $M$ outputs a classification score $\hat{y} = M(X)\in (0,1)$ , representing $P(y = 1|X)$ . Based on the score, a class label $y\in \{0,1\}$ is assigned. We seek to generate a counterfactual of $X$ , which is defined as a set of tokens, $X^{\prime} = \{x^{\prime}_{0},\dots,x^{\prime}_{n - 1}\}$ , that differs from $X$ in no more than $C_{max}$ percent of locations, is grammatically plausible, and leads to a different classification, $y^\prime$ . Here $C_{max}$ is an input parameter for maximum changes allowed, and smaller $C_{max}$ imposes stronger restrictions. + +Note that our setup assumes binary classification, but can be easily extended to multi-class scenario to generate either targeted (with specified $y'$ ) or + +un-targeted counterfactuals (with unspecified $y^\prime$ ). + +Method overview. Our method consists of three steps. First, we generate a set of candidate token substitutions for each position. Second, we evaluate the capacity of these candidate substitutions to change model classification (individually and collectively). Finally, we construct the counterfactual by beam search. + +# 2.1 Generating candidate substitutions + +We generate candidate substitutions by first performing latent space optimization and then generate substitutions from the trajectory of latent representations using a language model. + +Given an input token sequence $X = \{x_0, \dots, x_{n-1}\}$ , we assume model $M$ contains an embedding layer that maps this discrete input sequence into continuous embedding $E = \{e_0, \dots, e_{n-1}\}$ . The goal is to optimize a sparsely altered $E' = \{e_0', \dots, e_{n-1}'\}$ such that the model will output $y'$ , a target class different from $M$ 's initial prediction $y$ . With slight abuse of notation, let $M(E')$ denote $M$ 's classification score when replacing $E$ with $E'$ as the input embedding, we optimize the following objective. + +$$ +\min _ {E ^ {\prime}} C E \left(M \left(E ^ {\prime}\right), y ^ {\prime}\right) + \sum_ {j = 0} ^ {n - 1} \left| e _ {j} ^ {\prime} - e _ {j} \right| (1) +$$ + +which minimizes the cross-entropy between $M(E')$ and the desired $y'$ , with a LASSO regularization to favor sparse divergence from the original $E$ . + +To reduce the sensitivity to the stopping point of optimization and produce diverse candidates, we optimize $E'$ for $K$ steps and consider the full optimization trajectory $\{E_k': k = 1 \dots K\}$ to generate the candidate substitutions using the pretrained language model associated with model $M$ . + +Directly using the pre-trained language model is problematic because it does not operate in the same latent space as model $M$ , whose encoder has been fine tuned for the specific classification task at hand. A simple fix to this problem is to use the fine-tuned encoder of $M$ (which is used to optimize $E^{\prime}$ ) and retrain the associated language modeling head. This produces a language model that operates in the same space as the optimized embedding. + +Specifically, we feed each $E_k^{\prime}$ $(k = 1,\dots ,K)$ through the encoder of $M$ and the retrained language modeling head to generate a logit matrix $T_{k}$ of size $|V|\times n$ , where $T_{k}(s,t)$ quantifies the likelihood of observing the $s$ -th token of the vocabulary at the $t$ -th location given the overall context of $E_k^{\prime}$ . + +To generate $K$ candidate substitutions for each position $t$ , we iteratively process $T_{1}, \dots, T_{K}$ , selecting the token with the highest logit score excluding the original $x_{t}$ and previous selections. Let $S_{t}^{k}$ be the set of candidate substitutions for position $t$ generated at iteration $k$ considering $T_{k}$ , it is computed as follows. + +$$ +\mathcal {S} _ {t} ^ {k} = \mathcal {S} _ {t} ^ {k - 1} \cup \underset {s \notin \mathcal {S} _ {t} ^ {k - 1} \cup x _ {t}} {\operatorname {a r g m a x}} T _ {k} (s, t) \tag {2} +$$ + +At the end of this step, we produce a set of $K$ candidate substitutions for each input position. + +# 2.2 Evaluating Candidate Substitutions + +In the second step, we compute a metric that measures each candidate substitution's capacity to change the classification when applied in combination with other substitutions. Toward this goal, we consider Shapley value, which was originally proposed in cooperative game theory (Shapley, 1951) and has been used to measure feature importance for model interpretability (Lundberg and Lee, 2017). + +For a multi-player coalition-based game, the Shapley value of a player represents how valuable the player is as a potential coalition member. In our context, a coalition $L$ is a set of simultaneous substitutions and value $V(L)$ is measured by $L$ 's capacity to change model $M$ 's prediction. Let $X_{L}$ denote the input generated by applying all substitutions in $L$ to $X$ , and $M(X_{L})$ be $M$ 's prediction score. We define $V(L)$ to be $M(X_{L}) - M(X)$ if we wish to flip a negative prediction and $M(X) - M(X_{L})$ otherwise. + +The Shapley value of a single substitution $s$ measures the expected marginal value of adding $s$ to a coalition not already containing $s$ . To ensure computational tractability, we constrain the size of the coalition to be a fixed value $c_{s}$ . As such, coalitions of any other sizes will have value zero. Conceptually this measures the potential value of substitution $s$ when we modify exactly $c_{s}$ tokens. + +Under this setting, it is straightforward to show that the Shapley value of a single substitution $s$ can + +be estimated by the following equation: + +$$ +S V (s) = \frac {1}{\left| \mathcal {L} _ {s} \right|} \sum_ {L \in \mathcal {L} _ {s}} V (L) - \frac {1}{\left| \mathcal {L} _ {/ s} \right|} \sum_ {L \in \mathcal {L} _ {/ s}} V (L) \tag {3} +$$ + +$\mathcal{L}_s(\mathcal{L}_{/s})$ denotes the set of coalitions containing (not containing) $s$ that satisfy the size constraint. + +Fully enumerating $\mathcal{L}_s$ and $\mathcal{L}_{/s}$ to compute Equation 3 is infeasible in most situations. We use two strategies to improve efficiency. First, we apply filtering to remove unimportant locations from further consideration. We adapt the NormGrad saliency method described by Rebuffi et al. (2020) to text and use the following gradient-based saliency score. + +$$ +\operatorname {s a l i e n c y} (i) = \left| \left(\nabla_ {e _ {i}} \hat {y}\right) \odot e _ {i} \right| ^ {2} \tag {4} +$$ + +where $\nabla_{e_i}\hat{y}$ denotes the gradient of the original classification score $\hat{y}$ with respect to $e_i$ , the embedding of the $i$ -th token, and $\odot$ represents the Hadamard product (elementwise multiplication). + +Our second strategy is to approximate the Shapley values by sampling in the space of allowed substitutions. Suppose we want to evaluate each substitution $w$ times on average and there are a total of $N_{s}$ substitutions to be evaluated. It is interesting to note that we do not need $N_{s} \cdot w$ evaluations since each evaluation simultaneously contributes to the estimates of all $c_{s}$ substitutions that it contains. + +We apply filtering to consider only the top $C_{max} \times n$ locations, and fix the coalition size to be 50% of that ( $c_s = 0.5 \times C_{max} \times n$ ). Each important location contributes $K$ candidate substitutions. For input of length $n$ , there are $C_{max} \times K \times n$ total substitutions to evaluate. Because each coalition evaluation covers $0.5 \times C_{max} \times n$ substitutions, to evaluate each substitution $w$ times on average, we need to evaluate $2 \times w \times K$ coalitions, which is independent of $n$ and $C_{max}$ . + +# 2.3 Constructing the Counterfactual + +In the final step, we search for the optimal subset of substitutions via breadth-first beam search. The search space covers all possible subsets of nonconflicting substitutions, each subset corresponding to a unique candidate counterfactual. + +We initialize the beam with the root of the search tree, which is the empty subset. At each iteration, we expand a node in the beam with a successor function returning $b$ successors, each adding a single substitution. For a given search node, denoted + +by its subset $L$ , we construct $b$ successors by selecting $b$ substitutions with the best Shapley values that do not conflict in location with any $s \in L$ or introduce a redundant subset. + +We then evaluate each successor node by applying its substitutions to the original input $X$ and computing model $M$ 's output on the resulting $X'$ . We rank all successors based on the model's score for the desired class $y'$ minus the fraction of tokens modified by the successor in question and populate the new beam with the top $b$ candidates. + +We limit the search depth to be $C_{max} \times n$ , constraining our method to never modify more than $C_{max}$ percent of the input tokens. During search, if we generate a candidate that $M$ classifies as $y'$ , we stop immediately and return that candidate as our final output. As such, the time we spend for beam search depends on how quickly we find a successful counterfactual. + +# 2.4 Summary of approach + +We summarize our method as text Countercounticals via Latent Optimization and Shapley-guided Search (CLOSS). CLOSS has three primary hyperparameters: $K$ , the number of candidate substitutions generated per token locations; $w$ , the average number of times we wish to evaluate each substitution; $b$ , the beam width of the beam search that constructs the final counterfactual. The default values are $K = 30$ , $w = 5$ , $b = 15$ . The impact of these parameters will be explored in the experiments. + +# 3 Empirical Evaluation + +To evaluate our proposed method, we consider two different text classification tasks: sentiment classification and natural language inferences. + +# 3.1 Experimental Setup + +Data sources. We use the IMDB dataset (Maas et al., 2011) for sentiment classification. This is a binary classification dataset based on movie reviews from IMDB. For the natural language inference task, we use the QNLI dataset (Rajpurkar et al., 2016), which is a binary task derived from the Stanford question answering dataset. Each example contains a question and a context. The classifier must determine if the context answers the question. + +Following the evaluation scheme used by Li et al. (2020a), we sample 1000 random data points from IMDB of length less than or equal to 100 words as + +our "short" IMDB data. We do not filter the QNLI dataset. The average word counts for short IMDB and QNLI are shown in Table 1 (row 1). + +Classification models. For each task, we consider two classification models, RoBERTa (Liu et al., 2019) and BERT (Devlin et al., 2019), trained by TextAttack (Morris et al., 2020). We report the performance of both models in Table 1 (rows 2-3). + +
IMDB shortQNLI
Avg. words57.437.2
RoBERTa acc.0.9710.934
BERT acc.0.9740.908
+ +Table 1: Model and dataset statistics + +Evaluation criteria. We consider the following performance metrics that measure the ability of a method to successfully generate counterfactuals and the quality of the generated counterfactuals. + +- Failure rate (%F): the percent of inputs for which the method fails to change the model's prediction. + +- Fraction of tokens changed (\%C): the average token modification rate among successfully generated counterfactuals. + +- BLEU: the average BLEU score between successfully generated counterfactuals and their original inputs. + +- Perplexity (P): Following Zang et al. (2020), we use the exponentiated language modeling loss of GPT-2 (Radford et al., 2019) to compute perplexity to score linguistic plausibility. + +Baselines. We compare against adversarial baselines because we were unable to find counterfactual methods with open-source implementations. We carefully identified a set of baselines closely related to CLOSS with respect to the methodology, specifically focusing on black box methods that leverage pretrained language models (BERTAttack, BAE), and a white-box method using gradients and beamsearch (Hot-Flip). Unless otherwise stated, we use the implementations in the TextAttack package (Morris et al., 2020). All black-box methods use some saliency measure to prioritize substituting important tokens. While CLOSS estimates saliency from the gradient, the black-box baselines use leave-a-token-out estimates, i.e., by removing or masking a token. + +BERT Adversarial Example (BAE) (Garg and + +Ramakrishnan, 2020) is a black-box method that generates potential substitutions by masking out input tokens and using the pre-trained BERT language model to suggest replacements. + +BERT-Attack (Li et al., 2020b) is also a black-box method. It generates substitutions by feeding the entire unmasked input into the BERT language model to suggest replacements. + +Textfloer (Jin et al., 2020) is a black-box method that uses word embeddings by Mrkšić et al. (2016) to generate substitutions by selecting the vocabulary tokens whose embeddings have the highest cosine similarity with the original token. + +Probability Weighted Word Saliency (PWWS) (Ren et al., 2019) is a black-box method that uses WordNet synonyms as potential substitutions to preserve the semantic content. + +HotFlip (Ebrahimi et al., 2018) is a white-box method that uses model gradients to estimate the impact of every possible token substitution on the model's classification and then applies beam search to generate counterfactuals. HotFlip implemented in TextAttack only works for word or character-level classifiers, not WordPiece (Schuster and Nakajima, 2012) classifiers like RoBERTa and BERT. Hence we implemented our own version of HotFlip3 to be exactly comparable to our method. + +Adaptation of adversarial baselines for fair comparison. Adversaries differ from counterfactuals in that they additionally seek to retain the text's "true" class, relative to human judgement. In this regard, generating adversaries is more difficult than generating counterfactuals. Here we adapt the (adversary-generating) baselines to generate counterfactuals, thereby allowing fair comparison. + +All original baseline implementations employ certain heuristic constraints to preserve the original semantic content (and thus, true class) of the input. Most methods require a minimum cosine similarity between the Universal Sentence Encoder (Cer et al., 2018) (USE) representations of the modified text with the original input. Additional heuristics include not substituting stop words and requiring substitutions to have the same part-of-speech as the original. These heuristics directly modify the search space for a generation method, and thus can impact both the success and quality of counterfactual generation. + +For CLOSS and our implementation of HotFlip, we do not employ such heuristics. Additionally, we created an unconstrained version of the TextAttack (Morris et al., 2020) implementations (denoted by suffix '-U') of all other baselines by removing the adversarial constraints. Arguably, PWWS-U and TextFooler-U remain more constrained than CLOSS because they only use synonyms (WordNet and embedding based, respectively) for substitutions. However, the search spaces of BAE-U, BERT-Attack-U, and HotFlip are fully comparable to CLOSS. + +TextAttack by default ignores any input misclassified by the model $M$ , because the concept of an "adversarial" example does not readily extend to misclassified inputs. For counterfactual generation, we do not have this concern. Hence our evaluation seeks to generate a counterfactual that flips the model's classification regardless of its correctness. + +Baseline parameters. For HotFlip, we consider two versions: a default version (HotFlip D) that uses parameters suggested by Ebrahimi et al. (2018) and an optimized version (HotFlip O), where the parameters and search procedure are optimized for performance. See Appendix 1 for details of our HotFlip implementations. For all other baselines, we use the default parameters from TextAttack, which are the recommended parameters from the original papers. + +# 3.2 Results + +We report the results of all methods for short IMDB and QNLI in Table 2. Note that BERT-Attack restrains manipulations of multi-token words in a manner that is computationally intractable on our datasets; thus we do not report performance for the original BERT-Attack. Here we limit all methods to change no more than $15\%$ of tokens by setting $C_{max} = 0.15$ . The impact of different $C_{max}$ values will be explored later in Figure 1. + +Comparing to white-box baseline. The default HotFlip implementation substantially underperforms by all measures. Optimizing the parameters and search procedure for HotFlip leads to greatly improved performance. Comparing CLOSS with HotFlip O, we note that the failure rate of our method is slightly worse for QNLI and slightly better for IMDB short. For both datasets, the counterfactuals generated by CLOSS have fewer modifications and higher BLEU scores. The most striking difference is in the perplexity score, where + +IMDB short + +
MethodRoBERTaBERT
%F%CBLEUP%F%CBLEUP
CLOSS4.23.10.9272.44.12.80.9398.9
HotFlip D37.06.50.8614522.85.20.89140
HotFlip O7.15.10.881224.54.180.90129
BAE69.44.60.8611067.54.00.88136
PWWS14.65.90.839614.04.70.86125
Text,Fooler22.36.30.8291.531.95.70.83132
BAE-U16.65.70.8510725.14.90.87141
Bert-Attack-U6.34.40.9078.222.24.70.88120
PWWS-U12.15.90.8310211.74.60.86134
Text,Fooler-U12.75.70.8593.921.05.20.86142
+ +QNLI + +
MethodRoBERTaBERT
%F%CBLEUP%F%CBLEUP
CLOSS5.13.30.9292.43.53.30.92143
HotFlip D18.84.70.9013019.14.40.90174
HotFlip O3.44.00.901252.13.80.91178
BAE34.63.70.8794.433.24.00.87175
PWWS22.74.20.8795.114.94.40.86184
TextFooer19.44.60.8690.113.14.90.86176
BAE-U6.84.20.871046.04.10.88178
Bert-Attack-U6.74.00.8987.14.93.80.90156
PWWS-U16.04.30.871078.74.30.87201
TextFooer-U7.44.40.871014.64.30.88180
+ +Table 2: Comparison of CLOSS with baselines on the short IMDB and QNLI data. 'U' indicates unconstrained version of the baselines. Our implementation of HotFlip uses exactly the same set of constraints as CLOSS. CLOSS values are averaged over three runs. + +CLOSS wins by a large margin. This is not surprising as HotFlip does not care about the semantic plausibility of the generated sentences whereas our method uses the language model to propose semantically plausible substitutions. Note that GPT-2 and RoBERTa are cased models, while BERT is uncased. This explains BERT's higher perplexity. + +Comparing to black-box methods. We first observe that the heuristic constraints used by these methods have a drastic impact on the performance. Specifically, by removing these constraints, the failure rates of all methods are much reduced. However, the resulting counterfactuals tend to have lower quality, indicated by increased perplexity. Comparing CLOSS to both variants, we see that our method was able to achieve a highly competitive failure rate with few edits. CLOSS also achieves the lowest perplexity in most cases with the exception of RoBERTa model on QNLI, where BERTAttack-U have slightly lower perplexity. + +# 3.3 Impact of Varying $C_{max}$ + +We considering different $C_{max}$ values including 0.1, 0.15, 0.2, 0.3 and 0.5. Figure 1 plots the perplexity against failure rate for different values of $C_{max}^4$ . Increasing $C_{max}$ allows methods to change more input tokens, reducing their failure rates. However, higher $C_{max}$ also leads to greater distortion of the input, raising the perplexity. Thus, methods with better perplexity/fail rate tradeoffs have curves that fall closer to the lower-left corner of the plots. In this regard, CLOSS has the best performance on all comparisons, except for against BERT-Attack on RoBERTa QNLI, where the two methods appear comparable. + +# 3.4 Ablation studies + +We consider three ablated versions of CLOSS. + +CLOSS-EO removes the optimization step and in + +![](images/5a6f8ccfb928700141aec145ce9ac6ddfd12d89e7d481e33072765a235222e12.jpg) +(a) BERTIMDB + +![](images/9f8ec3b6f0062dc2bbc9ed7f88c9c9fe20127a4fde5f6cde6bf2b12f87ad616c.jpg) +(b) RoBERTa IMDB + +![](images/78ed1b6b81bc687e9d992da293008758b2c9d355eaa5a39e6c980e9e06f37594.jpg) +(c) BERT QNLI + +![](images/6f32f333efc29f8a9abf05f002af3e7b2c7a62651e33aa82745f769be3a565b1.jpg) +(d) RoBERTa QNLI +Figure 1: Plots of perplexity against failure rate as the maximum allowed percent of tokens changed ( $C_{max}$ ) varies. Values for $C_{max}$ are $10\%$ , $15\%$ , $20\%$ , $30\%$ and $50\%$ . CLOSS values are averaged over three runs. + +stead generates potential substitutions by feeding the original input into the default pre-trained language model associated with model $M$ . + +CLOSS-RTL skips retraining the language modeling head and uses the language modeling head of the pretrained language model. As a result, the language modeling head for this ablation has a different latent space compared to the fine-tuned encoder of classifier $M$ . + +CLOSS-SV removes the Shapley value estimates of each substitution's impact on classification. Instead, we priority substitutions during beam search based on the token saliency (Eq. 4). + +We compare the performance of CLOSS with its ablations in Table 3. Here we omit BLEU score because it strongly correlates with $\% \mathrm{C}$ in Tables 2, + +Effect of embedding optimization. By removing the optimization step, CLOSS-EO has significantly more failures, but lower perplexity. This is not surprising because optimizing the embedding increases the chance to flip the prediction but carries the risk of producing "unnatural" embeddings that lie outside the space of texts previously observed by the language model. This also sug + +gests that CLOSS-EO can be a good candidate for scenarios where "naturalness" of the text is critical. + +Effect of retraining language modeling head. It is interesting to note that CLOSS-RTL has comparable perplexity to CLOSS, but a higher failure rate. We believe this is because the retrained language modeling head can generate tokens that better match the data distribution of IMDB and QNLI (but not of English text in general), i.e., the distribution of tokens to which the classifier $M$ is sensitive. + +Effect of Shapley values. By removing Shapley value estimates, CLOSS-SV sees substantial degradations in all measures, suggesting critical importance of this step to our method. + +# 3.5 Computational Considerations + +The estimation of Shapley value for CLOSS incurs a substantial cost in terms of number of queries to the given model. Indeed, the number of queries used by CLOSS can be significantly higher than some baselines5. This section takes a closer look at + +
IMDBQNLI
RoBERTaBERTRoBERTaBERT
Method%F%CP%F%CP%F%CP%F%CP
CLOSS4.23.1372.44.12.7698.95.13.3392.43.53.31143
CLOSS-SV9.45.7384.511.65.061167.35.131086.45.05159
CLOSS-EO7.33.2563.38.43.1794.97.23.5172.26.13.51122
CLOSS-RTL5.53.273.77.52.91027.93.794.75.73.4136
+ +Table 3: Ablation results on IMDB and QNLI. Values are averaged over three runs. + +![](images/5f6cbb62977d936df76529a9a974793be316b3fe39267f0ca8c2c03e0b14efa7.jpg) +(a) + +![](images/db836a176213c1f8f4250b51fcdce87ad84bd02e9d834ba7990ce00afc33004a.jpg) +(b) + +![](images/0af26ff22602c96c924a8a0abe5d91875e2ec6208d8e5f5fd1b611152fa14400.jpg) +(c) +Figure 2: (a) Plot of failure rate of CLOSS and CLOSS-SV as a function of the number of model queries for short IMDB. Beam width ranges from 5 to 20 for both approaches. (b) Plot of failure rate of CLOSS in flipping BERT's prediction as a function of $w$ for both short and long IMDB. (c) Plot of number of BERT model queries used by CLOSS as a function of $w$ for both short and long IMDB. + +the computational trade-offs surrounding Shapley value estimations. + +Shapley or not. Given the computational cost of estimating Shapley values, would a more thorough search (e.g., using larger beam width) remove the need for computing Shapley values? To explore this question, we consider different beam width $b = 5, 10, 15$ and 20, and plot the resulting failure rates of CLOSS and CLOSS-SV against the number of queries to the model for short IMDB and BERT in Figure 2 (a). The figure shows that even with larger beam width and higher number of queries, the performance of CLOSS-SV still trails behind CLOSS. It also shows that the Shapley value guided search reduces CLOSS's sensitivity to the beam width $b$ both in terms of failure rate and the number of queries needed. + +Precision of Shapley. The Shapley value is estimated via sampling and the sampling rate is controlled by the parameter $w$ . Intuitively, larger $w$ leads to more accurate Shapley values, but incurs higher computation cost. We explore how sensitive our method is to the parameter $w$ in Figure 2(b&c). + +Specifically, Figure 2(b) plot the failure rate of CLOSS in flipping BERT's prediction for both + +short and long IMDB. We see that as long as $w$ is reasonably large ( $\geq 5$ ), the performance is fairly robust. Note that other measures like perplexity and BLEU score show similar trends, which are shown in Figure 3 in the Appendix. + +Figure 2(c), on the other hand, plots the average number of queries to model $M$ required with $w$ from 1 to 10. We see an interesting phenomenon for long IMDB where increased $w$ actually leads to decreased number of queries. This may appear counter-intuitive at first sight, it actually demonstrates the power of good Shapley value estimates in speeding up the search. This phenomenon, however, was not observed for the short IMDB data, likely due to the substantially smaller search space thanks to the shorter input length. + +# 4 Human and Qualitative Evaluation + +Human evaluations. For human evaluations, we choose to compare CLOSS against Bert-Attack and HotFlip O, the two baselines performing the best in perplexity and flip rate respectively. + +We randomly selected 100 original texts from IMDB for evaluation with the restriction that all three methods must successfully flip the classification changing $15\%$ or less of the original tokens. Additionally, we exclude texts with more than 50 tokens to ease the burden on evaluators. Using the + +BERT classifier, We apply BERT-Attack, CLOSS and HotFlip to generate counterfactuals for each input. Eight human evaluators are each assigned 25 original texts and asked to rank (ties allowed) the three counterfactuals in order of grammatical correctness. Each input is evaluated by two evaluators, the inter-evaluator agreement per pairwise comparison is $75.4\%$ . Human evaluators ranked CLOSS competitively with BERT-Attack and HotFlip, assigning average ranks of 1.54 to CLOSS, 1.68 to Bert-Attack and 2.50 to HotFlip. The difference between CLOSS and HotFlip is statistically significant (one-sided sign test, $p$ -value $< 0.0001$ ). + +Qualitative analysis of generated text. Inspecting the generated countnerfactuals, we observe some interesting patterns, summarized below. See Appendix (Tables 5 and 6) for specific examples. + +For the IMDB dataset, CLOSS often changes one or two sentiment words while the rest of the input still supports the original prediction. This suggests that the model may be triggered by a few sentiment words, ignoring most input. Identifying such critical substitutions will allow us to inspect the patterns of these "triggers" to reveal the weakness of the classifier. We also observe that when the model misclassifies, it often takes little change to correct the model, which helps debug the mistake. + +Sometimes CLOSS introduces synergistic changes where each change's capacity to influence the classification seems contingent on the other. Finally, CLOSS sometimes distorts sentimentphrases into non-words to remove their impact on classification, possibly making up for the lack of ability to remove words. + +For the QNLI dataset, unsurprisingly, we note that changing from entailment to non-entailment is far easier than the opposite (see Figures 5(c,d) in Appendix), and often requires changing only a few words shared by the Question and Context. Conversely, CLOSS can sometimes change non-entailment to entailment by introducing some shared word(s). This suggests that the model relies heavily on overlapping words to decide entailment. + +More detailed analysis can be found in the Appendix, including how CLOSS's changes are distributed among part of speech tags (Figure 4) and a failure analysis for CLOSS (A.7, Table 7). + +# 5 Conclusion + +We are motivated by how humans use counterfactuals to explain the concept of a class and seek to + +automatically generate counterfactual text input as a means to understand a deep NLP model and its definition of class. We assume full white-box access to the given model and perform optimization in the latent space to maximize the probability of predicting a target class. We then map from the optimized latent representation to candidate token substitutions using a language model. A key novelty of CLOSS is using Shapley values to estimate the potential of a token substitution in changing the model's prediction when used in combination with other substitutions. The Shapley value is then used to guide a breadth-first beam search to generate the final counterfactual. Through both automatic and human evaluations, we show that CLOSS achieves highly competitive performance both in terms of the success rate of generating counterfactuals as well as the quality of the generated counterfactuals. + +Our approach has several limitations. As a white-box approach, we require full access to the model, which can be restrictive in practical applications. Our approach currently only considers substitutions, excluding deletions and insertions. Finally, our method is only applicable to models that are based on pre-trained language models. Future work will adapt CLOSS to adversarial and black box settings. We also hope to improve the efficiency of CLOSS via more efficient Shapley value estimation (Chen et al., 2018; Jia et al., 2020). + +# Acknowledgements + +This work was partially supported by DARPA under grant N66001-17-2-4030. + +# References + +Nicholas Carlini and David Wagner. 2017. Towards evaluating the robustness of neural networks. In 2017 IEEE symposium on security and privacy (sp), pages 39-57. IEEE. +Daniel Cer, Yinfei Yang, Sheng yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, Yun-Hsuan Sung, Brian Strope, and Ray Kurzweil. 2018. Universal sentence encoder. +Jianbo Chen, Le Song, Martin J. Wainwright, and Michael I. Jordan. 2018. L-shapley and c-shapley: Efficient model interpretation for structured data. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. + +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. 2018. Hotflip: White-box adversarial examples for text classification. +Siddhant Garg and Goutham Ramakrishnan. 2020. Bae: Bert-based adversarial examples for text classification. +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. 2014. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572. +Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. 2017. Toward controlled generation of text. In International Conference on Machine Learning, pages 1587-1596. PMLR. +Ruoxi Jia, David Dao, Boxin Wang, Frances Ann Hubis, Nick Hynes, Nezihe Merve Gurel, Bo Li, Ce Zhang, Dawn Song, and Costas Spanos. 2020. Towards efficient data valuation based on the shapley value. +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. +Dianqi Li, Yizhe Zhang, Hao Peng, Liquin Chen, Chris Brockett, Ming-Ting Sun, and Bill Dolan. 2020a. Contextualized perturbation for textual adversarial attack. +Linyang Li, Ruotian Ma, Qipeng Guo, Xiangyang Xue, and Xipeng Qiu. 2020b. Bert-attack: Adversarial attack against bert using bert. +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. +Scott Lundberg and Su-In Lee. 2017. A unified approach to interpreting model predictions. +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. +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. +Nikola Mrkšić, Diarmuid Řeaghdha, Blaise Thomson, Milica Gašić, Lina Rojas-Barahona, Pei-Hao Su, David Vandyke, Tsung-Hsien Wen, and Steve Young. 2016. Counter-fitting word vectors to linguistic constraints. + +Lawrence Neal, Matthew Olson, Xiaoli Fern, Weng-Keen Wong, and Fuxin Li. 2018. Open set learning with counterfactual images. In Proceedings of the European Conference on Computer Vision (ECCV). +D. W. Otter, J. R. Medina, and J. K. Kalita. 2020. A survey of the usages of deep learning for natural language processing. IEEE Transactions on Neural Networks and Learning Systems, pages 1-21. +Lianhui Qin, Antoine Bosselut, Ari Holtzman, Chandra Bhagavatula, Elizabeth Clark, and Yejin Choi. 2019. Counterfactual story reasoning and 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 5046-5056. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: 100,000+ questions for machine comprehension of text. +Sylvestre-Alvise Rebuffi, Ruth Fong, Xu Ji, and Andrea Vedaldi. 2020. There and back again: Revisiting backpropagation saliency methods. +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. +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, Minneapolis, Minnesota. Association for Computational Linguistics. +M. Schuster and K. Nakajima. 2012. Japanese and Korean voice search. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5149-5152. +Lloyd Shapley. 1951. Notes on the n-person game - ii: The value of an n-person game. +Akhilesh Sudhakar, Bhargav Upadhyay, and Arjun Maheswaran. 2019. "transforming" delete, retrieve, generate approach for controlled text style transfer. 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 3269-3279, Hong Kong, China. Association for Computational Linguistics. + +Mukund Sundararajan and Amir Najmi. 2020. The many shapley values for model explanation. + +Ke Wang, Hang Hua, and Xiaojun Wan. 2019. Controllable unsupervised text attribute transfer via editing entangled latent representation. + +Tongshuang Wu, Marco Tulio Ribeiro, Jeffrey Heer, and Daniel S. Weld. 2021. Polyjuice: Automated, general-purpose counterfactual generation. + +Linyi Yang, Eoin M. Kenny, Tin Lok James Ng, Yi Yang, Barry Smyth, and Ruihai Dong. 2020. Generating plausible counterfactual explanations for deep transformers in financial text classification. + +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 the 58th Annual Meeting of the Association for Computational Linguistics, pages 6066-6080, Online. Association for Computational Linguistics. + +# A Appendix + +# A.1 Optimized HotFlip. + +For each candidate in original HotFlip's beam search, we score every possible single-token substitution by using gradients to estimate the substitution's impact on the classification. The score of a candidate counterfactual is the sum of the scores of each individual substitution introduced by the candidate. + +These scores form a surrogate value function, which the beam search aims to maximize. At each step of the beam search, we can generate the successors (children) for each current beam members (parent) by applying a single substitution to any location in the parent text. + +In our optimized HotFlip, we change the search procedure to promote diversity in the beam search by requiring every child generated off a common parent modify distinct locations in the text. We observe that this small modification substantially boost the performance HotFlip's performance. We also increase the beam size from the 10 suggested by Ebrahimi et al. (2018) to 100. Note that the original HotFlip's parameters are designed for character-level modification, which has a substantially smaller space of possible substitutions for each location. This might explain the poor performance of HotFlip D, and the need to modify the search procedure for token-level generation. + +# A.2 Average Number of Queries + +In Table 4, we present the average number of queries to the given model for CLOSS and baseline + +methods. We show two numbers per cell, where the first number is the average query number of all attempts (success or fail). The second number is the average number of queries for successful trials that modify $15\%$ or less of input tokens. + +# A.3 Performance when varying $w$ + +In Figure 3, we plot the other performance measures including $\% \mathrm{C}$ , BLEU and Perplexity, as a function of parameter $w$ . + +# A.4 Qualitative Analysis + +In tables 5 and 6, we present examples of counterfactuals generated by CLOSS that highlight interesting patterns we notice. + +# A.5 Part of Speech Changes + +In Figure 4, we show the percentages of total changes that occur in each part of speech type. We split the results by direction of change. Note that for IMDB, CLOSS tends to modify adjectives more when flipping from negative to positive compared to flipping from positive to negative. + +When flipping entailment to non-entailment, CLOSS is more likely to modify nouns compared to flipping non-entailment to entailment. This may re + +# A.6 Distribution over Percent of Tokens Changed + +Figure 5 contains histograms showing the distribution of percent of tokens changed over successfully generated counterfactuals. Note that flipping entailment to non-entailment requires fewer changes than the reverse. + +# A.7 Error Analysis + +We explore potential sources of counterfactual generation failure in table 7 by significantly increasing the computational resources devoted to certain steps of CLOSS and recording the resulting generation failure rate $(\% \mathrm{F})$ + +Even greatly increasing $w$ does not reduce $\% \mathrm{F}$ significantly. In comparison, increasing beam width is more effective, especially in regards to IMDB. The most effective interventions are to increase either $K$ or render all tokens salient and scale $w$ in proportion to the associated increase in potential substitutions. Note that when we increase $K$ without changing $w$ , the compute spent on estimating Shapley values scales linearly with $K$ . + +
MethodIMDBQNLI
RoBERTaBERTRoBERTaBERT
CLOSS558|485537|457455|405424|389
HotFlip D65.3|47.551.7|38.028.7|22.427.0|19.9
HotFlip O305|265234|20590.0|82.371.0|66.7
BAE142|111138|11094.7|81.797.1|85.7
PWWS483|466475|455246|236238|236
Textfooler259|190298|171144|102127|104
BAE-U424|285494|252172|148180|142
BERT-Attack-U277|231451|262172|149182|140
PWWS-U575|561568|549299|290290|287
Textfooler-U358|272426|259181|152179|145
+ +Table 4: Average queries per sample for CLOSS and baselines. + +![](images/ed230d31f84636037ca40d53aceb0a503600a5a55c2d00ca1b783de375886dc5.jpg) +(a) + +![](images/57c8dc9515d6a24e1a071f8f4ac5cedc641200bd60bb2a3fcab62eefbf7a0a24.jpg) +(b) +Figure 3: (a) Plot of average percent tokens changed by CLOSS as a function of $w$ for both short and long IMDB. (b) Plot of CLOSS average BLEU score as a function of $w$ for both short and long IMDB. (c) Plot of CLOSS average perplexity as a function of $w$ for both short and long IMDB. + +![](images/bd40e493c6cb2d876506088f1ebb0a32c0f0e5024c95eef7c873bab947745da0.jpg) +(c) + +These results suggest failures in the beam search are more of a bottleneck on performance than failing to identify useful substitutions with Shapley values. + +However, we can significantly improve performance by increasing both the pool of potential substitutions and the compute spent on estimating Shapley values. This implies many generation failures happen because the pool of potential substitutions the default CLOSS hyperparameters are able to search through does not contain substitutions able to flip the classification. + +
DescriptionText
(a) We can flip the class by changing a small fraction of the sentiment regions.Old: Ruth Gordon is one of the more sympathetic killers that Columbo has ever had to deal with. And, the plot is ingenious all the way around. This is one of the best Columbo episodes ever. Mariette Hartley and G. D. Spradlin are excellent in their supporting roles. And Peter Falk delivers a little something extra in his scenes with Gordon.
New: Ruth Gordon is one of the more sympathetic killers that Columbo has ever had to deal with. And, the plot is ingenious all the way around. This is one of the worse Columbo episodes ever. Mariette Hartley and G. D. Spradlin are excellent in their supporting roles. And Peter Falk delivers a little something extra in his scenes with Gordon.
Old: ruth gordon is one of the more sympathetic killers that columbo has ever had to deal with. and, the plot is ingenious all the way around. this is one of the best columbo episodes ever. mariette hartley and g. d. spradlin are excellent in their supporting roles. and peter falk delivers a little something extra in his scenes with gordon.
New: ruth gordon is one of the more sympathetic killers that columbo has ever had to deal with. and, the plot is ingenious all the way around. this is one of the worst columbo episodes ever. mariette hartley and g. d. spradlin are excellent in their supporting roles. and peter falk delivers a little something extra in his scenes with gordon.
(b) We sometimes see synergistic changes where each change's capacity to influence the classification seems contingent on the other.Old: Excellent documentary that still manages to shock and enlighten. Unfortunately, times haven't changed much since this was made and it is thus an important piece for all freedom-conscious Americans to see.
New: Very pathetic that still manages to shock and enlighten. Unfortunately, times haven't changed much since this was made and it is thus an important piece for all freedom-conscious Americans to see.
Old: I love all his work but this looks like nothing.. sorry.. This looks more like a "David Lynch copycat". I think people like it only because "it's from David Lynch".
New: I love all his work but this hits like everything.. sorry.. This looks more like a "David Lynch copycat". I think people like it only because "it's from David Lynch".
(c) RoBERTa incor-rectly classified text as positive. Flipping to negative requires little changes.Old: Some good movies keep you in front of the TV, and you are dying to see the result.This movie does not have highs and lows. It simply describes a young girl's family life in Africa. People come and go, the weather and the background are all the same.New: Some decent movies keep you in front of the TV, and you are dying to see the result.This movie does not have highs and lows. It simply describes a young girl's family life in Africa. People come and go, the weather and the background are all the same.
(d) BERT classifies as negative. Greater changes required to flip to positive.Old: some good movies keep you in front of the tv, and you are dying to see the result,this movie does not have highs and lows. it simply describes a young girl's family life in africa. people come and go, the weather and the background are all the same.New: some good movies keep you in front of the tv, and you are loving to see the result,this movie does not lack highs and lows. it simply describes a young girl's family life in africa. people come and go, the weather and the background are all the same.
(e) Sometimes distorts words/grammar; Note how CLOSS re-moves "I loved this" by converging "loved this" into "lovedoo", thereby removing the original's positive sentimentOld: I loved this mini series. Tara Fitzgerald did an incredible job portraying Helen Graham, a beautiful young woman hiding, along with her young son, from a mysterious past. As an anglophile who loves romances... this movie was just my cup of tea and I would recommend it to anyone looking to escape for a few hours into the England of the 1800's. I also must mention that Toby Stephens who portrays the very magnetic Gilbert Markham is reason enough to watch this wonderful production.New: I lovedoo mini series. Tara Fitzgerald did an incredible job portraying Helen Graham, a beautiful young woman hiding, along with her young son, from a mysterious past. As an anglophile who loves romances... this movie was just my cup of tea and I would recommend it to anyone looking to escape for a few hours into the England of the 1800's. I also must mention that Toby Stephens who portrays the very magnetic Gilbert Markham does reason enough to watch this dreadful production.
(f) Non-words can significantly change sentiment classification. "thisecrated" doesn't seem particularly sentiment-related, yet it can flip the classification of this otherwise very positive review.Old: absolutely fantastic! whatever i say wouldn't do this underrated movie the justice it deserves. watch it now! fantastic!New: absolutely fantastic! whatever i say wouldn't do thisecrated movie the justice it deserves. watch it now! fantastic!
+ +Table 5: Example IMDB counterfactuals generated by CLOSS. Each row demonstrates an interesting pattern of behavior we observed. We use green to highlight words whose changes flip the text to positive and red for changes that flip texts to negative. + +
DescriptionText
(a) CLOSS can often flip entailment to non-entailment by changing a word that appears in both the Question and Context.Old: Question: When was Luther's last sermon? +Context: His last sermon was delivered at Eisleben, his place of birth, on 15 February 1546, three days before his death. +New: Question: When was Luther's new sermon? +Context: His last sermon was delivered at Eisleben, his place of birth, on 15 February 1546, three days before his death. +Old: Question: when was luther's last sermon? +Context: his last sermon was delivered at eisleben, his place of birth, on 15 february 1546, three days before his death. +New: Question: when was luther's traveling sermon? +Context: his last sermon was delivered at eisleben, his place of birth, on 15 february 1546, three days before his death.
(b) CLOSS can sometimes induce entailment by changing a word in the Question (Context) to match one in the Context (Question).Old: Question: Who were the ESPN Deportes commentators for Super Bowl 50? +Context: On December 28, 2015, ESPN Deportes announced that they had reached an agreement with CBS and the NFL to be the exclusive Spanish-language broadcaster of the game, marking the third dedicated Spanish-language broadcast of the Super Bowl. +New: Question: Who were the ESPN Deportes agreements for Super Bowl 50? +Context: On December 28, 2015, ESPN Deportes announced that they had reached an agreement with CBS and the NFL to be the exclusive Spanish-language broadcaster of the game, marking the third dedicated Spanish-language broadcast of the Super Bowl.
(c) If lexical overlap fails, we often need many edits to change non-entailment to entailment.Old: Question: Who was the number two draft pick for 2011? +Context: This was the first Super Bowl to feature a quarterback on both teams who was the #1 pick in their draft classes. +New: Question: Who was the show two draft pick for Kate? +Context: This was the first Super half to feature a Premier on both teams who was the #1 pick in their draft classes.
+ +Table 6: Example QNLI counterfactuals generated by CLOSS. Each row demonstrates an interesting pattern of behavior we observe. We use green to highlight words whose changes flip the text to entailment and red for changes that flip texts to non-entailment. + +
ChangeRoBERTa IMDBBERT IMDBRoBERTa QNLIBERT QNLI
CLOSS4.24.15.13.5
Increase beam width0.90.82.63.3
Increase w2.13.23.94.0
Increase K0.40.31.42.4
Everything salient, fixed w6.29.36.44.0
Everything salient, scale w0.530.930.530.23
+ +Table 7: Shows the impact on failure rate of significantly increasing CLOSS hyperparameters. Beam width increases from 15 to 100, w from 5 to 50, K from 30 to 300. + +![](images/f414f4479eb2fc7857703dd12a993c83b26ba21ddb63823fc2a9fb44546bd5b3.jpg) +(a) BERTIMDB + +![](images/446d88bd8ecc22e0a89969dca4b2b5acf84ca7583fa354b1c59c91c317d93a5c.jpg) +(b) RoBERTa IMDB + +![](images/25690646fad92646ec2362ec158acebead37f58cf055701f898cb4a83a48e58e.jpg) +(c) BERTQNLI + +![](images/73550df73409dbf17c03db0c8d8df8689e139f86f2317ac1fc965786f6115a5d.jpg) +(d) RoBERTa QNLI + +![](images/79cbb838b2ccb9923c3a6b003b73d17a56fc030878d4c02db46f9012abb8f668.jpg) +Figure 4: Barcharts showing how the changes CLOSS makes are distributed among each part of speech tag. + +![](images/7ad793e0a2ee54f9fdee73d8a71204798d5aa5fc3c24eaa148d317118a311fef.jpg) + +![](images/3a5ac677f14eb18c8bbf28d255596f7e64cca6a061adfa3d91b40a35a03bc2d2.jpg) +(a) BERT IMDB +(c) BERTQNLI + +![](images/e59c19ed67cbf97c9195c7bb1fc7189b20735039a1fcf269aa0beed040cdd279.jpg) +(b) RoBERTa IMDB +(d) RoBERTa QNLI +Figure 5: Histograms showing the distribution of percent of tokens changed over successfully generated counterfactuals. \ No newline at end of file diff --git a/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/images.zip b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a492b9f76dfcc94ffba44d9609cda0dc6362e202 --- /dev/null +++ b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98dc0f6b297a88a0eb414e900eb9a80d28374ea69e2cb5ecaeb1e7912674862e +size 1542082 diff --git a/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/layout.json b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9bab32cb3fc21d056b2194c7c779f5ec8b9a1eff --- /dev/null +++ b/textcounterfactualsvialatentoptimizationandshapleyguidedsearch/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:963af9175fa2aa4792915a52f3f863dc3b4dc50edae102e492f7ec0d5573448e +size 537044 diff --git a/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_content_list.json b/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..5c42776c6122045731309fd7b850ef16aac57ec5 --- /dev/null +++ b/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29625bd01fbfa2b1e65ca2b3e4c799154a9ae4da5e72944205b9f11f4eb3e8ad +size 126835 diff --git a/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_model.json b/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5afb18fb77bda8cf0615c19327447a21f8e206af --- /dev/null +++ b/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dee8a89c133f675a0e79d22f9a7add8ac5b23b3691f9b3de30155e780ace7f1 +size 149290 diff --git a/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_origin.pdf b/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..617aa84f6a3ac664a93630de4c0c634b5892b0af --- /dev/null +++ b/textdetoxificationusinglargepretrainedneuralmodels/c375685d-d65f-42de-9c5d-aeca13427e8d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76889d6c49ef13acafefae5853838cdbcf7f25dc45ddc05513fc981ef007e633 +size 531591 diff --git a/textdetoxificationusinglargepretrainedneuralmodels/full.md b/textdetoxificationusinglargepretrainedneuralmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a0ff22df5f38c1e5a7b490e197f1b029d2cfcb19 --- /dev/null +++ b/textdetoxificationusinglargepretrainedneuralmodels/full.md @@ -0,0 +1,448 @@ +# Text Detoxification using Large Pre-trained Neural Models + +David Dale†, Anton Voronov‡, Daryna Dementieva‡, Varvara Logacheva‡, Olga Kozlova†, Nikita Semenov†, and Alexander Panchenko‡ + +$^{\ddagger}$ Skolkovo Institute of Science and Technology, Moscow, Russia + +†Mobile TeleSystems (MTS), Moscow, Russia + +{d.dale,anton.voronov,daryna.dementieva,v.logacheva,a.panchenko} @skoltech.ru + +{oskozlo9,nikita.semenov} $@$ mts.ru + +# Abstract + +We present two novel unsupervised methods for eliminating toxicity in text. Our first method combines two recent ideas: (1) guidance of the generation process with small style-conditional language models and (2) use of paraphrasing models to perform style transfer. We use a well-performing paraphraseer guided by style-trained language models to keep the text content and remove toxicity. Our second method uses BERT to replace toxic words with their non-offensive synonyms. We make the method more flexible by enabling BERT to replace mask tokens with a variable number of words. Finally, we present the first large-scale comparative study of style transfer models on the task of toxicity removal. We compare our models with a number of methods for style transfer. The models are evaluated in a reference-free way using a combination of unsupervised style transfer metrics. Both methods we suggest yield new SOTA results. + +# 1 Introduction + +Identification of toxicity in user texts is an active area of research (Zampieri et al., 2020; D'Sa et al., 2020; Han and Tsvetkov, 2020). The task of automatic rewriting of offensive content attracted less attention, yet it may find various useful applications such as making online world a better place by suggesting to a user posting a more neutral version of an emotional comment. The existing works on text detoxification (dos Santos et al., 2018; Tran et al., 2020; Laugier et al., 2021) cast this task as style transfer. The style transfer task is generally understood as rewriting of text with the same content and with altering of one or several attributes which constitute the "style", such as authorship (Voigt et al., 2018), sentiment (Shen et al., 2017), or degree of politeness (Madaan et al., 2020). Despite the goal of preserving the content, in many cases changing the style attributes changes the meaning of a sen + +tence significantly. $^{1}$ So in fact the goal of many style transfer models is to transform a sentence into a somewhat similar sentence of a different style on the same topic. $^{2}$ We suggest that detoxification needs better preservation of the original meaning than many other style transfer tasks, such as sentiment transfer, so it should be performed differently. + +We present two models for text detoxification, which have extra control for content preservation. The first model, ParaGeDi, is capable of fully regenerating the input. It is based on two ideas: external control of an output of a generation model by a class-conditioned LM (Krause et al., 2020) and formulation of style transfer task as paraphrasing (Krishna et al., 2020). Being based on a paraphrase model, ParaGeDi explicitly aims at preserving the meaning of the original sentence. The second approach, CondBERT, inspired by Wu et al. (2019a), follows the pointwise editing setup. It uses BERT to replace toxic spans found in the sentence with their non-toxic alternatives. The semantic similarity is maintained by showing the original text to BERT and reranking its hypotheses based on the similarity between the original words and their substitutes. Interestingly, BERT does not need any class-conditional pre-training to successfully change the text style from toxic to normal. + +In addition, we perform a large-scale evaluation of style transfer models on detoxification task, comparing our new models with baselines and state-of-the-art approaches. We release our code and data. + +Our contributions are as follows: + +- We propose two novel detoxification methods based on pre-trained neural language models: ParaGeDi (paraphrasing GeDi) and CondBERT (conditional BERT). + +- We conduct an evaluation of these models and their comparison with a number of state-of-the-art models for text detoxification and sentiment transfer and release the detoxification dataset. +- We create an English parallel corpus for the detoxification task by retrieving toxic/safe sentence pairs from the ParaNMT dataset (Wieting and Gimpel, 2018). We show that it can further improve our best-performing models. + +# 2 Related Work + +One of the most straightforward ways of solving style transfer task is to "translate" a source sentence into the target style using a supervised encoder-decoder model (Rao and Tetreault, 2018). Since the source and the target are in the same language, pretrained LMs such as GPT-2 (Radford et al., 2019) can be applied for this task — fine-tuning them on relatively small parallel corpora gives a good result (Wang et al., 2019). However, this method is used quite rarely because of the lack of sufficiently large parallel data. The rest of described models are trained in an unsupervised way. + +Pointwise Editing Models A relatively easy yet efficient style transfer method is to leave the sentence intact and manipulate only individual words associated with the style. Delete-Retrieve-Generate (DRG) framework (Li et al., 2018) was the first effort to perform such transfer. It proposes four methods based on this principle. Two of them perform well on our data: DRG-RetrieveOnly retrieves a sentence with the opposite style which is similar to the original sentence and returns it, and DRG-TemplateBased takes the style attributes from it and plugs them into the original sentence. Here, the performance depends on the methods for the identification of style markers and retrieval of replacements. Words associated with style are typically identified either based on their frequencies as in the original paper, some works use attention weights as features (Sudhakar et al., 2019). + +Alternatively, style transfer can use Masked Language Modelling (MLM). An MLM trained on a dataset with style labels picks a replacement word based not only on the context, but also on the style label. An example of such model is Mask & Infill (Wu et al., 2019b). It is most similar to CondBERT method we propose. However, CondBERT performs additional control over the style and the content preservation and is able to make multi-word replacements. Another similar model + +of this type is described by Malmi et al. (2020). It has a more complicated structure: there, two MLMs trained on corpora of different styles perform replacements jointly. + +End-to-end Architectures In contrast to these models, there exist end-to-end architectures for style transfer. They encode the source sentence, then manipulate the resulting hidden representation in order to incorporate a new style, and then decode it. Some of them disentangle the hidden representation into the representation of content and style (John et al., 2019). The others force the encoder to represent style-independent content (Hu et al., 2017). Alternatively, the model DualRL by Luo et al. (2019) performs a direct transfer from the source to the target style. The task is paired with the dual task (back transfer to the source style) which allows models to train without parallel data. The Deep Latent Sequence Model (DLSM) model by He et al. (2020) uses amortized variational inference to jointly train models for the primal and dual tasks. The Stable Style Transformer (SST) method (Lee, 2020) trains a pair of sequence-to-sequence transformers for primal and dual tasks using cross-entropy of a pretrained style classifier as an additional discriminative loss. The Style Transfer as Paraphrase (STRAP) method by Krishna et al. (2020) views a style transfer model as a paraphraser that adds attributes of a particular style to a text. The authors create pseudo-parallel data by transferring style-marked texts to neutral with a pre-trained general-purpose paraphraser and then train sequence-to-sequence models on these neutral-to-styled parallel datasets. Our ParaGeDi model is conceptually similar to these methods. However, unlike these methods, the style is not infused into the model or a sentence representation but is imposed on the generator by another model. + +Detoxification Detoxification of text is a relatively new style transfer task. The first work on this topic by (dos Santos et al., 2018) is an end-to-end seq2seq model trained on a non-parallel corpus with autoencoder loss, style classification loss and cycle-consistency loss. A more recent work by Tran et al. (2020) uses a pipeline of models: a search engine finds non-toxic sentences similar to the given toxic ones, an MLM fills the gaps that were not matched in the found sentences, and a seq2seq model edits the generated sentence to make it more fluent. Finally, Laugier et al. (2021) + +detoxify sentences by fine-tuning T5 as a denoising autoencoder with additional cycle-consistency loss. Dathathri et al. (2020) and Krause et al. (2020) approach a similar problem: preventing a language model from generating toxic text. They do not need to preserve the meaning of the input text. However, the idea of applying a discriminator to control an LM during generation can be used for style transfer, as we show in our experiments. + +# 3 Paraphrasing GeDi Model + +The recently proposed GeDi model (Krause et al., 2020) performs text generation from scratch guided by a language model informed about specific attributes of a text, e.g. style or topic. We extend this model by enabling it to paraphrase the input text. + +# 3.1 GeDi + +The original GeDi model consists of two components: a generation model (GPT-2) and a discrimination model, which is also a GPT-2 trained on sentences with additional sentence-level style labeling — during training the style label is prepended to a sentence. This makes the discriminating model learn the word distributions conditioned on a particular label. At each generation step, the distribution of the next token predicted by the main model $P_{LM}$ is modified using an additional class-conditional language model $P_{D}$ and the Bayes rule: + +$$ +P \left(x _ {t} \mid x _ {< t}, c\right) \propto P _ {L M} \left(x _ {t} \mid x _ {< t}\right) P _ {D} \left(c \mid x _ {t}, x _ {< t}\right) +$$ + +Here, $x_{t}$ is the current token, $x_{< t}$ is the prefix of the text, and $c$ is the desired attribute (e.g. toxicity or sentiment) — one of $C$ classes. The first term is produced by the main language model $P_{LM}$ , and the second term is calculated using the Bayes rule and the additional class-conditional language model $P_{CC}$ . Thus, the tokens which are more likely to appear in a text of the chosen style get a higher probability: + +$$ +P _ {D} (c \mid x _ {t}, x _ {< t}) \propto P (c) P _ {C C} (x, x _ {< t} \mid c) +$$ + +The name GeDi stands for Generative Discriminator, because a language model, which is generative by its nature, is used as a discriminator for guiding the generation process. GeDi was successfully applied to guiding a GPT-2 language model towards generating texts of particular topics and making the generated text less toxic. + +# 3.2 ParaGeDi + +In order to enable GeDi to preserve the meaning of the input text, we replace the regular language + +![](images/3844b890d77fde1dcfbb43a1816e4d4cf8e65cbe4fc21e972780b6009b480137.jpg) +Figure 1: The overview of ParaGeDi model. + +model in it with a model capable of paraphrasing. If we denote the original text by $x$ , the generated text of length $T$ by $y$ , and the desired style by $c$ , ParaGeDi models the following probability: + +$$ +\begin{array}{l} P (y _ {t} | y _ {< t}, x, c) \propto P _ {L M} (y _ {t} | y _ {< t}, x) P (c | y _ {t}, y _ {< t}, x) \\ \approx P _ {L M} \left(y _ {t} \mid y _ {< t}, x\right) P _ {D} \left(c \mid y _ {t}, y _ {< t}\right) \\ \end{array} +$$ + +The last step is an approximation because the class probability should be conditioned on both $x$ and $y$ . However, this approximation, although not being fully justified, allows us to decouple the paraphrase model (which requires a parallel corpus for training) from the style model (which requires only texts with style labels, not necessarily parallel). The paraphrase and the style model can be trained independently. Moreover, we can plug in any paraphrase as long as it shares the vocabulary with the class-conditional LM. The third (optional) component of this model is a reranker — an external model which reweighs the hypotheses generated by the style LM-guided paraphrase with respect to the style. Our reranker is a pre-trained toxicity classifier which chooses the least toxic hypothesis generated by the ParaGeDi model. Figure 1 illustrates the workflow of our model. + +ParaGeDi is trained as follows. Its loss $\mathcal{L}_{ParaGeDi}$ consists of a linear combination of two losses: the generative loss $\mathcal{L}_G$ used in LM training, and the discriminative loss $\mathcal{L}_D$ which further pushes different classes away from one another. + +$$ +\begin{array}{l} \mathcal {L} _ {G} = - \frac {1}{N} \sum_ {i = 1} ^ {N} \frac {1}{T _ {i}} \sum_ {t = 1} ^ {T _ {i}} \log P (y _ {t} ^ {(i)} | y _ {< t} ^ {(i)}, c ^ {(i)}) \\ \mathcal {L} _ {D} = - \frac {1}{N} \sum_ {i = 1} ^ {N} \log P (c ^ {(i)} | y _ {1: T _ {i}} ^ {(i)}) \\ \mathcal {L} _ {P a r a G e D i} = \lambda \mathcal {L} _ {D} + (1 - \lambda) \mathcal {L} _ {G} \\ \end{array} +$$ + +We enhance the model with a number of inference heuristics that improve content preservation and increase the style transfer accuracy. First, we use a heuristic from the original GeDi model. We raise the conditional LM probability to the power $w > 1$ , which biases the discriminator towards the correct class during generation: + +$$ +P (y _ {t} | y _ {< t}, x, c) \propto P _ {L M} (y _ {t} | y _ {< t}, x) P _ {C C} (c | y _ {t}, y _ {< t}) ^ {w} +$$ + +Besides that, we suggest two new heuristics: + +Smoothing of probabilities - adding a small $\alpha > 0$ to all probabilities from the conditional language model discourages the generation of tokens with low probability conditional on all classes: + +$$ +P _ {\alpha} (c | x _ {t}, x _ {< t}) = \frac {\alpha + P (c) P _ {C C} (x , x _ {< t} | c)}{\sum_ {c ^ {\prime} \in C} (\alpha + P (c ^ {\prime}) P _ {C C} (x , x _ {< t} | c ^ {\prime}))} +$$ + +Asymmetric lower and upper bounds ( $l$ and $u$ ) for class-conditional corrections: + +$$ +P _ {\alpha , l, u} \left(c \mid x _ {t}, x _ {< t}\right) = \max \left(l, \min \left(u, P _ {\alpha} \left(c \mid x _ {t}, x _ {< t}\right)\right)\right). +$$ + +By decreasing the value of $u$ we discourage the insertion of new tokens, as opposed to prohibiting existing tokens. For the problem of detoxification, it means that the model will try less to insert polite words than to delete toxic words from the sentence. + +# 4 Conditional BERT Model + +BERT (Devlin et al., 2019) has been trained on the task of filling in gaps ("masked LM"), we can use it to insert non-toxic words instead of the toxic ones. This approach has been suggested by Wu et al. (2019a) as a method of data augmentation. The authors identify words belonging to the source style, replace them with the [MASK] token, and the BERT model then inserts new words of the desired style in the designated places. To push BERT towards the needed style, the authors fine-tune BERT on a style-labelled dataset by replacing segmentation embeddings of original BERT with trainable style embeddings. + +We perform some changes to this model to adapt it for the detoxification task. While in the original conditional BERT model the words are masked randomly, we select the words associated with toxicity. This can be done in different ways, e.g. by training a word-level toxicity classifier or manually creating a vocabulary of rude and toxic words. We use a method which does not require any additional data or human effort. We train a logistic + +bag-of-words toxicity classifier. This is a logistic regression model which classifies sentences as toxic or neutral and uses their words as features. As a byproduct of the training process, each feature (word) yields a weight which roughly corresponds to its importance for classification. The words with the highest weights are usually toxic. We use the normalised weights from the classifier as toxicity score. The overview of CondBERT is shown in Figure 2. + +![](images/4440f6c50d40b674732e75a5dd53a237b4248e8dd538be76abda7e8a2d8bfb56.jpg) +Figure 2: The overview of the CondBERT model. + +For each word in a sentence, we compute the toxicity score and then define toxic words as the words with the score above a threshold $t = \max(t_{min}, \max(s_1, s_2, \dots, s_n) / 2)$ , where $s_1, s_2, \dots, s_n$ are scores of all words in a sentence and $t_{min} = 0.2$ is a minimum toxicity score. This adaptive threshold allows balancing the percentage of toxic words in a sentence so that we avoid cases when too many or no words are marked as toxic. + +To preserve the meaning of the replaced word, we employ the content preservation heuristics suggested by Arefyev et al. (2020): (i) Preserve the original tokens instead of masking them before the replacement; (ii) Rerank the replacement words suggested by BERT by the similarity of their embedding with the embedding of the original word. + +Despite using class-specific sentence embeddings, conditional BERT often predicts toxic words, apparently paying more attention to the context than to the embeddings of the desired class. To force the model to generate non-toxic words we calculate the toxicity of each token in BERT vocabulary and penalize the predicted probabilities of tokens with positive toxicities. + +Finally, we enable BERT to replace a single [MASK] token with multiple tokens. We generate each next token progressively by beam search and score each multitoken sequence by the harmonic mean of the probabilities of its tokens. + +# 5 Detoxification Experiments + +We train the two new models and a number of other systems for text detoxification. Below we describe datasets, evaluation setup, and results. + +# 5.1 Toxicity Classifier + +We train two binary classifiers of toxicity. One of them is used to rerank hypotheses in the ParaGeDi model, and the other participates in the evaluation. We train these two classifiers on different sets of data. The overall dataset is the merge of the English parts of the three datasets by Jigsaw (Jigsaw, 2018, 2019, 2020), containing around 2 million examples. We split it into two parts and fine-tune a RoBERTa model (Liu et al., 2019) on it. We use the roberta-large model from the original repository. The classifiers perform closely on the test set of the first Jigsaw competition, reaching the AUC-ROC of 0.98 and $\mathrm{F_1}$ -score of 0.76. + +# 5.2 Dataset + +For training and testing of the style transfer models, we use the English data from the first Jigsaw competition (Jigsaw, 2018). The majority of our methods are trained on non-parallel corpora of source and target styles. To prepare the toxic dataset, we divide the comments labelled as toxic into sentences (the original comments are often too long) and classify each of them with our toxicity classifier. Sentences classified as toxic are used as the toxic part of the dataset (we find 154,771 of them). To select the neutral part of the dataset, we randomly pick the same number of non-toxic sentences from the sentence-separated Jigsaw data. The test set is prepared analogously to the test set of the Jigsaw competition: we use 10,000 sentences with the highest toxicity score according to our classifier. + +# 5.3 Metrics + +There is no parallel test set available for the detoxification task, so we cannot use BLEU, METEOR or ROUGE metrics and resort to referenceless evaluation. Style transfer models need to change the style, preserve content and produce a fluent text. These parameters are often inversely correlated, so we need a compound metric to find a balance between them. We follow the evaluation strategy of Krishna et al. (2020) and use the metric $\mathbf{J}$ , which is the multiplication of sentence-level style accuracy, content preservation, and fluency. The system-level $\mathbf{J}$ is the average of sentence-level scores. Style accu + +racy (ACC) is measured with a pre-trained toxicity classifier described in Section 5.1. Content preservation (SIM) is evaluated as the similarity of sentence-level embeddings of the original and transformed texts computed by the model of Wieting et al. (2019). Fluency (FL) measured with the classifier of linguistic acceptability trained on the CoLA dataset (Warstadt et al., 2019). J is computed as the average of their sentence-level product. In addition to that, we tried a similar aggregated metric GM (Pang and Gimpel, 2019; Laugier et al., 2021) which uses perplexity as the measure of fluency and employs a different aggregation method. Our preliminary experiments showed that J and GM are strongly correlated, so we keep only J for further evaluation. + +# 5.4 Implementation Details + +For ParaGeDi, we use a pre-trained T5-based (Raffel et al., 2020) paraphraser, $^{4}$ fine-tuned on a random subsample of the ParaNMT dataset (Wieting and Gimpel, 2018). As a discriminator, we fine-tune the gpt2-medium model (Radford et al., 2019) on the training part of the Jigsaw-1 dataset using two control codes for toxic and polite texts. Before fine-tuning, we change the vocabulary of the discriminator to match that of T5, and update its embeddings accordingly. We train the discriminator using a combined generative and discriminative loss from Krause et al. (2020), adapting their code for this purpose. + +We use beam search decoding with 10 beams to generate paraphrase candidates with the paraphraseer and discriminator described above. We apply the classifier from section 5.1 to select the least toxic candidate from the 10 resulting paraphrases. + +# 5.5 Competing Methods + +We compare our models with state-of-the-art methods described in Section 2: DRG-TemplateBased, DRG-RetrieveOnly, Mask&Infill, DLSM, STRAP, and SST. We also implement three other baselines: Machine Translation, Detoxifying GPT-2, and Paraphraser. We do not directly compare our models with GeDi, because it is a language model and was not explicitly trained to transform texts. + +Machine Translation There is evidence that automatic translation tends to eliminate toxicity (Prabhumoye et al., 2018). Thus, we use a chain + +of Machine Translation models for detoxification. Namely, we perform English $\rightarrow$ Pivot $\rightarrow$ English translation. We choose French and Igbo as pivot languages. French is resource-rich and structurally similar to English, which ensures high-quality translations. Conversely, Igbo is low-resourced and syntactically different. Both experiments are conducted using Google Translate API. + +Detoxifying GPT-2 GPT-2 (Radford et al., 2019) can be adapted to a wide range of NLP tasks using a very small task-specific dataset. We experiment with the model's ability to perform sequence-to-sequence tasks. We train it on a parallel dataset of 200 toxic and safe sentences. We randomly select toxic sentences from the Google Jigsaw toxic comments dataset (Jigsaw, 2018) and manually rewrite them in the neutral tone. + +Paraphraser Krishna et al. (2020) suggest that a general-purpose paraphrase can remove style markers from text. We check this assumption. + +# 5.6 Results + +The performance of all tested models is given in Table 1. Both ParaGeDi and CondBERT outperform other models by a large margin. The success of CondBERT is explained by its use of heuristics targeted at the components of the metric: (i) it is penalized for generating toxic tokens, which ensures a high ACC score, (ii) over $80\%$ tokens stay unchanged, and the replacements are selected with respect to the similarity to the original words, increasing the overall SIM score, (iii) MLM is pretrained to replace masked tokens with plausible substitutes, increasing FL. ParaGeDi is behind in terms of similarity but has a slightly higher fluency because generation is a better strategy in terms of text naturalness than pointwise corrections. The closest competitor of our models is Mask&Infill which uses similar principles as CondBERT. However, some engineering decisions (e.g. masking of all words at once) result in a substantial drop in fluency and some decrease in style transfer accuracy. + +Surprisingly, many advanced models perform below the simplistic (DRG) models TemplateBased and RetrieveOnly. TemplateBased achieves a high similarity because it keeps most of the original sentence intact, and RetrieveOnly yields a high similarity and style transfer accuracy, because it outputs real non-toxic sentences from the training data. DLSM and SST models perform full re-generation of text (as opposed to pointwise corrections). More + +importantly, their decoders are trained from scratch on a relatively small dataset, hence their low fluency scores. Conversely, STRAP, which also generates the sentence, has the access to the larger pseudo-parallel data, resulting in higher fluency. + +Another finding is that MT has detoxification ability. However, it is inversely correlated with its quality: the $\mathrm{En}\rightarrow \mathrm{Ig}\rightarrow \mathrm{En}$ detoxifies $37\%$ of sentences but has low SIM and FL scores. Conversely, $\mathrm{En}\rightarrow \mathrm{Fr}\rightarrow \mathrm{En}$ yields a better output which keeps most of the original features, including toxicity. The same applies to the T5 paraphraseer. On the other hand, the GPT-2 model can be trained to detoxify even on a very small number of parallel sentences (200 in our experiments). Although it performs below many other models, we suggest that training it on a larger parallel dataset can boost its performance. We show examples of the paraphrases by the best-performing models in Table 2. + +Additional examples and qualitative analysis can be found in Appendices F and E, respectively. + +# 5.7 Parameter Selection + +Our models use multiple parameters and heuristics. We perform an ablation study to explore their usefulness. It turns out that the crucial features of CondBERT are multiword replacement which ensures high fluency and toxicity penalty which increases style strength. On the other hand, masking of all tokens at once as well as control of similarity do not affect the quality. More details on the CondBERT ablation study are given in Appendix B. + +ParaGeDi has only one training hyperparameter $\lambda$ which controls the strength of its discriminative loss. We discover its value has only a marginal effect on the overall quality: the value of $\mathbf{J}$ decreases only for $\lambda = 1$ which constitutes the absence of generative loss (see Figure 3). The style strength control influences the style accuracy, whereas the use of word probability upper bound increases the similarity, and the absence of beam search decreases fluency. On the other hand, reranking, beam size, smoothing do not affect the model performance. An ablation study of the ParaGeDi model can be found in Appendix C. + +# 6 Mining a Parallel Detoxifying Corpus + +The STRAP model (Krishna et al., 2020) is based on the assumption that a regular paraphrase can transform a stylistically marked text into a neutral text. Although our experiments show that a para- + +
ModelACCSIMFLJ
CondBERT (ours)0.940.690.770.50 ± 0.0037*
ParaGeDi (ours)0.950.660.800.50 ± 0.0032*
Mask&Infill (Wu et al., 2019b)0.780.800.490.31 ± 0.0041
DRG-TemplateBased (Li et al., 2018)0.660.820.590.30 ± 0.0041
DRG-RetrieveOnly (Li et al., 2018)0.930.330.840.26 ± 0.0019
DLSM (He et al., 2020)0.620.720.480.17 ± 0.0033
Detoxifying GPT-2 (baseline)0.540.480.720.17 ± 0.0026
STRAP (Krishna et al., 2020)0.290.690.800.15 ± 0.0027
En→Ig→En MT (baseline)0.370.680.570.12 ± 0.0025
T5 paraphraser (baseline)0.150.900.870.11 ± 0.0029
SST (Lee, 2020)0.800.550.120.05 ± 0.0019
En→Fr→En MT (baseline)0.060.910.810.04 ± 0.0019
+ +Table 1: Performance of detoxification models. Gray lines denote baselines, green lines denote models suggested in this work. The models are sorted with respect to the aggregated J score. The asterisk * denotes the scores that are significantly higher than the third best model (Mask&Infill) with $p < 0.01$ , based on the paired t-test. + +
Inputno room for those stupid antics .
ParaGeDi (ours)There's no space for all those adversities.
CondBERT (ours)no room for those . . . those bizarre exploits .
Mask&Infillno room for those compelling antics .
DRG-TemplateBasedno room for those conventions antics .
Inputzoological conspiracy theories ( arabisraeli conflict ) , by contrast , sucks horribly .
ParaGeDi (ours)By contrast, the zoological theories of conspiracy (the Arab-Israeli conflict) suffer horribly.
CondBERT (ours)zoological conspiracy theories ( arabisraeli conflict ) , by contrast , worked out badly .
Mask&Infillzoological conspiracy theories ( arabisraeli conflict ) , by contrast , ends horribly .
DRG-TemplateBasedzoological conspiracy theories ( arabisraeli conflict ) , by contrast , instrumental horribly .
Inputthis whole article is bullshit .
ParaGeDi (ours)This article's not a good deal.
CondBERT (ours)this whole article is considered incomplete .
Mask&Infillthis whole article is compelling .
DRG-TemplateBasedthis whole article is substantially .
+ +![](images/8f6bfcf5413ac5462abe652f2371f484d93cd9f1c41bc746893a917580aa01bf.jpg) +Figure 3: Performance of ParaGeDi with the varying $\lambda$ parameter (greater $\lambda$ corresponds to the stronger influence of the discriminative loss and smaller $\lambda$ means the stronger influence of the generative loss). + +phrasing, as well as an MT model, are bad detoxifiers on their own (see Section 5.6), we suggest that it is possible to find occasional detoxifying sentence pairs in a large parallel dataset of paraphrases. + +Experimental Setup To test this hypothesis, we classify the sentences from the ParaNMT para + +Table 2: Examples of detoxification by different models. + +
ModelACCSIMFLJ
Paraphraser
regular0.150.900.870.11 ±0.003
mined0.420.870.910.31 ±0.004
ParaGeDi
regular0.940.660.770.50 ±0.003
mined0.980.660.840.54 ±0.003
+ +Table 3: Comparison of paraphrasers for ParaGeDi. + +phrase dataset (Wieting and Gimpel, 2018) with our toxicity classifier described in Section 5.1 and obtain 500,000 paraphrase pairs where one sentence is more toxic than the other (for more details on the data collection process please see Appendix D). We then compare the regular paraphraser from Section 5.4 fine-tuned on a random subset of ParaNMT (regular) with its version fine-tuned on the mined toxic/safe parallel paraphrase corpus (mined). We also plug both paraphrasers into ParaGeDi model and compare the overall performance. The results are shown in Table 3. + +Discussion of Results None of the paraphrasers + +can fully detoxify the test set, but the mined paraphraseer gets a better ACC than the regular one (42% vs 15%). When we replace the regular paraphraseer with the detoxifying one in ParaGeDi, both detoxification rate and fluency improve without loss in the similarity score. This leaves us with the J score of 0.54, which is the highest score we obtained in our detoxification experiment. We do not include it in the main results (Table 1) because this model is not unsupervised. However, this result shows that the general-purpose ParaNMT corpus contains a large number of toxic/safe paraphrase pairs. We believe that mining parallel training sets from large corpora, as opposed to unsupervised methods of style transfer, is a fruitful direction. + +# 7 Human Evaluation of Detoxification + +While the automatic reference-free evaluation is cheap and fast, it may be unreliable. Toxicity and fluency classifiers are not perfect and can return erroneous evaluations. The embedding distance which is used to measure the content preservation was shown to weakly correlate with human judgements (Yamshchikov et al., 2021). Thus, we evaluate the best-performing models manually. + +Experimental Setup We design our manual evaluation setup to be as close as possible to the automatic evaluation. We evaluate our models along the same three metrics: style accuracy $(\mathrm{ACC}_m)$ , content similarity $(\mathrm{SIM}_m)$ , and fluency $(\mathrm{FL}_m)$ . For all metrics we use a ternary scale: $\{0, 0.5, 1\}$ corresponding to a bad, partially acceptable, and fully acceptable sentence. + +We ask five annotators to evaluate the models. Annotators are NLP researchers with MSc degree or above and with a good command of English. Prior to the annotation, we arranged a preliminary round to reach common annotation understanding. Each sentence is evaluated by three annotators, the final score for a sentence is computed as the average of their scores. We measure the inter-annotator agreement in terms of Krippendorff's $\alpha$ . We obtained the score of 0.42 for the style accuracy, 0.31 for content preservation, and 0.52 for fluency: a moderate agreement for style and fluency annotation, and low agreement for content annotation. + +We evaluate three models: our new models ParaGeDi and CondBERT, and Mask&Infill whose automatic scores were the highest among the existing models. The evaluation was conducted on 200 source sentences, each of them was transformed + +
ACCmSIMmFLmJm
ParaGeDi (ours)93.4164.7591.2555.34
CondBERT (ours)91.0063.9286.4150.47
Mask&Infill (top 1)75.3359.0862.0827.33
+ +Table 4: The results of manual evaluation sorted by $\mathbf{J}_{\mathbf{m}}$ . The differences between our models and Mask&Infill are statistically significant with $\alpha < 0.05$ based on the paired $t$ -test. Differences between ParaGeDi and CondBERT are significant only for the $\mathrm{FL}_m$ metric. + +by each of the evaluated models. The input (toxic) sentences for the evaluation were manually pre-selected to filter out disfluent or senseless utterances (this pre-selection did not consider the outputs). To compensate for the low inter-annotator agreement, we annotate each sample three times and report the average score. + +Discussion of Results We show the performance of models in terms of human evaluation in Table 4. The model scores are the averaged sentence scores. We combine the three metrics into a joint quality score which we denote as $\mathbf{J}_{\mathbf{m}}$ . Sentence-level $\mathbf{J}_{\mathbf{m}}$ is a multiplication of sentence $\mathrm{ACC}_m$ , $\mathrm{SIM}_m$ , and $\mathrm{FL}_m$ , and the model $\mathbf{J}_{\mathbf{m}}$ scores are the average of sentence scores. This manual evaluation corroborates the superiority of our models over Mask&Infill model. At the same time, it confirms that our two models are not significantly different. Although ParaGeDi outperforms CondBERT in terms of all metrics, the difference in scores is statistically significant only for $\mathrm{FL}_m$ . + +Besides the evaluation itself, we investigated to what extent the automatic metrics reflect the human judgements. To do that, we compute their Spearman's $\rho$ correlation score with human judgements (see Table 6). For style, we consider the accuracy of toxicity classifier that we used for the evaluation (ACC) and its version which returns the confidence instead of the binary label (ACC-soft). For content we compare SIM (embedding similarity used for computing the J score) and BLEU score between the original and detoxified sentence. For fluency, we consider the linguistic acceptability classifier (FL) and perplexity of the GPT-2 (Radford et al., 2019) language model (PPL) which is used for evaluating fluency in many works on style transfer and other generation tasks. + +This evaluation shows that the tested metrics of content preservation show only weak correlation with manual scores, which agrees with the previous research (Yamshchikov et al., 2021). The correla + +
ModelACCSIMFLJBLEU
human0.810.650.840.445 ± 0.0111.000
ParaGeDi (ours)0.930.620.880.515 ± 0.009*0.038 ± 0.005
Mask & Infill (Wu et al., 2019b)0.890.760.620.420 ± 0.0130.145 ± 0.008
DualRL (Luo et al., 2019)0.870.750.630.395 ± 0.0120.152 ± 0.008
CondBERT (ours)0.860.650.620.338 ± 0.0120.125 ± 0.007
SST (Lee, 2020)0.740.650.410.225 ± 0.0110.100 ± 0.007
DRG-RetrieveOnly (Li et al., 2018)0.950.290.830.225 ± 0.0060.004 ± 0.001
DRG-TemplateBased (Li et al., 2018)0.820.700.240.115 ± 0.0090.117 ± 0.007
+ +Table 5: Performance of the sentiment transfer models on the YELP dataset. The models are sorted with respect to the aggregated J score. * indicates the score which is significantly higher than the next best model with $p < {0.01}$ . + +
ACCmSIMmFLm
ACC-soft0.59SIM0.34FL0.54
ACC0.51BLEU0.19PPL0.45
+ +Table 6: Spearman's $\rho$ of automatic metrics for evaluating style, content, and fluency with our human scores. + +tion of automatic style and fluency metrics with human judgements is moderate. It turns out that the confidence of style classifier is a better style accuracy metric than a binary classifier and the acceptability classifier works better than perplexity, confirming the criticism of perplexity as a fluency metric (Krishna et al., 2020). + +# 8 Sentiment Transfer Experiments + +Text detoxification is not as well-established as other style transfer tasks, which makes it is difficult to put our models in the context of other works on style transfer. Thus, we conduct an experiment on a different domain, namely, sentiment transfer. + +Experimental Setup We train ParaGeDi and CondBERT on the Yelp reviews dataset (Li et al., 2018) and compare them with Mask&Infill, SST, DRG-TemplateBased, DRG-RetrieveOnly, and DualRL models (see Section 2). We tune the hyperparameters of ParaGeDi and CondBERT on the Yelp development set and use the outputs of other models generated by their authors. + +We evaluate the models using the J as in our detoxification experiments. For the evaluation of style transfer accuracy, we train two sentiment classifiers on two disjoint parts of the Yelp dataset as in Section 5.1. We use one for inference and another for evaluation. We also compute the BLEU score against human references provided by Li et al. (2018). The results are shown in Table 5, averaged over two transfer directions. + +Discussion of Results ParaGedi outperforms other models in terms of J. As before, the other models fail to generate fluent texts because they re + +place only specific words or because they learn to generate texts from scratch. ParaGeDi model is the only competitor which combines pre-trained models and with full regeneration. The performance of the CondBERT model is low on this task, corroborating that detoxification and style transfer for other domains require different techniques. + +On the other hand, the BLEU score questions this result. Compared to the human references, the best-performing model is DualRL followed by the two MLM-based models: Mask&Infill and our CondBERT. The evaluation of reference human answers also questions the referenceless metrics. First, we see that the ACC score is limited by the classifier performance. Since it gives only 0.81 to presumably $100\%$ correct manually written sentences, the small differences in ACC should not be considered significant, and the ACC above 0.81 is unreliable. Overall, since the score of human answers is close to those of ParaGeDi and Mask&Infill, ParaGeDi can still be considered a strong style transfer model, and more precise evaluation should be done by humans because metrics cannot distinguish between the models at this level. + +# 9 Conclusion + +We present two style transfer models tailored for detoxification, i.e. transfer from toxic to non-toxic texts. Both of them combine high-quality pretrained LMs with the extra style guidance. ParaGeDi is based on a paraphraseer guided by a style-conditioned GPT-2 model. CondBERT model is based on BERT which does not need any fine-tuning, and all style control is performed with a pre-trained toxicity classifier. We conduct a large-scale study of style transfer models exploiting both automatic and manual evaluation. Our experiments show that the proposed methods outperform other state-of-the-art style transfer models on the tasks of detoxification and sentiment transfer. + +# Ethical Statement + +Toxicity is a sensitive topic where the unexpected results and byproducts of research can cause harm. Therefore, we would like to consider some ethical concerns related to our work. + +On Definition of Toxicity Toxicity is an umbrella term for almost any undesirable behaviour on the Internet. It ranges from "mild" phenomena like condescending language (Perez Almendros et al., 2020) to grave insults or oppression based on racial or other social-demographic characteristics. + +While annotators agree when labelling serious cases of toxicity such as hate speech (Fortuna and Nunes, 2018), the labelling of less severe toxicity is subjective and depends on the annotator's background (Al Kuwatly et al., 2020). This can cause the underestimation of certain types of toxicity. To define the toxicity in the most objective feasible way, we adopt a data-driven approach as presented in detail formally in Appendix A. Both models we propose recognise toxicity based on a toxicity-labelled dataset and do not require any additional manually created dictionaries or rules. Thus, their understanding of toxicity can be tuned with the input data. This ensures that given a corpus with unbiased toxicity labelling our models can produce unbiased detoxification. + +On the other hand, in case the training corpus is biased, the model can reproduce the biases, so it should be applied with caution. + +Toxification of Texts Detoxification task implies the possibility to perform the opposite transformation, i.e. to rewrite a neutral text into a toxic one. Various style transfer models, including ours, could in principle be used to complete this task. However, in case of CondBERT, the quality of such transformation would be bad, and it would be almost impossible to pass the results of this "toxification" off as real toxic sentences. The reason for that is the structure of toxic data. + +One of the main properties of toxic style is the presence of lexical markers of this style (rude or obscene words). Such markers (i) carry most of stylistic information of a sentence (i.e. their presence is a strong indicator of this class), (ii) have synonyms which are free from this stylistic information. Both our methods strongly rely on these properties. They identify toxic words and replace them with non-toxic synonyms. On the other hand, if performing the opposite transformation, we can + +not use these properties any more. First, there do not exist non-toxic words which are strong indicators of neutral (non-toxic) style. Second, it is almost infeasible to identify non-toxic words which have toxic synonyms and replace them appropriately. Therefore, we suggest that CondBERT is not suitable for toxification. + +The above arguments do not prove that CondBERT or ParaGeDi cannot be applied for toxicification. However, they suggest that the quality of the resulting text might not be higher than with simpler toxicification methods (e.g. handwritten rules for inserting rude words). + +Detoxification as a Censorship Another concern is the fact the detoxification technology could no used to rewrite user-generated messages, which might be considered a form of censorship. We would like to look at that from a different perspective. The social media currently already perform censorship, e.g. Instagram provides tools for removal of messages based on automatically identified harmful content.[5] + +On the other hand, we suggest mitigating this policy by rewriting toxic messages instead of removing them altogether. Last but not least, we suggest that user messages should not be modified without user consent. The detoxificaiton models should be used for suggesting detoxifying edits rather than performing them automatically. + +At the same time, detoxification models can make chatbots safer by detoxifying (if necessary) their answers before sending them to users. An automatically generated toxic comment by a neural chatbot may be the result of pre-training on the biased textual data - a problem which is currently unsolved completely (Gehman et al., 2020). Therefore, a detoxification of automatically generated content might be a valid use-case for minimizing reputational losses for the company created such an unmoderated chatbot (Babakov et al., 2021). + +# Acknowledgements + +This research was conducted under the framework of the joint MTS-Skoltech laboratory. We are grateful to the reviewers for their helpful suggestions which substantially improved this work. + +# References + +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, Online. Association for Computational Linguistics. +Nikolay Arefyev, Boris Sheludko, Alexander Podolskiy, and Alexander Panchenko. 2020. Always keep your target in mind: Studying semantics and improving performance of neural lexical substitution. In Proceedings of the 28th International Conference on Computational Linguistics, pages 1242-1255, Barcelona, Spain (Online). International Committee on Computational Linguistics. +Nikolay Babakov, Varvara Logacheva, Olga Kozlova, Nikita Semenov, and Alexander Panchenko. 2021. Detecting inappropriate messages on sensitive topics that could harm a company's reputation. In Proceedings of the 8th Workshop on Balto-Slavic Natural Language Processing, pages 26-36, Kiyv, Ukraine. Association for Computational Linguistics. +Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. 2020. Plug and play language models: A simple approach to controlled text generation. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +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. +Ashwin Geet D'Sa, Irina Illina, and Dominique Fohr. 2020. Towards non-toxic landscapes: Automatic toxic comment detection using DNN. In Proceedings of the Second Workshop on Trolling, Aggression and Cyberbullying, pages 21-25, Marseille, France. European Language Resources Association (ELRA). +Paula Fortuna and Sérgio Nunes. 2018. A survey on automatic detection of hate speech in text. ACM Comput. Surv., 51(4). +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. Association for Computational Linguistics. +Xiaochuang Han and Yulia Tsvetkov. 2020. Fortifying toxic speech detectors against veiled toxicity. In + +Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7732-7739, Online. Association for Computational Linguistics. +Junxian He, Xinyi Wang, Graham Neubig, and Taylor Berg-Kirkpatrick. 2020. A probabilistic formulation of unsupervised text style transfer. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P. Xing. 2017. Toward controlled generation of text. 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 1587-1596. PMLR. +Jigsaw. 2018. Toxic comment classification challenge. https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge. Accessed: 2021-03-01. +Jigsaw. 2019. Jigsaw unintended bias in toxicity classification. https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification. Accessed: 2021-03-01. +Jigsaw. 2020. Jigsaw multilingual toxic comment classification. https://www.kaggle.com/c/jigsaw-multilingual-toxic-comment-classification. Accessed: 2021-03-01. +Vineet John, Lili Mou, Hareesh Bahuleyan, and Olga Vechtomova. 2019. Disentangled representation learning for non-parallel text style transfer. 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 424–434. Association for Computational Linguistics. +Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq R. Joty, Richard Socher, and Nazneen Fatema Rajani. 2020. Gedi: Generative discriminator guided sequence generation. CoRR, abs/2009.06367. +Kalpesh Krishna, John Wieting, and Mohit Iyyer. 2020. Reformulating unsupervised style transfer as paraphrase generation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 737-762, Online. Association for Computational Linguistics. +Guillaume Lample, Sandeep Subramanian, Eric Michael Smith, Ludovic Denoyer, Marc'Aurelio Ranzato, and Y-Lan Boureau. 2019. Multiple-attribute text rewriting. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. + +Leo Laugier, John Pavlopoulos, Jeffrey Sorensen, and Lucas Dixon. 2021. Civil rephrases of toxic texts with self-supervised transformers. CoRR, abs/2102.05456. +Joosung Lee. 2020. Stable style transformer: Delete and generate approach with encoder-decoder for text style transfer. In Proceedings of the 13th International Conference on Natural Language Generation, INLG 2020, Dublin, Ireland, December 15-18, 2020, pages 195-204. Association for Computational Linguistics. +Juncen Li, Robin Jia, He He, and Percy Liang. 2018. Delete, retrieve, generate: a simple approach to sentiment and style transfer. 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 1865-1874, New Orleans, Louisiana. 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. CoRR, abs/1907.11692. +Fuli Luo, Peng Li, Jie Zhou, Pengcheng Yang, Baobao Chang, Xu Sun, and Zhifang Sui. 2019. A dual reinforcement learning framework for unsupervised text style transfer. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 5116-5122. ijcai.org. +Aman Madaan, Amrith Setlur, Tanmay Parekh, Barnabas Poczos, Graham Neubig, Yiming Yang, Ruslan Salakhutdinov, Alan W Black, and Shrimai Prabhumoye. 2020. Politeness transfer: A tag and generate approach. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1869-1881, Online. Association for Computational Linguistics. +Eric Malmi, Aliaksei Severyn, and Sascha Rothe. 2020. Unsupervised text style transfer with padded masked language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8671-8680, Online. Association for Computational Linguistics. +Richard Yuanzhe Pang and Kevin Gimpel. 2019. Unsupervised evaluation metrics and learning criteria for non-parallel textual transfer. In Proceedings of the 3rd Workshop on Neural Generation and Translation, pages 138-147, Hong Kong. Association for Computational Linguistics. +Carla Perez Almendros, Luis Espinosa Anke, and Steven Schockaert. 2020. Don't patronize me! an annotated dataset with patronizing and condescending language towards vulnerable communities. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5891-5902, + +Barcelona, Spain (Online). International Committee on Computational Linguistics. +Shrimai Prabhumoye, Yulia Tsvetkov, Ruslan Salakhutdinov, and Alan W Black. 2018. Style transfer through back-translation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 866–876, Melbourne, Australia. 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. +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. +Sudha Rao and Joel Tetreault. 2018. Dear sir or madam, may I introduce the GYAFC dataset: Corpus, benchmarks and metrics for formality style transfer. 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 129-140, New Orleans, Louisiana. Association for Computational Linguistics. +Cicero Nogueira dos Santos, Igor Melnyk, and Inkit Padhi. 2018. Fighting offensive language on social media with unsupervised text style transfer. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 2: Short Papers, pages 189-194. Association for Computational Linguistics. +Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2017. Style transfer from non-parallel text by cross-alignment. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. +Akhilesh Sudhakar, Bhargav Upadhyay, and Arjun Maheswaran. 2019. "transforming" delete, retrieve, generate approach for controlled text style transfer. 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 3267-3277. Association for Computational Linguistics. +Minh Tran, Yipeng Zhang, and Mohammad Soleymani. 2020. Towards A friendly online community: An unsupervised style transfer framework for profanity redaction. In Proceedings of the 28th International Conference on Computational Linguistics, COLING 2020, Barcelona, Spain (Online), December 8-13, 2020, pages 2107-2114. International Committee on Computational Linguistics. + +Rob Voigt, David Jurgens, Vinodkumar Prabhakaran, Dan Jurafsky, and Yulia Tsvetkov. 2018. Rtgender: A corpus for studying differential responses to gender. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation, LREC 2018, Miyazaki, Japan, May 7-12, 2018. European Language Resources Association (ELRA). +Yunli Wang, Yu Wu, Lili Mou, Zhoujun Li, and Wenhan Chao. 2019. Harnessing pre-trained neural networks with rules for formality style transfer. 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 3571-3576. Association for Computational Linguistics. +Alex Warstadt, Amanpreet Singh, and Samuel R. Bowman. 2019. Neural network acceptability judgments. Trans. Assoc. Comput. Linguistics, 7:625-641. +John Wieting, Taylor Berg-Kirkpatrick, Kevin Gimpel, and Graham Neubig. 2019. Beyond BLEU: training neural machine translation with semantic similarity. 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 4344-4355. Association for Computational Linguistics. +John Wieting and Kevin Gimpel. 2018. *Paranmt-50m: Pushing the limits of paraphrastic sentence embeddings with millions of machine translations.* 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 451-462. Association for Computational Linguistics. +Xing Wu, Shangwen Lv, Liangjun Zang, Jizhong Han, and Songlin Hu. 2019a. Conditional BERT contextual augmentation. In Computational Science - ICCS 2019 - 19th International Conference, Faro, Portugal, June 12-14, 2019, Proceedings, Part IV, volume 11539 of Lecture Notes in Computer Science, pages 84-95. Springer. +Xing Wu, Tao Zhang, Liangjun Zang, Jizhong Han, and Songlin Hu. 2019b. Mask and infill: Applying masked language model for sentiment transfer. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 5271-5277. ijcai.org. +Ivan P. Yamshchikov, Viacheslav Shibaev, Nikolay Khlebnikov, and Alexy Tikhonov. 2021. Styletransfer and paraphrase: Looking for a sensible semantic similarity metric. 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 14213-14220. AAAI Press. + +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 (OffenseEval 2020). In Proceedings of the Fourteenth Workshop on Semantic Evaluation, pages 1425–1447, Barcelona (online). International Committee for Computational Linguistics. + +# A Definition of Text Detoxification Task + +In our work, we adhere to the data-driven definition of toxicity. The toxicity is a particular binary value associated with a text: {toxic, neutral}. We assume that this textual characteristic is measurable using a function $\sigma(x_i) \rightarrow s_i$ that obtains as input text $x_i$ and returns the corresponding style label $s_i$ . For instance, it can be implemented using a text classifier. + +Let us assume a set of two discreet mutually exclusive styles $S = \{s^{src}, s^{tg}\}$ which corresponds to the source toxic and target neutral styles. Let us consider two text corpora $D^{src} = \{d_1^{src}, d_2^{src}, \dots, d_n^{src}\}$ and $D^{tg} = \{d_1^{tg}, d_2^{tg}, \dots, d_m^{tg}\}$ belonging to the source and target styles $s^{src}$ and $s^{tg}$ , respectively. For each text $d_i$ , let us assume that it has a style $s_i$ measurable with the function $\sigma : D \to S$ . There also exists a binary function $\delta : D \times D \to [0,1]$ that indicates the semantic similarity of two input texts and a unary function $\psi : D \to [0,1]$ that indicates the degree of the text fluency. In general, the sizes of the source and the target corpora $D^{src}$ and $D^{tg}$ are different ( $n \neq m$ ) and the texts in them are not aligned, i.e., in general, $\delta(d_i^{src}, d_i^{tg}) \neq 1$ . If $n = m$ and $\delta(d_i^{src}, d_i^{tg}) = 1$ for all texts, this is a special case of a parallel style-aligned corpus. Given the introduced notations, we define the task of text detoxification as follows: + +A text detoxification model is a function $\alpha : S \times S \times D \to D$ that, given a source style $s^{src}$ , a target style $s^{tg}$ , and an input text $d^{src}$ , produces an output text $d^{tg}$ such that: + +- The style of the text changes from the source style $s^{src}$ to the target style $s^{tg}$ : $\sigma(d^{src}) \neq \sigma(d^{tg})$ , $\sigma(d^{tg}) = s^{tg}$ ; +- The content of the source text is saved in the target text as much as required for the task: $\delta(d^{src}, d^{tg}) \geq t^{\delta}$ ; +- The fluency of the target text achieves the required level: $\psi(d^{tg}) > t^{\psi}$ , + +where $t^\delta$ and $t^\psi$ are the error tolerance threshold values for the content preservation $(\delta)$ and fluency $(\psi)$ functions. + +When removing the toxicity from a text, we inevitably change a part of its meaning, so full content preservation cannot be reached. However, we should attempt to save the content as much as possible and adjust $t^\delta$ to the needs of this task. + +Thus, the task of obtaining a text detoxification model with the best parameters set may be viewed as maximizing the probabil- + +ity $P(d^{tg}|d^{src},s^{src},s^{tg})$ given the three above-mentioned constraints based on parallel or nonparallel text corpora $D^{src}$ and $D^{tg}$ . + +# B CondBERT Ablation Study + +Our CondBERT model was inspired by Wu et al. (2019a) and is similar to Wu et al. (2019b), but has some unique properties. We test their importance with the ablation study on the detoxification task. + +
ModelACCSIMFLJ
Full model0.910.730.750.50
Mask all toxic tokens0.940.690.770.50
No similarity penalty0.920.730.750.50
No multiword replacement0.870.800.560.40
No toxicity penalty0.570.790.820.33
+ +Table 7: Results of the CondBERT ablation study on detoxification. + +We use two heuristics for content preservation: not masking the toxic tokens and reranking replacement candidates with respect to their similarity to the original tokens. Removing any of these heuristics leads to lower content preservation and higher style accuracy, showing the inverse correlation of these properties (see Table 7). However, the J score for these models stays the same. On the other hand, turning off the possibility of filling a single mask with multiple words reduces the fluency and style accuracy, although obviously yields a better content preservation score, because the output sentence contains less new words. This affects the J score which is reduced for this model. Finally, the greatest impact on the J metric is caused by eliminating the toxicity penalty. The ACC is reduced dramatically, and although the other two metrics slightly grow compared to the full model, they cannot compensate for the low style accuracy. + +# C ParaGeDi Ablation Study + +ParaGeDi model consists of a paraphrase, a language model trained with the generative-discriminative loss, and a style classifier for reranking hypotheses. In addition to that, we use a number of heuristics during inference. We conduct ablation study on the detoxification task to understand the usefulness of these components. We test the following variations of ParaGeDi: + +- no discriminative loss $(\lambda = 0)$ , +- no generative loss $(\lambda = 1)$ , +- no upper bound ( $u = \infty$ ), +- no discriminator $(w = 0)$ , + +
ModelACCSIMFLJ
Full ParaGeDi0.950.660.790.50
no reranking0.870.700.800.50
beam of size 50.930.670.790.50
no discriminative loss0.900.680.810.49
no smoothing0.960.630.780.47
no beam search0.880.660.700.41
no control of style strength0.560.800.810.38
no generative loss0.770.700.670.37
no upper bound0.990.350.760.27
+ +Table 8: Results of the ParaGeDi ablation study. + +- no extra control of style strength $(w = 1)$ , +- no probability smoothing $(\alpha = 0)$ , +- no reranking, +- no beam search (beam size of 1). + +In each configuration, all other parameters are fixed. The performance of models is given in Table 8. + +Decreasing the number of beams leads to the deterioration of fluency and of style strength because of the smaller number options for the reranker to choose from. Removing the reranker leads to lower style strength with small gains in similarity or fluency. Turning off the smoothing of probabilities makes similarity and fluency degrade a little. Removing the upper bound on the discriminative correction leads to nearly $100\%$ style transfer but to very low similarity of the generated sentences to the original ones, as the model starts hallucinating. Decreasing the $w$ parameter reduces style accuracy but improves fluency and similarity, showing a clear trade-off between them. + +The individual components of the loss are slightly less important for style than inference parameters. With only the discriminative loss the model is still able to successfully transform style in $77\%$ of the cases, and the generative loss alone is able to change the style in $90\%$ cases. The latter figure shows that the model equipped with style labels can discriminate between styles even if it was not explicitly trained to do that. On the other hand, the elimination of the generative loss results in a significant drop in fluency. Although the class-conditional LM in ParaGeDi is a GPT2 model which has already been trained for generation task, the lack of generation-based fine-tuning reduces the quality of the resulting text. + +# D Details of Mining the Parallel Corpus + +Here we describe in more detail the process of mining of a detoxifying parallel paraphrase corpus. We + +use the ParaNMT dataset (Wieting and Gimpel, 2018) comprised of 50 million English sentences and their paraphrases back-translated from Czech. We filter the dataset keeping only the sentence pairs with moderate similarity (0.6 to 0.95) and similar length (with difference at most $40\%$ ), which is approximately $50\%$ of the dataset. We compute the similarity as the cosine distance between the averaged BERT embeddings of all words in a sentence. After this similarity- and length-based filtering we score each sentence with a RoBERTa-based toxicity classifier from Section 5.1 and keep only the pairs with the difference in toxicity scores of at least $50\%$ . Thus, we obtain 500,000 sentence pairs. Their examples are given in Table 9. + +Manual inspection of a random sample of the selected pairs shows that around $10\%$ of them are invalid paraphrases, $40\%$ are in fact both toxic or both safe, and around $50\%$ of them are valid detoxifying paraphrases. This suggests that with more rigorous filtering we can yield a corpus for detoxification of around 250,000 high-quality parallel sentences, which is larger than the majority of existing parallel style transfer datasets. + +# E Qualitative Analysis + +Both automatic and manual joint scores show that our best models are halfway between useless and perfect. But the actual success rate is much less than half. We call a detoxified sentence "perfect" if all three annotators gave it the maximal scores for all three aspects. With this definition, only $20\%$ of ParaGeDi sentences and $14\%$ of CondBERT sentences are perfect, and only about $1.5\%$ of Mask&Infill sentences are perfect. + +As you can judge from Table 4, the main cause of imperfection for all models is distortion of meaning. Below we describe our manual investigation into the causes of this distortion. + +In half of the cases, ParaGeDi conveys the meaning more or less adequately. Its mistakes include: + +- replacement of toxic words by similarly looking less toxic words with different meaning (e.g. "whore" $\rightarrow$ "Who's who", "stop behaving like fascist thugs" $\rightarrow$ "Stop looking at fascism", "taxman massive cunt, only outdone by linuxcunt himself." $\rightarrow$ "Taxman's massive cut, outdone by Linuxcune himself"). +- replacement of sentence meaning ("the election was yours to lose") $\rightarrow$ "the election is to be won", "this crap hole institute run by motherfuckers and + +
ReferenceTranslationsimldtoxreftoxtrn
0If Alkar is flooding her with psychic waste, that explains the high level of neurotransmitters.if Alkar floods her with her mental waste, it would explain the high levels of neurotransmitter.0.780.010.010.98
1Now you're getting nasty.you're becoming disgusting.0.750.070.060.99
2Well, we could spare your life, for one.well, we can spare your life.0.920.270.210.98
3Ah! Monkey, you've got to snap out of it.monkey, you have to wake up.0.660.310.050.99
4I've got orders to put her down.I have orders to kill her.0.730.180.010.99
5I'm not gonna have a child... ...with the same genetic disorder as me who's gonna die. L...I'm not going to breed kids with a genetic disorder that makes them die.0.700.200.950.04
6They're all laughing at us, so we'll kick your ass.they're laughing at us. We'll show you.0.620.230.990.00
7Maine was very short on black people back then.there wasn't much black in Maine then.0.720.190.960.15
8Briggs, what the hell's happening?Briggs, what the hell is going on?0.920.000.160.84
9Another one simply had no clue what to do, so whenever he met my brother he'd beat the crap out of him, and then say:another simply didn't know what to do, so whenever he met my brother, he nearly beat the shit out of him.0.880.100.050.93
10I suppose you want me to buy you flowers and chocolates and whisper sweet nothings.you'd probably want me to buy you some chocolates and flowers... and whispered some pretty rubbish.0.800.160.000.98
11So now their spirits are cursed, walking back roads, waterways, and if they find an unfaithful man, they kill him, and that man is never seen again.their souls are cursed, they guard the paths, he says, and when they encounter an unfaithful man, he will be killed, and his body will never be found.0.750.010.840.14
12Freezing him.I'll freeze him!0.780.180.010.57
13Come on, Cal, leave that shit alone.come on, Cal, put it down.0.660.270.990.00
14So he's the Top dog.he's the tallest son of a bitch.0.610.360.000.99
15I swore when I went out with Xander Harris.... ...I'd rather die than datea fixer-upper again.when I was dating Alex Harris, I swore I'd rather die than go out with a loser.0.790.150.010.99
16I'm famous, and you're done.I'm famous, and you're dead.0.820.000.000.98
17To quote Jake Oppenheimer: I, who am about to die, must seem to them something "God-awful."...to quote Jake and Oppenheimer: "I must die, I must feel like a terrible god."0.700.180.000.68
18"Could you please be quiet, Miss Lavish?" said Moist.'could you keep your mouth shut, Miss Opulent?' 'Said Moist.0.810.100.000.76
19Murder for hire.murder to order.0.700.000.070.96
+ +Table 9: Examples of mined detoxifying paraphrases. Here sim is similarity between sentences, computed by (Wieting and Gimpel, 2018), ld is relative difference in length, $\mathbf{t o x}_{\mathrm{ref}}$ and $\mathbf{t o x}_{\mathrm{tn}}$ are toxicity scores calculated by our classifier. + +bastards” $\rightarrow$ “a deloitte institute for mothers and their children”) + +- Avoiding the toxic or difficult part, for example "why we gotta have this miscegenation crap ?" $\rightarrow$ "Why do we need to have it?". In some cases, however, ParaGeDi masks or rephrases the toxic part of the message, while still preserving the general meaning, for example "start there first you idiot!" $\rightarrow$ "Let's start there first." + +In general, ParaGeDi makes the impression of fantasising too much, because it often rewrites the whole sentence, and from time to time changes its structure significantly. + +CondBERT, on the other hand, usually preserves the sentence structure, but often replaces words with inappropriate substitutes, often antonyms: "selfish" $\rightarrow$ "misunderstood", "racists" $\rightarrow$ "politicians", "cunt" $\rightarrow$ "nursemaid", "to troll and harass" + +to try out and help", "asskissers" $\rightarrow$ "honest people", "retarded" $\rightarrow$ "beautiful", "whore" $\rightarrow$ "sweetheart". Sometimes these replacements are more adequate, e.g. "old cock" $\rightarrow$ "old-fashioned stuff", "your attitude is shit" $\rightarrow$ "your attitude is completely wrong", "bitch i warned yall" $\rightarrow$ "i guess i warned you". But the proportion of sentences with the meaning preserved is smaller for CondBERT, being less than $40\%$ . + +The DLSM and Template-based DRG models often preserve the meaning by just preserving the toxic words, so their total success rate is low. The Retrieve-only DRG model almost never preserves the meaning. The Mask&Infill model seems to be overfitted: it often replaces toxic words with irrelevant non-toxic words (e.g. "crap" $\rightarrow$ "compelling") that the model apparently considers to be the "markers" of the non-toxic style. These properties make + +the baselines unsuitable for the detoxification task without adaptation, and the CondBERT model is in fact such an adaptation. + +Typical mistakes of both ParaGeDi and CondBERT can be attributed mostly to the insufficiency of semantic understanding: they often replace toxic words with semantically related words of different (often opposite) meaning, or simply with similarly looking words. We conjecture that with a paraphraseer trained on a larger corpus (we have used only $2\%$ of ParaNMT) or on more difficult examples would improve the ability of ParaGeDi to preserve meaning. + +Generally, our models produce the impression of not being mature enough for fully automatic use with texts where meaning is important. However, they can be used to suggest detoxification options to human writers, or to detoxify the output of chit-chat bots where the cost of producing an inarticulate utterance is considerably less than the cost of producing a toxic one. + +# F Examples of Detoxification + +Table 10 shows the examples of detoxification by our models ParaGeDi and CondBERT and the best competitor Mask&Infill. + +
Inputid have relatives signing up for aol finally in the mid to late 90s forwarding me stupid conservative conspiracy theory garbage .
ParaGeDi (ours)I'd have relatives sign up for aol in the mid-to late 90s. and send me some unorthodox conspiracy theories.
CondBERT (ours)id have relatives signing up for aol finally in the mid to late 90s forwarding me with some very conservative conspiracy theory stuff .
Mask&Infillid have relatives signing up for aol finally in the mid to late 90s forwarding me to conservative conspiracy theory ideas .
Inputwhy dont you bung off . smoke a fag . and have a cuppa ?
ParaGeDi (ours)Why don't you take a break. smoke a cigar. and have a cup of tea?
CondBERT (ours)why dont you bung off . smoke a great deal . and have a cuppa ?
Mask&Infillwhy dont you bung off . smoke a compelling compelling . and have a cuppa ?
Inputcan someone please fix that crap ?
ParaGeDi (ours)Can someone please do that?
CondBERT (ours)can someone please fix that stuff ?
Mask&Infillcan someone please fix that compelling ?
Inputits a very stupid name !
ParaGeDi (ours)It's a very strange name!
CondBERT (ours)its a very . . . strange . . . name !
Mask&Infillits a very compelling name !
Inputim a rookie pilot and would have never have done something this stupid .
ParaGeDi (ours)I've been a pilot for a while. and I never would have done anything like
CondBERT (ours)im a rookie pilot and would have never have done something this wrong .
Mask&Infillim a rookie pilot and would have never have done something this compelling .
Inputcut the damn funding and lets move on to the next program .
ParaGeDi (ours)Cut the funding and move on to the next program.
CondBERT (ours)cut the amount of the funding and lets move on to the next program .
Mask&Infillcut the compelling funding and lets move on to the next program .
Inputbitch i warned yell . didnt i ?
ParaGeDi (ours)Bits I've warned a lot. right?
CondBERT (ours)i guess i warned you . didnt i ?
Mask&Infillcompelling i warned yall . didnt i ?
Inputi was such an asshole .
ParaGeDi (ours)I was an ad.
CondBERT (ours)i was such an emotional mess .
Mask&Infilli was such an compelling .
Inputyour statements show me how ignorant you are .
ParaGeDi (ours)Your statements show me that you'd be indifferent.
CondBERT (ours)your statements show me how very wronged you are .
Mask&Infillyour statements show me how compelling you are .
Inputtrump will see justin as a lightweight fool .
ParaGeDi (ours)Trump will see justin as a light-hearted man.
CondBERT (ours)trump will see justin as a lightweight world title contender .
Mask&Infilltrump will see justin as a lightweight compelling .
Inputthis whole article is bullshit .
ParaGeDi (ours)This article's not a good deal.
CondBERT (ours)this whole article is considered incomplete .
Mask&Infillthis whole article is compelling .
Inputplease dont revert my edits without good reasoning just makes you look stupid .
ParaGeDi (ours)Please do not reverse my edits without a good reason.
CondBERT (ours)please dont try to do my edits without good reasoning just makes you look pretty bad .
Mask&Infillplease dont revert my edits without good reasoning just makes you look compelling .
Inputdo some research before you make a fool of yourself .
ParaGeDi (ours)Do a bit of research.
CondBERT (ours)do some research before you make a bigger picture out of my life .
Mask&Infilldo some research before you make a compelling of yourself .
Inputtry not to make wikipedia look so stupid .
ParaGeDi (ours)Try not to make Wikipedia seem like a bad idea.
CondBERT (ours)try not to make wikipedia look so unsettling .
Mask&Infilltry not to make wikipedia look so compelling .
Inputi will make sure i revert any stupid edits you make from now on .
ParaGeDi (ours)I'll be sure to correct any wrong edits that you make. from now on.
CondBERT (ours)i will make sure i do not make any mistake about any edits you make from now on .
Mask&Infilli will make sure i revert any compelling edits you make from now on .
+ +Table 10: Examples of detoxification by the best-performing models considered in our study. \ No newline at end of file diff --git a/textdetoxificationusinglargepretrainedneuralmodels/images.zip b/textdetoxificationusinglargepretrainedneuralmodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2b9f2df5559bcf8e4a70903d13ee0a9edac7f1c0 --- /dev/null +++ b/textdetoxificationusinglargepretrainedneuralmodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf51159254e1431534a739547d443fb741cb3756d0ec889de6b9b0bfb83ece51 +size 1147624 diff --git a/textdetoxificationusinglargepretrainedneuralmodels/layout.json b/textdetoxificationusinglargepretrainedneuralmodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7c26b23bf98eb4d70b9e6833c0983c7f7d4a39dc --- /dev/null +++ b/textdetoxificationusinglargepretrainedneuralmodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b817d94ea1f9c257ef3dd4fca1f1910462e7c078a62e4a0c7fe39b7524fe4b8 +size 552693 diff --git a/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_content_list.json b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..947dbb17b3c05529ebccb8eedea434b478a28a33 --- /dev/null +++ b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:567db66e6af9bf625370c58dcdea20bea0ac18d094559941811551337c4b85d5 +size 106114 diff --git a/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_model.json b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9aa25e7009d9f7eb4dd4e5415bf92f1a0514749e --- /dev/null +++ b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42d750cb8b94e01ae58ace8ae398251261f37a7e49b22d65382599727f892ddc +size 126872 diff --git a/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_origin.pdf b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c107e57a5c786666007f964f7180b5f5b1cc3d6 --- /dev/null +++ b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/d514dd00-a8f8-4644-ab58-94dcd823a2a7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3cdc2a5399c58d363ffb637be9909f8b7ba9321ed171d42d78acda00eabb3fd +size 632710 diff --git a/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/full.md b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9150da845548e22706c5f17089fe6abd0b7ce075 --- /dev/null +++ b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/full.md @@ -0,0 +1,362 @@ +# The Devil is in the Detail: Simple Tricks Improve Systematic Generalization of Transformers + +Róbert Csordás Kazuki Irie Jürgen Schmidhuber +The Swiss AI Lab IDSIA, USI & SUPSI, Lugano, Switzerland +{robert, kazuki, juergen}@idsia.ch + +# Abstract + +Recently, many datasets have been proposed to test the systematic generalization ability of neural networks. The companion baseline Transformers, typically trained with default hyper-parameters from standard tasks, are shown to fail dramatically. Here we demonstrate that by revisiting model configurations as basic as scaling of embeddings, early stopping, relative positional embedding, and Universal Transformer variants, we can drastically improve the performance of Transformers on systematic generalization. We report improvements on five popular datasets: SCAN, CFQ, PCFG, COGS, and Mathematics dataset. Our models improve accuracy from $50\%$ to $85\%$ on the PCFG productivity split, and from $35\%$ to $81\%$ on COGS. On SCAN, relative positional embedding largely mitigates the EOS decision problem (Newman et al., 2020), yielding $100\%$ accuracy on the length split with a cutoff at 26. Importantly, performance differences between these models are typically invisible on the IID data split. This calls for proper generalization validation sets for developing neural networks that generalize systematically. We publicly release the code to reproduce our results1. + +# 1 Introduction + +Systematic generalization (Fodor et al., 1988) is a desired property for neural networks to extrapolate compositional rules seen during training beyond training distribution: for example, performing different combinations of known rules or applying them to longer problems. Despite the progress of artificial neural networks in recent years, the problem of systematic generalization still remains unsolved (Fodor and McLaughlin, 1990; Lake and Baroni, 2018; Liska et al., 2018; Greff et al., 2020; Hupkes et al., 2020). While there has been much progress + +in the past years (Bahdanau et al., 2019; Korrel et al., 2019; Lake, 2019; Li et al., 2019; Russian et al., 2019), in particular on the popular SCAN dataset (Lake and Baroni, 2018) where some methods even achieve $100\%$ accuracy by introducing some non-trivial symbolic components into the system (Chen et al., 2020; Liu et al., 2020), the flexibility of such solutions is questionable. In fact, the existing SCAN-inspired solutions have limited performance gains on other datasets (Furrer et al., 2020; Shaw et al., 2020). It is thus not enough to solely focus on the SCAN dataset to progress research on systematic generalization. + +Recently, many datasets have been proposed for testing systematic generalization, including PCFG (Hupkes et al., 2020) and COGS (Kim and Linzen, 2020). The baseline Transformer models which are released together with the dataset are typically shown to dramatically fail at the task. However, the configurations of these baseline models are questionable. In most cases, some standard practices from machine translation are applied without modification. Also, some existing techniques such as relative positional embedding (Shaw et al., 2018; Dai et al., 2019), which are relevant for the problem, are not part of the baseline. + +In order to develop and evaluate methods to improve systematic generalization, it is necessary to have not only good datasets but also strong baselines to correctly evaluate the limits of existing architectures and to avoid false sense of progress over bad baselines. In this work, we demonstrate that the capability of Transformers (Vaswani et al., 2017) and in particular its universal variants (Dehghani et al., 2019) on these tasks are largely underestimated. We show that careful designs of model and training configurations are particularly important for these reasoning tasks testing systematic generalization. By revisiting configurations such as basic scaling of word and positional embeddings, early stopping strategy, and relative positional em + +bedding, we dramatically improve the performance of the baseline Transformers. We conduct experiments on five datasets: SCAN (Lake and Baroni, 2018), CFQ (Keysers et al., 2020), PCFG (Hupkes et al., 2020), COGS (Kim and Linzen, 2020), and Mathematical dataset (Saxton et al., 2019). In particular, our new models improve the accuracy on the PCFG productivity split from $50\%$ to $85\%$ , on the systematicity split from $72\%$ to $96\%$ , and on COGS from $35\%$ to $81\%$ over the existing baselines. On the SCAN dataset, we show that our models with relative positional embedding largely mitigate the so-called end-of-sentence (EOS) decision problem (Newman et al., 2020), achieving $100\%$ accuracy on the length split with a cutoff at 26. + +Also importantly, we show that despite these dramatic performance gaps, all these models perform equally well on IID validation datasets. The consequence of this observation is the need for proper generalization validation sets for developing neural networks for systematic generalization. + +We thoroughly discuss guidelines that empirically yield good performance across various datasets, and we will publicly release the code to make our results reproducible. + +# 2 Datasets and Model Architectures for Systematic Generalization + +Here we describe the five datasets, and specify the Transformer model variants we use in our experiments. The selected datasets include both already popular ones and recently proposed ones. Statistics of the datasets can be found in Table 10 in the appendix. + +# 2.1 Datasets + +Many datasets in the language domain have been proposed to test systematic generalization. All datasets we consider here can be formulated as a sequence-to-sequence mapping task (Sutskever et al., 2014; Graves, 2012). Common to all these datasets, the test set is sampled from a distribution which is systematically different from the one for training: for example, the test set might systematically contain longer sequences, new combinations or deeper compositions of known rules. We call this split the generalization split. Most of the datasets also come with a conventional split, where the train and test (and validation, if available) sets are independently and identically distributed samples. We call this the IID split. In this paper, we consider the + +following five datasets: + +SCAN (Lake and Baroni, 2018). The task consists of mapping a sentence in natural language into a sequence of commands simulating navigation in a grid world. The commands are compositional: e.g. an input jump twice should be translated to JUMP JUMP. It comes with multiple data splits: in addition to the "simple" IID split, in the "length" split, the training sequences are shorter than test ones, and in the "add primitive" splits, some commands are presented in the training set only in isolation, without being composed with others. The test set focuses on these excluded combinations. + +CFQ (Keysers et al., 2020). The task consists of translating a natural language question to a Freebase SPARQL query. For example Was M0 a director and producer of M1 should be translated to SELECT count $(\star)$ WHERE {M0 ns:filmdirector.film M1 . M0 ns:film.producer.film | ns:filmproduction_company.films M1}. The authors introduce splits based on "compound divergence" which measures the difference between the parse trees in the different data splits. The authors experimentally show that it is well correlated with generalization difficulty. It also comes with a length-based split. + +PCFG (Hupkes et al., 2020). The task consists of list manipulations and operations that should be executed. For example, reverse copy O14 O4 C12 J14 W3 should be translated to W3 J14 C12 O4 O14. It comes with different splits for testing different aspects of generalization. In this work, we focus on the "productivity" split, which focuses on generalization to longer sequences, and on the "systematicity" split, which is about recombining constituents in novel ways. + +COGS (Kim and Linzen, 2020). The task consists of semantic parsing which maps an English sentence to a logical form. For example, The puppy slept. should be translated to * puppy (x_1); sleep . agent (x_2, x_1). It comes with a single split, with a training, IID validation and OOD generalization testing set. + +Mathematics Dataset (Saxton et al., 2019). The task consists of high school level textual math questions, e.g. What is -5 - 110911? should be translated to -110916. The data is + +split into different subsets by the problem category, called modules. Some of them come with an extrapolation set, designed to measure generalization. The amount of total data is very large and thus expensive to train on, but different modules can be studied individually. We focus on "add_or_sub" and "place_value" modules. + +# 2.2 Model Architectures + +We focus our analysis on two Transformer architectures: standard Transformers (Vaswani et al., 2017) and Universal Transformers (Dehghani et al., 2019), and in both cases with absolute or relative positional embedding (Dai et al., 2019). Our Universal Transformer variants are simply Transformers with shared weights between layers, without adaptive computation time (Schmidhuber, 2012; Graves, 2016) and timestep embedding. Positional embedding are only added to the first layer. + +Universal Transformers are particularly relevant for reasoning and algorithmic tasks. For example, if we assume a task which consists in executing a sequence of operations, a regular Transformer will learn successive operations in successive layers with separate weights. In consequence, if only some particular orderings of the operations are seen during training, each layer will only learn a subset of the operations, and thus, it will be impossible for them to recombine operations in an arbitrary order. Moreover, if the same operation has to be reused multiple times, the network has to re-learn it, which is harmful for systematic generalization and reduces the data efficiency of the model (Csordás et al., 2021). Universal Transformers have the potential to overcome this limitation: sharing the weights between each layer makes it possible to reuse the existing knowledge from different compositions. On the downside, the Universal Transformer's capacity can be limited because of the weight sharing. + +# 3 Improving Transformers on Systematic Generalization + +In this section, we present methods which greatly improve Transformers on systematic generalization tasks, while they could be considered as details in standard tasks. For each method, we provide experimental evidences on a few representative datasets. In Section 4, we apply these findings to all datasets. + +# 3.1 Addressing the EOS Decision Problem with Relative Positional Embedding + +The EOS decision problem. A thorough analysis by Newman et al. (2020) highlights that LSTMs and Transformers struggle to generalize to longer output lengths than they are trained for. Specifically, it is shown that the decision when to end the sequence (the EOS decision) often overfits to the specific positions observed in the train set. To measure whether the models are otherwise able to solve the task, they conduct a so-called oracle evaluation: they ignore the EOS token during evaluation, and use the ground-truth sequence length to stop decoding. The performance with this evaluation mode is much better, which illustrates that the problem is indeed the EOS decision. More surprisingly, if the model is trained without EOS token as part of output vocabulary (thus it can only be evaluated in oracle mode), the performance is further improved. It is concluded that teaching the model when to end the sequence has undesirable side effects on the model's length generalization ability. + +We show that the main cause of this EOS decision problem in the case of Transformers is the absolute positional embedding. Generally speaking, the meaning of a word is rarely dependent on the word's absolute position in a document but depends on its neighbors. Motivated by this assumption, various relative positional embedding methods (Shaw et al., 2018; Dai et al., 2019) have been proposed. Unfortunately, they have not been considered for systematic generalization in prior work (however, see Sec. 5), even though they are particularly relevant for that. + +We test Transformers with relative positional embedding in the form used in Transformer XL (Dai et al., 2019). Since it is designed for auto-regressive models, we directly apply it in the decoder of our model, while for the encoder, we use a symmetrical variant of it (see Appendix C). The interface between encoder and decoder uses the standard attention without any positional embedding. + +Our experimental setting is similar to Newman et al. (2020). The length split in SCAN dataset restricts the length of the train samples to 22 tokens (the test set consists of samples with an output of more than 22 tokens). This removes some compositions from the train set entirely, which introduces additional difficulty to the task. $80\%$ of the test set consists of these missing compositions. In order to mitigate the issue of unknown composition + +Table 1: Exact match accuracies on length splits with different cutoffs. Reported results are the median of 5 runs. Trafo denotes Transformers. The numbers in the rows $+\mathrm{EOS} + \mathrm{Oracle}$ and $-\mathrm{EOS} + \mathrm{Oracle}$ are taken from Newman et al. (2020) as reference numbers but they can not be compared to others as they are evaluated with oracle length. Our models use different hyperparameters compared to theirs. We refer to Section 3.1 for details. + +
l (length cutoff)2224252627283032333640
Reference+EOS0.000.050.040.000.090.000.090.350.000.000.00
+EOS+Oracle0.530.510.690.760.740.570.780.660.771.000.97
-EOS+Oracle0.580.540.670.820.880.850.890.821.001.001.00
Ours (+EOS)Trafo0.000.040.190.290.300.080.240.360.000.000.00
+ Relative PE0.200.120.310.611.001.001.000.941.001.001.00
Universal Trafo0.020.050.140.210.260.000.060.350.000.000.00
+ Relative PE0.200.120.711.001.001.001.001.001.001.001.00
+ +and focus purely on the length problem, Newman et al. (2020) re-split SCAN by introducing different length cutoffs and report the performance of each split. We test our models similarly. However, our preliminary experiments showed the performance of the original model is additionally limited by being too shallow: it uses only 2 layers for both the encoder and decoder. We increased the number of layers to 3. To compensate for the increased number of parameters, we decrease the size of the feed-forward layers from 1024 to 256. In total, this reduces the number of parameters by $30\%$ . We train our models with Adam optimizer, a learning rate of $10^{-4}$ , batch size of 128 for 50k steps. + +The results are shown in Table 1. In order to show that our changes of hyperparameters are not the main reason for the improved performance, we report the performance of our modified model without relative positional embedding (row Trafo). We also include the results from Newman et al. (2020) for reference. We report the performance of Universal Transformer models trained with identical hyperparameters. All our models are trained to predict the EOS token and are evaluated without oracle (+EOS configuration). It can be seen that both our standard and Universal Transformers with absolute positional embedding have near-zero accuracy for all length cutoffs, whereas models with relative positional embedding excel: they even outperform the models trained without EOS prediction and evaluated with the ground-truth length. + +Although Table 1 highlights the advantages of relative positional embedding and shows that they can largely mitigate the EOS-overfitting issue, this does not mean that the problem of generalizing to longer sequences is fully solved. The sub-optimal performance on short length cutoffs (22-25) indicates that the model finds it hard to zero-shot gen + +eralize to unseen compositions of specific rules. To improve these results further, research on models which assume analogies between rules and compositions are necessary, such that they can recombine known constituents without any training example. + +Further benefits of relative positional embedding. In addition to the benefit highlighted in the previous paragraph, we found that models with relative positional embedding are easier to train in general. They converge faster (Figure 6 in the appendix) and are less sensitive to batch size (Table 9 in the appendix). As another empirical finding, we note that relative Transformers without shared layers sometimes catastrophically fail before reaching their final accuracy: the accuracy drops to 0, and it never recovers. We observed this with PCFG productivity split and the "Math: place_value" task. Reducing the number of parameters (either using Universal Transformers or reducing the state size) usually stabilizes the network. + +# 3.2 Model Selection Should Be Done Carefully + +The danger of early stopping. Another crucial aspect greatly influencing the generalization performance of Transformers is model selection, in particular early stopping. In fact, on these datasets, it is a common practice to use only the IID split to tune hyperparameters or select models with early stopping (e.g. Kim and Linzen (2020)). However, since any reasonable models achieve nearly $100\%$ accuracy on the IID validation set, there is no good reason to believe this to be a good practice for selecting models for generalization splits. To test this hypothesis, we train models on COGS dataset without early stopping, but with a fixed number of 50k training steps. The best model achieved a test accuracy of $81\%$ , while the original performance + +![](images/e3c2fa09877e3160ba8ca4df508664b345f980cfb640dc8d97099815624af73d.jpg) +Figure 1: Generalization accuracy on COGS as a function of training steps for standard Transformers with different embedding scaling schemes. The vertical lines show the median of the early stopping points for the five runs. Early stopping parameters are from Kim and Linzen (2020). "Token Emb. Up., Noam" corresponds to the baseline configuration (Kim and Linzen, 2020). See Sec. 3.3 for details on scaling. + +Table 2: Final IID validation and generalizations accuracy for COGS (50k steps) and PCFG Productivity set (300k steps) with different scaling (Section 3.3). Token Embedding Upscaling (TEU) is unstable on PCFG with our hyperparameters. Position Embedding Downscaling (PED) performs the best on both datasets. + +
IID ValidationGen. Test
COGSTEU1.00 ± 0.000.78 ± 0.03
No scaling1.00 ± 0.000.62 ± 0.06
PED1.00 ± 0.000.80 ± 0.00
PCFGTEU0.92 ± 0.070.47 ± 0.27
No scaling0.97 ± 0.010.63 ± 0.02
PED0.96 ± 0.010.65 ± 0.03
+ +by Kim and Linzen (2020) is $35\%$ . Motivated by this huge performance gap, we had no other choice but to conduct an analysis on the generalization split to demonstrate the danger of early stopping and discrepancies between the performance on the IID and generalization split. The corresponding results are shown in Figure 1 (further effect of embedding scaling is discussed in next Sec. 3.3) and Table 2. Following Kim and Linzen (2020), we measure the model's performance every 500 steps, and mark the point where early stopping with patience of 5 would pick the best performing model. It can be seen that in some cases the model chosen by early stopping is not even reaching half of the final generalization accuracy. + +To confirm this observation in the exact setting of Kim and Linzen (2020), we also disabled the early stopping in the original codebase ${}^{2}$ ,and observed that the accuracy improved to 65% without any other tricks. We discuss further performance improvements on COGS dataset in Section 4.4. + +![](images/1ff56ed857ea654dd24b3429ca227f72c86af1f83db3e98140114c50c33e18c1.jpg) +Figure 2: Relationship between validation loss and test accuracy (same distribution) on CFQ MCD 1 split for a relative Transformer. The color shows the training step. Five runs are shown. The loss has a logarithmic scale. High accuracy corresponds to higher loss, which is unexpected. For detailed analysis, see Figure 5. + +The lack of validation set for the generalization split. A general problem raised in the previous paragraph is the lack of validation set for evaluating models for generalization. Most of the datasets come without a validation set for the generalization split (SCAN, COGS, and PCFG). Although CFQ comes with such a set, the authors argue that only the IID split should be used for hyperparameter search, and it is not clear what should be used for model development. + +In order to test novel ideas, a way to gradually measure progress is necessary, such that the effect of changes can be evaluated. If the test set is used for developing the model, it implicitly risks overfitting to this test set. On the other hand, measuring performance on the IID split does not necessarily provide any valuable information about the generalization performance on the systematically different test set (see Table 2). The IID accuracy of all the considered datasets is $100\%$ (except on PCFG where it's also almost $100\%$ ); thus, no further improvement, nor potential difference between generalization performance of models can be measured (see also Table 8 in the appendix). + +It would be beneficial if future datasets would have a validation and test set for both the IID and the generalization split. For the generalization split, the test set could be designed to be more difficult than the validation set. This way, the validation set can be used to measure progress during development, but overfitting to it would prevent the model to generalize well to the test set. Such a division can be easily done on the splits for testing productivity. For other types of generalization, we could use multiple datasets sharing the same generalization problem. Some of them could be dedicated for development and others for testing. + +![](images/5c60636133790fc3ead50e542811dbf5fa660b1873f66cff4d261bd0831acac4.jpg) + +![](images/e5f3823d543fd38e222d3727a3d20b889ff0648898ac893a6517b5b18f9d2c0f.jpg) +Figure 3: Test loss and accuracy on PCFG during training. The loss exhibits an epoch-wise double descent phenomenon (Nakkiran et al., 2019), while the accuracy increases monotonically. Standard Transformer with PED (Sec. 3.3), Universal Transformer with absolute, and relative positional embeddings are shown. + +Intriguing relationship between generalization accuracy and loss. Finally, we also note the importance of using accuracy (instead of loss) as the model selection criterion. We find that the generalization accuracy and loss do not necessarily correlate, while sometimes, model selection based on the loss is reported in practice e.g. in Kim and Linzen (2020). Examples of this undesirable behavior are shown on Figure 2 for CFQ and on Figure 4 in the appendix for COGS dataset. On these datasets, the loss and accuracy on the generalization split both grows during training. We conducted an analysis to understand the cause of this surprising phenomenon, we find that the total loss grows because the loss of the samples with incorrect outputs increases more than it improves on the correct ones. For the corresponding experimental results, we refer to Figure 5 in the appendix. We conclude that even if a validation set is available for the generalization split, it would be crucial to use the accuracy instead of the loss for early stopping and hyperparameter tuning. + +Finally, on PCFG dataset, we observed epochwise double descent phenomenon (Nakkiran et al., 2019), as shown in Figure 3. This can lead to equally problematic results if the loss is used for model selection or tuning. + +# 3.3 Large Impacts of Embedding Scaling + +The last surprising detail which greatly influences generalization performance of Transformers is the choice of embedding scaling scheme. This is espe + +cially important for Transformers with absolute positional embedding, where the word and positional embedding have to be combined. We experimented with the following scaling schemes: + +1. Token Embedding Upscaling (TEU). This is the standard scaling used by Vaswani et al. (2017). It uses Glorot initialization (Glorot and Bengio, 2010) for the word embeddings. However, the range of the sinusoidal positional embedding is always in $[-1, 1]$ . Since the positional embedding is directly added to the word embeddings, this discrepancy can make the model untrainable. Thus, the authors upscale the word embeddings by $\sqrt{d_{\mathrm{model}}}$ where $d_{\mathrm{model}}$ is the embedding size. OpenNMT3, the framework used for the baseline models for PCFG and COGS datasets respectively by Hupkes et al. (2020) and Kim and Linzen (2020), also uses this scaling scheme. + +2. No scaling. It initializes the word embedding with $\mathcal{N}(0,1)$ (normal distribution with mean 0 and standard deviation of 1). Positional embeddings are added without scaling. +3. Position Embedding Downscaling (PED), which uses Kaiming initialization (He et al., 2015), and scales the positional embeddings by $\frac{1}{\sqrt{d_{\mathrm{model}}}}$ . + +The PED differs from TEU used in Vaswani et al. (2017) in two ways: instead of scaling the embedding up, PED scales the positional embedding down and uses Kaiming instead of Glorot initialization. The magnitude of the embeddings should not depend on the number of words in the vocabulary but on the embedding dimension. + +Table 2 shows the results. Although "no scaling" variant is better than TEU on the PCFG test set, it is worse on the COGS test set. PED performs consistently the best on both datasets. Importantly, the gap between the best and worst configurations is large on the test sets. The choice of scaling thus also contributes in the large improvements we report over the existing baselines. + +# 4 Results Across Different Datasets + +In this section, we apply the methods we illustrated in the previous section across different datasets. Table 3 provides an overview of all improvements we + +obtain on all considered datasets. Unless reported otherwise, all results are the mean and standard deviation of 5 different random seeds. If multiple embedding scaling schemes are available, we pick the best performing one for a fair comparison. Transformer variants with relative positional embedding outperform the absolute variants on almost all tested datasets. Except for COGS and CFQ MCD 1, the universal variants outperform the standard ones. In the following, we discuss and highlight the improvements we obtained for each individual dataset. + +# 4.1 SCAN + +We focused on the length split of the dataset. We show that it is possible to mitigate the effect of overfitting to the absolute position of the EOS token by using relative positional embedding. We already discussed the details in Sec. 3.1 and Table 1. + +# 4.2 CFQ + +On the output length split of CFQ, our Universal Transformer with absolute positional embedding achieves significantly better performance than the one reported in Keysers et al. (2020): $77\%$ versus $\sim 66\%$ . Here, we were unable to identify the exact reason for this large improvement. The only architectural difference between the models is that ours does not make use of any timestep (i.e. layer ID) embedding. Also, the positional embedding is only injected to the first layer in case of absolute positional embeddings (Sec. 2.2). The relative positional embedding variant performs even better, achieving $81\%$ . This confirms the importance of using relative positional embedding as a default choice for length generalization tasks, as we also demonstrated on SCAN in Sec. 3.1. + +On the MCD splits, our results slightly outperform the baseline in Keysers et al. (2020), as shown in Table 3. Relative Universal Transformers perform marginally better than all other variants, except for MCD 1 split, where the standard Transformer wins with a slight margin. We use hyperparameters from Keysers et al. (2020). We report performance after 35k training training steps. + +# 4.3 PCFG + +The performance of different models on the PCFG dataset is shown on Table 3. First of all, simply by increasing the number of training epochs from + +25, used by Hupkes et al. (2020), to $\sim 237$ (300k steps), our model achieves $65\%$ on the productivity split compared to the $50\%$ reported in Hupkes et al. (2020) and $87\%$ compared to $72\%$ on the systematicity split. Furthermore, we found that Universal Transformers with relative positional embeddings further improve performance to a large extent, achieving $85\%$ final performance on the productivity and $96\%$ on the systematicity split. We experienced instabilities while training Transformers with relative positional embeddings on the productivity split; thus, the corresponding numbers are omitted in Table 3 and Figure 6 in the appendix. + +# 4.4 COGS + +On COGS, our best model achieves the generalization accuracy of $81\%$ which greatly outperforms the $35\%$ accuracy reported in Kim and Linzen (2020). As we discussed in Sec. 3.2, just by removing early stopping in the setting of Kim and Linzen (2020), the performance improves to $65\%$ . Moreover, the baseline with early stopping is very sensitive to the random seed and even sensitive to the GPU type it is run on. Changing the seed in the official repository from 1 to 2 causes a dramatic performance drop with a $2.5\%$ final accuracy. By changing the scaling of embeddings (Sec. 3.3), disabling label smoothing, fixing the learning rate to $10^{-4}$ , we achieved $81\%$ generalization accuracy, which is stable over multiple random seeds. + +Table 3 compares different model variants. Standard Transformers with absolute and relative positional encoding perform similarly, with the relative positional variant having a slight advantage. Here Universal Transformers perform slightly worse. + +# 4.5 Mathematics Dataset + +We also test our approaches on subsets of Mathematics Dataset (Saxton et al., 2019). Since training models on the whole dataset is too resource-demanding, we only conduct experiments on two subsets: "place_value" and "add_or_sub". + +The results are shown in Table 3. While we can not directly compare our numbers with those reported in Saxton et al. (2019) (a single model is jointly trained on the whole dataset there), our results show that relative positional embedding is advantageous for the generalization ability on both subsets. + +Table 3: Test accuracy of different Transformer (Trafo) variants on the considered datasets. See Sec. 4 for details. The last column shows previously reported accuracies. References: [1] Newman et al. (2020), [2] Keysers et al. (2020), [3] https://github.com/google-research/google-research/tree/master/ cfq, [4] Hupkes et al. (2020), [5] Kim and Linzen (2020), [6] Saxton et al. (2019). Results marked with * cannot be directly compared because of different training setups. $\sim$ denotes approximative numbers read from charts reported in previous works. + +
TrafoUni. TrafoRel. TrafoRel. Uni. TrafoPrior Work
SCAN (length cutoff=26)0.30 ± 0.020.21 ± 0.010.72 ± 0.211.00 ± 0.000.00[1]
CFQ Output length0.57 ± 0.000.77 ± 0.020.64 ± 0.060.81 ± 0.01~ 0.66[2]
CFQ MCD 10.40 ± 0.010.39 ± 0.030.39 ± 0.010.39 ± 0.040.37 ± 0.02[3]
CFQ MCD 20.10 ± 0.010.09 ± 0.020.09 ± 0.010.10 ± 0.020.08 ± 0.02[3]
CFQ MCD 30.11 ± 0.000.11 ± 0.010.11 ± 0.010.11 ± 0.030.11 ± 0.00[3]
CFQ MCD mean0.20 ± 0.140.20 ± 0.140.20 ± 0.140.20 ± 0.140.19 ± 0.01[2]
PCFG Productivity split0.65 ± 0.030.78 ± 0.01-0.85 ± 0.010.50 ± 0.02[4]
PCFG Systematicity split0.87 ± 0.010.93 ± 0.010.89 ± 0.020.96 ± 0.010.72 ± 0.00[4]
COGS0.80 ± 0.000.78 ± 0.030.81 ± 0.010.77 ± 0.010.35 ± 0.06[5]
Math: add_or_sub0.89 ± 0.010.94 ± 0.010.91 ± 0.030.97 ± 0.01~ 0.91[6]*
Math: place_value0.12 ± 0.070.20 ± 0.02-0.75 ± 0.10~ 0.69[6]*
+ +# 5 Related Work + +Many recent papers focus on improving generalization on the SCAN dataset. Some of them develop specialized architectures (Korrel et al., 2019; Li et al., 2019; Russin et al., 2019; Gordon et al., 2020; Herzig and Berant, 2020) or data augmentation methods (Andreas, 2020), others apply meta-learning (Lake, 2019). As an alternative, the CFQ dataset proposed in (Keysers et al., 2020) is gaining attention recently (Guo et al., 2020; Furrer et al., 2020). Mathematical problem solving has also become a popular domain for testing generalization of neural networks (Kaiser and Sutskever, 2016; Schlag et al., 2019; Charton et al., 2021). The PCFG (Hupkes et al., 2020) and COGS (Kim and Linzen, 2020) are also datasets proposed relatively recently. Despite increasing interests in systematic generalization tasks, interestingly, no prior work has questioned the baseline configurations which could be overfitted to the machine translation tasks. + +Generalizing to longer sequences have been proven to be especially difficult. Currently only hybrid task-specific neuro-symbolic approaches can solve it (Nye et al., 2020; Chen et al., 2020; Liu et al., 2020). In this work, we focus on a subproblem required for length generalization: the EOS decision problem (Newman et al., 2020), and we show that it can be mitigated by using relative positional embeddings. + +The study of generalization ability of neural networks at different stages of training has been a + +general topic of interest (Nakkiran et al., 2019; Roelofs, 2019). Our analysis has shown that this question is particularly relevant to the problem of systematic generalization, as demonstrated by large performance gaps in our experiments, which has not been discussed in prior work. + +Prior work proposed several sophisticated initialization methods for Transformers (Zhang et al., 2019; Zhu et al., 2021), e.g. with a purpose of removing the layer normalization components (Huang et al., 2020). While our work only revisited basic scaling methods, we demonstrated their particular importance for systematic generalization. + +In recent work, Ontañón et al. (2021) have also focused on improving the compositional generalization abilities of Transformers. In addition to relative positional encodings and Universal Transformers, novel architectural changes such as "copy decoder" as well as dataset-specific "intermediate representations" (Herzig et al., 2021) have been studied. However, other aspects we found crucial, such as early stopping, scaling of the positional embeddings, and the validation set issues have not been considered. In consequence, our models achieve substantially higher performance than the best results reported by Ontañón et al. (2021) across all standard datasets: PCFG, COGS, and CFQ (without intermediate representations). + +Finally, our study focused on the basic Trans + +former architectures. However, the details discussed above in the context of algorithmic tasks should also be relevant for other Transformer variants and fast weight programmers (Schmidhuber, 1992; Schlag et al., 2021; Irie et al., 2021), as well as other architectures specifically designed for algorithmic reasoning (Graves et al., 2016; Kaiser and Sutskever, 2016; Csordás and Schmidhuber, 2019; Freivalsd et al., 2019). + +# 6 Conclusion + +In this work we showed that the performance of Transformer architectures on many recently proposed datasets for systematic generalization can be greatly improved by revisiting basic model and training configurations. Model variants with relative positional embedding often outperform the ones with absolute positional embedding. They also mitigate the EOS decision problem, an important problem previously found by Newman et al. (2020) when considering the length generalization of neural networks. This allows us to focus on the problem of compositions in the future, which is the remaining problem for the length generalization. + +We also demonstrated that reconsidering early stopping and embedding scaling can greatly improve baseline Transformers, in particular on the COGS and PCFG datasets. These results shed light on the discrepancy between the model performance on the IID validation set and the test accuracy on the systematically different generalization split. As a consequence, currently common practice of validating models on the IID dataset is problematic. We conclude that the community should discuss proper ways to develop models for systematic generalization. In particular, we hope that our work clearly demonstrated the necessity of a validation set for systematic generalization in order to establish strong baselines and to avoid a false sense of progress. + +# Acknowledgments + +We thank Aleksandar Stanić and Imanol Schlag for their helpful comments and suggestions on an earlier version of the manuscript. This research was partially funded by ERC Advanced grant no: 742870, project AlgoRNN, and by Swiss National Science Foundation grant no: 200021_192356, project NEUSYM. We thank hardware donations from NVIDIA & IBM. + +# References + +Jacob Andreas. 2020. Good-enough compositional data augmentation. In Proc. Association for Computational Linguistics (ACL), pages 7556-7566, Virtual only. +Dzmitry Bahdanau, Harm de Vries, Timothy J O'Donnell, Shikhar Murty, Philippe Beaudoin, Yoshua Bengio, and Aaron Courville. 2019. CLOSURE: Assessing systematic generalization of CLEVR models. In ViGIL workshop, NeurIPS, Vancouver, Canada. +Francois Charton, Amaury Hayat, and Guillaume Lample. 2021. Learning advanced mathematical computations from examples. In Int. Conf. on Learning Representations (ICLR), Virtual only. +Xinyun Chen, Chen Liang, Adams Wei Yu, Dawn Song, and Denny Zhou. 2020. Compositional generalization via neural-symbolic stack machines. In Proc. Advances in Neural Information Processing Systems (NeurIPS), Virtual only. +Róbert Csordás and Jürgen Schmidhuber. 2019. Improving differentiable neural computers through memory masking, de-allocation, and link distribution sharpness control. In Int. Conf. on Learning Representations (ICLR), New Orleans, LA, USA. +Róbert Csordás, Sjoerd van Steenkiste, and Jürgen Schmidhuber. 2021. Are neural nets modular? inspecting functional modularity through differentiable weight masks. In Int. Conf. on Learning Representations (ICLR), Virtual only. +Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G Carbonell, Quoc Le, and Ruslan Salakhutdinov. 2019. Transformer-xl: Attentive language models beyond a fixed-length context. In Proc. Association for Computational Linguistics (ACL), pages 2978-2988, Florence, Italy. +Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. 2019. Universal transformers. In Int. Conf. on Learning Representations (ICLR), New Orleans, LA, USA. +Jerry Fodor and Brian P McLaughlin. 1990. Connectionism and the problem of systematicity: Why smolensky's solution doesn't work. Cognition, 35(2):183-204. +Jerry A Fodor, Zenon W Pylyshyn, et al. 1988. Connectionism and cognitive architecture: A critical analysis. Cognition, 28(1-2):3-71. +Karlis Freivalds, Emils Ozolins, and Agris Sostaks. 2019. Neural shuffle-exchange networks - sequence processing in o(n log n) time. In Proc. Advances in Neural Information Processing Systems (NeurIPS), Vancouver, Canada. + +Daniel Furrer, Marc van Zee, Nathan Scales, and Nathanael Schärli. 2020. Compositional generalization in semantic parsing: Pre-training vs. specialized architectures. *Preprint arXiv:2007.08970*. +Xavier Glorot and Yoshua Bengio. 2010. Understanding the difficulty of training deep feedforward neural networks. In Proc. Int. Conf. on Artificial Intelligence and Statistics (AISTATS), pages 249-256, Sardinia, Italy. +Jonathan Gordon, David Lopez-Paz, Marco Baroni, and Diane Bouchacourt. 2020. Permutation equivariant models for compositional generalization in language. In Int. Conf. on Learning Representations (ICLR), Addis Ababa, Ethiopia. +Alex Graves. 2012. Sequence transduction with recurrent neural networks. In Workshop on Representation Learning, ICML, Edinburgh, Scotland. +Alex Graves. 2016. Adaptive computation time for recurrent neural networks. In Int. Conf. on Learning Representations (ICLR) Workshop Track, Vancouver, Canada. +Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwinska, Sergio Gomez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John P. Agapiou, Adrià Puigdomènech Badia, Karl Moritz Hermann, Yori Zwols, Georg Ostrovski, Adam Cain, Helen King, Christopher Summerfield, Phil Blunsom, Koray Kavukcuoglu, and Demis Hassabis. 2016. Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471-476. +Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. 2020. On the binding problem in artificial neural networks. Preprint arXiv:2012.05208. +Yinuo Guo, Zeqi Lin, Jian-Guang Lou, and Dongmei Zhang. 2020. Hierarchical poset decoding for compositional generalization in language. In Proc. Advances in Neural Information Processing Systems (NeurIPS), Virtual only. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2015. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proc. IEEE Int. Conf. on Computer Vision (ICCV), pages 1026-1034, Santiago, Chile. +Jonathan Herzig and Jonathan Berant. 2020. Span-based semantic parsing for compositional generalization. Preprint arXiv:2009.06040. +Jonathan Herzig, Peter Shaw, Ming-Wei Chang, Kelvin Guu, Panupong Pasupat, and Yuan Zhang. 2021. Unlocking compositional generalization in pre-trained models using intermediate representations. Preprint arXiv:2104.07478. + +Xiao Shi Huang, Felipe Perez, Jimmy Ba, and Mak-sims Volkovs. 2020. Improving transformer optimization through better initialization. In Proc. Int. Conf. on Machine Learning (ICML), pages 4475-4483, Virtual only. +Dieuwke Hupkes, Verna Dankers, Mathijs Mul, and Elia Bruni. 2020. Compositionality decomposed: How do neural networks generalise? Journal of Artificial Intelligence Research, pages 757-795. +Kazuki Irie, Imanol Schlag, Robert Csordás, and Jürgen Schmidhuber. 2021. Going beyond linear transformers with recurrent fast weight programmers. Preprint arXiv:2106.06295. +Lukasz Kaiser and Ilya Sutskever. 2016. Neural GPUs learn algorithms. In Int. Conf. on Learning Representations (ICLR), San Juan, Puerto Rico. +Daniel Keysers, Nathanael Scharli, Nathan Scales, Hylke Buisman, Daniel Furrer, Sergii Kashubin, Nikola Momchev, Danila Sinopalnikov, Lukasz Stafiniak, Tibor Tihon, Dmitry Tsarkov, Xiao Wang, Marc van Zee, and Olivier Bousquet. 2020. Measuring compositional generalization: A comprehensive method on realistic data. In Int. Conf. on Learning Representations (ICLR), Addis Ababa, Ethiopia. +Najoung Kim and Tal Linzen. 2020. COGS: A compositional generalization challenge based on semantic interpretation. In Proc. Conf. on Empirical Methods in Natural Language Processing (EMNLP), pages 9087-9105, Virtual only. +Kris Korrel, Dieuwke Hupkes, Verna Dankers, and Elia Bruni. 2019. Transcoding compositionally: Using attention to find more generalizable solutions. In Proc. BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, ACL, pages 1-11, Florence, Italy. +Brenden M Lake. 2019. Compositional generalization through meta sequence-to-sequence learning. In Proc. Advances in Neural Information Processing Systems (NeurIPS), pages 9788-9798, Vancouver, Canada. +Brenden M. Lake and Marco Baroni. 2018. Generalization without systematicity: On the compositional skills of sequence-to-sequence recurrent networks. In Proc. Int. Conf. on Machine Learning (ICML), pages 2873-2882, Stockholm, Sweden. +Yuanpeng Li, Liang Zhao, Jianyu Wang, and Joel Hestness. 2019. Compositional generalization for primitive substitutions. In Proc. Conf. on Empirical Methods in Natural Language Processing and Int.Joint Conf. on Natural Language Processing (EMNLP-IJCNLP), pages 4292-4301, Hong Kong, China. +Adam Liska, Germán Kruszewski, and Marco Baroni. 2018. Memorize or generalize? searching for a compositional RNN in a haystack. In AEGAP Workshop ICML, Stockholm, Sweden. + +Qian Liu, Shengnan An, Jian-Guang Lou, Bei Chen, Zeqi Lin, Yan Gao, Bin Zhou, Nanning Zheng, and Dongmei Zhang. 2020. Compositional generalization by learning analytical expressions. In Proc. Advances in Neural Information Processing Systems (NeurIPS), Virtual only. +Preetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang, Boaz Barak, and Ilya Sutskever. 2019. Deep double descent: Where bigger models and more data hurt. In Int. Conf. on Learning Representations (ICLR), Addis Ababa, Ethiopia. +Benjamin Newman, John Hewitt, Percy Liang, and Christopher D Manning. 2020. The eos decision and length extrapolation. In Proc. BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, EMNLP, pages 276-291, Virtual only. +Maxwell I Nye, Armando Solar-Lezama, Joshua B Tenenbaum, and Brenden M Lake. 2020. Learning compositional rules via neural program synthesis. Preprint arXiv:2003.05562. +Santiago Ontañón, Joshua Ainslie, Vaclav Cvicek, and Zachary Fisher. 2021. Making transformers solve compositional tasks. Preprint arXiv:2108.04378. +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 Proc. Advances in Neural Information Processing Systems (NeurIPS), pages 8024-8035, Vancouver, Canada. +Rebecca Roelofs. 2019. Measuring Generalization and overfitting in Machine learning. Ph.D. thesis, UC Berkeley. +Jake Russian, Jason Jo, Randall C O'Reilly, and Yoshua Bengio. 2019. Compositional generalization in a deep seq2seq model by separating syntax and semantics. Preprint arXiv:1904.09708. +David Saxton, Edward Grefenstette, Felix Hill, and Pushmeet Kohli. 2019. Analysing mathematical reasoning abilities of neural models. In Int. Conf. on Learning Representations (ICLR), New Orleans, LA, USA. +Imanol Schlag, Kazuki Irie, and Jürgen Schmidhuber. 2021. Linear transformers are secretly fast weight programmers. In Proc. Int. Conf. on Machine Learning (ICML), volume 139, pages 9355-9366, Virtual only. +Imanol Schlag, Paul Smolensky, Roland Fernandez, Nebojsa Jojic, Jurgen Schmidhuber, and Jianfeng Gao. 2019. Enhancing the transformer with explicit relational encoding for math problem solving. Preprint arXiv:1910.06611. + +Jürgen Schmidhuber. 1992. Learning to control fast-weight memories: An alternative to recurrent nets. Neural Computation, 4(1):131-139. +Jürgen Schmidhuber. 2012. Self-delimiting neural networks. Preprint arXiv:1210.0118. +Peter Shaw, Ming-Wei Chang, Panupong Pasupat, and Kristina Toutanova. 2020. Compositional generalization and natural language variation: Can a semantic parsing approach handle both? Preprint arXiv:2010.12725. +Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. In Proc. North American Chapter of the Association for Computational Linguistics on Human Language Technologies (NAACL-HLT), pages 464-468, New Orleans, Louisiana, USA. +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. 2014. Sequence to sequence learning with neural networks. In Proc. Advances in Neural Information Processing Systems (NIPS), pages 3104-3112, Montreal, Canada. +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 Proc. Advances in Neural Information Processing Systems (NIPS), pages 5998-6008, Long Beach, CA, USA. +Biao Zhang, Ivan Titov, and Rico Sennrich. 2019. Improving deep transformer with depth-scaled initialization and merged attention. In Proc. Conf. on Empirical Methods in Natural Language Processing and Int.Joint Conf. on Natural Language Processing (EMNLP-IJCNLP), pages 898-909, Hong Kong, China. +Chen Zhu, Renkun Ni, Zheng Xu, Kezhi Kong, W Ronny Huang, and Tom Goldstein. 2021. Gradinit: Learning to initialize neural networks for stable and efficient training. Preprint arXiv:2102.08098. + +# A Evaluation Metrics + +For all tasks, accuracy is computed on the sequence-level, i.e. all tokens in the sequence should be correct for the output to be counted as correct. For the losses, we always report the average token-wise cross entropy loss. + +# B Hyperparameters + +For all of our models we use an Adam optimizer with the default hyperparameters of PyTorch (Paszke et al., 2019). We only change the learning rate. We use dropout with probability of 0.1 after each component of the transformer: both after the attention heads and linear transformations. We specify the dataset-specific hyperparameters in Table 4. For all Universal Transformer experiments, we use both the "No scaling" and the "Positional Embedding Downscaling" methods. For the standard Transformers with absolute positional embedding we test different scaling variants on different datasets shown in Table 6. When multiple scaling methods are available, we choose the best performing ones when reporting results in Table 3. We always use the same number of layers for both encoder and decoder. The embedding and the final softmax weights of the decoder are always shared (tied embeddings). + +The number of parameters for different models and the corresponding to representative execution time is shown in Table 5. + +# C Relative Positional Embedding + +We use the relative positional embedding variant of self attention from Dai et al. (2019). Here, we use a decomposed attention matrix of the following form: + +$$ +\begin{array}{l} \boldsymbol {A} _ {i, j} ^ {\text {r e l}} = \underbrace {\boldsymbol {H} _ {i} ^ {\top} \boldsymbol {W} _ {q} ^ {\top} \boldsymbol {W} _ {k , E} \boldsymbol {H} _ {j}} _ {(a)} + \underbrace {\boldsymbol {H} _ {i} ^ {\top} \boldsymbol {W} _ {q} ^ {\top} \boldsymbol {W} _ {k , P} \boldsymbol {P} _ {i - j}} _ {(b)} \\ + \underbrace {\boldsymbol {u} ^ {\top} \boldsymbol {W} _ {k , E} \boldsymbol {H} _ {j}} _ {(c)} + \underbrace {\boldsymbol {v} ^ {\top} \boldsymbol {W} _ {k , P} \boldsymbol {P} _ {i - j}} _ {(d)} \\ \end{array} +$$ + +where $H_{i}$ is the hidden state of the $i^{\mathrm{th}}$ column of the Transformer, $P_{i}$ is an embedding for position (or in this case distance) $i$ . Matrix $W_{q}$ maps the states to queries, $W_{k,E}$ maps states to keys, while $W_{k,P}$ maps positional embedding to keys. $u$ and $v$ are learned vectors. Component (a) corresponds to + +content-based addressing, (b) to content based relative positional addressing, (c) represents a global content bias, while (d) represents a global position bias. + +We use sinusoidal positional embedding $\pmb{P}_i \in \mathbb{R}^{d_{\mathrm{model}}}$ . The relative position, $i$ , can be both positive and negative. Inspired by Vaswani et al. (2017), we define $P_{i,j}$ as: + +$$ +\boldsymbol {P} _ {i, j} = \left\{ \begin{array}{l l} \sin \left(i / 1 0 0 0 0 ^ {2 j / d _ {\mathrm {m o d e l}}}\right), & \text {i f} j = 2 k \\ \cos \left(i / 1 0 0 0 0 ^ {2 j / d _ {\mathrm {m o d e l}}}\right) & \text {i f} j = 2 k + 1 \end{array} \right. \tag {1} +$$ + +Prior to applying the softmax, $A_{i,j}^{\mathrm{rel}}$ is scaled by $\frac{1}{\sqrt{d_{\mathrm{model}}}}$ , as in Vaswani et al. (2017). + +We never combine absolute with relative positional embedding. In case of a relative positional variant of any Transformer model, we do not add absolute positional encoding to the word embeddings. We use relative positional attention in every layer, except at the interface between encoder and decoder, where we use the standard formulation from Vaswani et al. (2017), without adding any positional embedding. + +# D Embedding Scaling + +In this section, we provide full descriptions of embedding scaling strategies we investigated. In the following, $w_{i}$ denotes the word index at input position $i$ , $\pmb{E}_{w} \in \mathbb{R}^{d_{\mathrm{model}}}$ denotes learned word embedding for word index $w$ . Positional embedding for position $i$ is defined as in Eq. 1. + +Token Embedding Upscaling. Vaswani et al. (2017) combine the input word and positional embeddings for each position $i$ as $\pmb{H}_i = \sqrt{d_{\mathrm{model}}} \pmb{E}_{w_i} + \pmb{P}_i$ . Although in the original paper, the initialization of $\pmb{E}$ is not discussed, most implementations use Glorot initialization (Glorot and Bengio, 2010), which in this case means that each component of $\pmb{E}$ is drawn from $\mathcal{U}(-\sqrt{\frac{6}{d_{\mathrm{model}} + N_{\mathrm{words}}}}, \sqrt{\frac{6}{d_{\mathrm{model}} + N_{\mathrm{words}}}})$ where $\mathcal{U}(a,b)$ represents the uniform distribution in range $[a,b]$ . + +No scaling. This corresponds to how PyTorch initializes embedding layers by default: each element of $\pmb{E}$ is drawn from $\mathcal{N}(0,1)$ . $\mathcal{N}(\mu, \sigma)$ is the normal distribution with mean $\mu$ and standard deviation of $\sigma$ . The word embeddings are combined with the positional embeddings without any scaling: $H_{i} = E_{w_{i}} + P_{i}$ + +Table 4: Hyperparameters used for different tasks. We denote the feedforward size as $d_{\mathrm{FF}}$ . For the learning rate of CFQ (denoted by $*$ ), the learning rate seemingly differs from Keysers et al. (2020). In fact, although Keysers et al. (2020) use Noam learning rate scheduling, scaling by $\frac{1}{\sqrt{d_{\mathrm{model}}}}$ is not used, so we had to compensate for this to make them functionally equivalent. + +
dmodeldFFnhheadnlayersbatch sizelearning ratewarmupschedule
SCAN1282568325610-3--
CFQ - Non-universal12825616240960.9*4000Noam
CFQ - Universal2565124620482.24*8000Noam
PCFG5122048866410-4--
COGS5125128212810-4--
COGS Noam5125128212824000Noam
Mathematics51220488625610-4--
+ +Table 5: Model sizes and execution times. One representative split is shown per dataset. Other splits have the same number of parameters, and their execution time is in the same order of magnitude. + +
DatasetModelNo. of paramsExecution timeGPU type
SCANStandard992k1:30Titan X Maxwell
Universal333k1:15
Relative Pos.1.1M1:45
Universal, Relative Pos.366k1:30
CFQ MCD 2Standard685k10:00Tesla V100-SXM2-32GB-LS
Universal1.4M12:00
Relative Pos.751k14:15
Universal, Relative Pos.1.5M14:00
PCFG SystematicityStandard44.7M20:30Tesla V100-PCIE-16GB
Universal7.9M17:00
Relative Pos.47.8M21:30
Universal, Relative Pos.8.4M21:30
COGSStandard9.3M17:30Tesla V100-SXM2-32GB-LS
Universal5.1M17:15
Relative Pos.10.3M21:00
Universal, Relative Pos.5.6M20:00
Math: add_or_subStandard4.4M8:00Tesla P100-SXM2-16GB
Universal7.4M7:30
Relative Pos.4.7M8:30
Universal, Relative Pos.7.9M8:00
+ +Table 6: Scaling types used for standard transformers with absolute positional embedding on different datasets. TEU denotes Token Embedding Upscaling, PED denotes Position Embedding Downscaling. + +
TEUNo scalingPED
SCAN✓✓
CFQ MCD✓✓
CFQ Length✓✓✓
PCFG Productivity✓✓✓
PCFG Systematicity✓✓✓
COGS✓✓✓
Mathematics✓✓
+ +Position Embedding Downscaling. We propose to use Kaiming initialization (He et al., 2015) for the word embeddings: each element of $E \sim \mathcal{N}(0, \frac{1}{\sqrt{d_{\mathrm{model}}}})$ . Instead of scaling up the word em + +beddings, the positional embeddings are scaled down: $H_{i} = E_{w_{i}} + \frac{1}{\sqrt{d_{\mathrm{model}}}} P_{i}$ + +# E Analyzing the Positively Correlated Loss and Accuracy + +In Sec. 3.2, we reported that on the generalization splits of some datasets both the accuracy and the loss grows together during training. Here we further analyze this behavior in Figure 5 (see the caption). + +# F Accuracies on the IID Split + +To show that the IID accuracy does not provide any useful signal for assessing the quality of the final model, we report IID accuracies of the models from Table 3 in Table 8. We only show datasets for which an IID validation set is available in the same split + +Table 7: Test accuracy of different Transformer (Trafo) variants and different initializations on the considered datasets. This is a more detailed version of Table 3, with detailed scores for all initialization variants. The last column shows previously reported accuracies. References: [1] Newman et al. (2020), [2] Keysers et al. (2020), [3] https://github.com/google-research/google-research/tree/master/cfq, [4] Hupkes et al. (2020), [5] Kim and Linzen (2020), [6] Saxton et al. (2019). Results marked with $*$ cannot be directly compared because of different training setups. $\sim$ denotes imprecise numbers read from charts in prior works. For the configuration marked by $\dagger$ , the results are obtained by running 8 seeds from which 3 crashed, resulting in 5 useful runs reported below. Crashed runs suddenly drop their accuracy to 0, which never recovers during the training. The reason for the crashing is the overly big learning rate (2.24, from the baseline). We run another 10 seeds with learning rate of 2.0, obtaining similar final accuracy of $0.75 \pm 0.02$ , but without any crashed runs. + +
InitTrafoUni. TrafoRel. TrafoRel. Uni. TrafoReported
SCAN (length cutoff=26)PED0.30 ± 0.020.21 ± 0.01--0.00[1]
No scaling0.15 ± 0.070.14 ± 0.050.72 ± 0.211.00 ± 0.00
CFQ Output lengthPED0.56 ± 0.020.60 ± 0.34--~ 0.66[2]
TEU0.57 ± 0.000.74 ± 0.02 †--
No scaling0.53 ± 0.040.77 ± 0.020.64 ± 0.060.81 ± 0.01
CFQ MCD 1PED0.36 ± 0.020.37 ± 0.05--0.37 ± 0.02[3]
No scaling0.40 ± 0.010.39 ± 0.030.39 ± 0.010.39 ± 0.04
CFQ MCD 2PED0.08 ± 0.010.09 ± 0.01--0.08 ± 0.02[3]
No scaling0.10 ± 0.010.09 ± 0.020.09 ± 0.010.10 ± 0.02
CFQ MCD 3PED0.10 ± 0.000.11 ± 0.00--0.11 ± 0.00[3]
No scaling0.11 ± 0.000.11 ± 0.010.11 ± 0.010.11 ± 0.03
CFQ MCD meanPED0.18 ± 0.130.19 ± 0.14--0.19 ± 0.01[2]
No scaling0.20 ± 0.140.20 ± 0.140.20 ± 0.140.20 ± 0.14
PCFG Productivity splitPED0.65 ± 0.030.78 ± 0.01--0.50 ± 0.02[4]
TEU0.47 ± 0.270.78 ± 0.01--
No scaling0.63 ± 0.020.76 ± 0.01-0.85 ± 0.01
PCFG Systematicity splitPED0.87 ± 0.010.93 ± 0.01--0.72 ± 0.00[4]
TEU0.75 ± 0.080.92 ± 0.01--
No scaling0.86 ± 0.020.92 ± 0.000.89 ± 0.020.96 ± 0.01
COGSPED0.80 ± 0.000.77 ± 0.02--0.35 ± 0.06[5]
TEU0.78 ± 0.030.78 ± 0.03--
No scaling0.62 ± 0.060.51 ± 0.070.81 ± 0.010.77 ± 0.01
Math: add_or_subPED0.80 ± 0.010.92 ± 0.02--~ 0.91[6]*
No scaling0.89 ± 0.010.94 ± 0.010.91 ± 0.030.97 ± 0.01
Math: place_valuePED0.00 ± 0.000.20 ± 0.02--~ 0.69[6]*
No scaling0.12 ± 0.070.12 ± 0.01-0.75 ± 0.10
+ +![](images/5231d2c91ac1d38163441f85aafb98171e017b5201efb6974408f3ce1bef62a1.jpg) +(a) COGS: IID Validation set + +![](images/f2c3038f75343d64d650ec0711c74177b46aaf3fa166559e97096d059c58c57e.jpg) +(b) COGS: Generalization test set + +as the one reported in Table 3. This complements the IID and generalization accuracies on COGS and PCFG with different embedding scalings we reported in Table 2. With the exception of standard Transformer on PCFG and the "place_value" module of the Mathematics dataset, all other validation accuracies are $100\%$ , while their generalization accuracy vary wildly. + +# G Additional Results + +Figure 4 shows that both the test loss and accuracy grows on COGS dataset during training. Additionally, it shows the expected, IID behavior on the same dataset for contrast. + +Figure 6 shows the relative change in convergence speed when using relative positional embeddings. + +![](images/a7195878b41f5b9aa2c14480b8cdd9ba3cb103a896f64303289e291915d7a3f5.jpg) +(a) Decomposed loss + +![](images/f195f3bb463adc13291f0cae8ab193eaa0156588b969d28ee9dbd65645b4e7a8.jpg) +(b) Histogram of "good" loss (first and last measurement) + +![](images/5c60ee3f922c9b374f25e1bcf0621e1b0f94e1138a0ce8e7f255df24a3049eb5.jpg) +Figure 4: Relationship between the loss and accuracy on (a) IID validation set and (b) the generalization test set on COGS (it comes without a validation set for the generalization splits). Standard Transformers are used. The color shows the training step. Five runs are shown. The loss is shown on a logarithmic scale. On the IID validation set (a), the accuracy increases when the loss decreases, as expected. In contrast, on the generalization split (b), high accuracy corresponds to higher loss. For generalization validation loss versus generalization accuracy on CFQ MCD 1, see Figure 2. For the analysis of the underlying reason, see Figure 5. +(c) Histogram of "bad" loss (first and last measurement) + +![](images/ea7a426ad9639a8a3b4b35a5edc3d08fbfff4a9068bf1d4bc2215705940eafc1.jpg) +Figure 5: Analysis of the growing test loss on the systematically different test set on CFQ MCD 1 split. We measure the loss individually for each sample in the test set. We categorize samples as "good" if the network output on the corresponding input matched the target exactly any point during the training, and as "bad" otherwise. (a) The total loss (increasing) can be decomposed to the loss of the "good" samples (decreasing), and the loss of the "bad" samples (increasing). (b, c) The histogram of the loss for the "good" and "bad" samples at the beginning and end of the training. The loss of the "good" samples concentrates near zero, while the "bad" samples spread out and the corresponding loss can be very high. The net effect is a growing total loss. +Figure 6: Relative change in convergence speed by using relative positional embeddings instead of absolute. Convergence speed is measured as the mean number of steps needed to achieve $80\%$ of the final performance of the model. Relative variants usually converge faster. Universal Transformers benefit more than the non-universal ones. The non-universal variants are not shown for PCFG and "Math: place_value", because the relative variants do not converge (see Sec. 3.1). + +Table 8: IID validation accuracy for datasets where IID test set is available. CFQ and PCFG are not shown because they require the model to be trained on a separate, IID split. The other settings correspond to Table 3 in the main text. Generalization split test accuracies are shown in parenthesis for easy comparison. + +
TransformerUni. TransformerRel. TransformerRel. Uni. Transformer
SCAN (length cutoff=26)1.00 ± 0.00 (0.30)1.00 ± 0.00 (0.21)1.00 ± 0.00 (0.72)1.00 ± 0.00 (1.00)
COGS1.00 ± 0.00 (0.80)1.00 ± 0.00 (0.78)1.00 ± 0.00 (0.81)1.00 ± 0.00 (0.77)
Math: add_or_sub1.00 ± 0.00 (0.89)1.00 ± 0.00 (0.94)1.00 ± 0.00 (0.91)1.00 ± 0.00 (0.97)
Math: place_value0.80 ± 0.45 (0.12)1.00 ± 0.00 (0.20)-1.00 ± 0.00 (0.75)
+ +Table 9: Accuracy of different Transformer variants on CFQ. "Big" variant has a batch size of 4096, and is trained with Noam scheduler (learning rate 0.9). "Small" variant has a batch size of 512 and a fixed learning rate of $10^{-4}$ . The ratio of accuracies of "small" and "big" variants are also shown in the "Ratio" column, indicating the relative performance drop caused by decreasing the batch size. Relative variants experience less accuracy drop. + +
VariantTransformerRel. TransformerUni. TransformerRel. Uni. Transformer
CFQ MCD 1Big0.40 ± 0.010.39 ± 0.020.41 ± 0.030.42 ± 0.02
Small0.26 ± 0.020.32 ± 0.010.28 ± 0.000.36 ± 0.01
Ratio0.650.800.680.85
CFQ MCD 2Big0.10 ± 0.010.09 ± 0.010.09 ± 0.000.09 ± 0.02
Small0.05 ± 0.010.07 ± 0.010.04 ± 0.010.10 ± 0.01
Ratio0.510.760.501.05
CFQ MCD 3Big0.11 ± 0.000.11 ± 0.010.11 ± 0.010.12 ± 0.02
Small0.09 ± 0.000.09 ± 0.000.09 ± 0.010.11 ± 0.01
Ratio0.800.850.850.98
CFQ Out. len.Big0.57 ± 0.020.64 ± 0.040.76 ± 0.030.81 ± 0.02
Small0.41 ± 0.030.51 ± 0.020.55 ± 0.020.70 ± 0.03
Ratio0.720.800.730.87
+ +Table 10: Dataset statistics. "#" denotes number of samples. Vocabulary size shows the union of input and output vocabularies. Train and test length denotes the maximum input/output length in the train and test set, respectively. + +
Dataset# train# IID valid.# gen. test# gen. valid.Voc. sizeTrain len.Test len.
Scan (length cutoff=26)1645818282624-199/269/48
CFQ MCD 195743-119681196818129/9530/103
CFQ MCD 295743-119681196818129/10730/91
CFQ MCD 395743-119681196818129/10730/103
CFQ Output Length100654-9512951218129/7729/107
PCFG Productivity81010-11333-53553/20071/736
PCFG Systematicity82168-10175-53571/73671/496
COGS24155300021000-87122/15361/480
Math: add_or_sub19690291000010000-6960/1962/23
Math: place_value1492268998810000-6950/152/1
\ No newline at end of file diff --git a/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/images.zip b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c37a3819ad627c25ede89b62f23e319a5b6b4f45 --- /dev/null +++ b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90e30bd2d7cde82f5f098d70d28b01535d2c4e39d06151094e3671e580630b15 +size 828693 diff --git a/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/layout.json b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..48350a86f91a465267b239391e609585bd602742 --- /dev/null +++ b/thedevilisinthedetailsimpletricksimprovesystematicgeneralizationoftransformers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2db61e5149f17c4bfb0b56846fe414a0ba4b9bab7cda8042bf20c14ddccb61ae +size 454218 diff --git a/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_content_list.json b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9bf2036827204d363e2a7f77312dd44126b4fe2f --- /dev/null +++ b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68cd800d1f402d623659f2b5dede0099fc7aaa96828f376bae0890dd112b1fc5 +size 55945 diff --git a/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_model.json b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_model.json new file mode 100644 index 0000000000000000000000000000000000000000..fb64260437e7e33b0bf6fac92773afc187456f31 --- /dev/null +++ b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bea34b30e4ab70c72155cab8f4b8ed9d47ddb2ccfa32733d0de4e514bb95e451 +size 68307 diff --git a/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_origin.pdf b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1e331d2c0bb169adab88f172a260d4c9d6174b8a --- /dev/null +++ b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/cb036867-6ca7-49c9-8732-5a4cea4f4102_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f306fe39e227b42f0a4e02b8f01d6ea55863b34ce18b20a0676972aa8528662 +size 711969 diff --git a/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/full.md b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..782ea9df6cb3cc4aafcb4f6b83cca7167c1322f7 --- /dev/null +++ b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/full.md @@ -0,0 +1,226 @@ +# The Effect of Efficient Messaging and Input Variability on Neural-Agent Iterated Language Learning + +Yuchen Lian $^{1,2}$ , Arianna Bisazza $^{3}$ , Tessa Verhoef $^{2}$ + +$^{1}$ Faculty of Electronic and Information Engineering, Xi'an Jiaotong University + +$^{2}$ Leiden Institute of Advanced Computer Science, Leiden University + +$^{3}$ Center for Language and Cognition, University of Groningen + +{y.lian, t.veroef}@liacs.leidenuniv.nl + +a.bisazza@rug.nl + +# Abstract + +Natural languages display a trade-off among different strategies to convey syntactic structure, such as word order or inflection. This trade-off, however, has not appeared in recent simulations of iterated language learning with neural network agents (Chaabouni et al., 2019b). We re-evaluate this result in light of three factors that play an important role in comparable experiments from the Language Evolution field: (i) speaker bias towards efficient messaging, (ii) non systematic input languages, and (iii) learning bottleneck. Our simulations show that neural agents mainly strive to maintain the utterance type distribution observed during learning, instead of developing a more efficient or systematic language. + +# 1 Introduction + +The world's languages show immense variety, but linguistic patterns also show important universal tendencies (Greenberg, 1963). It has been argued that these common design features are shaped by human cognitive constraints and pressures during communication and transmission (Kirby et al., 2014). A well-known example of these tendencies is the trade-off between case marking and word order as redundant strategies to encode the role of sentence constituents (Sinnemäki, 2008; Futrell et al., 2015): flexible order typically correlates with the presence of case marking (e.g. in Russian), while fixed order is often observed in languages with little or no case marking (e.g. English). + +Researchers interested in language universals and their origins have extensively used agent-based modeling techniques to study the impact of social processes on the emergence of linguistic structures (de Boer, 2006). Besides the horizontal transmission that is often modeled in the referential game setup, the process of iterated learning, where signals are transmitted vertically from generation to generation, has been identified to shape language (Kirby, 2001; Kirby et al., 2014). + +Recently, the advent of deep learning based NLP has triggered a renewed interest in agent-based simulations of language emergence. Most existing studies simulate the emergence of language by letting neural network agents play referential games and studying the signals they use (Kottur et al., 2017; Havrylov and Titov, 2017; Lazaridou et al., 2018; Chaabouni et al., 2019a; Dagan et al., 2021). By contrast, Chaabouni et al. (2019b) expose their agents to a pre-defined language, which is then learned and reproduced iteratively by a chain of agents. They analyze how specific properties of the initial languages affect learnability, and further investigate how agent biases affect the evolution across generations. Among others, they studied whether neural agents tend to avoid redundant coding strategies as natural languages do. However, the case-marking/word-order trade-off did not clearly appear in their iterated learning experiments. + +In this work, we re-evaluate this finding in light of three factors that play an important role in comparable experiments from the Language Evolution field: (i) speaker bias towards efficient messaging (i Cancho and Solé, 2003), (ii) unpredictable variation in the initial languages (Smith and Wonnacott, 2010; Fedzechkina et al., 2017), (iii) exposure to a limited set of example utterances, known as 'learning bottleneck' (Kirby et al., 2014). We follow the iterated learning setup of Chaabouni et al. (2019b) where neural agents are trained to communicate about trajectories in a simple gridworld, exchanging instructions in miniature languages (Fig. 1).1 + +# 2 Miniature Languages + +Word order and case marking are two different mechanisms to convey sentence constituent roles, both widely attested among world languages. Both + +
TypeUtterance
Fix+Markerm1 up 2 m2 left 3 m3 down 1
Fixup 2 left 3 down 1
Free-orderm1 up 2 m3 down 1 m2 left 3
+Markerm2 left 3 m1 up 2 m3 down 1
m3 down 1 m1 up 2 m2 left 3
...
+ +Figure 1: Utterances corresponding to 'UP UP LEFT LEFT LEFT DOWN', in three basic languages. + +have been shown to serve as equally valuable cues to learn grammatical roles during language learning by children (Slobin and Bever, 1982), and by simple recurrent neural networks (Lupyan and Christiansen, 2002). To model these mechanisms we use simple artificial languages based on Chaabouni et al. (2019b). The meaning space is composed of trajectories defined by random combinations of four oriented actions {LEFT, RIGHT, UP, DOWN}. Each utterance or sentence (S) consists of several phrases (P), which in turn are composed of a command (C) and a quantifier (Q): + +$$ +S \rightarrow P _ {i} P _ {j} P _ {k} \dots \tag {1} +$$ + +$$ +P _ {i} \left| P _ {j} \right| P _ {k} | \dots \rightarrow C Q \tag {2} +$$ + +$$ +C \rightarrow (l e f t | r i g h t | u p | d o w n) \tag {3} +$$ + +$$ +Q \rightarrow (1 | 2 | 3) \tag {4} +$$ + +where left,right,up,down,1,2,3 are spoken words which are atomic elements of the language. We consider three basic language types: Fixed-order with marker (redundant), Fixed-order without marker (non-redundant), and Free-order with marker (non-redundant). See examples in Fig. 1. + +Fixed-order vs. Free-order This concerns Rule 1: In a fixed-order language, the order of phrases strictly corresponds to the temporal order of instructions in the trajectory.2 Free-order languages, instead, allow any permutation of phrases. For instance, there are in total six possible free-order utterances for a 3-phrase trajectory (Fig. 1). + +Case Marking In a case-marking language, each phrase is preceded by a temporal marker indicating its role. Thus, Rule 2 changes to: $P_{i} \rightarrow m_{i} C Q$ with the marker $m_{i}$ indicating that $C Q$ is the $i^{th}$ action segment. Note that a fully free-order language is unintelligible without markers. + +# 3 Neural-Agents Iterated Learning + +We strictly follow the iterated learning setup of Chaabouni et al. (2019b) unless explicitly noted. + +Agent architecture Agents are implemented as 1-layer attentional Seq2Seq (Sutskever et al., 2014; Bahdanau et al., 2015) LSTM (Hochreiter and Schmidhuber, 1997) networks. Each agent acts as both speaker (receiving trajectories and describing them with utterances) and listener (receiving utterances and trying to induce the corresponding trajectories). The vocabulary contains both actions and words; embeddings of the encoder input and decoder output are tied (Press and Wolf, 2017). + +Individual and iterated learning Given trajectory-utterance pairs, agents are trained by teacher forcing (Salakhutdinov, 2014) in both listening and speaking mode, using the early-stopping and optimizer settings of Chaabouni et al. (2019b). Iterated learning (Kirby, 2001) is implemented by letting a trained adult agent teach a randomly initialized child agent, and repeating this process for a number of generations. At each generation, two steps are performed: (1) a trained adult agent receives a batch of trajectories and generates utterances by sampling from its own decoder outputs; (2) a randomly initialized child agent is trained on these agent-specific trajectory-utterance pairs. As an exception, the generation-0 agent is directly trained on the corpus generated by a given miniature grammar. + +Evaluation In both speaking and listening mode, sequences are generated by greedy decoding and evaluated by sentence-level accuracy. Listener evaluation is standard as the true meaning of an utterance is unique. For speakers in the first generation, instead, we consider all acceptable utterances according to the grammar as candidate targets; for later generations, we take $k = i!$ utterances sampled from the parent's speaking network as targets ( $i$ is the maximum number of phrases per trajectory). Validation for early stopping is performed similarly. These evaluation procedures allow a child agent's language to deviate from the parent language, even while achieving perfect accuracy. + +For each experiment, we report speaking accuracy, listening accuracy, as well as average utterance length across generations. To get more insight into language changes, we plot the distribution of utterance types in the adult speaking agents across generations. Specifically, we count how often an utterance belongs to one of the basic language types (fix, fix Marker, free, free Marker), and how often markers are dropped for some of the phrases (fix_drop, free_drop). Utterances that do not fall into any of these categories are labeled as 'other'. + +For more technical details on the agents and evaluation, see Appendix A. Example utterances at various generations are shown in Appendix B. + +# 4 Effect of Least-Effort Bias + +A bias towards efficient messaging has been proposed as explaining factor for several tendencies observed in natural languages (i Cancho and Solé, 2003; Kanwal et al., 2017; Fedzechkina et al., 2017). Could the lack of such a bias in neural networks explain the survival of redundant languages? To verify this, we design a simple mechanism simulating an agent's preference to minimize utterance length, based on Chaabouni et al. (2019b)'s framework: To teach the next generation, given a trajectory $\mathbf{t}$ , an adult agent generates $n$ (possibly identical) utterances $\{\hat{u}\} = \{u_1, u_2, \dots u_n\}$ by sampling from its trained network. Instead of modifying the training process, we exploit the diversity occurring in the sampled utterances and hard-code a shorter-sentence selection bias into this adult language generation. As shown in Algorithm 1, the sampling function is called $n$ times to generate $n$ samples. In turn, at each iteration, we ask the adult speaker to generate $\ell$ sentences and select each time the shortest one. Thus, we can control the bias strength by varying the number of generated samples $(\ell)$ in each of the $n$ iterations. As $\ell$ increases, the chances of sampling a shorter sentence increase, resulting in a stronger pressure; $\ell = 1$ means no bias. We expect this least-effort bias will cause the redundant disambiguation mechanism to gradually disappear, and the fixed-order strategy to dominate as that always leads to shorter utterances. + +Results Fig. 2 shows the iterated learning results of the Fixed+Marker language with various levels of least-effort bias $\ell = \{1,3,5,8\}$ , which represent no pressure, low-, medium- and high-level pressure towards shorter utterances, respectively. The experiment without least-effort pressure + +Algorithm 1: Shorter-sentence selection +Input: Trajectory t +Output: n sampled utterances { $\hat{u}$ } +for $j = 1:n$ do +if shorter_selection then +uttrs = Adultspeaker(t).sample(ℓ) +uttr_select = uttrs[0] +for i = 1 : ℓ do +u = uttrs[i] +if len(u) ≤ len(uttr_select) then +uttr_select = u +else +uttr_select = Adultspeaker(t).sample(1) + $\{\hat{u}\}$ .append(uttr_select) + +$(\ell = 1)$ corresponds to the setup of Chaabouni et al. (2019b), in which the redundant language was found to remain stable across generations. + +We find that, while speaking accuracy remains stable (2a), our least-effort pressure leads to a severe drop in listening accuracy (2b) and a dramatic increase of other types in the speaking adult agent starting from the fifth generation (2d). Stronger levels of pressure lead to a faster decrease of average utterance length (2c), which was expected. However, manual inspection of the utterances (Appendix B) reveals that agents start dropping entire phrases, thereby losing information, instead of either dropping markers or changing the word order. + +# 5 Effect of Input Language Variability + +In the languages of Chaabouni et al. (2019b), markers are either present and fully systematic, or not present at all. If there is no marker example in the initial language, it is unlikely an agent would suddenly invent it. Conversely, a fully systematic use of markers may be perfectly learnable by the agent, unlikely to change or disappear over generations. Unpredictable variation, instead, is a common feature of the artificial languages used in human learning studies. For example Fedzechkina et al. (2017) combine optional case marking with either fixed or free word order, while Smith and Wonnacott (2010) use two plural markers with different distributions over nouns. Inspired by this, we experiment with unpredictable variations in the use of markers, namely: (i) variability among utterances, where each utterance is consistent with one of the basic language types chosen at random, and (ii) variability within utterances, where the use of markers is also unpredictable within a single utterance. + +# 5.1 Variability Among Utterances + +For every trajectory in the initial training set, two utterances are generated for each of the three basic + +![](images/a96c5987c17fbfce325d3ffcaaca71065ec6da05c749b94e183ca56334966a71.jpg) +(a) Speaking accuracy + +![](images/ea4c629ca47bd3fabf12a2cbba5af81526b568c94814ea1879f490079df7b225.jpg) +(b) Listening accuracy +Figure 2: Iterated learning of the Fixed+Marker language with least-effort pressure of varying strength $(\ell)$ , over 10 generations. Results in (a,b,c) are averaged over three random-seed initializations. (d) shows the distribution of utterance types of the speaking adult agents with $\ell = 3$ (one seed only). + +![](images/8c5dc553c5219f1d07cab9db612b0feb4e368a0e8cc3fb05c6eaa0eacfa1c42d.jpg) +(c) Average utterance length + +![](images/e67b5f4a5c52558c6a71cb5d279646d8068847fbe6e840969094826be7993a76.jpg) +(d) Utterance types $(\ell = 3)$ + +language types: (i) Fixed-order+Marker, (ii) Fixed-order without markers and (iii) Free-order+Marker. Our goal here is to find out whether the agents will tend to prefer any of the three language types over generations, according to their inherent biases. + +Results Results are shown in Fig. 3 (blue lines). The overall high speaking accuracy suggests that the agents can learn to imitate their parents' language very well. We observe a slow, but steady, loss in listening accuracy, which we attribute to the random sampling errors from the parent speaker and the natural presence of errors in the neural network learning process. Besides a steady increase of un categorizable utterances (other) in Fig. 3d, the distribution of the three language types remains relatively stable even after 20 generations. We looked for sentences where only some of the markers are dropped (free_drop/fix_drop) but found almost none. See examples in Appendix B. These results show that mixing language types in the initial training set is not sufficient to induce the loss of redundant encoding with agent learners, as opposed to human learners (Fedzechkina et al., 2017). + +Results with Least-Effort Bias We also study the combination of the two factors (Mix+pressure) using medium pressure $(\ell = 3)$ . This setup (Fig. 3, green lines) leads to a more efficient language during the first five generations, as shown by the initially stable speaking and listening accuracy and a decrease of average length. This phase corresponds to a proliferation of fixed-order no-marker sentences and the disappearance of the other language types (3e). In only two generations, this language has reached the shortest possible overall length while remaining intelligible. After a while, however, child agents start to receive shorter but incorrect utterances, resulting in a drop of listening accuracy and, finally, an unintelligible language. + +# 5.2 Variability Within Utterances + +We design a more unpredictable language where each phrase marker is randomly dropped according to a given probability (10%). Half of the utterances are fixed- and half are free-order. See examples in Appendix B. This language is closely inspired by those of Fedzechkina et al. (2017). We expect agents will either stop using markers completely over generations, or use them more consistently. + +Results Despite the relatively small probability of dropping a marker, speaking and listening accuracies drop rapidly (3a and 3b, grey lines) and other utterances become dominant (Fig. 3f). This language becomes unintelligible before regularization is observed, again challenging our expectations. + +# 6 Effect of Learning Bottleneck + +Although real languages support the production of enormous sets of utterances, human learners master them by exposure to a limited number of examples. This learning bottleneck acts as a pressure forcing languages to regularize during cultural transmission (Smith et al., 2003; Brighton et al., 2005). Human-based experiments and computational simulations have found that this pressure can lead to increased structure in emerging language systems (Kirby et al., 2014). We apply a learning bottleneck to our mixed language experiment (Sect. 5.1) by randomly sub-sampling, at each iteration, $50\%$ of the data used to train the next generation. Evaluation and training details are the same as in Sect. 5.1. + +Results We find that training data sub-sampling leads to a slightly steeper drop in listening accuracy (yellow vs. blue line in Fig. 3b), but the respective distributions of utterance types (Fig. 3g vs. 3d) remain very similar, suggesting the learning bottle + +![](images/1808ec179b3091c14740f19c0a564d8b79bb8431cdfd153c4a7fdb1dea5a2cfc.jpg) +(a) Speaking accuracy + +![](images/df04915631902250820faa9de64ec4c32e25227bde505a82c2495f4632cdd0fd.jpg) +(b) Listening accuracy + +![](images/bcff58b12cfba8c3b44ae0ac9d9dac78e94be413d73b5d6bf2a8025bd0622769.jpg) +(c) Average utterance length + +![](images/e84d719ff8bba7adbc05a7decf9070200bc449ef92fd8542d18553152eef2bd3.jpg) +(d) Utterance types (Mix) + +![](images/b68e4dbc88615bfbc02c2b892136869f45fa6a566aca9b70a3861787b3a424dc.jpg) +(e) Utter. types (Mix+pressure) + +![](images/f9c439739e6327ffde7d5fd1372895fee3ca7269f37b4283a5f8ec3fd2458845.jpg) +Figure 3: Mixed language learning without and with least-effort pressure, drop-marker language without least-effort pressure, and mixed language with learning bottleneck. Results in (a,b,c) are averaged over three random seeds. (d,e,f,g) show the respective distributions of utterance types in the speaking adult agents (one seed only).4 + +![](images/5d373a5c2aa6a6ce01d896163119b808c393806207c015febda131f8f4a70447.jpg) +(f) Utter. types (Mix_drop) +(g) Utter. types (Bottleneck) + +neck does not result in a more structured language. + +# 7 Discussion and Conclusions + +Neural-agent iterating learning is a promising framework to study the impact of social processes on the emergence of patterns and language universals, like the word order/case marking tradeoff. However, previous work with LSTM-based agents (Chaabouni et al., 2019b) has failed to replicate this human-like pattern. We re-evaluated this finding by (i) hard-coding a least-effort bias into our agents, (ii) designing less systematic input languages, and (iii) introducing a learning bottleneck. In all cases, our agents proved to be accurate learners, but the patterns of language change over generations did not match our expectations. Specifically, least-effort bias (\$4) and highly unpredictable input language (\$5.2) led to communication failure, whereas moderate input language variability (\$5.1) and learning bottleneck (\$6) led to a stable language distribution, confirming previous observations on the survival of redundant coding strategies in neural-agent iterated learning (Chaabouni et al., 2019b). Only combining least-effort bias with moderate language variability (\$5.1) led to a temporary optimization of the language, but that was again followed by communication failure. + +In real language use, the pressure to reduce effort is balanced with communicative needs (Kirby et al., 2015; Regier et al., 2015) and does normally not + +lead to severe language degradation. Future work should design subtler least-effort biases, for instance considering efficiency in terms of grammatical structure and cognitive effort. Moreover, our results with non fully systematic languages show that agents strive to preserve the initial utterance type distribution. In human learning, this behavior is called probability matching and is affected by task complexity: more difficult tasks tend to regularization or over-matching (Ferdinand et al., 2019; Kam and Newport, 2009), where the more frequent variant is chosen more often than it appeared in the input. Over many generations, even a slight overmatching can lead to the emergence of linguistic regularities (Smith and Wonnacott, 2010) like the word order/case marking trade-off observed in human learners by Fedzechkina et al. (2017). We conclude that the current neural-agent iterated learning framework is not yet ready to simulate language evolution processes in a human-like way. More natural cognitive biases supporting efficiency should be modeled, while the speaker objective should be balanced with a measure of communicative success, such as the likelihood of a message to be understood by the listener (Goodman and Frank, 2016; Scontras et al., 2021). + +# Acknowledgements + +Lian was partly funded by the China Scholarship Council (CSC 201906280463). Bisazza was partly funded by the Netherlands Organization for Scientific Research (NWO project 639021646). + +# 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. +Henry Brighton, Kenny Smith, and Simon Kirby. 2005. Language as an evolutionary system. *Physics of Life Reviews*, 2(3):177-226. +Rahma Chaabouni, Eugene Kharitonov, Emmanuel Dupoux, and Marco Baroni. 2019a. Anti-efficient encoding in emergent communication. 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 6290-6300. +Rahma Chaabouni, Eugene Kharitonov, Alessandro Lazaric, Emmanuel Dupoux, and Marco Baroni. 2019b. Word-order biases in deep-agent emergent communication. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5166-5175, Florence, Italy. Association for Computational Linguistics. +Gautier Dagan, Dieuwke Hupkes, and Elia Bruni. 2021. Co-evolution of language and agents in referential games. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 2993-3004, Online. Association for Computational Linguistics. +Bart de Boer. 2006. Computer modelling as a tool for understanding language evolution. In Evolutionary epistemology, language and culture, pages 381-406. Springer. +Maryia Fedzechkina, Elisaa L Newport, and T Florian Jaeger. 2017. Balancing effort and information transmission during language acquisition: Evidence from word order and case marking. Cognitive science, 41(2):416-446. +Vanessa Ferdinand, Simon Kirby, and Kenny Smith. 2019. The cognitive roots of regularization in language. Cognition, 184:53-68. +Richard Futrell, Kyle Mahowald, and Edward Gibson. 2015. Quantifying word order freedom in dependency corpora. In Proceedings of the Third International Conference on Dependency Linguistics (Depling 2015), pages 91-100, Uppsala, Sweden. Uppsala University, Uppsala, Sweden. +Noah D. Goodman and Michael C. Frank. 2016. Pragmatic language interpretation as probabilistic inference. Trends in cognitive sciences, 20(11):818-829. +Joseph Harold Greenberg. 1963. Universals of language. + +Serhii Havrylov and Ivan Titov. 2017. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. 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 2149-2159. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735-1780. +Ramon Ferrer i Cancho and Ricard V Solé. 2003. Least effort and the origins of scaling in human language. Proceedings of the National Academy of Sciences, 100(3):788-791. +Carla L Hudson Kam and Elissa L Newport. 2009. Getting it right by getting it wrong: When learners change languages. Cognitive psychology, 59(1):30-66. +Jasmeen Kanwal, Kenny Smith, Jennifer Culbertson, and Simon Kirby. 2017. Zipf's law of abbreviation and the principle of least effort: Language users optimise a miniature lexicon for efficient communication. Cognition, 165:45-52. +Simon Kirby. 2001. Spontaneous evolution of linguistic structure—an iterated learning model of the emergence of regularity and irregularity. IEEE Transactions on Evolutionary Computation, 5(2):102-110. +Simon Kirby, Tom Griffiths, and Kenny Smith. 2014. Iterated learning and the evolution of language. Current opinion in neurobiology, 28:108-114. +Simon Kirby, Monica Tamariz, Hannah Cornish, and Kenny Smith. 2015. Compression and communication in the cultural evolution of linguistic structure. Cognition, 141:87-102. +Satwik Kottur, José Moura, Stefan Lee, and Dhruv Batra. 2017. Natural language does not emerge 'naturally' in multi-agent dialog. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2962-2967, Copenhagen, Denmark. Association for Computational Linguistics. +Angeliki Lazaridou, Karl Moritz Hermann, Karl Tuys, and Stephen Clark. 2018. Emergence of linguistic communication from referential games with symbolic and pixel input. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Gary Lupyan and Morten H. Christiansen. 2002. Case, word order, and language learnability: Insights from connectionist modeling. In Proceedings of the Twenty-Fourth Annual Conference of the Cognitive Science Society. + +Ofir Press and Lior Wolf. 2017. Using the output embedding to improve language models. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 157-163, Valencia, Spain. Association for Computational Linguistics. +Sashank J. Reddi, Satyen Kale, and Sanjiv Kumar. 2018. On the convergence of adam and beyond. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Terry Regier, Charles Kemp, and Paul Kay. 2015. Word meanings across languages support efficient communication. The handbook of language emergence, 87:237. +Ruslan Salakhutdinov. 2014. Deep learning. In The 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '14, New York, NY, USA - August 24 - 27, 2014, page 1973. ACM. +Gregory Scontras, Michael Henry Tessler, and Michael Franke. 2021. A practical introduction to the rational speech act modeling framework. *ArXiv preprint*, abs/2105.09867. +Kaius Sinnemäki. 2008. Complexity trade-offs in core argument marking. Language complexity: Typology, contact, change, 67:88. +Dan I. Slobin and Thomas G. Bever. 1982. Children use canonical sentence schemas: A crosslinguistic study of word order and inflections. Cognition, 12(3):229-265. +Kenny Smith, Simon Kirby, and Henry Brighton. 2003. Iterated learning: A framework for the emergence of language. Artificial life, 9(4):371-386. +Kenny Smith and Elizabeth Wonnacott. 2010. Eliminating unpredictable variation through iterated learning. Cognition, 116(3):444-449. +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. + +# A Training details + +Following Chaabouni et al. (2019b) we limit the maximum number of segments per trajectory, $i$ , to 5 and at most 3 steps per phrase, resulting in a total of 89k possible trajectories. Subsequently, the number of candidate target utterances during evaluation is set to $k = i! = 120$ . As an exception, for the drop-marker language (Section 5.2) we limit $i$ to 4 instead of 5 due to the computational cost of enumerating all correct utterances for a trajectory in this language during validation (accordingly, $k$ is reduced to 24). The trajectory-utterance pairs are randomly split into training, validation and test sets with a proportion of $80\%$ , $10\%$ and $10\%$ respectively. + +We fix the hidden layer size (20) and batch size (16) for all experiments. Similar to Chaabouni et al. (2019b), we use the Amsgrad optimizer (Reddi et al., 2018). For each generation, the maximum number of training epochs is set to 100 and we stop the training if both speaking and listening accuracy on development set have no improvement over 5 epochs. To ensure the reliability of our results, we repeat each experiment with 3 different random seeds and observe trends over 20 generations (unless trends are already very clear after 10, as in Fig. 2). + +# B Example utterances at various generations + +We let each agent generate six utterances corresponding to the trajectory 'RIGHT UP UP DOWN RIGHT RIGHT'. As some of these utterances are identical, we remove the duplicates and only list unique ones in Tab. 3. + +
Fix+Marker with pressure (l=3)MixMix with pressure (l=3)
InputM1 right 1 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 2 M3 down 1 M4 right 3M1 right 1 M2 up 2 M3 down 1 M4 right 3
M1 right 1 M2 up 2 M4 right 3 M3 down 1M2 up 2 M4 right 3 M3 down 1 M1 right 1
M3 down 1 M1 right 1 M4 right 3 M2 up 2M4 right 3 M2 up 2 M3 down 1 M1 right 1
Iter_0M1 right 1 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 2 M3 down 1 M4 right 3M1 right 1 M2 up 2 M3 down 1 M4 right 3
M3 right 1 M2 up 2 M4 right 3 M3 down 1M1 right 1 M2 up 2 M4 right 3 M3 down 1
Iter_1M1 right 1 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 2 M3 down 1 M4 right 3M1 right 1 M2 up 2 M3 down 1 M4 right 3
M2 up 2 M1 right 1 M4 right 3 M3 down 1M3 down 1 M2 up 2 M4 right 3 M1 right 1
M3 down 1 M2 up 2 M4 right 3 M1 right 1
Iter_5M1 right 1 M2 up 2 M3 down 1 M4 right 3 M1 right 1 M2 up 2 M3 down 1 M4 right 3 M1 right 1 M2 up 2 M3 down 1 M4 right 3 M5 3M3 down 1 M4 right 3 M2 up 2 M1 right 1 M2 up 2 M3 down 1 M4 right 3 M1 right 1 right 1 up 2 down 1 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 2 M3 down 1 M4 right 3 M1 right 1 M4 right 3 M3 down 1 M4 right 3 M4 right 3 M3 down 1 M1 right 1 M2 up 2
Iter_10M1 right 1 M2 up 2 M3 down 1 M1 right 1 M2 up 2 M1 right 1right 1 up 2 down 1 right 3right 1 up 2 down 1 right 3
M2 up 2 M3 down 1 M4 right 3 M1 right 1right 1 up 2
M1 right 1 M3 down 1 M4 right 3 M2 up 2right 1
M1 right 1 M3 down 1 M4 right 3 M2 up 2
right 1 up 2 down 1 right 3
+ +
Mix_dropMix with learning bottleneck
InputM1 right 1 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 2 down 1 M4 right 3M1 right 1 M2 up 2 M3 down 1 M4 right 3
M2 up 2 right 1 M4 right 3 M3 down 1M3 down 1 M1 right 1 M2 up 2 M4 right 3
down 1 M1 right 1 up 2 M4 right 3M4 right 3 M2 up 2 M3 down 1 M1 right 1
M1 right 1 M4 right 3 M2 up 2 M3 down 1
Iter_0right 3 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3
M1 right 1 up 1 M3 down 1 M2 up 2 M4 right 3M3 down 1 M1 right 1 M2 up 2 M4 right 3
M1 right 1 M4 right 3 M3 down 1 M2 up 2M1 right 1 M2 up 2 M3 down 1 M4 right 3
M1 right 1 M2 up 2 M3 down 1 M4 right 3
M3 down 1 M1 right 1 M4 right 3
Iter_1M3 down 1 M1 right 1 M2 up 2 M4 right 3M3 down 1 M4 right 3 M2 up 2 M1 right 1
M2 up 2 M4 right 3 M1 right 1 M3 down 1M4 right 3 M3 down 1 M2 up 2 M1 right 1
M2 up 2 M1 right 1 M3 down 1 M4 right 3M4 right 3 M3 down 1 M1 right 1 M2 up 2
M1 right 1 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 2 M3 down 1 M4 right 3
Iter_5M3 down 1 right 3 M1 right 1 M2 up 2M2 up 2 M4 right 3 M1 right 1 M5 right 3
M2 up 2 M1 right 1 M3 down 1 M4 right 3M2 up 2 M3 down 1 M4 right 3 M1 right 1
right 2 M2 up 2 M3 down 1 M4 right 3right 1 up 2 down 1 right 3
M1 right 1 M2 up 3 M3 down 1 M4 right 3M1 right 1 M3 down 1 M4 right 3 M2 up 2
M1 right 1 M2 up 2 M3 down 1 M4 right 3
M3 down 1 right 3 M4 right 3 M1 right 1
Iter_10M1 right 1 M3 down 1 M4 right 3 M1 right 1M1 right 1 M2 up 2 M3 down 1 M4 right 3
M4 right 3 down 1 M1 right 1 M2 down 1 down 1
M4 right 3 M2 up 2 M4 right 3
M1 right 2 M2 up 3 M3 down 1 M4 right 3
M3 down 1 M1 right 2 M4 right 3 M2 up 1
M1 right 1 M3 down 2 M4 right 3 M3 down 1
+ +Table 3: Utterances sampled from the agents' speaking network given the trajectory 'RIGHT UP UP DOWN RIGHT RIGHT' in Fix+Marker language learning with pressure (\$4), Mix language learning without and with pressure (\$5.1), Mix_drop language learning (\$5.2) and Mix language with learning bottleneck (\$6). For each experiment and each generation, we show six randomly sampled utterances (duplicates are omitted for clarity). \ No newline at end of file diff --git a/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/images.zip b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..eef2a046474f1c451ccc38f91f3ca2bd74308c59 --- /dev/null +++ b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0fc8a25a9c29e658fd9aa6301a4dbfe363046250efcbcd6c1a0dc2d13a96fa0 +size 430742 diff --git a/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/layout.json b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..918579b20584432e238270af80d2706513df1aed --- /dev/null +++ b/theeffectofefficientmessagingandinputvariabilityonneuralagentiteratedlanguagelearning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87424d1377c81e0372730fae99913c023b21efd2719032e93c4fb74e5e54e390 +size 251123 diff --git a/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_content_list.json b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7a91b2c3bc5380f96394ec8fb19e67387b9c5f0d --- /dev/null +++ b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ed4320d2170afbe78cb4ff11ef5d579f7da0a3b9bd020ba608e57261670c8e0 +size 37048 diff --git a/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_model.json b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2a0673f63516b3363e13317056f71fd8f05b0453 --- /dev/null +++ b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16419ab4ca9c1217587e2069b9e4e6a6441e25ec640e8bfc3890f967e636c082 +size 45934 diff --git a/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_origin.pdf b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..63b41e043ee74db42ca522f55559de76484d6fae --- /dev/null +++ b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/151b056e-9bb8-41f5-94bd-82a6ad7cc0ed_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74d3e2c9ac5f06a7b8817d54da3a5c7c7f4359fe307ae65aa8a5d23579351240 +size 229309 diff --git a/theeffectofroundtriptranslationonfairnessinsentimentanalysis/full.md b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9bdfd33b22e8e831a067447ea82d3ed6cc210fc4 --- /dev/null +++ b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/full.md @@ -0,0 +1,127 @@ +# The Effect of Round-Trip Translation on Fairness in Sentiment Analysis + +Jonathan Gabel Christiansen* and Mathias Lykke Gammelgaard* and Anders Søgaard Dpt. of Computer Science, University of Copenhagen + +# Abstract + +Sentiment analysis systems have been shown to exhibit sensitivity to protected attributes. Round-trip translation, on the other hand, has been shown to normalize text. We explore the impact of round-trip translation on the demographic parity of sentiment classifiers and show how round-trip translation consistently improves classification fairness at test time (reducing up to $47\%$ of between-group gaps). We also explore the idea of retraining sentiment classifiers on round-trip-translated data. + +# 1 Introduction + +It is both unethical and potentially illegal for document classification algorithms to perform significantly better for some groups in society than for others (Mehrabi et al., 2019). Many document classification technologies have, however, been shown to be sensitive to protected attributes such as gender and age (Mehrabi et al., 2019; Delobelle et al., 2020; Ferrer et al., 2020; Koh et al., 2021). This also holds for sentiment analysis (Johannsen et al., 2015; Hovy, 2015; Kritchenko and Mohammad, 2018; Bhaskaran and Bhallamudi, 2019; Touileb et al., 2020). At the same time it is known that round-trip machine translation (Huang, 1990; Federmann et al., 2019) can be used to normalize text (Ling et al., 2013; Rabinovich et al., 2017; Prabhumoye et al., 2018). This could potentially remove group specific deviations from normal language. However, Stanovsky et al. (2019) found that machine translation is also prone to potentially introducing gender bias. Combined, this leaves it an open question whether round-trip translation can be used to reduce the sensitivity of document classifiers to protected attributes of the authors. + +In this paper, we evaluate the effect of round-trip translation on fairness using a representative + +# Text + +Sally is a whiz at math. + +Sally es una experta en matemáticas. + +Sally is a math expert. + +Table 1: The normalizing effect of round-trip translation: translating English to Spanish and back. + +corpus of Danish Trustpilot reviews, in which reviews are associated with self-reported protected attributes (gender and age) (Hovy et al., 2015). We evaluate this effect across nine different document classification architectures, both in the setting in which round-trip translation happens at test time only, and in the setting in which both training and test data are translated to a foreign language and back. + +Contributions We evaluate round-trip translation as a technique for mitigating sensitivity to protected attributes across two attributes and three document classification architectures. We find that round-trip translation at test time consistently reduces the fairness gap (with up to $47\%$ ), but that for our best models (SVMs stacked on BERT representations), the effect disappears when both training and test data are translated into a foreign language and back. + +# 2 Round-trip Translation + +Round-trip machine translation (Huang, 1990; Federmann et al., 2019) is the process of machine translating a document to another language and then back to the original language. Table 1 shows a toy example of this process. Ling et al. (2013) found that machine translations of human translations of English tweets into Chinese, back into English, had a tendency to normalize the original text. Rabinovich et al. (2017) observed a similar normalization effect in machine translation systems, and based on their observation, Prabhumoye + +
GroupCharacteristics# of reviews
1Male, Age ≤ 427628
2Female, Age ≤ 425020
3Male, 42 < Age ≤ 557081
4Female, 42 < Age ≤ 555571
5Male, 55 < Age7535
6Female, 55 < Age4489
+ +Table 2: Test groups + +et al. (2018) subsequently proposed to use roundtrip translation for style transfer. In this paper, we investigate whether this observed normalization effect can be used to mitigate fairness problems in document classification. Specifically, we will use Google cloud translation1 to translate Danish product reviews from the Trustpilot corpus (into English and back), to obtain a (machine) normalized version of this corpus, which we make publicly available.2 + +# 3 Experiments + +Fairness metric The fairness literature is rich with definitions of fairness (Mehrabi et al., 2019), most of which are interpretations of the Rawlsian notion of fairness as equal opportunity (Rawls, 1971). In this work, we adopt the following definition of fairness: + +Definition 3.1 (Fairness as equal risk). A model $\theta$ is fair for a set of groups $\mathcal{G}$ , if $\mathbb{E}[\ell(\theta(\mathcal{X}_g), \mathcal{Y}_g)] = \mathbb{E}[\ell(\theta(\mathcal{X}_h, \mathcal{Y}_h)]$ for any $g, h \in \mathcal{G}$ . + +If the maximal difference in empirical risk between any two groups in $\mathcal{G}$ is $\epsilon$ , we say $\theta$ is $\epsilon$ -fair. Below we use the F1-score for the negative class as our $\ell(\cdot)$ .3 Note how fairness as equal risk is a generalization of approximately equal conditional risk (Donini et al., 2018). + +Data The Danish section of the Trustpilot Corpus consists of 149,240 reviews annotated for (self-reported) sentiment, gender and age. The sentiment ratings are provided on a scale from 1 to 5, which we binarize by mapping low ratings to negative class, i.e., $\{1,2,3\} \mapsto 0$ , and high ratings to positive class, i.e., $\{4,5\} \mapsto 1$ . This leads to a highly skewed distribution of 8,257 negative reviews and 140,983 positive ones. This also motivates the use + +of F1-score for the negative class as our performance metric. + +We randomly split the data set into training and test leaving $75\%$ of the reviews as training data, and $25\%$ of the reviews as our test data. The test set is further split into six demographic groups according to self-reported gender4 and age (binned in three equal groups), as presented in Table 2. We use these six roughly equal-sized groups to evaluate the fairness of our models. + +Impact of round-trip translation We use KL-divergence to get a first impression of the extent to which round-trip translation normalizes our data. This is done across the most frequent 1,000 words in the Trustpilot corpus. For each group, we calculate the probability distribution for these words and compute its KL-divergence to the overall distribution. We do this before and after round-trip translating. Table 4 lists the KL-divergencies before and after round-trip translation. As expected, we observe a significant decrease in KL-divergence for all groups after round-trip translating. This indicates that the reviews were indeed normalized during the process of round-trip translation. We also see that the number of unique words dropped by $36\%$ after round-trip translation. + +Document classifiers Our document classifiers all rely on vector representations from pretrained language models. We use two different pretrained language models, namely the multilingual LASER model (Artetxe and Schwenk, 2019) and a monolingual BERT (Devlin et al., 2019) trained for Danish. On top of these we train several classifiers, including nearest neighbor, logistic regression, and (Gaussian kernel) support vector machines (SVMs). We set regularization parameters through grid-search and cross-validation over the training data, but also report results for unregularized logistic regression and SVMs. See Table 3 for hyper-parameters and results. + +# 4 Results + +In Table 3, we evaluate three document classification architectures across three scenarios: (a) a + +
ModelParamsMinMaxFairness GapReduction?
REVISIONS → REVIEWS (baseline condition)
BERT-KNNk=60.4280.6280.200
BERT-LRl2-regularized0.6280.7480.120
BERT-LRunregularized0.6330.7350.102Undefined
BERT-SVMC=10, rbf0.6420.7500.108
BERT-SVMC=1000, rbf0.6250.7440.119
LASER-LRl2-regularized0.0090.0450.036
LASER-LRunregularized0.5190.6930.174
LASER-SVMC=10, rbf0.5700.7370.167
LASER-SVMC=1000, rbf0.5730.7370.164
REVISIONS → ROUND-TRIP
BERT-KNNk=60.4200.5710.151↓
BERT-LRl2-regularized0.6080.7120.104↓
BERT-LRunregularized0.6080.7060.098↓
BERT-SVMC=10, rbf0.6120.7100.098↓
BERT-SVMC=1000, rbf0.6150.7100.095↓
LASER-LRl2-regularized0.0090.0480.039↑
LASER-LRunregularized0.5290.6820.153↓
LASER-SVMC=10, rbf0.5800.7050.125↓
LASER-SVMC=1000, rbf0.5860.7050.119↓
ROUND-TRIP → ROUND-TRIP
BERT-KNNk=60.4680.5750.107↓
BERT-LRl2-regularized0.6050.7250.120⇒
BERT-LRunregularized0.6170.7260.109↑
BERT-SVMC=10, rbf0.5920.7420.150↑
BERT-SVMC=1000, rbf0.6000.7310.131↑
LASER-LRl2-regularized0.6100.7300.120↑
LASER-LRunregularized0.5450.6890.144↓
LASER-SVMC=10, rbf0.5890.7130.124↓
LASER-SVMC=1000, rbf0.5880.7150.127↓
+ +Table 3: We use $F_{1}$ score of positive class as our performance metric. We make several observations: (a) Round-trip translation at test time consistently reduces the fairness gap, and with up to $47\%$ . (b) Round-trip translation of training and test data reduces the fairness gap for LASER models, but widens it for BERT models. (c) Generally, LASER models seem less fair than BERT models, and unregularized models seem more fair than regularized ones. The latter observation aligns with previous work indicating that sparseness is at odds with robustness and fairness (Globerson and Roweis, 2006; Søgaard, 2013; Khani and Liang, 2021). + +
GroupKLD REVIEWSKLD ROUND-TRIP
10.0270.021
20.0280.023
30.0110.009
40.0230.021
50.0280.022
60.0270.020
+ +Table 4: The KL-divergence between the probability distribution of the 1000 most frequent words in each group and the general distribution, before and after round-trip translation. Round-trip translation reduces group-level divergences. + +baseline condition in which classifiers are trained and evaluated on Trustpilot reviews; (b) a scenario in which reviews are round-trip-translated at test time for normalization; and (c) a condition in which the classifiers are retrained on round-trip-translated reviews and evaluated on round-trip-translated reviews. + +Test time normalization with round trip translation (b) has an overall positive effect on cross-group generalization, reducing the fairness gap with up to $\sim 27\%$ . The third scenario (c) - i.e., the idea of using round-trip translation for normalizing both the training and the test data - yields mixed results, with fairness gap increases up to $\sim 39\%$ (for BERT models) and decreases up to $\sim 47\%$ (for LASER models). Machine translation introduces its own biases, and some representations may be more sensitive to such biases. Note also that the process of round-trip translating the data consistently reduces the overall accuracy of our document classifiers, suggesting a trade-off between fairness and accuracy. + +# 5 Discussion + +Round-trip translation is a simple technique for test-time input normalization, and we have shown that it can significantly reduce sensitivity to protected attributes at a low performance cost. One advantage of round-trip translation is that it does not require annotation of protected attributes. Such datasets are generally only available for English at this point. High-quality machine translation, in contrast, is available for hundreds of languages. In this paper, we experiment with using round-trip translation to reduce group disparity of sentiment classifiers for Danish. + +It is important to note, however, that the overall performance drop that results from round-trip trans + +lation, while relatively small, means that the absolute performance on minority group drops. In other words, all users experience worse performance with the more fair sentiment classifiers. This, of course, is unfortunate and potentially introduces an ethical dilemma. In fact, it is only with our LASER models that minority group performance improves and fairness is reduced. + +Round-trip translation is orthogonal to other approaches to improving fairness, such as distributionally robust optimization (Sagawa et al., 2020), invariant risk minimization (Arjovsky et al., 2020), and adversarial training (Dayanik and Padó, 2021). Round-trip translation can thus easily be combined with any of these approaches, but note that these approaches require annotation of protected attributes. Round-trip translation does not and can thus be considered an unsupervised approach to reducing group disparities. + +The fairness gap was most consistently reduced by test-time round-trip translation, but doing round-trip translation may be more effective for other machine translation systems. In our experiments, Google Translate introduced new biases when relying on BERT representations, but the approach was successful for document classifiers based on LASER representations: Here, we saw both reductions of the fairness gap and improvements for minority groups. For 2/4 classifiers, we even saw improvements for the majority groups. + +# 6 Conclusion + +Sentiment classifiers perform better on reviews written by some demographic groups rather than others, with groups defined by protected attributes such as gender and age. We present a first experiment with round-trip translation as a means of reducing this fairness gap in sentiment classification. Specifically, we show that translating Danish product reviews into English and back, reduces group disparity across three different classification architectures. While the performance cost may in our case be prohibitive for some architectures, in practice, we believe that round-trip translation can be an important technique for improving the fairness of document classifiers in the future, which is easier to scale to new tasks and languages than approaches that require annotation of protected attributes. + +# Ethics Statement + +The gender and age information in the Trustpilot Corpus is self-reported, and all reviewers were free to not report this information. All reviewers that supplied gender information, identified as either male or female, but were free to report other genders. + +# Acknowledgement + +This work was supported by the Innovation Fund Denmark (Grants no. 0175-00011A and 0175-00014B). + +# References + +Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. 2020. Invariant risk minimization. +Mikel Artetxe and Holger Schwenk. 2019. Massively multilingual sentence embeddings for zero-shot cross-lingual transfer and beyond. Transactions of the Association for Computational Linguistics, 7:597-610. +Jayadev Bhaskaran and Isha Bhallamudi. 2019. Good secretaries, bad truck drivers? occupational gender stereotypes in sentiment analysis. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pages 62-68, Florence, Italy. Association for Computational Linguistics. +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, Online. Association for Computational Linguistics. +Pieter Delobelle, Paul Temple, Gilles Perrouin, Benoit Frénay, Patrick Heymans, and Bettina Berendt. 2020. Ethical adversaries: Towards mitigating unfairness with adversarial machine learning. +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. +Michele Donini, Luca Oneto, Shai Ben-David, John S Shawe-Taylor, and Massimiliano Pontil. 2018. Empirical risk minimization under fairness constraints. In Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc. + +Christian Federmann, Oussama Elachqar, and Chris Quirk. 2019. Multilingual whispers: Generating paraphrases with translation. In Proceedings of the 5th Workshop on Noisy User-generated Text (W-NUT 2019), pages 17-26, Hong Kong, China. Association for Computational Linguistics. +Xavier Ferrer, Tom van Nuenen, Jose M. Such, Mark Côté, and Natalia Criado. 2020. Bias and discrimination in ai: a cross-disciplinary perspective. +Amir Globerson and Sam T. Roweis. 2006. Nightmare at test time: robust learning by feature deletion. In ICML, volume 148 of ACM International Conference Proceeding Series, pages 353-360. ACM. +Dirk Hovy. 2015. Demographic factors improve classification performance. 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 752-762, Beijing, China. Association for Computational Linguistics. +Dirk Hovy, Anders Johannsen, and Anders Søgaard. 2015. User review sites as a resource for large-scale sociolinguistic studies. In Proceedings of the 24th International Conference on World Wide Web, WWW '15, page 452-461, Republic and Canton of Geneva, CHE. International World Wide Web Conferences Steering Committee. +Xiuming Huang. 1990. A machine translation system for the target language inexpert. In COLNG 1990 Volume 3: Papers presented to the 13th International Conference on Computational Linguistics. +Anders Johannsen, Dirk Hovy, and Anders Søgaard. 2015. Cross-lingual syntactic variation over age and gender. In Proceedings of the Nineteenth Conference on Computational Natural Language Learning, pages 103–112, Beijing, China. Association for Computational Linguistics. +Fereshte Khani and Percy Liang. 2021. Removing spurious features can hurt accuracy and affect groups disproportionately. In *FAccT* '21: 2021 ACM Conference on Fairness, Accountability, and Transparency, Virtual Event / Toronto, Canada, March 3-10, 2021, pages 196-205. ACM. +Svetlana Kiritchenko and Saif Mohammad. 2018. Examining gender and race bias in two hundred sentiment analysis systems. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pages 43-53, New Orleans, Louisiana. Association for Computational Linguistics. +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. +Wang Ling, Chris Dyer, Alan W Black, and Isabel Trancoso. 2013. Paraphrasing 4 microblog normalization. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 73-84, Seattle, Washington, USA. Association for Computational Linguistics. +Ninareh Mehrabi, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. 2019. A survey on bias and fairness in machine learning. +Shrimai Prabhumoye, Yulia Tsvetkov, Ruslan Salakhutdinov, and Alan W Black. 2018. Style transfer through back-translation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 866-876, Melbourne, Australia. Association for Computational Linguistics. +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, Valencia, Spain. Association for Computational Linguistics. +John Rawls. 1971. A Theory of Justice, 1 edition. Belknap Press of Harvard University Press, Cambridge, Massachusetts. +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. +Anders Søgaard. 2013. Zipfian corruptions for robust POS tagging. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 668-672, Atlanta, Georgia. Association for Computational Linguistics. +Gabriel Stanovsky, Noah A. Smith, and Luke Zettlemoyer. 2019. Evaluating gender bias in machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1679-1684, Florence, Italy. Association for Computational Linguistics. +Samia Touileb, Lilja Øvrelid, and Erik Velldal. 2020. Gender and sentiment, critics and authors: a dataset of Norwegian book reviews. In Proceedings of the Second Workshop on Gender Bias in Natural Language Processing, pages 125-138, Barcelona, Spain (Online). Association for Computational Linguistics. \ No newline at end of file diff --git a/theeffectofroundtriptranslationonfairnessinsentimentanalysis/images.zip b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7c072e46d65ced13a6412f5fc55481df08273881 --- /dev/null +++ b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b39dd4305dc6da0e4b69cf81140375470ccf2b0696514cc2f61d7c2cf7b62cb +size 233539 diff --git a/theeffectofroundtriptranslationonfairnessinsentimentanalysis/layout.json b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5d8bd63b652ac55f085cec78de91d82e0f2a2466 --- /dev/null +++ b/theeffectofroundtriptranslationonfairnessinsentimentanalysis/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1902a94a9c76148f7ae31e20a8c084dd45385eb330f6e6a4bbe311fa7391ca54 +size 156903 diff --git a/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_content_list.json b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c564e7ce76f9b93d0231432419a90cf0647b2585 --- /dev/null +++ b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf9b126e8cec9b0783e1ee25bcab4274030cca480bbb23943eea948edc0570fc +size 93673 diff --git a/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_model.json b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a61d5bf1d59163f2ac64074b1fed96e5fd27e653 --- /dev/null +++ b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3242f1be3ac4f24efbcaf895d0502172c8b1d1a322485e98d27cef7e085fab4 +size 116172 diff --git a/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_origin.pdf b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7087cf69150af32beb986e1168ac9d3276a622f5 --- /dev/null +++ b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/446c458b-67ce-44fe-8224-37d8ebc8f66a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9675cee5f350b5c2361a6b3c59a75c480dbbf68f47d0858f7527880d46b51fc6 +size 727284 diff --git a/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/full.md b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a6c798315bc66e6ebb7996506c1fec312e883b0c --- /dev/null +++ b/thefutureisnotonedimensionalcomplexeventschemainductionbygraphmodelingforeventprediction/full.md @@ -0,0 +1,410 @@ +# The Future is not One-dimensional: Complex Event Schema Induction by Graph Modeling for Event Prediction + +Manling Li $^{1}$ , Sha Li $^{1}$ , Zhenhailong Wang $^{1}$ , Lifu Huang $^{2}$ , Kyunghyun Cho $^{3}$ , Heng Ji $^{1}$ , Jiawei Han $^{1}$ , Clare Voss $^{4}$ + +$^{1}$ UIUC $^{2}$ Virginia Tech $^{3}$ NYU $^{4}$ US ARL + +{manling2,shal2,wangz3,hengji,hanj}@illinois.edu, lifuh@vt.edu,kyunghyun.cho@nyu.edu,clare.r.voss.civ@mail.mil + +# Abstract + +Event schemas encode knowledge of stereotypical structures of events and their connections. As events unfold, schemas are crucial to act as a scaffolding. Previous work on event schema induction focuses either on atomic events or linear temporal event sequences, ignoring the interplay between events via arguments and argument relations. We introduce a new concept of Temporal Complex Event Schema: a graph-based schema representation that encompasses events, arguments, temporal connections and argument relations. In addition, we propose a Temporal Event Graph Model that predicts event instances following the temporal complex event schema. To build and evaluate such schemas, we release a new schema learning corpus containing 6,399 documents accompanied with event graphs, and we have manually constructed gold-standard schemas. Intrinsic evaluations by schema matching and instance graph perplexity, prove the superior quality of our probabilistic graph schema library compared to linear representations. Extrinsic evaluation on schema-guided future event prediction further demonstrates the predictive power of our event graph model, significantly outperforming human schemas and baselines by more than $23.8\%$ on HITS@1. + +# 1 Introduction + +The current automated event understanding task has been overly simplified to be local and sequential. Real world events, such as disease outbreaks and terrorist attacks, have multiple actors, complex timelines, intertwined relations and multiple possible outcomes. Understanding such events requires knowledge in the form of a library of event schemas, capturing the progress of time, and performing global inference for event prediction. For + +example, regarding the 2019 protest in Hong Kong International Airport, a typical question from analysts would be "How long will the flights being canceled?" This requires an event understanding system to match events to schema representations and reason about what might happen next. The airport protest schema would be triggered by "protest" and "flight cancellation", and evidence of protesters (e.g., the number of protesters, the instruments being used, etc) will suggest a CEO resignation event, or a flight rescheduling event, or continuous flight cancellation events with respective probabilities. + +![](images/0abf9cba33031a9076ec00545b87d21037f2cc56015e6b79b82b7a49b6d9875c.jpg) +Figure 1: The example schema of the complex event type car-bombing. A person learned to make bombs and bought materials as well as a vehicle. Then the bomb was assembled to the vehicle, and then the attacker drove it to attack people. People can be hurt by the vehicle, or by the explosion of the bomb, or by the crash of the vehicle. + +Comprehending such a news story requires following a timeline, identifying key events and tracking characters. We refer to such a "story" as a complex event, e.g., the Kabul ambulance bombing event. Its complexity comes from the inclusion of multiple atomic events (and their arguments), relations and temporal order. A complex event schema can be used to define the typical structure of a particular type of complex event, e.g., carbombing. This leads us to the new task that we address in this paper: temporal complex event + +schema induction. Figure 1 shows an example schema about car-bombing with multiple temporal dependencies between events. Namely, the occurrence of one event may depend on multiple events. For example, the ASSEMBLE event happens after buying both the bomb materials and the vehicle. Also, there may be multiple events following an event, such as the multiple consequences of the ATTACK event in Figure 1. That is to say, "the future is not one-dimensional". Our automatically induced probabilistic complex event schema can be used to forecast event abstractions into the future and thus provide a comprehensive understanding of evolving situations, events, and trends. + +For each type of complex event, we aim to induce a schema library that is probabilistic, temporally organized and semantically coherent. Low level atomic event schemas are abundant, and can be part of multiple, sparsely occurring, higher-level schemas. We propose a Temporal Event Graph Model, an auto-regressive graph generation model, to reach this goal. Given a currently extracted event graph, we generate the next event type node with its potential arguments, such as the ARREST event in Figure 2, and then propagate edge-aware information following temporal orders. After that, we employ a copy mechanism to generate coreferential arguments, such as the DETAINEE argument is the ATTACKER of the previous ATTACK event, and build relation edges for them, e.g., PARTWhole relation between the PLACE arguments. Finally, temporal dependencies are determined with argument connections considered, such as the temporal edge showing that ARREST is after ATTACK. + +Our generative model serves as both a schema library and a predictive model. Specifically, we can probe the model to generate event graphs unconditionally to obtain a set of schemas. We can also pass partially instantiated graphs to the model and "grow" the graph either forward or backward in time to predict missing events, arguments or relations, both from the past and in the future. We propose a set of schema matching metrics to evaluate the induced schemas by comparing with human-created schemas and show the power of the probabilistic schema in the task of future event prediction as an extrinsic evaluation, to predict event types that are likely to happen next. + +We make the following novel contributions: + +- This is the first work to induce probabilistic temporal graph schemas for complex events + +
SymbolMeaning
G∈GInstance graph of a complex event
S∈SSchema graph of a complex event type
e∈EEvent node in an instance graph
v∈VEntity node in an instance graph
{ei,el}Temporal ordering edge between events eiand el, indicating eiis before el
{ei,a,vj}Argument edge, indicatingvjplays argument role a in the event ei
{vj,r,vk}Relation edge between entitiesvjand vk,and r is the relation type
A(e)Argument role set of event e, defined by the IE ontology
ΦεThe type set of events
ΦγThe type set of entities
φ(·)A mapping function from a node to its type
G<i>Subgraph of G containing events before eiand their arguments
+ +Table 1: List of symbols + +across documents, which capture temporal dynamics and connections among individual events through their coreferential or related arguments. + +- This is the first application of graph generation methods to induce event schemas. +- This is the first work to use complex event schemas for event type prediction, and also produce multiple hypotheses with probabilities. +- We have proposed a comprehensive set of metrics for both intrinsic and extrinsic evaluations. +- We release a new data set of 6,399 documents with gold-standard schemas annotated manually. + +# 2 Problem Formulation + +From a set of documents describing a complex event, we construct an instance graph $G$ which contains event nodes $E$ and entity nodes (argument nodes) $V$ . There are three types of edges in this graph: (1) event-event edges $\langle e_i, e_l \rangle$ connecting events that have direct temporal relations; (2) event-entity edges $\langle e_i, a, v_j \rangle$ connecting arguments to the event; and (3) entity-entity edges $\langle v_j, r, v_k \rangle$ indicating relations between entities. We can construct instance graphs by applying Information Extraction (IE) techniques on an input text corpus. In these graphs, the relation edges do not have directions but temporal edges between events are directional, going from the event before to the event after. + +For each complex event type, given a set of instance graphs $\mathcal{G}$ , the goal of schema induction is to generate a schema library $S$ . In each schema graph $S$ , the nodes are abstracted to the types of events and entities. Figure 1 is an example + +Existing Graph +![](images/932a39c00d14ce592da79546eb8ce2b1babf279a7e6d7088301ec64f7ec08dbe.jpg) +Temporal Ordering + +(1) Event Generation +![](images/25f3a780ab7b2de81aaaa5543f7fdd6233894a7e3838724e8d7067d19a55f72b.jpg) +Temporal Ordering + +(2) Edge-Aware Graph Neural Network +![](images/ac4a628e8158dfbd413b9632ef2ab6dc9f7c9258679ef48d15d34dd8485ce3af.jpg) +Temporal Ordering + +![](images/2ff4e768bc36eac63a829efb064bd6494d20e63342bfca3fb65db6c691bbf765.jpg) +(3) Coreferential Argument Generation + +![](images/e0fa1935db70705e38c8fef0dd135cc02df796d41d68c7cd94c79a39caf09613.jpg) +(4) Entity Relation Edge Generation + +![](images/cd23fdb09a35f76b4d6bcbc1eea8a0c9fafb84c8abf0e4d5466d1b2cf5de7eee.jpg) +(5) Event Temporal Ordering Prediction +Figure 2: The generation process of Temporal Event Graph Model. + +of schema $^2$ for complex event type car-bombing. Schema graphs can be regarded as a summary abstraction of instance graphs, capturing the reoccurring structures. + +# 3 Our Approach + +# 3.1 Instance Graph Construction + +To induce schemas for a complex event type, such as car-bombing, we construct a set of instance graphs, where each instance graph is about one complex event, such as Kabul ambulance bombing. + +We first identify a cluster of documents that describes the same complex event. In this paper, we treat all documents linked to a single Wikipedia page as belonging to the same complex event, detailed in §4.1. + +We use OneIE, a state-of-the-art Information Extraction system (Lin et al., 2020), to extract entities, relations and events, and then perform cross-document entity (Pan et al., 2015, 2017) and event coreference resolution (Lai et al., 2021) over the document cluster of each complex event. We further conduct event-event temporal relation extraction (Ning et al., 2019; Wen et al., 2021b) to determine the order of event pairs. We run the entire + +pipeline following (Wen et al., 2021a) $^{3}$ , and the detailed extraction performance is reported in the paper. + +After extraction, we construct one instance graph for each complex event, where coreferential events or entities are merged. We consider the isolated events as irrelevant nodes in schema induction, so they are excluded from the instance graphs during graph construction. Considering schema graphs focus on type-level abstraction, we use type label and node index to represent each node, ignoring the mention level information in these instance graphs. + +# 3.2 Temporal Event Graph Model Overview + +Given an instance graph $\mathcal{G}$ , we regard the schema as the hidden knowledge to guide the generation of these graphs. To this end, we propose a temporal event graph model that maximizes the probability of each instance graph, parameterized by $\prod_{G\in \mathcal{G}}p(G)$ . At each step, based on the previous graph $G_{< i}$ , we predict one event node $e_i$ with its arguments to generate the next graph $G_{i}$ + +$$ +p (G) = \prod_ {i = 0} ^ {| \mathcal {E} |} p \left(G _ {i} \mid G _ {< i}\right). +$$ + +We factorize the probability of generating new nodes and edges as: + +$$ +\begin{array}{l} p (G _ {i} | G _ {< i}) = p \left(e _ {i} | G _ {< i}\right) \prod_ {a _ {j} \in \mathcal {A} (e _ {i})} p (\langle e _ {i}, a _ {j}, v _ {j} \rangle | e _ {i}, a _ {j}) \\ \prod_ {v _ {k} \in G _ {< i}} p (\langle v _ {j}, r, v _ {k} \rangle | v _ {j}, v _ {k}) \prod_ {e _ {l} \in G _ {< i}} p (\langle e _ {i}, e _ {l} \rangle | e _ {i}, e _ {l}). \tag {1} \\ \end{array} +$$ + +As shown in Figure 2, an event node $e_i$ is generated first according to the probability $p(e_i | G_{