diff --git a/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_content_list.json b/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6f4eff25c37757c504aec8cfcf5e27403c01d078 --- /dev/null +++ b/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:920227012980db3f31b5b86c1bb5bfce3caaa5190c11c76ee25862304af6be57 +size 101514 diff --git a/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_model.json b/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_model.json new file mode 100644 index 0000000000000000000000000000000000000000..be52da6c1c5cd50c11c6be203a54cd7ff72eea72 --- /dev/null +++ b/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cafe03c29a439776b9f228bbc0aba9d1359fda571a7240be85e9cb8826061df +size 121962 diff --git a/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_origin.pdf b/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ec6b19a5aa394de7eeb5e303c7af1e5d896886d9 --- /dev/null +++ b/ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0fc5a9cfb01f35f9c0b64070aeb70db7f91096c34c8f5b7c8fdbfdb2d15a143 +size 1543197 diff --git a/ambigqaansweringambiguousopendomainquestions/full.md b/ambigqaansweringambiguousopendomainquestions/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b52ac82e1dd2734527bda44a4cb17945dfe7632a --- /dev/null +++ b/ambigqaansweringambiguousopendomainquestions/full.md @@ -0,0 +1,449 @@ +# AMBIGQA: Answering Ambiguous Open-domain Questions + +Sewon Min, $^{1,2}$ Julian Michael, $^{1}$ Hannaneh Hajishirzi, $^{1,3}$ Luke Zettlemoyer $^{1,2}$ + +1University of Washington 2Facebook AI Research 3Allen Institute for Artificial Intelligence + +{sewon, julianjm, hannaneh, lsz}@cs.washington.edu + +# Abstract + +Ambiguity is inherent to open-domain question answering; especially when exploring new topics, it can be difficult to ask questions that have a single, unambiguous answer. In this paper, we introduce AMBIGQA, a new open-domain question answering task which involves finding every plausible answer, and then rewriting the question for each one to resolve the ambiguity. To study this task, we construct AMBIGNQ, a dataset covering 14,042 questions from NQ-OPEN, an existing open-domain QA benchmark. We find that over half of the questions in NQ-OPEN are ambiguous, with diverse sources of ambiguity such as event and entity references. We also present strong baseline models for AMBIGQA which we show benefit from weakly supervised learning that incorporates NQ-OPEN, strongly suggesting our new task and data will support significant future research effort. Our data and baselines are available at https://nlp.cs.washington.edu/ambigqa. + +# 1 Introduction + +In the open-domain setting, it can be difficult to formulate clear and unambiguous questions. For example, Figure 1 shows a Google search query (Kwiatkowski et al., 2019) that, perhaps surprisingly, has two possible interpretations given the evidence in Wikipedia. Although open-domain question answering (QA) systems aim to answer any factoid question (Voorhees et al., 1999), existing methods assume questions have a single well-defined answer. Nonetheless, ambiguity arises frequently in open-domain QA, where questions are written during information gathering (e.g., search queries) without knowledge of the answer. As we will see in Section 4, over $50\%$ of the questions we sampled from a set of Google search queries are ambiguous. Furthermore, identifying ambiguities is difficult both for humans and machines. As + +![](images/7aa3b76fc49ca5e14d6ffa6006d3cc835964666e79ec915a3344dd915cb2973e.jpg) + +# AMBIGQA Input + +When did harry potter and the sorcerer's stone movie come out? + +Harry Potter and the Philosopher's Stone (film) +From Wikipedia, the free encyclopedia + +The film had its world premiere at the Odeon Leicester Square in London on 4 November 2001, with the cinema arranged to resemble Hogwarts School. (...) The film was released to cinemas in the United Kingdom and United States on 16 November 2001. + +# AMBIGQA Output + +Q: When did harry potter and the sorcerer's stone movie come out at the Odeon Leicester Square? A: 4 November 2001 +Q: When did harry potter and the sorcerer's stone movie come out in cinemas? +A: 16 November 2001 + +![](images/52406853a35279c3b2c32d3088cdb283bcd3a96508ab4c782b59b0c0e50e15b2.jpg) +Figure 1: An AMBIGNQ example where the prompt question (top) appears to have a single clear answer, but is actually ambiguous upon reading Wikipedia. AMBIGQA requires producing the full set of acceptable answers while differentiating them from each other using disambiguated rewrites of the question. + +shown in Figure 1, ambiguity is a function of both the question and the evidence provided by a large text corpus. + +To study this challenge, we introduce AMBIGQA (Answering Ambiguous Open-domain Questions), a new task which involves disambiguating and answering potentially ambiguous questions. Specifically, the model must (1) find a set of distinct, equally plausible answers to the question, and (2) provide minimal yet unambiguous rewrites of the question that clarify the interpretation which leads to each answer. Figure 1 shows two such disambiguated questions and their answers. + +To support the study of this task, we construct a dataset called AMBIGNQ using 14,042 questions from an open-domain version of NATURAL QUESTIONS (Kwiatkowski et al., 2019), denoted NQ-OPEN. For each question, annotators search for, + +
TypeExample
Event references (39%)What season does meredith and derek get married in grey's anatomy? +Q: In what season do Meredith and Derek get informally married in Grey's Anatomy? / A: Season 5 +Q: In what season do Meredith and Derek get legally married in Grey's Anatomy? / A: Season 7
Properties (27%)How many episode in seven deadly sins season 2? +Q: How many episodes were there in seven deadly sins season 2, not including the OVA episode? / A: 25 +Q: How many episodes were there in seven deadly sins season 2, including the OVA episode? / A: 26
Entity references (23%)How many sacks does clay matthews have in his career? +Q: How many sacks does Clay Matthews Jr. have in his career? / A: 69.5 +Q: How many sacks does Clay Matthews III have in his career? / A: 91.5
Answer types (16%)Who sings the song what a beautiful name it is? +Q: Which group sings the song what a beautiful name it is? / A: Hillsong Live +Q: Who is the lead singer of the song what a beautiful name it is? / A: Brooke Ligertwood
Time-dependency (13%)When does the new family guy season come out? +Q: When does family guy season 16 come out? / A: October 1, 2017 +Q: When does family guy season 15 come out? / A: September 25, 2016 +Q: When does family guy season 14 come out? / A: September 27, 2015
Multiple sub-questions (3%)Who was british pm and viceroy during quit india movement? +Q: Who was british viceroy during quit India movement? / A: Victor Hope +Q: Who was british pm during quit India movement? / A: Winston Churchill
+ +Table 1: Breakdown of the types of ambiguity in 100 randomly sampled items from the AMBIGNQ development data. Each example may fall into multiple categories. + +navigate, and read multiple Wikipedia pages to find as many answers as possible. The high prevalence of ambiguity makes the task difficult even for human experts; it is inherently difficult to know if you have found every possible interpretation of a question. Nonetheless, we are able to collect high quality data covering high levels of ambiguity (2.1 distinct answers per question on average) with high estimated agreement (89.0 F1) on valid answers. The types of ambiguity are diverse and sometimes subtle (Table 1), including ambiguous entity or event references, or ambiguity over the answer type; many are only apparent after examining one or more Wikipedia pages. + +To establish initial performance levels on this data, we present a set of strong baseline methods. We extend a state-of-the-art QA model (Karpukhin et al., 2020) with three new components: (1) set-based question answering with a sequence-to-sequence model, (2) a question disambiguation model, and (3) a modification to democratic constraining (Zhou and Goldman, 2004) which leverages the partial supervision available in the full NQ-OPEN dataset. We also do an ablation study and qualitative analysis, which suggest there is significant room for future work on this task. + +To summarize, our contributions are threefold. + +1. We introduce AMBIGQA, a new task which requires identifying all plausible answers to + +an open-domain question, along with disambiguated questions to differentiate them. + +2. We construct AMBIGNQ, a dataset with 14,042 annotations on NQ-OPEN questions containing diverse types of ambiguity. +3. We introduce the first baseline models that produce multiple answers to open-domain questions, with experiments showing their effectiveness in learning from our data while highlighting avenues for future work. + +# 2 Related Work + +Open-domain Question Answering requires a system to answer any factoid question based on evidence provided by a large corpus such as Wikipedia (Voorhees et al., 1999; Chen et al., 2017). Existing benchmarks use questions of various types, from open-ended information-seeking (Berant et al., 2013; Kwiatkowski et al., 2019; Clark et al., 2019) to more specialized trivia/quiz (Joshi et al., 2017; Dunn et al., 2017). To the best of our knowledge, all existing formulations assume each question has a single clear answer. + +Our work is built upon an open-domain version of NATURAL QUESTIONS (Kwiatkowski et al., 2019), denoted NQ-OPEN, composed of questions posed by real users of Google search, each with an answer drawn from Wikipedia. NQ-OPEN has promoted several recent advances in open + +domain question answering (Lee et al., 2019; Asai et al., 2020; Min et al., 2019a,b; Guu et al., 2020; Karpukhin et al., 2020). Nonetheless, Kwiatkowski et al. (2019) report that the answers to such questions are often debatable, and the average agreement rate on NQ-OPEN test data is $49.2\%$ , in large part due to ambiguous questions. In this work, we embrace this ambiguity as inherent to information seeking open-domain QA, and present the first methods for returning sets of answers paired with different interpretations of the question. + +Clarification Questions have been used to study question ambiguity in other settings. Research on community Q&A (Braslavski et al., 2017; Rao and Daumé III, 2018, 2019) studies finding underspecification in the question, but it does not find the answer to the original question. In recent work, Xu et al. (2019) study clarification of questions that are intentionally annotated with pre-specified entity reference ambiguities. Aliannejadi et al. (2019) and Zamani et al. (2020) use clarification questions to refine intents of simple query logs without immediately apparent information needs (e.g., single keywords like $\text{dinosaur}^2$ ). + +In contrast, we study open-domain factoid questions asked by real users: these present clear information needs, but carry diverse naturally occurring ambiguities (see Table 1). Furthermore, instead of prolonging the user's information-seeking session with clarification questions, our task formulation provides a complete and immediate solution with unambiguous rewrites of the original question. + +Question Rewriting is a novel, well-defined task which we propose for differentiating distinct answers. To the best of our knowledge, it has not been studied for resolving ambiguity; we are only aware of Elgohary et al. (2019) which use question rewriting to convert conversational questions into self-contained questions. + +# 3 Task: AMBIGQA + +# 3.1 AMBIGQA Setup + +Figure 1 depicts the AMBIGQA task. The input is a prompt question $q$ , and the output is a list of $n$ question-answer pairs $(x_{1},y_{1}),\ldots ,(x_{n},y_{n})$ where each $y_{i}$ is an equally plausible answer to $q$ and each $x_{i}$ is a minimally edited modification of + +$q$ whose answer is unambiguously $y_{i}$ . We consider two subtasks. + +Multiple Answer Prediction. Given a question $q$ , output a set of semantically distinct and equally plausible answers $y_{1},\ldots ,y_{n}$ , where $n$ is unknown. + +Question Disambiguation. Given $q$ and a set of answers $y_{1},\ldots ,y_{n}$ , generate disambiguated questions $x_{1},\ldots ,x_{n}$ , where each $x_{i}$ is a minimal edit of $q$ which makes it unambiguous so that $y_{i}$ is a correct answer and all $y_{j}$ for all $j\neq i$ are incorrect. When $n = 1$ , this task is trivial, as $x_{1} = q$ . + +We choose to represent ambiguity with a set of disambiguated questions because it is well-defined, immediately human-interpretable, and allows for straightforward annotation of a wide range of ambiguities without complex guidelines. + +# 3.2 Evaluation Metrics + +To evaluate model performance, we present several ways to compare a model prediction with $m$ question-answer pairs $(x_{1},y_{1}),\ldots ,(x_{m},y_{m})$ with a gold reference set with $n$ pairs $(\bar{x}_1,\bar{y}_1),\dots ,(\bar{x}_n,\bar{y}_n)$ . Since there may be more than one way to refer to a single answer (e.g., Michael Jordan and Michael Jeffrey Jordan) each gold answer $\bar{\mathcal{V}}_i$ is a set of acceptable answer strings, where all $\bar{\mathcal{V}}_i$ are disjoint. + +We assign each predicted question-answer pair $(x_{i},y_{i})$ a correctness score based on a string similarity function $f$ valued in [0, 1]. + +$$ +c _ {i} = \max _ {1 \leq j \leq n} \mathbb {I} [ y _ {i} \in \bar {\mathcal {Y}} _ {j} ] f (x _ {i}, \bar {x} _ {j}). +$$ + +Intuitively, $c_{i}$ considers (1) the correctness of the answer and (2) the similarity $f(x_{i},\bar{x}_{j})$ between the predicted and reference question. We calculate F1 treating the $c_{i}$ as measures of correctness: + +$$ +\begin{array}{l} \operatorname {p r e c} _ {f} = \frac {\sum_ {i} c _ {i}}{m}, \quad \operatorname {r e c} _ {f} = \frac {\sum_ {i} c _ {i}}{n}, \\ \mathrm {F 1} _ {f} = \frac {2 \times \operatorname {p r e c} _ {f} \times \operatorname {r e c} _ {f}}{\operatorname {p r e c} _ {f} + \operatorname {r e c} _ {f}}. \\ \end{array} +$$ + +We consider three choices of $\mathrm{F}_f$ . $\mathrm{F1}_{\mathrm{ans}}$ is the F1 score on answers only, where $f$ always yields 1. This may be used without the question disambiguation step. $\mathrm{F1}_{\mathrm{BLEU}}$ accounts for string similarity between questions, calculating $f$ with BLEU (Papineni et al., 2002). $\mathrm{F1}_{\mathrm{EDIT - F1}}$ uses EDIT-F1 as $f$ , where EDIT-F1 is a new measure that represents each disambiguated question by its added and + +deleted unigrams compared to the prompt question, and computes the F1 score between them. For example, consider the prompt question "Who made the play the crucible?", the reference "Who wrote the play the crucible?" and the prediction "Who made the play the crucible in 2012?". The gold edits3 here are $\left\lfloor -\text{made}\right\rfloor$ , +wrote $\int$ while the predicted edits are $\left\lfloor +\text{in}\right\rfloor$ , +2012 $\int$ . Their EDIT-F1 is thus zero, even though the questions are similar. Unlike BLEU which we use to directly measure similarity to the gold question, this metric only gives credit for getting the key semantic differences correct between the original question and the clarification. + +# 4 Data: AMBIGNQ + +# 4.1 Data Collection + +We construct AMBIGNQ using prompt questions from NQ-OPEN and English Wikipedia as the evidence corpus. We use Amazon Mechanical Turk for crowdsourcing. + +The crucial annotation challenge is maximizing recall: finding all possible distinct answers to a question. This is difficult, as ambiguities are often only apparent after carefully searching the evidence for multiple possible answers. However, we can collect high quality data with high levels of ambiguity using careful worker selection and a two stage pipeline: generation and validation. + +Generation. Workers in the first stage are given a prompt question and a search box that uses the Google Search API restricted to English Wikipedia. Allowing annotators to find Wikipedia pages on their own closely approximates the real process people use to answer open-ended questions—an approach with no existing large-scale dataset. $^4$ + +Workers find all plausible answers to the question; when there are multiple, each answer is paired with a minimal edit of the prompt question which differentiates it from the other answers, in line with our task requirements. A distinct answer may be annotated as multiple possible spans (e.g., Michael Jordan and Michael Jeffrey Jordan). + +As a special case, some questions contain temporal deixis which depends on the time of writing, e.g., "When does the new family guy season come out?". To avoid unmanageably many answers, we + +
Split# data# QAs %
1234+
Train10,03653241410
Dev2,00249231413
Test2,00444241616
+ +Table 2: Data statistics. For the number of QA pairs (# QAs), the minimum is taken when there are more than 1 accepted annotations. + +instruct workers to remove the time-dependence by rewriting the prompt question for up to three most recent events before Jan 1, 2018, e.g., “When does family guy season 16 come out?” (see Table 1). + +Validation. Workers in the validation stage review the annotations provided by multiple generators. Validator marks each generator's annotations as correct or incorrect, or provide a new set of question-answer pairs by combining the valid ones from each generator. They search Wikipedia as generators do, and are additionally given Wikipedia pages that generators viewed to speed up the process. Validation is skipped when annotated answers from all generators exactly match (37% of cases). + +Quality control. We recruit highly qualified workers through a qualification test (details in Appendix A). Although the task was difficult for most workers, we found that our highly qualified full-time workers, given quick and detailed feedback on their work, produced high accuracy and recall. For development and test data, we use two generators and one validator per prompt question. For training data, we skip validation and only use one generator per question. + +Inter-annotator agreement. Evaluating generators against each other on the development set yields $60.8\mathrm{F1}_{\mathrm{ans}}$ . All annotations passed validation for $76\%$ of questions, while annotators made changes ( edits or exclusions) in the remaining $24\%$ . The average $\mathrm{F1}_{\mathrm{ans}}$ between co-authors and workers on a sample of 50 validations was $89.0\%$ . This indicates that, despite the intrinsic difficulty and subjectivity of the task, humans agree on the boundary between valid and invalid answers in most cases. + +# 4.2 Data Analysis + +The final dataset contains 14,042 annotated examples, split consistently with NQ-OPEN. As shown in Table 2, over $50\%$ of development and test examples contain multiple question-answer pairs. This + +![](images/2e124062b331ff946932c4144c9f23f3fadd2a615400b54042ca02d401d653ea.jpg) +(a) Number of unique Wikipedia pages visited by crowdworkers.† + +![](images/2449f24123e5aee81fac65e19daf389cc59e149de906fb493374c63f30ca81a1.jpg) +(b) Number of search queries written by crowdworkers. +Figure 2: Data Analysis on the development data. This is actually an underestimate; we could not track when annotators viewed pages by following hyperlinks for technical reasons. + +![](images/26ba859f3912587cc8e0c30f537da9203cd336dc4082dc9bccc83a94366ba34f.jpg) +(c) Word cloud of the edits made in questions; and indicate added and deleted unigrams, respectively. + +indicates a high rate of ambiguity in NQ-OPEN, even though previous work has studied it with the assumption that each question has a single answer. We also find a discrepancy between development and test; this is likely due to the way in which NQ-OPEN is constructed, which over-samples difficult questions in the test set (see Appendix B for details). The training set contains relatively fewer ambiguous examples $(47\%)$ , presumably because using only one worker per training example yielded slightly lower recall. + +Types of ambiguity. Table 1 shows a breakdown of the types of ambiguity in AMBIGNQ. They are diverse, including ambiguity in entity references, event references, properties, and answer types, with a relatively uniform distribution between them. In comparison to Xu et al. (2019), who intentionally elicit questions with ambiguous entity references, our analysis shows that unintended ambiguity comes from diverse sources. In many cases, ambiguity is not apparent from the prompt question alone, but only after researching the question on Wikipedia, as evidenced by differences in model performance (Section 6.2). + +Annotator behavior. Figures 2a and 2b show the number of unique Wikipedia pages and the number of search queries used by workers during annotation. More often than not, workers used multiple queries and navigated multiple Wikipedia pages, showing how our setup captures ambiguity in the retrieval step of open-domain question answering, which is missed in approaches that assume a prespecified evidence document. + +Distribution of edits. Figure 2c shows unigram edits made to questions in the development data, where we remove stopwords except wh-words and group numeric values by the number of digits. Adding numerals such as years is common, as they + +can easily disambiguate entity or event references or remove time dependence. Wh-word changes are also common, especially for specifying the answer type (e.g., from who to which group; see Table 1). The distribution of edits is fairly long-tailed, with the 100 most frequent edits covering $36\%$ of the total, and the top 1,000 covering $69\%$ . + +# 5 Model + +To set initial performance levels on AMBIGNQ, we present a baseline AMBIGQA model combining ideas from recent advances in open-domain QA (Karpukhin et al., 2020) and generation (Lewis et al., 2020). Given a prompt question $q$ , our model predicts answers $y_{1}..y_{n}$ , and generates corresponding questions $x_{1}..x_{n}$ conditioning on $q$ , the answers $y_{1}..y_{n}$ , and the evidence passages. A novel constraining step also allows the model to leverage the partial supervision available in NQ-OPEN. + +Multiple Answer Prediction. Here we describe SPANSEQGEN, our model for multiple answer prediction. Following Karpukhin et al. (2020), a state-of-the-art model on NQ-OPEN, SPANSEQGEN first retrieves 100 passages with a BERT-based (Devlin et al., 2019) dual encoder, and reranks them using a BERT-based cross encoder. Then, instead of predicting an answer span from the top 1 passage as Karpukhin et al. (2020) does, SPANSEQGEN uses another sequence-to-sequence model based on BART (Lewis et al., 2020). Specifically, it conditions on the concatenation of $q$ and the top passages in order up to 1024 tokens, and sequentially generates distinct answers token-by-token, separated by [SEP]. We pretrain SPANSEQGEN on NQ-OPEN and finetune it on AMBIGNQ. + +We develop SPANSEQGEN primarily because Karpukhin et al. (2020) is designed for generating a single answer, but SPANSEQGEN also boosts the + +Algorithm 1 Democratic co-training with weak supervision (Section 5). +1: // Each question in $D_{\text{full}}$ has an answer list annotated +2: // Each question in $D_{\text{partial}}$ has one answer annotated +3: $\hat{D}_{\text{full}} \gets D_{\text{full}}$ +4: for iter $\in \{1..N\}$ do +5: // Train $C$ sequence-to-sequence QA models +6: for $i \in \{1..C\}$ do +7: $\phi_i \gets \text{train}(\hat{D}_{\text{full}})$ +8: $\hat{D}_L \gets D_{\text{full}}$ +9: for $(q^j, y^j) \in D_{\text{partial}}$ do +10: // Get predictions by using $y_j$ as prefix +11: $\hat{Y}^j \gets \{\hat{y} \mid \hat{y} \neq y^j$ , and +12: $|\{i \mid \hat{y} \in \phi_i(q^j | y^j), 1 \leq i \leq C\}| > \frac{C}{2}$ +13: } +14: if $|\hat{Y}^j| > 0$ then +15: // Add it as a multiple answer case +16: $\hat{D}_{\text{full}} \gets \hat{D}_L \cup \{(q^j, \{y^j\} \cup \hat{Y}^j)\}$ +17: else if $\forall i = 1..C, |\phi_i(x^j) - \{y^j\}| = 0$ then +18: // Add it as a single answer case +19: $\hat{D}_{\text{full}} \gets \hat{D}_L \cup \{(q^j, \{y^j\})\}$ + +performance on NQ-OPEN (41.5→42.2 on the test data). We include ablations on different approaches and models in Section 6.2. + +Question Disambiguation. We design a question disambiguation (QD) model based on BART. The model generates each question $x_{i}$ ( $i = 1..n$ ) conditioning on the concatenation of $q$ , the target answer $y_{i}$ , other answers $y_{1}\ldots y_{i - 1},y_{i + 1}\ldots y_{n}$ , and the top passages as used by SPANSEQGEN. We pretrain on NQ-OPEN to generate questions given an answer and passage, and then finetune it on the full task data in AMBIGNQ. We include ablations on different variants of the model in Section 6.2. + +Co-training with weak supervision. Given the prevalence of unlabelled ambiguity in NQ-OPEN, we introduce a method that treats the NQ-OPEN annotations as weak supervision and learns to discover potential ambiguity in the data. We modify a democratic co-training algorithm (Zhou and Goldman, 2004) as described in Algorithm 1. We iteratively grow the training set $\hat{D}_{\mathrm{full}}$ from AMBIGNQ $(D_{\mathrm{full}})$ with silver data from NQ-OPEN $(D_{\mathrm{partial}})$ predicted by a majority of a set $C$ of SPANSEQGEN models trained on $\hat{D}_{\mathrm{full}}$ . The key step is injecting the known answer $y^{j}$ from NQ-OPEN as a prefix to SPANSEQGEN's output during prediction. In each step, if a majority of $C$ predict an additional answer, we assume we have found a false negative and add the result to the training set $\hat{D}_{\mathrm{full}}$ . If all models predict no additional answer, we add the example to $\hat{D}_{\mathrm{full}}$ with $y^{j}$ as a single answer. + +# 6 Experiments + +We describe the baseline models used in our experiments, followed by results and ablations. Implementation details and hyperparameters of all models are provided in Appendix D. + +# 6.1 Baselines + +DISAMBIG-FIRST. This baseline disambiguates the prompt question without any context from plausible answers or reference passages. Specifically, it implements the following pipeline: (1) Feed the prompt question $q$ into a BERT-based binary classifier to determine whether it is ambiguous. (2) If $q$ is ambiguous, pass it into a BART-based model which generates a sequence of disambiguated questions $x_{1}..x_{n}$ ( $n > 1$ ), separated by [SEP]; otherwise, consider only $x_{1} = q$ . (3) Feed each $x_{i}$ into a state-of-the-art model on NQ-OPEN (Karpukhin et al., 2020) to produce its answer $y_{i}$ . + +Thresholding $^+$ QD. We also include a model based on Karpukhin et al. (2020), with thresholding for multiple answer prediction and our question disambiguation (QD) model. Karpukhin et al. (2020) outputs a likelihood score for each span; we obtain $y_{1}\dots y_{n}$ by taking valid spans with likelihood larger than a hyperparameter $\gamma$ . The model is trained to maximize the marginal likelihood of any span in the gold answer set $\bar{y}_1\dots \bar{y}_n$ . As with SPANSEQGEN, we pretrain on NQ-OPEN and finetune on AMBIGNQ. We then produce disambiguated questions using our BART-based QD model (Section 5). + +# 6.2 Results + +Table 3 reports the performance of our baselines; example model outputs are provided in Table 5. + +Main results. We first find that DISAMBIG-FIRST is significantly worse than other models. In particular, classification accuracy on whether the prompt question is ambiguous is $67\%$ , close to the majority baseline $(60\%)$ . When the model does identify an ambiguous question, its rewrites often look reasonable on the surface, but do not match the facts. For instance, in example 1 of Table 5, it asks about filming in 2017 and during season 1 for Snow White and the Huntsman, which was actually a film released in 2012. This shows that reading evidence documents is crucial for identifying and characterizing ambiguities. + +While SPANSEQGEN outperforms Karpukhin et al. (2020) with thresholding, the difference is + +
ModelF1ans (all)F1ans (multi)F1BLEUF1EDIT-F1
devtestdevtestdevtestdevtest
DISAMBIG-FIRST28.124.821.918.84.24.02.72.2
Thresholding + QD37.132.328.424.813.411.36.65.5
SPANSEQGEN + QD39.733.529.324.513.411.47.25.8
SPANSEQGEN† + QD41.235.229.824.513.610.67.45.7
SPANSEQGEN† (Co-training) + QD42.335.931.726.014.311.58.06.3
+ +Table 3: Results on AMBIGNQ. The multi measure only considers examples with multiple question-answer pairs. ${}^{ \dagger }$ indicates ensemble. See Appendix B for details on the discrepancy between development and test. + +
Modelqyiy1...yi-1,yi+1...ynFull taskGold answers given
F1BLEUF1EDIT-F1F1BLEUF1EDIT-F1
QD model14.38.040.119.2
- prompt question-6.77.715.119.2
- untargeted answers-14.27.341.217.2
Always prompt question--15.90.047.40.0
+ +Table 4: Ablations on question disambiguation (development data, multiple answers only). QD model refers to the question disambiguation model described in Section 5. For multiple answer prediction, we use SPANSEQGEN† with co-training (Full task) or the gold answers (Gold answers given). + +not as great as we expected. This suggests two things. First, thresholding may be a surprisingly effective baseline for outputting multiple answers, even though the answers must compete with each other for probability mass in order to surpass the threshold $\gamma$ . Second, maximizing likelihood in a sequence-to-sequence model like SPANSEQGEN may not produce well-calibrated results. For instance, the model seems to suffer due to variation in the length of the output sequence, outputting shorter sequences on average (3.0 tokens) than gold (6.7). This leads to low recall when there are multiple answers; our best model achieves a precision of 49.6 and recall of 25.3 for its $F1_{\mathrm{ans}}$ of 31.7 on such questions. + +Overall, SPANSEQGEN achieves reasonable $\mathrm{F1}_{\mathrm{ans}}$ scores. $\mathrm{F1}_{\mathrm{ans}}$ on examples with multiple question-answer pairs (multi) are lower, indicating that predicting all plausible answers is more challenging than predicting a single answer, as expected. SPANSEQGEN also obtains the best performance in $\mathrm{F1}_{\mathrm{BLEU}}$ and $\mathrm{F1}_{\mathrm{EDIT - F1}}$ , although their absolute values are low in general; we discuss this in our question disambiguation ablations below. + +There is a substantial difference in performance between development and test overall, likely due to distributional differences in the original questions + +in NQ-OPEN; detailed discussion is in Appendix B. + +Effect of co-training. The last two rows of Table 3 reports the effect of our co-training method. As co-training requires multiple trained models, we compare with a naive ensemble. While we see gains from ensembling alone, an ensemble trained with the co-training method achieves the best performance on all metrics. This result demonstrates the potential of jointly using AMBIGNQ and partial supervision from NQ-OPEN. + +Ablations on question disambiguation. Table 4 reports results of an ablation experiment on question disambiguation (QD). Among our ablations, we include models without the prompt question or untargeted answers as input, and a naive baseline that always outputs the prompt question. We report the metrics both in the scenarios of the full task and the gold answers given, to see the performance dependent on and independent from multiple answer prediction, respectively.[6] + +Simply copying the prompt question gives high $\mathrm{F1}_{\mathrm{BLEU}}$ , which is natural since the questions were disambiguated using minimal edits. This justifies using $\mathrm{F1}_{\mathrm{EDIT-F1}}$ to evaluate semantic differences from the prompt question. In addition, we find that + +Prompt question #1: Where was snow white and the huntsman filmed? + +# Reference: + +Q: Where were beach scenes for snow white and huntsman predominantly filmed? / A: Marloes Sands Beach +Q: Where was principal photography for snow white and huntsman filmed? / A: United Kingdom +Q: Where was castle in snow white and huntsman filmed? / A: Gateholm island +Prediction of DISAMBIG-FIRST: $(\mathrm{F1}_{\mathrm{ans}} = 0.40, \mathrm{F1}_{\mathrm{EDIT - F1}} = 0.00)$ +Q: Where was snow white and the huntsman filmed in 2017? / A: Marloes Sands Beach +Q: Where was snow white and the huntsman filmed during the filming of Season 1 of the TV series? / A: Marloes Sands Beach +Prediction of SPANSEQGEN: $(\mathrm{F1}_{\mathrm{ans}} = 0.80, \mathrm{F1}_{\mathrm{EDIT - F1}} = 0.69)$ +Q: Where was snow white and huntsman principal photography filmed / A: United Kingdom +Q: Where were beach scenes for snow white and huntsman mostly filmed / A: Marloes Sands Beach + +Prompt question #2: When was the city of new york founded? + +# Reference: + +Q: When was city of new york founded by dutch and initially called new amsterdam? / A: 1624 +Q: When was city of new york under english control and renamed to new york? / A: 1664 +Prediction of SPANSEQGEN: $(\mathrm{F1}_{\mathrm{ans}} = 1.00, \mathrm{F1}_{\mathrm{EDIT - F1}} = 0.67)$ +Q: When was city of new york city founded with dutch protection? / A: 1624 +Q: When was city of new york city founded and renamed with english name? / A: 1664 + +Table 5: Model predictions on samples from the development data. (#1) DISAMBIG-FIRST generates questions that look reasonable on the surface but don't match the facts. SPANSEQGEN produces the reasonable answers and questions, although not perfect. (#2) SPANSEQGEN produces correct answers and questions. + +
Reference has multiple answers
Multiple answer prediction is correct2%
Multiple answer prediction is partially correct†40%
Multiple answer prediction is incorrect14%
Reference has one answer
Over-generated predictions2%
Correct single answer prediction26%
Incorrect single answer prediction12%
Reference is incorrect4%
+ +In 15 out of 20 cases, the model generates only one answer. + +our QD model conditioned on all available context is better than other variants in overall metrics. + +Performance is low overall, even given the gold answers, highlighting the challenge of the task. We think there are two major reasons. First, maximizing the likelihood of the output sequence can miss the importance of edits to the prompt question, leading the QD model to miss the information that is most important to differentiate one answer from the others. Second, there is a lack of annotated data, especially for question disambiguation which does not benefit from weakly supervised learning with NQ-OPEN; future work can explore how to maximize the use of supervision from other available data. It is also worth noting that the metric may miss edits that are semantically correct, but phrased differently (see Table 5, example 2). + +Table 6: Analysis of predictions made by SPANSEQGEN with co-training, on 50 samples from the development data. Examples shown in Appendix (Table 10). + +
ModelNQ-OPEN +EMF1ans +(all)F1ans +(multi)
Dev
Min et al. (2019b)34.730.820.4
Asai et al. (2020)31.729.719.7
Karpukhin et al. (2020)39.835.226.5
SPANSEQGEN42.036.424.8
Test
Min et al. (2019b)34.527.517.0
Asai et al. (2020)32.627.917.7
Karpukhin et al. (2020)41.530.123.2
SPANSEQGEN42.230.820.7
+ +Table 7: Zero-shot performance on multiple answer prediction of the models trained on NQ-OPEN. We report Exact Match (EM) on NQ-OPEN and $\mathrm{F1}_{\mathrm{ans}}$ on AMBIGNQ. + +# 6.3 Zero-shot results + +Since AMBIGNQ provides an evaluation set with explicit sets of multiple answers, we can also test if models trained on partial supervision only (NQ-OPEN) are capable of producing full answer sets. In fact, the problem of ambiguity already exists in previous QA tasks, and a single labeled answer can be viewed as a sample from a multi-modal distribution of answers. This setting is important for modeling in domains where single-answer datasets are available but full annotations like in AMBIGNQ are not. To this end, we present a zero-shot setting where a system predicts multiple distinct answers without using AMBIGNQ training data. We include four NQ-OPEN models including ours, consisting of diverse approaches and model architec + +tures, as baselines. These models, when trained on NQ-OPEN, may be made to predict multiple answers via thresholding as described in Section 6.1.7 Table 7 reports zero-shot performance. Although SPANSEQGEN outperforms Karpukhin et al. (2020) in the standard setting, it is worse in zero-shot $\mathrm{F1}_{\mathrm{ans}}$ (multi), potentially because thresholding exacerbates the problems that SPANSEQGEN has with long sequences (Section 6.2). + +# 6.4 Error Analysis + +Table 6 reports an analysis of predictions by SPANSEQGEN with co-training, based on 50 random samples from the development data; examples can be found in the Appendix (Table 10). When there are multiple reference answers, the model rarely gets all correct answers, although often generates a subset of them. In 15 out of 20 partially correct cases, the model produces only one answer, consistent with the under-generation we found in Section 6.2. In four out of those 15 cases, the model prediction is arguably the most likely answer,[8] but in the other 11 cases, it hard to argue for one answer over the other(s). It is also worth noting that accuracy on examples with a single answer is quite high, being correct in 13 out of 20 cases. This estimated accuracy on unambiguous questions is higher than state-of-the-art levels on NQ-OPEN (42 EM), suggesting that NQ-OPEN may substantially underestimate performance due to the prevalence of unmarked ambiguity. Together with our experimental results, this seems to indicate that recall of multiple answers is one of the primary challenges in AmbigQA. + +# 7 Conclusion & Future Work + +We introduced AMBIGQA, a new task that involves providing multiple possible answers to a potentially ambiguous open-domain question, and providing a disambiguated question corresponding to each answer. We constructed AMBIGNQ, a dataset with 14,042 annotations on NQ-OPEN questions. Our analysis shows the dataset contains diverse types of ambiguity, often not visible from the prompt question alone. We also introduced a first base + +line model for producing multiple answers to open-domain questions, with experiments showing its effectiveness in learning from our data while highlighting possible areas for improvement. + +Future research developing on AmbigQA models may include explicitly modeling ambiguity over events and entities or in the retrieval step, as well as improving performance on the difficult problems of answer recall and question disambiguation. Furthermore, future work may build on the AmbigQA task with more open-ended approaches such as (1) applying the approach to QA over structured data (such as ambiguous questions that require returning tables), (2) handling questions with no answer or ill-formed questions that require inferring and satisfying more complex ambiguous information needs, and (3) more carefully evaluating usefulness to end users. + +# Acknowledgments + +This research was supported by ONR N00014-18-1-2826, DARPA N66001-19-2-403, the NSF (IIS-1252835, IIS-1562364), an Allen Distinguished Investigator Award, and the Sloan Fellowship. We thank Mandar Joshi, H2Lab members and the anonymous reviewers for their helpful comments and suggestions. + +# References + +Mohammad Aliannejadi, Hamed Zamani, Fabio Crestani, and W Bruce Croft. 2019. Asking clarifying questions in open-domain information-seeking conversations. In SIGIR. +Akari Asai, Kazuma Hashimoto, Hannaneh Hajishirzi, Richard Socher, and Caiming Xiong. 2020. Learning to retrieve reasoning paths over wikipedia graph for question answering. In ICLR. +Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on Freebase from question-answer pairs. In EMNLP. +Pavel Braslavski, Denis Savenkov, Eugene Agichtein, and Alina Dubatovka. 2017. What do you mean exactly? Analyzing clarification questions in CQA. In Proceedings of the 2017 Conference on Conference Human Information Interaction and Retrieval. +Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. 2017. Reading Wikipedia to answer open-domain questions. In ACL. +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 *NAACL*. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In *NAACL*. +Matthew Dunn, Levent Sagun, Mike Higgins, Ugur Guney, Volkan Cirik, and Kyunghyun Cho. 2017. SearchQA: A new q&a dataset augmented with context from a search engine. arXiv preprint arXiv:1704.05179. +Ahmed Elgohary, Denis Peskov, and Jordan L. Boyd-Graber. 2019. Can you unpack that? learning to rewrite questions-in-context. In EMNLP. +Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020. REALM: Retrieval-augmented language model pre-training. In ICML. +Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. 2017. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In ACL. +Vladimir Karpukhin, Barlas Oguz, Sewon Min, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In EMNLP. +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 Change, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. 2019. Natural Questions: a benchmark for question answering research. TACL. +Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. 2019. Latent retrieval for weakly supervised open domain question answering. In ACL. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2020. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In ACL. +Julian Michael, Gabriel Stanovsky, Luheng He, Ido Dagan, and Luke Zettlemoyer. 2018. Crowdsourcing question-answer meaning representations. In NAACL. +Sewon Min, Danqi Chen, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2019a. A discrete hard EM approach for weakly supervised question answering. In EMNLP. +Sewon Min, Danqi Chen, Luke Zettlemoyer, and Han-naneh Hajishirzi. 2019b. Knowledge guided text retrieval and reading for open domain question answering. arXiv preprint arXiv:1911.03868. + +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. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a method for automatic evaluation of machine translation. In ACL. +Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. 2017. Automatic differentiation in PyTorch. +Sudha Rao and Hal Daumé III. 2018. Learning to ask good questions: Ranking clarification questions using neural expected value of perfect information. In ACL. +Sudha Rao and Hal Daumé III. 2019. Answer-based adversarial training for generating clarification questions. In *NAACL*. +Pavel Sountsov and Sunita Sarawagi. 2016. Length bias in encoder decoder models and a case for global conditioning. In EMNLP. +Felix Stahlberg and Bill Byrne. 2019. On nmt search errors and model errors: Cat got your tongue? In EMNLP. +Ellen M Voorhees et al. 1999. The TREC-8 question answering track report. In Trec. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. HuggingFace's Transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771. +Jingjing Xu, Yuechen Wang, Duyu Tang, Nan Duan, Pengcheng Yang, Qi Zeng, Ming Zhou, and SUN Xu. 2019. Asking clarification questions in knowledge-based question answering. In EMNLP. +Hamed Zamani, Gord Lueck, Everest Chen, Rodolfo Quispe, Flint Luu, and Nick Craswell. 2020. Mimics: A large-scale data collection for search clarification. In ACM International on Conference on Information and Knowledge Management. +Y. Zhou and S. Goldman. 2004. Democratic co-learning. In IEEE International Conference on Tools with Artificial Intelligence. + +# A Data Collection Details + +We use Amazon Mechanical Turk9 and Spacro (Michael et al., 2018)10 for crowdsourcing. All data was collected in February and March of 2020. We use the Google Search API11 restricted to English Wikipedia for the search tool. + +Crowdsourcing details. Figure 3 shows the interface used for generation and validation. We use an iframe to render Wikipedia pages in a mobile view, in order to provide the document format that they are familiar with, rather than the plain text with no formatting. When workers write the questions and the answers in the generation stage, we show appropriate error messages (e.g. when the written question is the same as the prompt question) or warning messages (e.g., when the answer is composed of more than 20 words) in order to give tight feedback. Workers produce free text answers which we instruct them to copy and paste from Wikipedia. + +We pay 0.75 and 0.15 USD per prompt question for generation and validation, respectively. Generators may skip the prompt question if the answer is not found in Wikipedia, or the question is ill-formed, too subjective or too ambiguous, e.g., "When did the new tax cuts go into effect?" + +Quality control. We only recruit full-time workers that are dedicated to our task. We were able to recruit full-time workers by requiring the minimum number of HITs that can be achieved by working 40 hours a week. We also host a public website for them to monitor the validated statuses, ask questions on examples that they do not understand the validated result, or claim on the validation which is incorrect in their opinion. We found it very useful to communicate with workers, give feedback, and fix the incorrect annotations. + +Inter-annotator agreement. When two independent generators are evaluated on the answer list from each other, they obtain $60.8\mathrm{F1}_{\mathrm{ans}}$ . Specifically, for $76\%$ of questions, all annotations passed validation, either automatically because they exactly matched $(37\%)$ or because they were both accepted by annotators $(39\%)$ . In the remaining $24\%$ of cases, one annotator missed a possible question-answer pair that the other one found, or included an invalid question-answer pair. + +To assess validation quality, two co-authors annotated a random sample of 50 validations. The average $\mathrm{F1}_{\mathrm{ans}}$ between the co-authors and workers was $89.0\%$ . + +# B Discrepancy between development and test in NQ-OPEN + +In our experiments on AMBIGNQ, we found a significant discrepancy between the development and test sets. Upon further investigation, we identified that this is at least in part due to a distributional difference between the development and test sets of NQ-OPEN, upon which we built the data. As this may be important for other researchers working on NQ-OPEN, we detail our findings here. + +Following Lee et al. (2019), NQ-OPEN is constructed by filtering NATURAL QUESTIONS to questions where at least one annotator provided a non-null short answer to the question.[12] While the training and development sets of NQ-OPEN were all drawn from the training set of NATURAL QUESTIONS, in which one annotator answered each question, the test set of NQ-OPEN is taken from its development set, which had five annotators per question. + +This difference in number of annotators introduces a sampling bias: questions for which an annotator is less likely to find an answer are overrepresented in the NQ-OPEN test set, in comparison to training and development. Suppose, for example, that a randomly sampled annotator has a $50\%$ chance of producing a short answer for some question $q$ . Then $q$ has a $50\%$ chance of making it into NQ-OPEN's development set, but a $(1 - .5^{5}) = 97\%$ chance of making it into test. Concretely, when each annotator is considered independently, $34.6\%$ of the short answer annotations in the test set of NQ-OPEN are null answers, and the majority of annotations are null for $33.9\%$ of questions. + +As a consequence, there is a significant gap in model performance between development and test when they are evaluated under the same conditions. The official evaluation protocol for NQ-OPEN counts a prediction as correct if it matches any of the gold reference answers. Under these conditions, the gap between development and test appears marginal (Table 8, first two columns). However, as the NQ-OPEN test set was more compre + +
ModelAnyFirst
devtestdevtest
Min et al. (2019b)34.734.532.425.7
Asai et al. (2020)31.732.628.923.8
Karpukhin et al. (2020)39.841.537.029.8
SPANSEQGEN42.042.238.831.1
+ +Table 8: Exact Match (EM) on NQ-OPEN of different models, counting a prediction as correct if it matches Any gold reference, or only the First non-null one. + +hensively annotated than development, it has a more generous evaluation; the number of unique reference answers is 1.2 and 1.8 on development and test, respectively. In order to make the evaluation more consistent, we try evaluating models against the first reference answer only, and find a significant gap between development and test (5–8%) across all models (Table 8, last two columns).13 + +Despite this discrepancy, AMBIGNQ follows the setup and data split from NQ-OPEN providing consistency with prior work. Since the AMBIGNQ development and test sets were annotated under the same conditions, this discrepancy now shows up in the metrics. We leave the distribution shift of questions on the test data as one of challenges on AMBIGNQ. + +# C Data Analysis Details + +Mismatches with NQ-OPEN. $29.4\%$ of AMBIGNQ development examples do not include the NQ-OPEN answer. We analyze a random sample of 50 such questions, and present a breakdown in Table 9. We find that our answers are correct in $92\%$ of cases, among which $44\%$ of disagreements are due to mismatched spans, $22\%$ are due to the NQ-OPEN answer being incorrect, and $14\%$ are due to time-dependence in the question. Of the $8\%$ of cases where our answer is incorrect, the NQ-OPEN answers are also incorrect over half the time, indicating that these may be difficult questions. + +# D Baseline Implementation Details + +Evidence corpus. We use English Wikipedia dump from 2018-12-20 and 2020-01-20 for NQ-OPEN and AMBIGNQ, respectively. Following + +Karpukhin et al. (2020), we take the plain text and split passages to be up to 100 words each. + +Model implementation. All models are implemented in PyTorch (Paszke et al., 2017), PyTorch Transformers (Wolf et al., 2019) (for BERT) and fairseq (Ott et al., 2019) (for BART). We use $\mathrm{BERT}_{\mathrm{BASE}}$ and $\mathrm{BART}_{\mathrm{LARGE}}$ for all models. We use the exact same setup and hyperparameters for any process that we follow Karpukhin et al. (2020). For the passage retrieval through a dual encoder, we use the provided multi-setting trained model. For all BART-based models, we follow the default hyparameters from BART summarization code in fairseq, using one 32GB gpu. For finetuning, we change the learning rate to be $5e - 6$ on both tasks. We use beam search for decoding the sequence. We train the model for 4 epochs (when trained on NQ-OPEN or pseudo-labelled data) or 15 epochs (when trained on AMBIGNQ), and take the best checkpoint based on the development data. Note that the perplexity of the output sequence does not correlate with the metric of interest (Exact Match, F1ans or F1EDIT-F1) as briefly discussed in Section 6.2, so using the metric of interest instead of perplexity is important for hyperparameter tuning or the choice of the best checkpoint. + +Details in ensemble and co-training. We use an ensemble based on voting; the answers that are predicted by the highest number of models are chosen as the final answers. The number of models used in ensemble $(C)$ is $C = 5$ before cotraining and $C = 4$ after cotraining. For co-training, we use $N = 2$ and $C = 6$ , where $N$ is the number of iteration and $C$ is the number of models, in line with Algorithm 1. The choice of $C$ is determined by taking the best combination of the models as follows. We train sixteen different models, using different hyperparameters including checkpoints from NQ-OPEN, learning rates, the order of the answers in the output sequence and the random seed. We then measure the development $\mathrm{F1}_{\mathrm{ans}}$ on different combinations of the models with varying $C$ ( $4 \leq C \leq 6$ ) and take the best one. + +# E Error Analysis of SPANSEQGEN + +Table 10 reports an analysis of predictions by SPANSEQGEN, on 50 random samples from the development set. We refer to Section 6.4 for the discussions. + +![](images/059cc696fed5d0c0e02fd8321d5a269744f6a4312fb4f81064d645db020202e0.jpg) + +![](images/151fdc8fa1aa6a0f3581ba596802d9dbedde7da8a5c1c4b0d373c4cc2cd688a5.jpg) + +(a) Interface in the generation stage when the workers write a query and see the search results. + +![](images/9600dc2e36656187abc065961caa737ffa473ed8e59ce12c589e3942ad226194.jpg) + +![](images/798d746d6071c27385fb48662da4ab8ac771c17697c81a81a6c11b6509dc5734.jpg) + +(b) Interface in the generation stage when the workers click and read one of Wikipedia pages from the search results. + +![](images/bc7ab73391859ef0a20fa7336a90cfc2cb6d406c471d15d0604324aa505500c6.jpg) +Figure 3: Interface for crowdsourcing. + +![](images/079315f51131eab3b53981c075f0399327c2c64d9c430e04ed9e3aad5efe318f.jpg) + +(c) Interface in the validation stage when the workers are given annotations from two generation workers and click the Wikipedia page that the generation workers have read. + +
Answer span mismatch (44%)
Q: Who did the artwork for pink floyd's wall? +NQ-OPEN answer: Gerald Anthony Scarfe +AMBIGNQ answer: +Q: Who did the art work for the album cover of Pink Floyd's The Wall? / A: Gerald Scarfe +Q: Who was the cinematographer for Pink Floyd - The Wall (1982 film)? / A: Peter Biziou
NQ-OPEN answer incorporated as a question (2%)
Q: What award did leonardo dicaprio won for the revenant? +NQ-OPEN answer: BAFTA Award; Academy Award for Best Actor; Golden Globe Award +AMBIGNQ answer: +Q: What British Academy Film Awards award did leonardo dicaprio won for the revenant? / A: Best Actor in a Leading Role +Q: What Academy award did leonardo dicaprio won for the revenant? / A: Best Actor +Q: What Golden Globe award did leonardo dicaprio won for the revenant? / A: Best Actor in a Motion Picture - Drama +(Other question-answer pairs omitted)
NQ-OPEN answer less specific (10%)
Q: When was the nba 3 point line introduced? +NQ-OPEN answer: 1979 +AMBIGNQ answer: June 1979
NQ-OPEN answer incorrect and our answers include all possible answers (22%)
Q: Who was inducted into the national inventors hall of fame first? +NQ-OPEN answer: John Fitch +AMBIGNQ answer: Thomas Edison +Comment: Thomas Edison inducted in 1973, John Fitch inducted in 2006. John Fitch is mentioned as the earliest born inventor inducted.†
Mismatch from time-dependence (14%)
Q: Who has the most home runs in the home run derby? +NQ-OPEN answer: Todd Frazier +AMBIGNQ answer: +Q: Who has the most home runs in the the TV show the home run derby? / A: Mickey Mantle; Mickey Charles Mantle +Q: Who has the most home runs in the annual competition the home run derby? / A: Joc Russell Pederson; Joc Pederson
NQ-OPEN answer is reasonable and our answers miss it (4%)
Q: Who was the first person to settle dodge city? +NQ-OPEN answer: civilians +AMBIGNQ answer: Henry J. Sitler
NQ-OPEN answer incorrect but our answers miss another possible answer (4%)
Q: In which year were chips used inside the computer for the first time? +NQ-OPEN answer: 1975 +AMBIGNQ answer: 1962 +Comment: The years that the chips were used for the first time in the prototype and the production are 1962 and 1974, respectively, and can be both included.‡
+ +Table 9: Breakdown of cases that NQ-OPEN answer is not included in AMBIGNQ answers. +†en.wikipedia.org/wiki/List_of_National_Inventors_Hall_of_Fame_inductees +‡en.wikipedia.org/wiki/History_of_computing_hardware_(1960s%E2%80%93present) + +
Reference has multiple answers; Multiple answer prediction is correct (2%) Prompt question: Who was england's prime minister during ww1? Reference: H. H. Asquith (beginning of WW1), David Lloyd George (end of WW1) Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {1.00}}\right) \mathrm{H}.\mathrm{H} \) . Asquith,David Lloyd George
Reference has multiple answers; Multiple answer prediction is partially correct (40%) Prompt question: Who played kelly on the drew carey show? NQ-OPEN answer: Cynthia Watros Reference: Cynthia Watros (as Kellie N.), Jenny McCarthy (as M. Kelly), Brett Butler (as G. Kelly), Anna Gunn (as Kelly W.) Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {0.40}}\right) \) : Brett Butler
Reference has multiple answers; Multiple answer prediction is incorrect (14%) Prompt question: Who plays the white queen in alice through the looking glass? Reference: Amelia Crouch (young White Queen), Anne Hathaway (adult White Queen) Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {0.00}}\right) : \) Helena Bonham Carter \( {}^{ \dagger } \)
Reference has one answer; over-generated predictions (2%) Prompt question: How many times csk reached final inipl? Reference: eight Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {66.7}}\right) : \) eight,seven \( {}^{ \ddagger } \)
Reference has one answer; correct single answer prediction (26%) Prompt question: When did the 5th circuit became the 11th circuit? Reference: October 1, 1981 Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {100.0}}\right) : \) October 1, 1981
Reference has one answer; incorrect single answer prediction (12%) Prompt question: Who is considered the home team for super bowl 52? Reference: New England Patriots Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {0.0}}\right) : \) Atlanta Falcons
Reference is incorrect (4%) Prompt question: Who has won the most trophies man utd or liverpool? Reference: Man utd (trophies), Liverpool (FIFA andUEFA Cups) Prediction: \( \left( {{\mathrm{{F1}}}_{\text{ans }} = {66.7}}\right) : \) Manchester United
+ +Table 10: Analysis of multiple answer predictions made by SPANSEQGEN with co-training, on 50 samples from the development data. Rewrites are omitted but differentiation of multiple answers is denoted as a keyword in italic. +Helena Bonham Carter played Red Queen. +$^{\ddagger}$ In fact, the model may have found time-dependency, because the eighth event happened only in 2019. \ No newline at end of file diff --git a/ambigqaansweringambiguousopendomainquestions/images.zip b/ambigqaansweringambiguousopendomainquestions/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5ca08e6b4e1d5dcd6a0839b7be1322f39f77f591 --- /dev/null +++ b/ambigqaansweringambiguousopendomainquestions/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71ac8fc14581b98c7b31579fd324d7013f1eb33123a4fa6e19b24e916dca9cc6 +size 966707 diff --git a/ambigqaansweringambiguousopendomainquestions/layout.json b/ambigqaansweringambiguousopendomainquestions/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6ad01ee1201e382583f256b9cf10d500da11944d --- /dev/null +++ b/ambigqaansweringambiguousopendomainquestions/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0b284fd1cd8b805d6e52e3e903b3098a34367db39a446e8f877bede6bd02914 +size 521408 diff --git a/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_content_list.json b/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e5518cc630c851b23da3888ee4b682184af9534a --- /dev/null +++ b/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:502ba5462abf2093e3e37b0a501ec7b218d01c7d5b40b5b64bbc496f9f0bae3d +size 68791 diff --git a/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_model.json b/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_model.json new file mode 100644 index 0000000000000000000000000000000000000000..96efcbf4d113d83d865f36b816c76e2be86ca162 --- /dev/null +++ b/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce58fd22a81fecea2bb034105e53b7413f207681173ed81328c019dc7301d58b +size 86079 diff --git a/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_origin.pdf b/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..96d2a9e0b45fc62414747eaff711378f5e51ad0e --- /dev/null +++ b/analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8095b3fe9834189f18909bff5196d6c97b12519d847078172773556283e642ab +size 1009438 diff --git a/analogousprocessstructureinductionforsubeventsequenceprediction/full.md b/analogousprocessstructureinductionforsubeventsequenceprediction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7bf79a300fef00b003b99502d238445f25e909a6 --- /dev/null +++ b/analogousprocessstructureinductionforsubeventsequenceprediction/full.md @@ -0,0 +1,275 @@ +# Analogous Process Structure Induction for Sub-event Sequence Prediction + +Hongming Zhang $^{1*}$ , Muhao Chen $^{2}$ , Haoyu Wang $^{2}$ , Yangqiu Song $^{1}$ , & Dan Roth $^{2}$ + +$^{1}$ Department of Computer Science and Engineering, HKUST + +$^{2}$ Department of Computer and Information Science, UPenn + +{hzhangal, yqsong}@cse.ust.hk + +{why16gz1, muhao, danroth}@seas.upenn.edu + +# Abstract + +Computational and cognitive studies of event understanding suggest that identifying, comprehending, and predicting events depend on having structured representations of a sequence of events and on conceptualizing (abstracting) its components into (soft) event categories. Thus, knowledge about a known process such as "buying a car" can be used in the context of a new but analogous process such as "buying a house". Nevertheless, most event understanding work in NLP is still at the ground level and does not consider abstraction. In this paper, we propose an Analogous Process Structure Induction (APSI) framework, which leverages analogies among processes and conceptualization of sub-event instances to predict the whole sub-event sequence of previously unseen open-domain processes. As our experiments and analysis indicate, $\mathsf{APSI}^1$ supports the generation of meaningful sub-event sequences for unseen processes and can help predict missing events. + +# 1 Introduction + +Understanding events has long been a challenging task in NLP, to which many efforts have been devoted by the community. However, most existing works are focusing on procedural (or horizontal) event prediction tasks. Examples include predicting the next event given an observed event sequence (Radinsky et al., 2012) and identifying the effect of a biological process (i.e., a sequence of events) on involved entities (Berant et al., 2014). These tasks mostly focus on predicting related events in a procedure based on their statistical correlations in previously observed text. As a result, understanding the meaning of an event might + +![](images/2edebec26f5d45bb93925954833000334598c1e3c161e139a59a74f55861efcf.jpg) +Figure 1: An illustration of leveraging known processes to predict the sub-event sequence of a new process. + +not be crucial for these horizontal tasks. For example, simply selecting the most frequently co-occurring event can offer acceptable performance on the event prediction task (Granroth-Wilding and Clark, 2016). + +Computational and cognitive studies (Schank and Abelson, 1977; Zacks and Tversky, 2001) suggest that inducing and utilizing the hierarchical structure of events is a crucial component of how humans understand new events and can help many aforementioned horizontal event prediction tasks. Consider the example in Figure 1. Assume that one has never bought a house, but is familiar with how to "buy a car" and "rent a house"; referring to analogous steps in these two relevant processes would still provide guidance for the target process of "buy a house". Motivated by this hypothesis, our work proposes to directly evaluate a model's event understanding ability. We define this as the + +![](images/fd9b4b1bfa799e2f8a61d9ddfdd556d32dae4c195bb87583ea0b381af1ba49b2.jpg) +Figure 2: Demonstration of the proposed APSI framework. Given a target process $P$ , we first decompose its semantics into two dimensions (i.e., predicate and argument) by grouping processes that share a predicate or an argument. For each such group of processes, we then leverage the observed process graphs $\mathcal{G}$ to generate an abstract and probabilistic representation for their sub-event sequences. In the last step, we merge them with an instantiation module to produce the sub-event sequence of $P$ . + +ability to identify vertical relations, that is, to predict the sub-event sequence of a new process3. We require models to generate the sub-event sequence for a previously unobserved process given observed processes along with their sub-event sequences, which we refer to as "the observed process graphs" in the rest of this paper. This task is more challenging than "conventional" event predictions tasks, since it requires the generation of a sub-event sequence given a new, previously unobserved, process definition. + +To address this problem, we propose an Analogous Process Structure Induction (APSI) framework. Given a new process definition (e.g., 'buy a house'), we first decompose it into two dimensions: predicate and argument. For each of these, we collect a group of processes that share the same predicate (i.e., 'buy-ARG') or same argument (i.e., 'PRE-house'), and then induce an abstract and probabilistic sub-event representation for each group. Our underlying assumption is that processes that share the same predicate or argument could be analogous to each other, and thus could share similar sub-event structures. Finally, we merge these two abstract representations, using an instantiation module, to predict the sub-event structure of the target process. By doing so, we only need a small number of analogous pro + +![](images/e54c8ea5987ad2837ecb478bca6007e684fe17b7e4b9d56ced62bbf005ca6c2d.jpg) +Figure 3: Examples of Sub-Event Representations. + +cesses (as we show, 20, on average) to generate unseen sub-events for the target process. Intrinsic and extrinsic evaluations show that APSI outperforms all baseline methods and can generate meaningful sub-event sequences for unseen processes, which are proven to be helpful for predicting missing events. + +The rest of the paper is organized as follows. Section 2 introduces the Analogous Process structure induction (APSI) framework. Section 3 describes our intrinsic and extrinsic evaluation, demonstrating the effectiveness of APSI and the quality of the induced process knowledge. We discuss related works in Section 4 and conclude this paper with Section 5. + +# 2 The APSI Framework + +Figure 2 illustrates the details of the proposed APSI framework. Given an unseen process $P$ , a target sub-event sequence length $k$ , and a set of + +observed process graphs $\mathcal{G}$ , the task is to predict a $k$ -step sub-event sequence $[E_1', E_2', \dots, E_k']$ for $P$ . Each process graph $G \in \mathcal{G}$ in the input contains a process definition $P^G$ and an $n$ -step temporally ordered sub-event sequence $[E_1^G, E_2^G, \dots, E_n^G]$ . We assume that each process $P$ is described as a combination of a predicate and an argument (e.g., 'buy+house') and each sub-event $E \in \mathcal{E}$ is given as verb-centric dependency graph as used in (Zhang et al., 2020b) (see examples in Figure 3). In APSI, we decompose the target process into two dimensions (i.e., predicate and argument). For each target process, we collect a group of observed process graphs that share either the predicate or the argument with the target process; we assume that processes in these groups have sufficient information for predicting the structure of the target process. We then leverage an event conceptualization module to induce an abstract representation of each process group. Finally, we merge the two abstract, probabilistic representations and instantiate it to generate a ground sub-event sequence as the final prediction. Detailed descriptions of APSI components are introduced as follows. + +# 2.1 Semantic Decomposition + +Each process definition $P$ is given as a predicate and its argument, which we term below the two "dimensions" of the process definition. We then collect all process graphs in $\mathcal{G}$ that have the same predicate as $P$ into $\mathcal{G}_p$ and those that have the same argument into $\mathcal{G}_a$ . We assume that these two sets provide the information needed to generate an abstract process representation that would guide the instantiation of the event steps for $P$ . + +# 2.2 Semantic Abstraction + +The goal of the semantic abstraction step is to acquire abstract representations $S_{p}$ and $S_{a}$ for $\mathcal{G}_p$ and $\mathcal{G}_a$ respectively, to help transfer the knowledge from the grounded observed processes to the target new process. To do so, we first need to conceptualize observed sub-events in $\mathcal{G}_p$ and $\mathcal{G}_a$ (e.g., "eat an apple") to a more abstract level (e.g., "eat fruit"). Clearly, each event could be conceptualized to multiple abstract events. For example, "eat an apple" can be conceptualized to "eat fruit" but also to "eat food", and the challenge is to determine the appropriate level of abstraction. On one hand, the conceptualized event cannot be too general, as we do not want to lose touch with the original event, and, on the other hand, if it + +is too specific, we will not aggregate enough instances of sub-events into it, thus we will have difficulties transferring knowledge to the new unseen process. To automatically achieve the balance between these conflicting requirements and select the best abstract event for each observed sub-event, we model it as a weighted mutually exclusive set cover problem (Lu and Lu, 2014) and propose an efficient algorithm, described below, to solve it. We then merge the repeated conceptualized events and determine their relative positions. + +# 2.2.1 Modeling Event Conceptualization + +For each event $E$ , we first identify all potential events that it can be conceptualized to. If two subevents $E_1$ and $E_2$ can be conceptualized to the same event $C$ , we place $E_1$ and $E_2$ into the set $\mathcal{E}_C$ . To qualitatively guide the abstraction process we introduce below a notion of semantic loss that we incur as we move up to more abstract representations. To measure the semantic loss during the conceptualization, we assign weight to each set: + +$$ +W \left(\mathcal {E} _ {C}\right) = \frac {1}{\sum_ {E \in \mathcal {E} _ {C}} F (E , C)}, \tag {1} +$$ + +where $F(E, C)$ is a scoring function, defined below in Eq. 2, that captures the amount of "semantic details" preserved due to abstracting from $E$ to $C$ . With this definition, the event conceptualization problem can be formalized as finding exclusive4 sets (such as $C$ ) that cover all observed events with minimum total weight. In the rest of this section, we first introduce how to collect potential conceptualized events for each $E$ , how we define $F$ , and how we solve this discrete optimization problem. + +Identifying Potential Conceptualizations Assume that sub-event $E$ contains $m$ words $w_{1}^{E}, w_{2}^{E}, \ldots, w_{m}^{E}$ , each corresponds to a node in Figure 3; for each of these, we can retrieve a list of hypernym paths from WordNet (Miller, 1998). For example, given the word "house", WordNet returns two hypernym paths: (1) "house" $\rightarrow$ "building" $\rightarrow$ "structure" $\rightarrow$ ...; (2) "house" $\rightarrow$ "firm" $\rightarrow$ "business" $\rightarrow$ ... As a result, we can find $\prod_{w \in E} L(w)$ potential conceptualized events for $E$ , where $L(w)$ is the number of $w$ 's hypernyms. We denote the potential conceptualized event set for $E$ as $\mathcal{C}_{E}$ and the overall set as $\mathcal{C}$ . + +Algorithm 1 Event Conceptualization + +INPUT: Set of events $\mathcal{E}$ . Each $\mathbf{E} \in \mathcal{E}$ is associated with a set of potential conceptualization events $\mathcal{C}_E$ . The overall conceptualized event set $\mathcal{C}$ . + +1: Initialize event partition set $\mathcal{P} := \emptyset$ . +2: while $\mathcal{E} \neq \emptyset$ do +3: for Each $E \in \mathcal{E}$ do +4: for Each $C \in \mathcal{C}_E$ do +5: $\mathcal{E}_C\coloneqq \emptyset$ +6: Compute $F(E, C)$ using Eq. (2). +7: end for + +8: end for +9: for Each $C \in \mathcal{C}$ do +10: for Each $E\in \mathcal{E}$ do +11: if $C\in \mathcal{C}_E$ then +12: $\mathcal{E}_C\coloneqq \mathcal{E}_C\cup \{E\} .$ +13: end if +14: end for +15: Compute $W(\mathcal{E}_C)$ using Eq. (1). +16: end for +17: Select $\mathcal{E}_{C_{min}}$ with the minimum $W$ score. +18: $\mathcal{E} := \mathcal{E} \setminus \tilde{\mathcal{E}}_C$ . +19: $\mathcal{P} := \mathcal{P} \cup \{\hat{\mathcal{E}}_{C_{min}}\}$ . +20: end while + +OUTPUT: Partition of $n$ event subsets $\mathcal{P} = \{\mathcal{E}_1, \mathcal{E}_2, \dots, \mathcal{E}_n\}$ , where each subset $\mathcal{E}_i$ corresponds to a unique conceptualized event $C_i$ . + +Conceptualization Scoring As mentioned above, for each pair of a sub-event $E$ and its potential conceptualization $C$ , we propose a scoring function $F(E, C)$ to measure how much "semantic information" is preserved after the conceptualization. Motivated by Budanitsky and Hirst (2006) and based on the assumption that the more abstract the conceptualized event is, the more semantic details are lost, we define $F(E, C)$ to be: + +$$ +F (E, C) = \prod_ {i = 1} ^ {m} w ^ {D \left(w _ {i} ^ {E}, w _ {i} ^ {C}\right)}, \tag {2} +$$ + +where $D(w_{i}^{E},w_{i}^{C})$ is the depth from $w_{i}^{E}$ to $w_{i}^{C}$ on the taxonomy path, and $w$ is a hyper-parameter $^{6}$ measuring how much "semantics" is preserved following each step of the conceptualization. + +Conceptualization Assignment Now we are able to model the procedure of finding proper conceptualized events as a weighted mutually exclusive set cover problem. Note that this is an NP-complete problem and requires a prohibitive computational cost to obtain the optimum solution (Karp, 1972). To obtain an efficient solution that is empirically sufficient for assigning conceptualized events with reasonable amount of in + +stances, we develop a greedy procedure as described in Algorithm 1. For each retrieved process graph set $\mathcal{G}_p$ or $\mathcal{G}_a$ , we collect all its sub-events as $\mathcal{E}$ and use it as the input for the conceptualization algorithm. In each iteration, we first compute the conceptualization score $F$ for all the $(E,C)$ pairs and then compute the weight score for all conceptualization sets $\mathcal{E}_C$ . After selecting the set with minimum weight, $\mathcal{E}_{C_{min}}$ , we remove all the events covered by it from $\mathcal{E}$ and repeat the process until no event is left. After the conceptualization, we merge sub-events that are conceptualized to the same event and represent them with the resulting conceptualized event $C$ , whose weight is defined to be $\overline{W} (C) = \frac{1}{W(\mathcal{E}_C)}$ . Compared with the naive algorithm, which first expands all possible subsets (i.e., it includes all subsets of $\mathcal{E}_C$ for all $C$ ) and then leverages the sort and filter technique to select the final subsets, we reduce the time complexity from $O(|\mathcal{C}|\cdot |\mathcal{E}|^2)$ to $O(n\cdot |\mathcal{C}|\cdot |\mathcal{E}|)$ , where $n$ is the number of conceptualized events and is typically much smaller than $|\mathcal{E}|$ . + +# 2.2.2 Conceptualized Event Ordering + +After conceptualizing and merging all sub-events, we need to determine their loosely temporal order (e.g., whether they typically appear at the beginning or the end of these sub-event sequences). Let the set of selected conceptualized events be $\mathcal{C}^*$ . For each $C \in \mathcal{C}^*$ , we define its order score $T(C)$ , indicating how likely $C$ is to appear first, as: + +$$ +T (C) = \sum_ {C ^ {\prime} \in \mathbf {C} ^ {*}} \theta \left(\sum_ {E _ {C} \in \mathcal {E} _ {C}} \sum_ {E _ {C ^ {\prime}} \in \mathcal {E} _ {C ^ {\prime}}} t \left(E _ {C}, E _ {C ^ {\prime}}\right) - t \left(E _ {C ^ {\prime}}, E _ {C}\right)\right), \tag {3} +$$ + +where $\theta$ is the unit step function and $t(E_C, E_{C'})$ represents how many times $E_C$ appears before $E_{C'}$ in an observed process graph. + +# 2.3 Sub-event Sequence Prediction + +In the last step, we leverage the two abstract representations we got for the predicate and argument of the target process definition to predict its final sub-events. To do so, we propose the following instantiation procedure. We are given the abstract representations $S_{p}$ and $S_{a}$ , for the predicate and argument, respectively. Each is a set of conceptualized events associated with weights and order scores. For each conceptualized event $C_{p} \in S_{p}$ using each event $C_{a} \in S_{a}$ , we can generate a new instantiated event $\hat{C}_{p}$ . For example, if $C_{p}$ is "cut fruit" and $C_{a}$ is 'buy an apple', then our model + +would create the new event "cut an apple". Specifically, for each $w \in C_p$ , if we can find a word $\hat{w}$ such that $\hat{w}$ is a hyponym of $w$ , we will replace $w$ with $\hat{w}$ and repeat this process until no hyponym can be detected in $C_p$ . We denote the generated event by $\hat{C}_p$ . To account for the semantic loss during the instantiation procedure, we define the weight and order score of $\hat{C}_p$ as follows: + +$$ +\hat {W} \left(\hat {C} _ {p}\right) = \bar {W} \left(C _ {p}\right) \cdot F \left(\hat {C} _ {p}, C _ {p}\right) \cdot \frac {\sum_ {C _ {a} ^ {\prime} \in S _ {a}} \bar {W} \left(C _ {a} ^ {\prime}\right)}{\bar {W} \left(C _ {a}\right)} \tag {4} +$$ + +$$ +\hat {T} (\hat {E _ {p}}) = T (C _ {p}) \cdot F (\hat {C _ {p}}, C _ {p}) \cdot \frac {\sum_ {C _ {a} ^ {\prime} \in S _ {a}} \bar {W} \left(C _ {a} ^ {\prime}\right)}{\bar {W} (C _ {a})}, \tag {5} +$$ + +Similarly, we apply the same procedure to $C_a$ with $C_p$ , and denote the resulted event $\hat{C}_a$ . We then repeatedly merge instantiated events by summing up their weights and averaging their order scores. In the end, we select top $k$ sub-events based on the weights and sort them based on the order score as the sub-event sequence prediction. + +# 3 Evaluation + +In this section, we conduct intrinsic and extrinsic evaluations to show that APSI can generate meaningful sub-event sequences for unseen processes, which can help predict the missing events. + +# 3.1 Dataset + +We collect process graphs from the WikiHow website $^{7}$ (Koupaee and Wang, 2018). In WikiHow, each process is associated with a sequence of temporally ordered human-created steps. For each step, as shown in Figure 3, we use the tool released by ASER (Zhang et al., 2020b) to extract events and construct the process graphs. We select all processes, where each step has one and only one event, and randomly split them into the train and test data. As a result, we got 13,501 training process graphs and 1,316 test process graphs $^{8}$ , whose average sub-event sequence length is 3.56. + +# 3.2 Baseline Methods + +We compare with the following baseline methods: Sequence to sequence (Seq2seq): One intuitive solution to the sub-event sequence prediction task would be modeling it as a sequence to sequence problem, where the process is treated as the input and the sub-event sequence the output. Here we + +adopt the standard GRU-based encoder-decoder framework (Sutskever et al., 2014) as the base framework and change the generation unit from words to events. For each process or sub-event, we leverage pre-trained word embeddings (i.e., GloVe-6b-300d (Pennington et al., 2014)) or language models (i.e., RoBERTa-base (Liu et al., 2019)) as the representation, which are denoted as Seq2seq (GloVe) and Seq2seq (RoBERTa). + +Top One Similar Process: Another baseline is the "top one similar process". For each new process, we can always find the most similar observed process. Then we can use the sub-event sequence of the observed process as the prediction. We employ different methods (i.e., token-level Jaccard coefficient or cosine similarity of GloVe/RoBERTa process representations) to measure the process similarity. We denote them as Top one similar process (Jaccard), (GloVe), and (RoBERTa), respectively. + +For each process, we also present a randomly generated sequence and a human-generated sequence as the lower-bound and upper-bound for sub-event sequence prediction models. + +# 3.3 Intrinsic Evaluation + +We first present the intrinsic evaluation to show the quality of the predicted sub-event sequences of unseen processes. For each test process, we provide the process name and the sub-event sequence length10 to evaluated systems and ask them to generate a fixed-length sub-event sequence. + +# 3.3.1 Evaluation Metric + +Motivated by the ROUGE score (Lin, 2004), we propose an event-based ROUGE (E-ROUGE) to evaluate the quality of the predicted sub-event sequence. Specifically, similar to ROUGE, which evaluates the generation quality based on N-gram token occurrence, we evaluate how much percentage of the sub-event and time-ordered sub-event pairs in the induced sequence is covered by the human-provided references. We denote the evaluation over single event and event pairs as E-ROUGE1 and E-ROUGE2, respectively. We also provide two covering standards to better understand the prediction quality: (1) "String Match": all words in the predicted event/pairs must be the same as the referent event/pairs; (2) "Hypernym Allowed": the predicted and referent event must + +
ModelString MatchHypernym Allowed
E-ROUGE1E-ROUGE2E-ROUGE1E-ROUGE2
Random2.91650.466423.58738.1089
Seq2seq (GloVe)5.03231.496527.871013.0946
Seq2seq (RoBERTa)4.54550.483128.003212.8502
Top one similar process (Jaccard)8.85895.100028.654814.6231
Top one similar process (GloVe)9.87975.145229.420313.6001
Top one similar process (RoBERTa)9.25994.739030.659915.8417
Analogous Process Structure Induction (APSI)14.80136.604536.164819.2418
Human29.018915.254250.464729.4423
+ +(a) Basic Setting (for each sub-event, we only predict and evaluate the verb) + +
ModelString MatchHypernym Allowed
E-ROUGE1E-ROUGE2E-ROUGE1E-ROUGE2
Random0.00000.00000.51040.0903
Seq2seq (GloVe)0.19350.05340.96770.1069
Seq2seq (RoBERTa)0.48700.00001.78570.2899
Top one similar process (Jaccard)0.65620.22572.47970.5867
Top one similar process (GloVe)0.87500.21062.88010.7372
Top one similar process (RoBERTa)0.94790.30093.28110.9929
Analogous Process Structure Induction (APSI)3.49880.45136.16111.1885
Human11.63515.590518.00348.2695
+ +(b) Advanced Setting (for each sub-event, we predict and evaluate all words) + +Table 1: Intrinsic evaluation results of the induced process structures. On average, we have 1.7 human-generated sub-event sequences as the references for each test process. Best performing models are marked with the bold font. + +have the same dependency structure, and for the words on the same graph position, they should be the hypernym of or same as each other. For example, if the referent event is "eat apple" and the predicted event is "eat fruit", we still count it as a match. The "String Match" setting is stricter, but the "Hypernym Allowed" setting also has its unique value to help better understand if our system is predicting relevant sub-events. + +# 3.3.2 Implementation Details + +In terms of training, we set both $w_{v}$ and $w_{n}$ to be 0.5 for our model. For the seq2seq baselines, we set the learning rate to be 0.001 and train the models until they converge on the training data. All other hyper-parameters following the original paper. In terms of the evaluation, we also provide two settings. (1) Basic: we follow previous works (Glavas et al., 2014) to predict and evaluate events based on verbs; (2) Advanced: we predict and evaluate events based on all words. + +# 3.3.3 Result Analysis + +We show the results in Table 1. In general, there is still a notable gap between current models' performance and human performance, but the pro + +posed APSI framework can indeed generate sufficiently relevant sub-events. For example, if we only consider the verb. Even in the string match setting, $14.8\%$ of the predicted event and $6.6\%$ of the ordered event pairs are covered by the references, which is much better than the random guess and nearly half of the performance of human beings. If hypernym is allowed, $36\%$ and $19\%$ of the predicted event and event pairs are covered. Besides that, if we take all words in the event into consideration, the task becomes more challenging. Specifically, even human can only achieve 11.63 E-ROUGE1 and 5.59 E-ROUGE2, which suggests that low scores achieved by current models are probably due to the limitation of the current dataset (e.g., on average, we only have 1.7 references for each test process). If more references are provided, the performance of all models will also increase. In the rest of the intrinsic evaluation, we present more detailed analysis based on the advanced setting (string match) and a case study to help better understand the performance of APSI. + +# 3.3.4 Effect of the Instantiation Module + +One key step in our framework is how to leverage the two abstract representations to predict the fi + +![](images/31807b66f922476c618ae418ab5cce9f94a5fecc9340ce5f7d94f862c703420e.jpg) +Figure 4: Hyper-parameter influence on the quality of APSI generated sub-event sequences. For both $w_{v}$ and $w_{n}$ , 0 indicates no conceptualization and the larger the value, the deeper the conceptualization is. Best performing ranges are marked with red boxes, which indicate that the suitable conceptualization level is the key to APSI's success. + +![](images/5434a28192cb87003089f66aa1cc9d2c8dda630901f579d81df06a7d737b798f.jpg) + +
ModelE-ROUGE1E-ROUGE2
Simple Merge2.58840.4062
Normalized2.22380.3611
APSI (Instantiation)3.49880.4513
+ +Table 2: Performance of different merging methods. + +nal sub-event sequence. In APSI, we propose an instantiation module, which jointly leverages the two representations to generate detailed events. To show its effect, we compare it with two other options: (1) Simple Merge: Merge two representation and select the top $k$ sub-events based on the weight; (2) Normalized: First normalize the weight of all sub-events based on each representation and then select the top $k$ sub-events. + +From the result in Table 2, we can see that due to the imbalanced distribution of the two representations, simply choosing the most weighted sub-events is problematic. On average, for each predicate, we can collect 18.04 processes, while we can only collect 1.92 processes for each argument. As a result, the sub-events in the predicate representation typically have a larger weight. Thus if we simply merge them, most of the predicted sub-events will come from the predicate representation. Ideally, the "normalized" method can eliminate the influence of such imbalance, but it also amplifies the noise and achieves worse empirical performance. Differently, the proposed instantiation module uses events in one representation as the reference to help instantiate the events in the other one. As a result, we jointly use these two representations to generate a group of detailed events, + +![](images/00f7955aa48a9e4ebe7cdbbacf31c67c7887c2ec001bfbb2f79221b25e09b96c.jpg) +Figure 5: Case Study. We mark the covered and not covered predictions with green and red colors. + +and then we can select the top $k$ generated new events. By doing so, we do not only go detailed from the abstract representation but also avoid the imbalanced distribution issue. + +# 3.3.5 Hyper-parameter Analysis + +In APSI, we use two hyper-parameters $w_{v}$ and $w_{n}$ to control the conceptualization and instantiation depth we want over verbs and nouns respectively. 0 means no conceptualization and the larger value indicates more conceptualization we encourage. We show the performance of APSI with different hyper-parameter combinations in Figure 4, from which we can see that a suitable level of conceptualization is the key to the success of APSI. If no conceptualization is allowed, all the predicted events are restricted to the observed sub-event, thus we cannot predict "search house" after seeing "search car" and some events about the house. On the other hand, if we do not restrict the depth of conceptualization, all the sub-events will be conceptualized to be too general. As a result, even with the instantiation module, we could not predict the detailed sub-event as we want. + +![](images/101f9d5e8456132180188ca5cf84772ad2fbcb2b3749572e1898e85f5adab0bd.jpg) +Figure 6: Demonstration of the event masked LM. Pre-trained language models are trained to predict the masked event given other events as the context. + +# 3.3.6 Case Study + +Figure 5 shows an example that we use to analyze the current limitations of APSI. We can see that APSI can successfully predict events like "identify symptoms", but fails to predict event "identify causes". Instead, it predicts "take supplements". This is because APSI learns to predict such sequence from other processes like "treat diarrhea" or other diseases in the observed process graphs. Treating those diseases typically does not involve identifying the cause, which is not the case for treating pain. And, treating diseases often involves taking medicines, which can be conceptualized to "take supplement". As no events about pain helps instantiate "supplement", APSI just predicts it. + +# 3.4 Extrinsic Evaluation + +As discussed by (Rumelhart, 1975), the knowledge about process and sub-events can help understand event sequences. Thus, in this section, we investigate whether the induced process knowledge can help predict the missing events. Given a sub-event sequence, for each event in the sequence, we can use the rest of the sequence as the context and ask models to select the correct event against one negative event example. To make the task challenging, instead of random sampling, we follow Zellers et al. (2019) to select similar but wrong negative candidates based on their representation (i.e., BERT (Devlin et al., 2019)) similarity. We use the same training and test as the intrinsic experiment and as a result, we got 13,501 training sequences and 7,148 test questions. + +The baseline method we are comparing with is the event-based masked language model11, whose + +
ModelAccuracyΔ
RoBERTa-based Event LM73.59%-
+ Seq2seq (GloVe)73.06%-0.53%
+ Seq2seq (RoBERTa)72.33%-1.26%
+ Top1 similar (Jaccard)72.76%-0.83%
+ Top1 similar (GloVe)74.14%0.55%
+ Top1 similar (RoBERTa)74.16%0.57%
+ APSI74.78%†1.19%
+ Human76.97%‡3.38%
+ +Table 3: Results on the event prediction task. † and ‡ indicate the statistical significance over the baseline with p-value smaller than 0.01 and 0.001 respectively. + +demonstration is shown in figure 6. We use pretrained RoBERTa-base (Liu et al., 2019) to initialize the tokenizer and transformer layer and all sequences of training processes as the training data. To show the value of understanding the relationship between process and their sub-event sequence, for each sub-event sequence in the test data, we first leverage the process name and different structure prediction methods to predict sub-event sequences and use them as additional context to help the event masked LM to predict the missing event. To show the effect upper bound of adding process knowledge, we also tried adding the process structure provided by human beings as the context $^{12}$ , which is denoted as ‘+Human’. All models are evaluated based on accuracy. + +From the results in Table 3, we can make the following observations. First, adding high-quality process knowledge (i.e., APSI and Human) can significantly help the baseline model, which indicates that adding knowledge about the process can help better understand the event sequence. Second, the effect of process knowledge is positively correlated with their quality as shown in Table 1. Adding a low-quality process structure may hurt the performance of the baseline model due to the introduction of the extra noise. Third, the current way of using process knowledge is still very simple and there is room for better usage of the process knowledge, as the research focus of this paper is predicting process structure rather than applying it, we leave that for the future work. + +# 4 Related Works + +Throughout history, considering the importance of events in understanding human language (e.g., commonsense knowledge (Zhang et al., 2020a)), many efforts have been devoted to define, represent, and understand events. For example, VerbNet (Schuler, 2005) created a verb lexicon to represent the semantic relations among verbs. After that, FrameNet (Baker et al., 1998) proposed to represent the event semantics with schemas, which has one predicate and several arguments. Apart from the structure of events, understanding events by predicting relations among them also becomes a popular research topic (e.g., TimeBank (Pustejovsky et al., 2003) for temporal relations and Event2Mind (Rashkin et al., 2018) for causal relations). Different from these horizontal relations between events, in this paper, we propose to understand event vertically by treating each event as a process and trying to understand what is happening (i.e., sub-event) inside the target event. Such knowledge is also referred to as event schemata (Zacks and Tversky, 2001) and shown crucial for how humans understand events (Abbott et al., 1985). One line of related works in the NLP community is extracting super-sub event relations from textual corpus (Hovy et al., 2013; Glavas et al., 2014). The difference between this work and them is that we are trying to understand events by directly generating the sub-event sequences rather than extracting such information from text. Another line of related works is the narrative schema prediction (Chambers and Jurafsky, 2008), which also holds the assumption that event schemata can help understand events. But their research focus is using the overall process implicitly to help predict future events while this work tries to understand events by knowing the relation between processes and their sub-event sequences explicitly. + +# 5 Conclusion + +In this paper, we try to understand events vertically by viewing them as processes and predicting their sub-event sequences. Our APSI framework is motivated by the notion of analogous processes, and attempts to transfer knowledge from (a very small number of) familiar processes to a new one. The intrinsic evaluation demonstrates the effectiveness of APSI and the quality of the predicted sub-event sequences. Moreover, the extrinsic evaluation shows that, even with a naive ap + +plication method, the process knowledge can help better predict missing events. + +# Acknowledgements + +This research is supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via IARPA Contract No. 2019-19051600006 under the BETTER Program, and by contract FA8750-19-2-1004 with the US Defense Advanced Research Projects Agency (DARPA). The views expressed are those of the authors and do not reflect the official policy or position of the Department of Defense or the U.S. Government. This paper is also partially supported by Early Career Scheme (ECS, No. 26206717), General Research Fund (GRF, No. 16211520), and Research Impact Fund (RIF, No. R6020-19) from the Research Grants Council (RGC) of Hong Kong. + +# References + +Valerie Abbott, John B Black, and Edward E Smith. 1985. The representation of scripts in memory. Journal of memory and language, pages 179-199. +Collin F. Baker, Charles J. Fillmore, and John B. Lowe. 1998. The Berkeley FrameNet Project. In Proceedings of COLING-ACL 1998, pages 86-90. +Jonathan Berant, Vivek Srikumar, Pei-Chun Chen, Abby Vander Linden, Brittany Harding, Brad Huang, Peter Clark, and Christopher D. Manning. 2014. Modeling biological processes for reading comprehension. In Proceedings of EMNLP 2014. +Alexander Budanitsky and Graeme Hirst. 2006. Evaluating wordnet-based measures of lexical semantic relatedness. Comput. Linguistics, 32(1):13-47. +Nathanael Chambers and Daniel Jurafsky. 2008. Unsupervised learning of narrative event chains. In Proceedings of ACL 2008, pages 789-797. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT 2019, pages 4171-4186. +Goran Glavas, Jan Snajder, Marie-Francine Moens, and Parisa Kordjamshidi. 2014. Hieve: A corpus for extracting event hierarchies from news stories. In Proceedings of LREC 2014, pages 3678-3683. +Mark Granroth-Wilding and Stephen Clark. 2016. What happens next? event prediction using a compositional neural network model. In Proceedings of AAAI 2016, pages 2727-2733. + +Eduard H. Hovy, Teruko Mitamura, Felisa Verdejo, Jun Araki, and Andrew Philpot. 2013. Events are not simple: Identity, non-identity, and quasi-identity. In Proceedings of EVENTS@NAACL-HLT 2013, pages 21-28. +Richard M. Karp. 1972. Reducibility among combinatorial problems. In Proceedings of a symposium on the Complexity of Computer Computations 1972, pages 85-103. +Mahnaz Koupae and William Yang Wang. 2018. Wikihow: A large scale text summarization dataset. CoRR, abs/1810.09305. +Chin-Yew Lin. 2004. ROUGE: A package for automatic evaluation of summaries. In Proceedings of Text Summarization Branches Out 2004, 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. CoRR, abs/1907.11692. +Songjian Lu and Xinghua Lu. 2014. An exact algorithm for the weighed mutually exclusive maximum set cover problem. CoRR, abs/1401.6385. +George A Miller. 1998. WordNet: An electronic lexical database. MIT press. +Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. Glove: Global vectors for word representation. In Proceedings of EMNLP 2014, pages 1532-1543. +James Pustejovsky, Patrick Hanks, Roser Sauri, Andrew See, Robert Gaizauskas, Andrea Setzer, Dragomir Radev, Beth Sundheim, David Day, Lisa Ferro, et al. 2003. The timebank corpus. In Corpus linguistics, page 40. +Kira Radinsky, Sagie Davidovich, and Shaul Markovitch. 2012. Learning causality for news events prediction. In Proceedings of the 21st World Wide Web Conference 2012, WWW 2012, Lyon, France, April 16-20, 2012, pages 909-918. +Hannah Rashkin, Maarten Sap, Emily Allaway, Noah A. Smith, and Yejin Choi. 2018. Event2mind: Commonsense inference on events, intents, and reactions. In Proceedings of ACL 2018, pages 463-473. +DE Rumelhart. 1975. Notes on a schema for stories language, thought, and culture. Representation and understanding, pages 211-236. +Roger C Schank and Robert P Abelson. 1977. Scripts, plans, goals and understanding: An inquiry into human knowledge structures. +Karin Kipper Schuler. 2005. Verbnet: A broad-coverage, comprehensive verb lexicon. + +Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. In Proceedings of NeurIPS 2014, pages 3104-3112. +Jeffrey M Zacks and Barbara Tversky. 2001. Event structure in perception and conception. Psychological bulletin, 127(1):3. +Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. 2019. Hellaswag: Can a machine really finish your sentence? In Proceedings of ACL 2019, pages 4791-4800. +Hongming Zhang, Daniel Khashabi, Yangqiu Song, and Dan Roth. 2020a. Transomics: From linguistic graphs to commonsense knowledge. In Proceedings of IJCAI 2020, pages 4004-4010. +Hongming Zhang, Xin Liu, Haojie Pan, Yangqiu Song, and Cane Wing-Ki Leung. 2020b. ASER: A large-scale eventuality knowledge graph. In Proceedings of WWW 2020, pages 201-211. \ No newline at end of file diff --git a/analogousprocessstructureinductionforsubeventsequenceprediction/images.zip b/analogousprocessstructureinductionforsubeventsequenceprediction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ff38ee992b03f1e1ce72c7f7ab6d2d1c9ee81d04 --- /dev/null +++ b/analogousprocessstructureinductionforsubeventsequenceprediction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e3e16294c887cf5e72b16cfcdeba272b3227721ce1086735544102a07ce508e +size 412798 diff --git a/analogousprocessstructureinductionforsubeventsequenceprediction/layout.json b/analogousprocessstructureinductionforsubeventsequenceprediction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..0097ba1c7b0c2070e886b6947f80a361a23cefbc --- /dev/null +++ b/analogousprocessstructureinductionforsubeventsequenceprediction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f004cbf22881d0d3e55ef00368a61395b71cdbe41a0c65aca79143092ab33368 +size 413815 diff --git a/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_content_list.json b/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..980bc14a3284965d73073cdc534441baf5bc718f --- /dev/null +++ b/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e86b3a8954007f9247e51d07a7035bc6c832fe53828348da01d668dc33bfb309 +size 98497 diff --git a/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_model.json b/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a5d9aaf14866f894855385cdee0bcc21b88cdff1 --- /dev/null +++ b/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ae0ce5b6b958af05259378eaea5d1bfcf323b1920ee40d1c834bafd55817fe9 +size 119840 diff --git a/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_origin.pdf b/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..d3d22b9c1abc67f1586295ee31104018cbdd5529 --- /dev/null +++ b/analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0530dc1e4929f2d7cc8ac1bc606d3bb12f2c60c59177b55be422bbd155026092 +size 631742 diff --git a/analyzingindividualneuronsinpretrainedlanguagemodels/full.md b/analyzingindividualneuronsinpretrainedlanguagemodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..27dc6d0bd0f9752bb5f8e5f46e6da74e6029f191 --- /dev/null +++ b/analyzingindividualneuronsinpretrainedlanguagemodels/full.md @@ -0,0 +1,356 @@ +# Analyzing Individual Neurons in Pre-trained Language Models + +Nadir Durrani Hassan Sajjad Fahim Dalvi Yonatan Belinkov\* + +{ndurrani,hsajjad,faimaduddin}@hbku.edu.qa + +Qatar Computing Research Institute, HBKU Research Complex, Doha 5825, Qatar + +*MIT Computer Science and Artificial Intelligence Laboratory and Harvard John A. Paulson School of Engineering and Applied Sciences, Cambridge, MA, USA belinkov@csail.mit.edu + +# Abstract + +While a lot of analysis has been carried to demonstrate linguistic knowledge captured by the representations learned within deep NLP models, very little attention has been paid towards individual neurons. We carry out a neuron-level analysis using core linguistic tasks of predicting morphology, syntax and semantics, on pre-trained language models, with questions like: i) do individual neurons in pretrained models capture linguistic information? ii) which parts of the network learn more about certain linguistic phenomena? iii) how distributed or focused is the information? and iv) how do various architectures differ in learning these properties? We found small subsets of neurons to predict linguistic tasks, with lower level tasks (such as morphology) localized in fewer neurons, compared to higher level task of predicting syntax. Our study reveals interesting cross architectural comparisons. For example, we found neurons in XLNet to be more localized and disjoint when predicting properties compared to BERT and others, where they are more distributed and coupled. + +# 1 Introduction + +Transformer-based neural language models have constantly pushed the state-of-the-art in downstream NLP tasks such as Question Answering, Textual Entailment, etc. (Rajpurkar et al., 2016; Wang et al., 2018). Central to this revolution is the contextualized embedding, where each word is assigned a vector based on the entire input sequence, allowing it to capture not only a static semantic meaning but also a contextualized meaning. + +Previous work on analyzing neural networks showed that while learning rich NLP tasks such as machine translation and language modeling, these deep models capture fundamental linguistic phenomena such as word morphology, syntax and various other relevant properties of interest (Shi et al., + +2016; Adi et al., 2016; Belinkov et al., 2017a,b; Dalvi et al., 2017; Blevins et al., 2018). + +More recently Liu et al. (2019) and Tenney et al. (2019) used probing classifiers to analyze pretrained neural language models on a variety of sequence labeling tasks and demonstrated that contextualized representations encode useful, transferable features of language. While most of the previous studies emphasize and analyze representations as a whole, very little work has been carried to analyze individual neurons in deep NLP models. + +Studying individual neurons can facilitate understanding of the inner workings of neural networks (Karpathy et al., 2015; Dalvi et al., 2019; Suau et al., 2020) and have other potential benefits such as controlling bias and manipulating system's behaviour (Bau et al., 2019), model distillation and compression (Rethmeier et al., 2020), efficient feature selection (Dalvi et al., 2020), and guiding architectural search. + +In this work, we put the representations learned within pre-trained transformer models under the microscope and carry out a fine-grained neuron level analysis with respect to various linguistic properties. We target questions such as: i) do individual neurons in pretrained models capture linguistic information? ii) which parts of the network learn more about certain linguistic phenomena? iii) how distributed or focused is the information? and iv) how do various architectures differ in learning these properties? + +A typical methodology in previous work on analyzing representations trains probing classifiers using the representations learned within a neural model, to predict the understudied task. We also use a probing classifier approach to analyze individual neurons. Since neurons are multivariate in nature and work in groups, we additionally use elastic-net regularization that encourages individual and group of neurons to play a role in the train + +ing of the classifier. Given a trained classifier, we consider the weights assigned to each neuron as a measure of their importance with respect to the understudied linguistic task. We use probes with high selectivity (Hewitt and Liang, 2019) to ensure that our results reflect the property of representations and not the probe's capacity to learn. + +We choose 4 pre-trained models: ELMo (Peters et al., 2018a), its transformer variant T-ELMo (Peters et al., 2018b), BERT (Devlin et al., 2019) and XLNet (Yang et al., 2019) - covering a varied set of modeling choices, including the building blocks (recurrent networks versus Transformers), optimization objective (auto-regressive versus non-autoregressive), and model depth and width. Our cross architectural analysis yields the following insights: + +- Information across networks is distributed, but it is possible to extract a very small subset of neurons to predict a linguistic task with the same accuracy as using the entire network. +- Low level tasks such as predicting morphology require fewer neurons compared to high level tasks such as predicting syntax. +- Some phenomena (e.g. Verbs) are distributed across many neurons while others (e.g. Interjections) are localized in a fewer neurons. +- Lower layers contain more word-level specialized neurons, and higher layers contain neurons specialized in syntax-level information. +- BERT is the most distributed model with respect to all properties while XLNet exhibits focus with the most disjoint set of neurons and layers designated for different linguistic properties. + +# 2 Methodology + +A common approach for probing neural network components against linguistic properties is to train a linear classifier using the activations generated from the trained neural network as static features. The underlying assumption is that if a simple linear model can predict a linguistic property, then the representations implicitly encode this information. + +Probe: We go a level deeper and identify neurons within the learned representations to carry out + +a more fine-grained neuron $^1$ level analysis. We use a logistic regression classifier with elastic-net regularization (Zou and Hastie, 2005). The weights of the trained classifier serve as a proxy to select the most relevant features $^2$ within the learned representations, to predict a linguistic property. Formally, consider a pre-trained neural language model $\mathbf{M}$ with $L$ layers: $\{l_1, l_2, \ldots, l_L\}$ . Given a dataset $\mathbb{D} = \{w_1, w_2, \ldots, w_N\}$ with a corresponding set of linguistic annotations $\mathbb{T} = \{t_{w_1}, t_{w_2}, \ldots, t_{w_N}\}$ , we map each word $w_i$ in the data $\mathbb{D}$ to a sequence of latent representations: $\mathbb{D} \xmapsto {\mathbb{M}} \mathbf{z} = \{\mathbf{z}_1, \ldots, \mathbf{z}_n\}$ . The representations can either be extracted from the entire model or just from an individual layer. The model is trained by minimizing the following loss function: + +$$ +\mathcal {L} (\theta) = - \sum_ {i} \log P _ {\theta} (t _ {w _ {i}} | w _ {i}) + \lambda_ {1} \| \theta \| _ {1} + \lambda_ {2} \| \theta \| _ {2} ^ {2} +$$ + +where $P_{\theta}(t_{w_i}|w_i)$ is the probability that word $i$ is assigned property $t_{w_i}$ . The weights $\theta \in \mathbb{R}^{D\times T}$ are learned with gradient descent. Here $D$ is the dimensionality of the latent representations $\mathbf{z}_i$ and $T$ is the number of tags (properties) in the linguistic tag set, which the classifier is predicting. The terms $\lambda_1\| \theta \| _1$ and $\lambda_2\| \theta \| _2^2$ correspond to $L1$ and $L2$ regularization. This combination, known as elastic-net, strikes a balance between identifying very focused localized features ( $L1$ ) versus distributed neurons ( $L2$ ). We use a grid search algorithm described in Search, to find the most appropriate set of lambda values. But let us describe the neuron ranking algorithm first. + +Neuron Ranking Algorithm: Once the classifier has been trained, our goal is to retrieve individual or a group of neurons (some subset of features of the latent representation) that are the most relevant for predicting a particular linguistic property $\mathbb{T}$ of interest. We use the neuron ranking algorithm as described in Dalvi et al. (2019). Given the trained classifier $\theta \in \mathbb{R}^{D\times T}$ , the algorithm extracts a ranking of the $D$ neurons in the model $\mathbb{M}$ . For each label $t$ in task $\mathbb{T}$ , the weights are sorted by their absolute values in descending order. To select $N$ most salient neurons w.r.t. the task $\mathbb{T}$ , an iterative process is carried. The algorithm starts with a small + +percentage of the total weight mass and selects the most salient neurons for each sub-property (e.g. Nouns in POS tagging) until the set reaches the specified size $N$ . + +Search: The search criteria is driven through ablation of weights in the trained classifier. Once the classifier is trained, we select $M^4$ top and bottom features according to our ranked list (obtained using neuron ranking algorithm described above) and zero-out the remaining features. We then compute score for each lambda set $(\lambda_1, \lambda_2)$ as: + +$$ +\mathcal {S} (\lambda_ {1}, \lambda_ {2}) = \alpha (A _ {t} - A _ {b}) - \beta (A _ {z} - A _ {l}) +$$ + +where $A_{t}$ is the accuracy of the classifier retaining top neurons and masking the rest, $A_{b}$ is the accuracy retaining bottom neurons, $A_{z}$ is the accuracy of the classifier trained using all neurons but without regularization, and $A_{l}$ is the accuracy with the current lambda set. The first term ensures that we select a lambda set where accuracies of top and bottom neurons are further apart and the second term ensures that we prefer weights that incur a minimal loss in classifier accuracy due to regularization. We set $\alpha$ and $\beta$ to be 0.5 in our experiments. This formulation enables the search to be automated, compared to Dalvi et al. (2019) where the lambdas were selected manually, which we found to be cumbersome and error-prone. + +Minimal Neuron Selection: Once we have obtained the best regularization lambdas, we follow a 3-step process to extract minimal neurons for any downstream task: i) train a classifier to predict the task using all the neurons (call it Oracle), ii) obtain a neuron ranking based on the ranking algorithm described above, iii) choose the top $N$ neurons from the ranked list and retrain a classifier using these, iv) repeat step 3 by increasing the size of $N$ , until the classifier obtains an accuracy close (not less than a specified threshold $\delta$ ) to the Oracle. + +Control Tasks: While there is a plethora of work demonstrating that contextualized representations encode a continuous analogue of discrete linguistic information, a question has also been raised recently if the representations actually encode linguistic structure or whether the probe memorizes + +the understudied task. We use Selectivity as a criterion to put a "linguistic task's accuracy in context with the probe's capacity to memorize from word types" (Hewitt and Liang, 2019). It is defined as the difference between linguistic task accuracy and control task accuracy. An effective probe is recommended to achieve high linguistic task accuracy and low control task accuracy. The control tasks for our probing classifiers are defined by mapping each word type $x_{i}$ to a randomly sampled behavior $C(x_{i})$ , from a set of numbers $\{1\ldots T\}$ where $T$ is the size of tag set to be predicted in the linguistic task. The sampling is done using the empirical token distribution of the linguistic task, so the marginal probability of each label is similar. We compute Selectivity by training classifiers using all and the selected neurons. + +# 3 Experimental Setup + +Pre-trained Neural Language Models: We present results with 4 pre-trained models: ELMo (Peters et al., 2018a), and 3 transformer architectures: Transformer-ELMo (Peters et al., 2018b), BERT (Devlin et al., 2019) and XLNet (Yang et al., 2019). The ELMo model is trained using a bidirectional recurrent neural network (RNN) with 3 layers each of size 1024 dimensions. Its transformer equivalent (T-ELMo) is trained with 7 layers but with the same hidden layer size. The BERT model is trained as an auto-encoder with a dual objective function of predicting masked words and next sentence in auto-encoding fashion. We use base version (13 layers and 768 dimensions). Lastly we included XLNet-base which is trained with the same parameter settings (number and size of hidden layers) as BERT, but with a permutation based auto-regressive objective function. + +Language Tasks: We evaluated our method on 4 linguistic tasks: POS-tagging using the Penn TreeBank (Marcus et al., 1993), syntax tagging (CCG supertagging)7 using CCGBank (Hockenmaier, 2006), syntactic chunking using CoNLL 2000 shared task dataset (Tjong Kim Sang and Buchholz, 2000), and semantic tagging using the Parallel Meaning Bank data (Abzianidze et al., 2017). We used standard splits for training, de + +velopment and test data (See Appendix A.1) + +Classifier Settings: We used linear probing classifier with elastic-net regularization, using a categorical cross-entropy loss, optimized by Adam (Kingma and Ba, 2014). Training is run with shuffled mini-batches of size 512 and stopped after 10 epochs. The regularization weights are trained using grid-search algorithm. For sub-word based models, we use the last activation value to be the representative of the word as prescribed for the embeddings extracted from Neural MT models (Dur-rani et al., 2019) and pre-trained Language Models (Liu et al., 2019). Linear classifiers are a popular choice in analyzing deep NLP models due to their better interpretability (Qian et al., 2016; Belinkov et al., 2020). Hewitt and Liang (2019) have also shown linear probes to have higher Selectivity, a property deemed desirable for more interpretable probes. Linear probes are particularly important for our method as we use the learned weights as a proxy to measure the importance of each neuron. + +# 4 Evaluation + +# 4.1 Ablation Study + +First we evaluate our rankings as obtained by the neuron selection algorithm presented in Section 2. We extract a ranked list of neurons with respect to each property set (linguistic task $T$ ) and ablate neurons in the classifier to verify the rankings. This is done by zeroing-out all the activations in the test, except for the selected $M\%$ neurons. We select top, random and bottom $20\%$ neurons to evaluate our rankings. Table 1 shows the efficacy of our rankings, with low performance (prediction accuracy) using only the bottom or random neurons versus using only the top neurons. The accuracy of random neurons is high in some cases (for example CCG, a task related to predicting syntax) showing when the underlying task is complex, the information related to it is more distributed across the network causing redundancy. + +# 4.2 Minimal Neuron Set + +Now that we have established correctness of the rankings, we apply the algorithm incrementally to select minimal neurons for each linguistic task + +
BERTXLNetT-ELMoELMo
POS
All96.0496.1396.3996.48
Top90.1692.2891.9683.01
Random28.4558.1748.4030.80
Bottom16.8644.6421.1115.56
SEM
All92.0992.6491.9493.29
Top84.3290.7084.1681.23
Random64.2872.1466.1575.82
Bottom59.0225.3736.1458.32
Chunking
All95.0194.1593.4393.14
Top89.0189.1687.6382.51
Random75.8375.2679.4070.23
Bottom66.8246.6648.1164.39
CCG
All92.1692.5591.7091.19
Top75.1376.4871.3168.19
Random71.1163.7168.2341.17
Bottom59.1362.4267.1130.32
+ +Table 1: Ablation Study: Selecting all, top, random and bottom $20\%$ neurons and zeroing-out remaining to evaluate classifier accuracy on blind test (averaged over 3 runs). See Appendix A.4 for dev results. + +that obtain a similar accuracy (we use a threshold $\delta = 0.5$ ) as using the entire network (all the features). Identifying a minimal set of top neurons enables us to highlight: i) parts of the learned network where different linguistic phenomena are predominantly captured, ii) how localized or distributed information is with respect to different properties. + +Table 2 summarizes the results. Firstly we show that in all the tasks, selecting a subset of top $\mathrm{N}\%$ neurons and retraining the classifier can obtain a similar (sometimes even better) accuracy as using all the neurons $\left( {\mathrm{{Acc}}}_{a}\right)$ for classification as static features. For lexical tasks such as POS or SEM tagging, a very small number of neurons (roughly 400 i.e $4\%$ of features in BERT and XLNet) was found to be sufficient for achieving an accuracy $\left( {\mathrm{{Acc}}}_{t}\right)$ similar to oracle $\left( {\mathrm{{Acc}}}_{a}\right)$ . More complex syntactic tasks such as Chunking and CCG tagging required larger sets of neurons (up to 2365 - one third of the network in T-ELMo) to accomplish the same. It is interesting to see that all the models, irrespective of their size, required a comparable number of selected neurons, in most of the cases. On the POS and SEM tagging tasks, besides T-ELMo all other models use roughly the same number of neurons. T-ELMo required more neurons in SEM tagging to achieve the task. This + +
BERTXLNetT-ELMoELMo
Neuα9984998471683072
POS
Neut400/4%400/4%430/6%368/12%
Acca96.0496.1396.3996.48
Acct95.8696.4996.0796.22
Selα14.4523.4922.6519.82
Selt31.6831.8237.3138.51
SEM
Neut400/4%400/4%716/10%307/10%
Acca92.0992.6491.9493.29
Acct92.1292.6291.9793.17
Selα5.7714.0312.7811.18
Selt27.1726.5523.8732.28
Chunking
Neut1000/10%1000/10%860/12%983/32%
Acca95.0194.6293.4393.14
Acct94.9994.1793.3793.08
Selα16.3022.7724.4218.13
Selt29.1928.4230.9526.21
CCG
Neut1500/15%1500/15%2365/33%1014/33%
Acca92.1692.5591.791.19
Acct92.3692.3991.3990.95
Selα7.3314.0211.9911.48
Selt15.0624.1518.3217.88
+ +could imply that knowledge of lexical semantics in T-ELMo is distributed in more neurons. In an overall trend, ELMo generally needed fewer neurons while T-ELMo required more neurons compared to the other models to achieve oracle performance. Both these models are much smaller than BERT and XLNet. We did not observe any correlation, comparing results with the size of the models. + +Control Tasks: We use Selectivity to further demonstrate that our probes (trained using the entire representation and selected neurons) do not memorize from word types but learned the underlying linguistic task. Recall that an effective probe is recommended to achieve high linguistic task accuracy and low control task accuracy. The results + +Table 2: Selecting minimal number of neurons for each downstream NLP task. Accuracy numbers reported on blind test-set (averaged over three runs) - $\mathrm{Neu}_a =$ Total number of neurons, $\mathrm{Neu}_t =$ Top selected neurons, $\mathrm{Acc}_a =$ Accuracy using all neurons, $\mathrm{Acc}_t =$ Accuracy using selected neurons after retraining the classifier using selected neurons, $\mathrm{Sel} =$ Difference between linguistic task and control task accuracy when classifier is trained on all neurons $(\mathrm{Sel}_a)$ and top neurons $(\mathrm{Sel}_t)$ . + +
BERTXLNetT-ELMoELMo
Neuα9984998471683072
POS
Neut250/2.5%250/2.5%215/3%153/5%
Acca96.0496.1396.3996.48
Acct93.7095.7294.9294.45
SEM
Neut250/2.5%400/4%286/4%307/5%
Acca92.0992.6491.9493.29
Acct91.4490.9290.1793.17
Chunking
Neut600/6%600/6%430/6%614/20%
Acca95.0194.6293.4393.14
Acct93.5392.8392.2891.79
CCG
Neut698/7%734/8%716/10%675/22%
Acca92.1692.5591.7091.19
Acct91.7391.1189.7989.08
+ +Table 3: Selecting minimal number of neurons for each downstream NLP task with a looser threshold $\delta = 2$ . Accuracy numbers reported on blind test-set (averaged over three runs) - $\mathrm{Neu}_a =$ Total number of neurons, $\mathrm{Neu}_t =$ Top selected neurons, $\mathrm{Acc}_a =$ Accuracy using all neurons, $\mathrm{Acc}_t =$ Accuracy using selected neurons after retraining the classifier using selected neurons. + +(see Table 2) show that selectivity with top neurons $(Sel_{t})$ is much higher than selectivity with all neurons $Sel_{a}$ . It is evident that using all the neurons may contribute to memorization whereas higher selectivity with selected neurons indicates less memorization and efficacy of our neuron selection. We achieve high selectivity when selecting 400 neurons as in the case of POS and SEM. The chunking and CCG tasks require a lot more neurons with CCG requiring up to $33\%$ of the network. Here, the low selectivity indicates that while the information about CCG is distributed into several neurons, a set of random neurons may also be able to achieve a decent performance. + +Discussion: Identifying neurons that are salient to a task has various potential applications such as task-specific model compression, by removing the irrelevant neurons with respect to the task or task-specific fine-tuning based on selected neurons. It is however tricky how to model this, for example one complexity is that zeroing out non-salient neurons in the lower layers directly affects any salient neurons in the subsequent layers. A rather direct + +application to our work is efficient feature-based transfer learning, which has shown to be a viable alternative to the fine-tuning approach (Peters et al., 2019). Feature-based approach uses contextualized embeddings learned from pre-trained models as static feature vectors in the down-stream classification task. Classifiers with large contextualized vectors are not only cumbersome to train, but also inefficient during inference. They have also been shown to be sub-optimal when supervised data is insufficient (Hameed, 2018). BERT-large, for example, is trained with 19,200 (25 layers $\times$ 768 dimensions) features. Reducing the feature set to a smaller number can lead to faster training of the classifier and efficient inference. Earlier (in Table 2) we obtained minimal set of neurons with a very tight threshold of $\delta = 0.5$ . By allowing a loser threshold, say $\delta = 2$ , we can reduce the set of minimal neurons to improve the efficiency even more. See Table 3 for results. For more on this, we refer interested readers to look at Dalvi et al. (2020), where we explored this more formally, expanding our study to the sentence-labeling GLUE tasks (Wang et al., 2018). + +# 5 Analysis + +# 5.1 Layer-wise Distribution + +Previous work on analyzing deep neural networks analyzed how individual layers contribute towards a downstream task (Liu et al., 2019; Kim et al., 2020; Belinkov et al., 2020). Here we observe how the neurons, selected from the entire network, spread across different layers of the model. Such an analysis gives an alternative view of which layers contribute predominantly towards different tasks. Figure 1 presents the results. In most cases, lexical tasks such as learning morphology (POS tagging) and word semantics (SEM tagging) are dominantly captured by the neurons at lower layers, whereas the more complicated task of modeling syntax (CCG supertagging) is taken care of at the final layer. An exception to this overall pattern is the BERT model. Top neurons in BERT spread across all the layers, unlike other models where top neurons (for a particular task) are contributed by fewer layers. This reflects that every layer in BERT possesses neurons that specialize in learning particular language properties, while other models have designated layers that specialize in learning those language properties. Different from other models, neurons in the embedding layer show min + +imum contribution in XLNet consistently across the tasks. Let us analyze the results with respect to each linguistic task. + +POS Tagging: Every layer in BERT and ELMo contributed towards the top neurons, while the distribution is dominated by lower layers in XLNet and T-ELMo, with an exception of XLNet not choosing any neurons from the embedding layer. + +SEM Tagging: Similar to POS, all layers of BERT contributed to the list of top neurons. However, the middle layers showed the most contribution (see layer numbers 4-7 in Figure 1e). This is in line with Liu et al. (2019) who found middle and higher middle layers to give optimal results for the semantic tagging task. On XLNet, T-ELMo and ELMo, the first layer after the embedding layer got the largest share of the top neurons of SEM. This trend is consistent across other tasks, i.e., the core linguistic information is learned earlier in the network with an exception of BERT, which distributes information across the network. + +Chunking Tagging: The overall pattern remained similar in the task of chunking. Notice however, a shift in pattern – the contribution from lower layers decreased compared to previous tasks, in the case of BERT. For example, in the SEM task, top neurons were dominantly contributed from lower and middle layers, in chunking middle and higher layers contributed most. This could be attributed to the fact that chunking is a more complex syntactic task and is learned at relatively higher layers. + +CCG Supertagging: Compared to chunking, CCG supertagging is a richer syntactic tagging task, almost equivalent to parsing (Bangalore and Joshi, 1999). The complexity of the task is evident in our results as there is a clear shift in the distribution of top neurons moving from middle to higher layers. The only exception again is the BERT model where this information is well spread across the network, but still dominantly preserved in the final layers. + +Discussion: Our results are in line with and reinforce the layer-wise analysis presented in Liu et al. (2019). However, unlike their work and all other work on layer-wise probing analysis, which trains a classifier on each layer individually to compare the results, our method trains a single classifier on all layers concatenated to analyze which layers contribute most to the task based on the most relevant selected features. This makes the playing field even + +![](images/150eeba2511644295ca707acae8706038080b86fc78a97d27239e334b52a0ea2.jpg) +(a) POS-BERT + +![](images/50f9c97af2d2c45c264e843b24da1d522f81b65f8df49c37702af445ef5ad3f1.jpg) +(b) POS-XLNet + +![](images/c12f5e8e99fef25148b1310911c6447d9645c9dd6e84a64d32853f0aa354c66d.jpg) +(c) POS - T-ELMo + +![](images/3a17e1c9938451a23ce4df5a79f3e358e2ca9c3da1c85080eeb54d459aca4348.jpg) +(d) POS - ELMo + +![](images/ac863742d5d63e931a2d8217fa6012822cdc65fe56f189faa0d0e0d13f94cf42.jpg) +(e) SEM-BERT + +![](images/79afef706c204ef09c20ef534e07c42e54b7326619047a9209299d3f445bde54.jpg) +(f) SEM-XLNet + +![](images/faaf4b3e5046307db1a7a21b3d1fbc5495ca0cf3c91957f45b63e23875e32c32.jpg) +(g) SEM - T-ELMo + +![](images/7a07d437c57bf0c5e30d176b34cdeb32aa65166f1bbb5e5ffa057daf84e9114d.jpg) +(h) SEM - ELMo + +![](images/1da1a36551cf5b07fe2897977699363e07031decd743041ec83d0b5729267b47.jpg) +(i)Chunking-BERT + +![](images/ccbe8be2dc9fbbc513b67522c39d568a7fa9fe951fc3c57d3f76914ec0b1f9b4.jpg) + +![](images/4fd7d1d135f0be9d2c9376cc7611a48e92c66b5dcc1552ccee097c3ed96274c1.jpg) +(k)Chunking-T-ELMo + +![](images/73ef557409049ee9a0b63cdc31be732bebb719401dacf61cf8900e8c51808ebf.jpg) + +![](images/0c342b917d66e89454fba3980e4f768c5c5bde28aa35a0e1b2c65d35d504849e.jpg) +(m) CCG-BERT + +![](images/88ac51f83006a580149aa2d8e476a81ae78f45111dc59a5f7341163d441352ec.jpg) +(j)Chunking-XLNet +(n) CCG-XLNet + +![](images/1718de93416beda989a5153a07f178dfcab79c288165e134989f8626247fd757.jpg) +(o) CCG - T-ELMo + +![](images/abb4e2939975beb0a8a91bfb635ffadcc48256abf532d832cc1ddfe79f95ae04.jpg) +(1)Chunking-ELMo +(p) CCG - ELMo + +and results in a sharper analysis. For example, Liu et al. (2019) showed layer 1 in Transformer-ELMo to give the best result on the task of predicting POS tags; however, layers 2 and 3 almost give similar accuracy (see Appendix D1 in their paper). Based on these results, one cannot confidently claim that the task of POS is predominantly captured at layer 1. However, our method clearly shows this result (see Figure 1c). + +# 5.2 Localization versus Distributedness + +Next we study how localized or distributed different properties are within a linguistic task (for example nouns or verbs in POS tagging, location in semantic tagging), and across different architectures. Remember that the ranking algorithm extracts neurons for each label $t$ (e.g. LOC:location or EVE:event categories in semantic tagging) in task $T$ , sorted based on absolute weights. The final rankings are obtained by selecting from each label using the neuron ranking algorithm as described in Section 2. This allows us to analyze how localized or distributed a property is, based on the number of neurons that are selected for each label in the task. + +![](images/53ac336b7137010f064a61b68b98ed5eddef3580b1f6c16c634e59590a3f48f7.jpg) +Figure 1: How top neurons spread across different layers for each task? X-axis = Layer number, Y-axis = Number of neurons selected from that layer +Figure 2: Number of neurons per label: Some properties (e.g., interjections) are localized in fewer neurons, while others (e.g., nouns) are more distributed. Y-axis = number of neurons per label + +Property-wise: We found that while many properties are distributed, i.e., a large group of neurons is used to predict a label, some properties such as functional or unambiguous words that do not require contextual information are learned using fewer neurons. For example, UH (interjections) or the TO particle required fewer neurons across architectures compared to NNPS (proper noun; plural) in the task of POS tagging (Figure 2). Similarly + +![](images/19b10b13db8e2ca3cd4380336ae4f8acbbc1f7f12387da458ba4bccd6aaed214.jpg) +Figure 3: Top neurons in XLNet are more localized towards individual properties compared to other architectures + +![](images/882885f48bb1b1a7052c4481f315fe1912a406ec4bfd7a95ff6e9e1c730ec311.jpg) + +EQA (equating property, e.g., as tall as you) is handled with fewer neurons compared to ORG (organization property). We observed a similar behavior in the task of chunking, with I-PRT (particles inside of a chunk) requiring fewer neurons across different architectures. On the contrary, B-VP (beginning of verb phrase) required plenty many. + +Layer-wise: Previously we analyzed each linguistic task in totality. We now study whether individual properties (e.g., adjectives) are localized or well distributed across layers in different architectures. We observed interesting cross architectural similarities, for example the neurons that predict the foreign words (FW) property were predominantly localized in final layers (BERT: 13, XLNET: 11, T-ELMo: 7, ELMo:3) of the network in all the understudied architectures. In comparison, the neurons that capture common class words such as adjectives (JJ) and locations (LOC) are localized in lower layers (BERT: 0, XLNET: 1, T-ELMo: 0, ELMo:1). In some cases, we did find variance, for example personal pronouns (PRP) in POS tagging and event class (EXC) in semantic tagging were handled at different layers across different architectures. See Appendix A.7 for all labels. + +Architecture-wise: We found that top neurons in XLNet are more localized towards individual properties compared to other architectures where top neurons are shared across multiple properties. We demonstrate this in Figure 3. Notice how the number of neurons for different labels10 is much smaller in the case of XLNet, although roughly the same number of total neurons (400 for POS tagging and 960 for chunking on average; see Table + +2) were required by all pre-trained models to carry out a task. This means that in XLNet neurons are exclusive towards specific properties compared to other architectures where neurons are shared between multiple properties. Such a trait in XLNet can be potentially helpful in predicting the behavior of the system as it is easier to isolate neurons that are designated toward specific phenomena. + +# 6 Related Work + +Rise of neural network has seen a subsequent rise of interpretability of these models. Researchers have explored visualization methods to analyze learned representations (Karpathy et al., 2015; Kádár et al., 2017), attention heads (Clark et al., 2019; Vig, 2019) of language compositionality (Li et al., 2016) etc. While such visualizations illuminate the inner workings of the network, they are often qualitative in nature and somewhat anecdotal. + +A more commonly used approach tries to provide a quantitative analysis by correlating parts of the neural network with linguistic properties, for example by training a classifier to predict a feature of interest (Adi et al., 2016; Conneau et al., 2018). Please refer to Belinkov and Glass (2019) for a comprehensive survey of work done in this direction. Liu et al. (2019) used probing classifiers for investigating the contextualized representations learned from a variety of neural language models on numerous word level linguistic tasks. A similar analysis was carried by Tenney et al. (2019) on a variety of sub-sentence linguistic tasks. We extend this line of work to carry out a more fine-grained neuron level analysis of neural language models. + +Our work is most similar to Dalvi et al. (2019) who conducted neuron analysis of representations learned from sequence-to-sequence machine trans + +lation models. Our work is different from them in that i) we carry out analysis on a wide range of architectures which are deeper and more complicated than RNN-based models and illuminate interesting insights, ii) we automated the grid-search criteria to select the regularization parameters, compared to manual selection of lambdas, which is cumbersome and error-prone. In contemporaneous work, Suau et al. (2020) used max-pooling to identify relevant neurons (aka Expert units) in pre-trained models, with respect to a specific concept (for example word-sense). + +A pitfall to the approach of probing classifiers is whether the probe is faithfully reflecting the property of the representation or just learned the task? Hewitt and Liang (2019) defined control tasks to analyze the role of training data and lexical memorization in probing experiments. Voita and Titov (2020) proposed an alternative that measures Minimal Description Length of labels given representations. It would be interesting to see how a probe's complexity in their work (code length) compares with the number of selected neurons according to our method. The results are consistent at least in the ELMo POS example, where layer 1 was shown to have the shortest code length in their work. In our case, most top neurons are selected from layer 1 (see Figure 1d for example). Pimentel et al. (2020) discussed the complexity of the probes and argued for using highest performing probes for tighter estimates. However, complex probes are difficult to analyze. Linear models are preferable due to their explainability; especially in our work, as we use the learned weights as a proxy to get a measure of the importance of each neuron. We used linear classifiers with control tasks as described in Hewitt and Liang (2019). Although we mainly used probing accuracy to drive the neuron selection in this work, and Selectivity only to demonstrate that our results reflect the property learned by representations and not probe's capacity to learn – an interesting idea would be to use selectivity itself to drive the investigation. However, it is not trivial how to optimize for selectivity as it cannot be controlled/tuned directly – for example, removing some neurons may decrease accuracy but may not change selectivity. We leave this exploration for future work. + +Probing classifiers require supervision for the linguistic tasks of interest with annotations, limiting their applicability. Bau et al. (2019) used unsupervised approach to identify salient neurons in neural + +machine translation and manipulated translation output by controlling these neurons. Recently, Wu et al. (2020) measured similarity of internal representations and attention across prominent contextualized representations (from BERT, ELMo, etc.). They found that different architectures have similar representations, but different individual neurons. + +# 7 Conclusion + +We analyzed individual neurons across a variety of neural language models using linguistic correlation analysis on the task of predicting core linguistic properties (morphology, syntax and semantics). Our results reinforce previous findings and also illuminate further insights: i) while the information in neural language models is massively distributed, it is possible to extract a small number of features to carry out a downstream NLP task, ii) the number of extracted features varies based on the complexity of the task, iii) the neurons that learn word morphology and lexical semantics are predominantly found in the lower layers of the network, whereas the ones that learn syntax are at the higher layers, with the exception of BERT, where neurons were spread across the entire network, iv) closed-class words (for example interjections) are handled using fewer neurons compared to polysemous words (such as nouns and adjectives), v) features in XLNet are more localized towards individual properties as opposed to other architectures where neurons are distributed across many properties. A direct application of our analysis is efficient feature-based transfer learning from large-scale neural language models: i) identifying that most relevant features for a task are contained in layer $x$ reduces the forward-pass to that layer, ii) reducing the feature set decreases the time to train a classifier and also its inference. We refer interested readers to see our work presented in Dalvi et al. (2020) for more details. + +# Acknowledgements + +We thank the anonymous reviewers for their feedback on the earlier draft of this paper. This research was carried out in collaboration between the Qatar Computing Research Institute (QCRI) and the MIT Computer Science and Artificial Intelligence Laboratory (CSAIL). Y.B. was also supported by the Harvard Mind, Brain, and Behavior Initiative (MBB). + +# References + +Lasha Abzianidze, Johannes Bjerva, Kilian Evang, Hessel Haagsma, Rik van Noord, Pierre Ludmann, Duc-Duy Nguyen, and Johan Bos. 2017. The parallel meaning bank: Towards a multilingual corpus of translations annotated with compositional meaning representations. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics, EACL '17, pages 242-247, Valencia, Spain. +Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. 2016. Fine-grained Analysis of Sentence Embeddings Using Auxiliary Prediction Tasks. arXiv preprint arXiv:1608.04207. +Srinivas Bangalore and Aravind K. Joshi. 1999. Supertagging: An approach to almost parsing. Computational Linguistics, 25(2). +Anthony Bau, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2019. Identifying and controlling important neurons in neural machine translation. In International Conference on Learning Representations. +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2017a. What do Neural Machine Translation Models Learn about Morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (ACL), Vancouver. Association for Computational Linguistics. +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2020. On the linguistic representational power of neural machine translation models. Computational Linguistics, 45(1):1-57. +Yonatan Belinkov and James Glass. 2019. Analysis methods in neural language processing: A survey. Transactions of the Association for Computational Linguistics, 7:49-72. +Yonatan Belinkov, Lluis Márquez, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2017b. Evaluating Layers of Representation in Neural Machine Translation on Part-of-Speech and Semantic Tagging Tasks. In Proceedings of the 8th International Joint Conference on Natural Language Processing (IJCNLP). +Terra Blevins, Omer Levy, and Luke Zettlemoyer. 2018. Deep RNNs encode soft hierarchical syntax. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 14-19, Melbourne, Australia. 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. + +Alexis Conneau, German Kruszewski, Guillaume Lample, Loic Barrault, and Marco Baroni. 2018. What you can cram into a single vector: Probing sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL). +Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, D. Anthony Bau, and James Glass. 2019. What is one grain of sand in the desert? analyzing individual neurons in deep nlp models. In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence (AAAI, Oral presentation). +Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, and Stephan Vogel. 2017. Understanding and Improving Morphological Learning in the Neural Machine Translation Decoder. In Proceedings of the 8th International Joint Conference on Natural Language Processing (IJCNLP). +Fahim Dalvi, Hassan Sajjad, Nadir Durrani, and Yonatan Belinkov. 2020. Analyzing redundancy in pretrained transformer models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP-2020), Online. Association for Computational Linguistics. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), Minneapolis, Minnesota. Association for Computational Linguistics. +Nadir Durrani, Fahim Dalvi, Hassan Sajjad, Yonatan Belinkov, and Preslav Nakov. 2019. One size does not fit all: Comparing NMT representations of different granularities. 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 1504-1516, Minneapolis, Minnesota. Association for Computational Linguistics. +Shilan Hameed. 2018. Filter-wrapper combination and embedded feature selection for gene expression data. International Journal of Advances in Soft Computing and its Applications, 10:90-105. +John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +Julia Hockenmaier. 2006. Creating a CCGbank and a wide-coverage CCG lexicon for German. In Proceedings of the 21st International Conference on + +Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, ACL '06, pages 505-512, Sydney, Australia. +Akos Kádár, Grzegorz Chrupa, and Afra Alishahi. 2017. Representation of linguistic form and function in recurrent neural networks. Computational Linguistics, 43(4):761-780. +Andrej Karpathy, Justin Johnson, and Li Fei-Fei. 2015. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078. +Taeuk Kim, Jihun Choi, Daniel Edmiston, and Sang goo Lee. 2020. Are pre-trained language models aware of phrases? simple but strong baselines for grammar induction. +Diederik Kingma and Jimmy Ba. 2014. Adam: A Method for Stochastic Optimization. arXiv preprint arXiv:1412.6980. +Jiwei Li, Xinlei Chen, Eduard Hovy, and Dan Jurafsky. 2016. Visualizing and understanding neural models in NLP. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 681-691, San Diego, California. Association for Computational Linguistics. +Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. 2019. Linguistic knowledge and transferability of contextual representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1073-1094, Minneapolis, Minnesota. Association for Computational Linguistics. +Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. 1993. Building a large annotated corpus of English: The Penn Treebank. Computational Linguistics, 19(2):313-330. +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018a. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), New Orleans, Louisiana. Association for Computational Linguistics. +Matthew Peters, Mark Neumann, Luke Zettlemoyer, and Wen-tau Yih. 2018b. Dissecting contextual word embeddings: Architecture and representation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1499-1509, Brussels, Belgium. Association for Computational Linguistics. + +Matthew E. Peters, Sebastian Ruder, and Noah A. Smith. 2019. To tune or not to tune? adapting pretrained representations to diverse tasks. In Proceedings of the 4th Workshop on Representation Learning for NLP (RepL4NLP-2019), Florence, Italy. Association for Computational Linguistics. +Tiago Pimentel, Josef Valvoda, Rowan Hall Maudslay, Ran Zmigrod, Adina Williams, and Ryan Cotterell. 2020. Information-theoretic probing for linguistic structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4609-4622, Online. Association for Computational Linguistics. +Peng Qian, Xipeng Qiu, and Xuanjing Huang. 2016. Analyzing Linguistic Knowledge in Sequential Model of Sentence. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 826-835, Austin, Texas. Association for Computational Linguistics. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. SQuAD: $100,000+$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383-2392, Austin, Texas. Association for Computational Linguistics. +Nils Rethmeier, Vageesh Kumar Saxena, and Isabelle Augenstein. 2020. Tx-ray: Quantifying and explaining model-knowledge transfer in (un-)supervised NLP. In Proceedings of the Thirty-Sixth Conference on Uncertainty in Artificial Intelligence, UAI 2020, virtual online, August 3-6, 2020, page 197. AUAI Press. +Xing Shi, Inkit Padhi, and Kevin Knight. 2016. Does string-based neural MT learn source syntax? In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, EMNLP '16, pages 1526-1534, Austin, TX, USA. +Xavier Suau, Luca Zappella, and Nicholas Apostoloff. 2020. Finding experts in transformer models. CoRR, abs/2005.07647. +Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R Thomas McCoy, Najoung Kim, Benjamin Van Durme, Sam Bowman, Dipanjan Das, and Ellie Pavlick. 2019. What do you learn from context? probing for sentence structure in contextualized word representations. In International Conference on Learning Representations. +Erik F. Tjong Kim Sang and Sabine Buchholz. 2000. Introduction to the CoNLL-2000 shared task chunking. In Fourth Conference on Computational Natural Language Learning and the Second Learning Language in Logic Workshop. +Jesse Vig. 2019. A multiscale visualization of attention in the transformer model. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages + +37-42, Florence, Italy. Association for Computational Linguistics. +Elena Voita and Ivan Titov. 2020. Information-theoretic probing with minimum description length. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing. 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. +John Wu, Hassan Belinkov, Yonatan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2020. Similarity Analysis of Contextual Word Representation Models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL), Seattle. Association for Computational Linguistics. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, 8-14 December 2019, Vancouver, BC, Canada, pages 5754-5764. +Hui Zou and Trevor Hastie. 2005. Regularization and variable selection via the elastic net. Journal of the Royal Statistical Society, Series B, 67:301-320. + +# A Appendices + +# A.1 Data and Representations + +We used standard splits for training, development and test data for the 4 linguistic tasks (POS, SEM, Chunking and CCG super tagging) that we used to carry out our analysis on. The splits to preprocess the data are available through git repository11 released with Liu et al. (2019). See Table 4 for statistics. We obtained the understudied pre-trained models from the authors of the paper, through personal communication. + +
TaskTrainDevTestTags
POS365571802196344
SEM3692853011060073
Chunking88811843201122
CCG39101190824041272
+ +# A.2 Hyperparameters + +We use elastic-net based regularization to control the trade-off between selecting focused individual neurons versus group of neurons while maintaining the original accuracy of the classifier without any regularization. We do a grid search on $L_{1}$ and $L_{2}$ ranging from values $0\ldots 1e^{-7}$ . See Table 5 for the optimal values for each task across different architectures. + +Table 4: Data statistics (number of sentences) on training, development and test sets using in the experiments and the number of tags to be predicted + +
BERTXLNetT-ELMoELMo
L1, L2 = λ1, λ2
POS.001, .01.001, .01.001, .001.001, .0001
SEM.001, .01.001, .01.001, .001.001, .0001
Chunk1e-4, 1e-51e-4, 1e-4.001, .001.001, .01
CCG1e-5, 1e-61e-5, 1e-61e-4, 1e-61e-5, 1e-6
+ +# A.3 Infrastructure and Run Time + +Our experiments were run on NVidia GeForce GTX TITAN X GPU card. Grid search for finding optimal lambdas is expensive when optimal number of neurons for the task are unknown. Running grid search would take $\mathcal{O}(MN^2)$ where $M = 100$ + +Table 5: Best elastic-net lambdas parameters for each task + +
BERTXLNetT-ELMoELMo
POS
All96.1096.3896.6196.45
Top90.3293.0792.1385.03
Rand29.4357.3249.1432.18
Bot17.9945.6123.0117.36
SEM
All92.6392.1692.4093.35
Top85.1790.9184.1383.01
Rand65.1271.1165.1174.18
Bot58.1926.1135.9957.11
Chunking
All95.1194.1993.9393.85
Top90.1390.0388.1383.12
Rand74.1275.6378.1971.48
Bot64.1345.4347.1665.12
CCG
All92.2392.4391.6691.23
Top75.6176.3171.2268.09
Rand70.0163.1168.0341.37
Bot61.1262.3167.9930.12
+ +Table 6: Ablation Study: Selecting all, top, random (rand) and bottom (bot) $20\%$ neurons and zeroing-out remaining to evaluate classifier accuracy on dev test (averaged over three runs). + +(if we try increasing number of neurons in each step by $1\%$ and $N = 0,0.1,\ldots 1e^{-7}$ . We fix the $M = 20\%$ to find the best regularization parameters first reducing the grid search time to $\mathcal{O}(N^2)$ and find the optimal number of neurons in a subsequent step with $\mathcal{O}(M)$ . The overall running time of our algorithm therefore is $\mathcal{O}(M + N^2)$ . This varies a lot in terms of wall-clock computation, based on number of examples in the training data, number of tags to be predicted in the downstream task. Including a full forward pass over the pretrained model to extract the contextualized vector, and running the grid search algorithm to find the best hyperparameters and minimal set of neurons took on average 12 hours ranging from 3 hours (for POS with ELMo experiment) to 18 hours (for CCG with BERT). + +# A.4 Ablation Study + +We reported accuracy numbers on ablating top, random and bottom neurons in the trained classifier, on blind test-set in the main body. In Table 6, we report results on development tests. + +
BERTXLNetT-ELMoELMo
Neuα9984998471683072
POS
Neut400/4%400/4%430/6%368/12%
Acca96.1096.3896.6196.45
Acct96.4896.5296.3396.07
Selα15.5123.4322.6919.12
Selt31.8131.6237.6138.52
SEM
Neut400/4%400/4%716/10%307/10%
Acca92.6392.1692.4093.35
Acct92.1992.5992.1793.21
Selα5.8214.0112.1911.37
Selt27.1926.4623.9732.33
Chunking
Neut1000/10%1000/10%860/12%983/32%
Acca95.1194.1993.9393.85
Acct95.0794.1393.6193.48
Selα16.3322.8724.3118.09
Selt29.3228.1931.0526.38
CCG
Neut1500/15%1500/15%2365/33%1014/33%
Acca92.2392.4391.6691.23
Acct92.1392.4991.8991.09
Selα7.4814.2111.4211.99
Selt15.9124.8218.3117.34
+ +Table 7: Selecting minimal number of neurons for each downstream NLP task. Accuracy numbers reported on dev test (averaged over three runs) - $\mathrm{Neu}_a =$ Total number of neurons, $\mathrm{Neu}_t =$ Top selected neurons, $\mathrm{Acc}_a =$ Accuracy using all neurons, $\mathrm{All}_t =$ Accuracy using selected neurons after retraining the classifier using selected neurons, $\mathrm{Sel} =$ Difference between linguistic task and control task accuracy when classifier is trained on all neurons $(\mathrm{Sel}_a)$ and top neurons $(\mathrm{Sel}_t)$ . + +# A.5 Minimal Neuron Set + +We reported minimal number of neurons required to obtain oracle accuracy in the main body, along with the results on Selectivity. In Table 7, we report results on development tests. + +# A.6 Localized versus Distributed Labels + +In Section 5.1 we only showed number of features learned for selected labels in each task. Figure 4 shows results for all the tags across different tasks. The results show that some tags are localized and captured by a focused set of neurons while others are distributed and learned within a large set of neurons. + +# A.7 XLNet versus Others + +Notice in Figure 4 that neurons required by each label in XLNet (red bars) are strikingly small compared to other architectures specifically T-ELMo (yellow bars). This is interesting given the fact that total number of neurons required by some of the tasks are very similar. For example task of POS tagging required 400 neurons for BERT and XLNet, 320 for ELMo and 430 in T-ELMo. This means that neurons in XLNet are mutually exclusive towards the properties whereas in other architectures neurons are shared across multiple properties. Due to large tag set (1272 tags) in CCG super tagging, it is not possible to include it among figures. + +# A.8 Layer-wise Distribution + +In Section 5.2 we showed labels are captured dominantly at which layers for a few labels. In Figure 5c we show all labels and which layers they are predominantly captured at, across different architectures. + +![](images/5550f5cc153b414d4137b3968fb71b89283d6c46feb0f50b7093830bea45014d.jpg) +(a) POS Tagging + +![](images/1fd5effa7ab514b76f74ab8b7c13e56387743cbd9322de90507a00bb4e007612.jpg) +(b) SEM Tagging + +![](images/143506a554fcba7ad70dc2c6f22212b9a27fb3f480c8583105db83ce9a8697d0.jpg) +(c) Chunking Tagging +Figure 4: Number of neurons per label across architectures + +![](images/dc08719f2786c2d6d0149f2f275fb487b81b3946b4a14534246fee897c64c57a.jpg) +(a) POS Tagging + +![](images/7aa59c5b9462947ef8c0a4dc6550a3a5dc5680ac9692e92a5d09cdfec704871b.jpg) +(b) SEM Tagging + +![](images/d4151c78f7ca3b9f9627b8c3035bf70a516761662b2e5f8e6db3fc34d6283fdd.jpg) +(c) Chunking Tagging +Figure 5: Layer that predominately captures each label \ No newline at end of file diff --git a/analyzingindividualneuronsinpretrainedlanguagemodels/images.zip b/analyzingindividualneuronsinpretrainedlanguagemodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4d5039346619c38f6e863634836e4f94e2dad347 --- /dev/null +++ b/analyzingindividualneuronsinpretrainedlanguagemodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdb05485a625f108ee5f9dc2fcb9de4a2a6949fd1756e3e1a15e3367fa597887 +size 798776 diff --git a/analyzingindividualneuronsinpretrainedlanguagemodels/layout.json b/analyzingindividualneuronsinpretrainedlanguagemodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9c0f3e35cf3d82dfc3c9b53595bc13deb4ebebdb --- /dev/null +++ b/analyzingindividualneuronsinpretrainedlanguagemodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdc626f3b001849293df06d7036bbcebd575db66c528cfb312a15ac3b25de242 +size 472863 diff --git a/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_content_list.json b/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d7d28ad056905545b27520fccf70248237873052 --- /dev/null +++ b/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:64c4e85d1235a0cfd574281c53bbf1f907b69cd25dec8460b2f5f8ab8b0d94b5 +size 123807 diff --git a/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_model.json b/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5ed8450546b4b222546d41b0e146eeb2b47734bf --- /dev/null +++ b/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca42206caf648969aea9f5de92646e138a04e376a7603be9b0184999cfe9430f +size 151189 diff --git a/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_origin.pdf b/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7ecdce08fd0956f148d43e3a4b8c2d1c212586bd --- /dev/null +++ b/analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6585a1a798e6bdead3b972f9ecb22d05ba665cdcb586244e07771f6338467b8 +size 5021007 diff --git a/analyzingredundancyinpretrainedtransformermodels/full.md b/analyzingredundancyinpretrainedtransformermodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..b3f85888aa569e914bb94cf35be849970a4cf214 --- /dev/null +++ b/analyzingredundancyinpretrainedtransformermodels/full.md @@ -0,0 +1,454 @@ +# Analyzing Redundancy in Pretrained Transformer Models + +Fahim Dalvi Hassan Sajjad Nadir Durrani Yonatan Belinkov\* + +{faimaduddin,hsajjad,ndurrani}@hbku.edu.qa + +Qatar Computing Research Institute, HBKU Research Complex, Doha 5825, Qatar + +*MIT Computer Science and Artificial Intelligence Laboratory and Harvard John A. Paulson School of Engineering and Applied Sciences, Cambridge, MA, USA belinkov@csail.mit.edu + +# Abstract + +Transformer-based deep NLP models are trained using hundreds of millions of parameters, limiting their applicability in computationally constrained environments. In this paper, we study the cause of these limitations by defining a notion of Redundancy, which we categorize into two classes: General Redundancy and Task-specific Redundancy. We dissect two popular pretrained models, BERT and XLNet, studying how much redundancy they exhibit at a representation-level and at a more fine-grained neuron-level. Our analysis reveals interesting insights, such as: i) $85\%$ of the neurons across the network are redundant and ii) at least $92\%$ of them can be removed when optimizing towards a downstream task. Based on our analysis, we present an efficient feature-based transfer learning procedure, which maintains $97\%$ performance while using at-most $10\%$ of the original neurons. $^{1}$ + +# 1 Introduction + +Large pretrained models have improved the state-of-the-art in a variety of NLP tasks, with each new model introducing deeper and wider architectures causing a significant increase in the number of parameters. For example, BERT large (Devlin et al., 2019), NVIDIA's Megatron model, and Google's T5 model (Raffel et al., 2019) were trained using 340 million, 8.3 billion and 11 billion parameters respectively. + +An emerging body of work shows that these models are over-parameterized and do not require all the representational power lent by the rich architectural choices during inference. For example, these models can be distilled (Sanh et al., 2019; + +Sun et al., 2019) or pruned (Voita et al., 2019; Sajjad et al., 2020), with a minor drop in performance. Recent research (Mu et al., 2018; Ethayarajh, 2019) analyzed contextualized embeddings in pretrained models and showed that the representations learned within these models are highly anisotropic. While these approaches successfully exploited over-parameterization and redundancy in pretrained models, the choice of what to prune is empirically motivated and the work does not directly explore the redundancy in the network. Identifying and analyzing redundant parts of the network is useful in: i) developing a better understanding of these models, ii) guiding research on compact and efficient models, and iii) leading towards better architectural choices. + +In this paper, we analyze redundancy in pretrained models. We classify it into general redundancy and task-specific redundancy. The former is defined as the redundant information present in a pretrained model irrespective of any downstream task. This redundancy is an artifact of overparameterization and other training choices that force various parts of the models to learn similar information. The latter is motivated by pretrained models being universal feature extractors. We hypothesize that several parts of the network are specifically redundant for a given downstream task. + +We study both general and task-specific redundancies at the representation-level and at a more fine-grained neuron-level. Such an analysis allows us to answer the following questions: i) how redundant are the layers within a model? ii) do all the layers add significantly diverse information? iii) do the dimensions within a hidden layer represent different facets of knowledge, or are some neurons largely redundant? iv) how much information in a pretrained model is necessary for specific downstream tasks? and v) can we exploit redundancy to + +enable efficiency? + +We introduce several methods to analyze redundancy in the network. Specifically, for general redundancy, we use Center Kernel Alignment (Kornblith et al., 2019) for layer-level analysis, and Correlation Clustering for neuron-level analysis. For task-specific redundancy, we use Linear Prob-ing (Shi et al., 2016a; Belinkov et al., 2017) to identify redundant layers, and Linguistic Correlation Analysis (Dalvi et al., 2019) to examine neuronlevel redundancy. + +We conduct our study on two pretrained language models, BERT (Devlin et al., 2019) and XLNet (Yang et al., 2019). While these networks are similar in the number of parameters, they are trained using different training objectives, which accounts for interesting comparative analysis between these models. For task-specific analysis, we present our results across a wide suite of downstream tasks: four core NLP sequence labeling tasks and seven sequence classification tasks from the GLUE benchmark (Wang et al., 2018). Our analysis yields the following insights: + +# General Redundancy: + +- Adjacent layers are most redundant in the network, with lower layers having greater redundancy with adjacent layers. +- Up to $85\%$ of the neurons across the network are redundant in general, and can be pruned to substantially reduce the number of parameters. +- Up to $94\%$ of neuron-level redundancy is exhibited within the same or neighbouring layers. + +# Task-specific Redundancy: + +- Layers in a network are more redundant w.r.t. core language tasks such as learning morphology as compared to sequence-level tasks. +- At least $92\%$ of the neurons are redundant with respect to a downstream task and can be pruned without any loss in task-specific performance. +- Comparing models, XLNet is more redundant than BERT. +- Our analysis guides research in model distillation and suggests preserving knowledge of lower layers and aggressive pruning of higher-layers. + +Finally, motivated by our analysis, we present an efficient feature-based transfer learning procedure that exploits various types of redundancy present in the network. We first target layer-level task-specific redundancy using linear probes and + +reduce the number of layers required in a forward pass to extract the contextualized embeddings. We then filter out general redundant neurons present in the contextualized embeddings using Correlation Clustering. Lastly, we remove task-specific redundant neurons using Linguistic Correlation Analysis. We show that one can reduce the feature set to less than 100 neurons for several tasks while maintaining more than $97\%$ of the performance. Our procedure achieves a speedup of up to $6.2\mathrm{x}$ in computation time for sequence labeling tasks. + +# 2 Related Work + +A number of studies have analyzed representations at layer-level (Conneau et al., 2018; Liu et al., 2019; Tenney et al., 2019; Kim et al., 2020; Belinkov et al., 2020) and at neuron-level (Bau et al., 2019; Dalvi et al., 2019; Suau et al., 2020; Durrani et al., 2020). These studies aim at analyzing either the linguistic knowledge learned in representations and in neurons or the general importance of neurons in the model. The former is commonly done using a probing classifier (Shi et al., 2016a; Belinkov et al., 2017; Hupkes et al., 2018). Recently, Voita and Titov (2020); Pimentel et al. (2020) proposed probing methods based on information theoretic measures. The general importance of neurons is mainly captured using similarity and correlation-based methods (Raghu et al., 2017; Chrupaña and Alishahi, 2019; Wu et al., 2020). Similar to the work on analyzing deep NLP models, we analyze pretrained models at representation-level and at neuron-level. Different from them, we analyze various forms of redundancy in these models. We draw upon various techniques from the literature and adapt them to perform a redundancy analysis. + +While the work on pretrained model compression (Cao et al., 2020; Shen et al., 2020; Sanh et al., 2019; Turc et al., 2019; Gordon et al., 2020; Guyon and Elisseeff, 2003) indirectly shows that models exhibit redundancy, little has been done to explore the redundancy in the network. Recent studies (Voita et al., 2019; Michel et al., 2019; Sajjad et al., 2020; Fan et al., 2020) dropped attention heads and layers in the network with marginal degradation in performance. Their work is limited in the context of redundancy as none of the pruning choices are built upon the amount of redundancy present in different parts of the network. Our work identifies redundancy at various levels of the network and can guide the research in model + +compression. + +# 3 Experimental Setup + +# 3.1 Datasets and Tasks + +To analyze the general redundancy in pre-trained models, we use the Penn Treebank development set (Marcus et al., 1993), which consists of roughly 44,000 tokens. For task-specific analysis, we use two broad categories of downstream tasks - Sequence Labeling and Sequence Classification tasks. For the sequence labeling tasks, we study core linguistic tasks, i) part-of-speech (POS) tagging using the Penn TreeBank, ii) CCG super tagging using CCGBank (Hockenmaier, 2006), iii) semantic tagging (SEM) using Parallel Meaning Bank data (Abzianidze and Bos, 2017) and iv) syntactic chunking using CoNLL 2000 shared task dataset (Sang and Buchholz, 2000). + +For sequence classification, we study tasks from the GLUE benchmark (Wang et al., 2018), namely i) sentiment analysis (SST-2) (Socher et al., 2013), ii) semantic equivalence classification (MRPC) (Dolan and Brockett, 2005), iii) natural language inference (MNLI) (Williams et al., 2018), iv) question-answering NLI (QNLI) (Rajpurkar et al., 2016), iv) question pair similarity $^{2}$ (QQP), v) textual entailment (RTE) (Bentivogli et al., 2009), and vi) semantic textual similarity (Cer et al., 2017). $^{3}$ Complete statistics for all datasets is provided in Appendix A.1. + +Other Settings The neuron activations for each word in our dataset are extracted from the pretrained model for sequence labeling while the [CLS] token's representation (from a fine-tuned model) is used for sequence classification. The fine-tuning step is essential to optimize the [CLS] token for sentence representation. In the case of sub-words, we pick the last sub-word's representation (Durrani et al., 2019; Liu et al., 2019). For sequence labeling tasks, we use training sets of 150K tokens, and standard development and test splits. For sequence classification tasks, we set aside $5\%$ of the training data and use it to optimize all the parameters involved in the process and report results on development sets, since the test sets are not publicly available. + +# 3.2 Models + +We present our analysis on two transformer-based pretrained models, BERT-base (Devlin et al., 2019) and XLNet-base (Yang et al., 2019). The former is a masked language model, while the latter is of an auto-regressive nature. We use the transformers library (Wolf et al., 2019) to fine-tune these models using default hyperparameters. + +Classifier Settings For layer-level probing and neuron-level ranking, we use a logistic regression classifier with ElasticNet regularization. We train the classifier for 10 epochs with a learning rate of $1e^{-3}$ , batch size of 128 and a value of $1e^{-5}$ for both $L1$ and $L2$ lambda regularization parameters. + +# 4 Problem Definition + +Consider a pretrained model $\mathbf{M}$ with $L$ layers: $\{l_0, l_1, \ldots, l_L\}$ , where $l_0$ is an embedding layer and each layer $l_i$ is of size $H$ . Given a dataset $\mathbb{D} = \{w_1, w_2, \ldots, w_T\}$ consisting of $T$ words, the contextualized embedding of word $w_j$ at layer $l_i$ is $z_j^i = l_i(w_j)$ . A neuron consists of each individual unit of $z_j^i$ . For example, BERT-base has $L = 13$ layers, each of size 768 i.e. there are 768 individual neurons in each layer. The total number of neurons in the model are $13 \times 768 = 9984$ . + +We analyze redundancy in $\mathbf{M}$ at layer-level $l_{i}$ : how redundant is a layer? and at neuron-level: how redundant are the neurons? We target these two questions in the context of general redundancy and task-specific redundancy. + +Notion of redundancy: We broadly define redundancy to cover a range of observations. For example, we imply high similarity as a reflection of redundancy. Similarly, for task-specific neuron-level redundancy, we hypothesize that some neurons additionally might be irrelevant for the downstream task in hand. There, we consider irrelevancy as part of the redundancy analysis. Succinctly, two neurons are considered to be redundant if they serve the same purpose from the perspective of feature-based transfer learning for a downstream task. + +# 5 General Redundancy + +Neural networks are designed to be distributed in nature and are therefore innately redundant. Addi + +![](images/54822f7d777b49d88c368b9d02b7c4c4b59993ae75eeeafaa0fae7b94c9c9a3c.jpg) +(a) BERT + +![](images/de70d1a48b45b8f6a5c46f3fe07a5b8f6354856961ebdc3cedc55ca23117cd0a.jpg) +(b) XLNet + +tionally, over-parameterization in pretrained models with a combination of various training and design choices causes further redundancy of information. In the following, we analyze general redundancy at layer-level and at neuron-level. + +# 5.1 Layer-level Redundancy + +We compute layer-level redundancy by comparing representations from different layers in a given model using linear Center Kernel Alignment (cka - Kornblith et al. (2019)).cka is invariant to isotropic similarity and orthogonal transformation. In other words, the similarity measure itself does not depend on the various representations having neurons or dimensions with exactly the same distributions, but rather assigns a high similarity if the two representations behave similarly over all the neurons. Moreover,cka is known to outperform other methods such as CCA (Andrew et al., 2013) and SVCCA (Raghu et al., 2017), in identifying relationships between different layers across different architectures. While there are several other methods proposed in literature to analyze and compare representations (Kriegeskorte et al., 2008; Bouchacourt and Baroni, 2018; Chrupaça and Alishahi, 2019; Chrupaça, 2019), we do not intend to compare them here and instead usecka to show redundancy in the network. The mathematical definition ofcka is provided in Appendix A.6 for the reader. + +We compute pairwise similarity between all $L$ layers in the pretrained model and show the corresponding heatmaps in Figure 1. We hypothesize that a high similarity entails (general) redundancy. Overall the similarity between adjacent layers is high, indicating that the change of encoded knowledge from one layer to another takes place in small incremental steps as we move from a lower layer to a higher layer. An exception to this observation is + +![](images/6ec2f105c38f8ac7e1f38ac4f503172e25de76c356ebf188c4bba048933cb9b5.jpg) + +![](images/1f55127829b6200d94a78abbd9225f670d32e6a534a335ceb0b46d06bace7454.jpg) +Figure 1: Pairwise Similarity between the layers. Brighter colors indicate higher similarity. +(a) BERT +(b) XLNet +Figure 2: General neuron-level redundancy in BERT and XLNet; comparing the average reduction of neurons for different CC thresholds and the average accuracy across all downstream tasks. See Appendix A.2 for detailed per-task results. + +the final pair of layers, $l_{11}$ and $l_{12}$ , whose similarity is much lower than other adjacent pairs of layers. We speculate that this is because the final layer is highly optimized for the objective at hand, while the lower layers try to encode as much general linguistic knowledge as possible. This has also been alluded to by others (Hao et al., 2019; Wu et al., 2020). + +# 5.2 Neuron-level Redundancy + +Assessing redundancy at the layer level may be too coarse grained. Even if a layer is not redundant with other layers, a subset of its neurons may still be redundant. We analyze neuron-level redundancy in a network using correlation clustering - CC (Bansal et al., 2004). We group neurons with highly correlated activation patterns over all of the words $w_{j}$ . Specifically, every neuron in the vector $z_{j}^{i}$ from some layer $i$ can be represented as a $T$ dimensional vector, where each index is the activation value $z_{j}^{i}$ of that neuron for some word $w_{j}$ , where $j$ ranges from 1 to $T$ . We calculate the Pearson product-moment correlation of every neuron vector $z^{i}$ with every other neuron. This results in a $N \times N$ matrix corr, where $N$ is the total number of neurons and corr(x,y) represents the correlation + +![](images/5eae3788854df5ebd51dc2d573ba999d36ca2aa1978dfc2cbc8afc5b29ec6c8d.jpg) +Figure 3: Percentage of clusters which contain neurons from the same layers, adjacent layers, within three neighboring layers and more than three layers apart. + +between neurons $x$ and $y$ . The correlation value ranges from -1 to 1, giving us a relative scale to compare any two neurons. A high absolute correlation value between two neurons implies that they encode very similar information and therefore are redundant. We convert $corr$ into a distance matrix $cdist$ by applying $cdist(x,y) = 1 - |corr(x,y)|$ and cluster the distance matrix $cdist$ by using agglomerative hierarchical clustering with average linkage5 to minimize the average distance of all data points in pairs of clusters. The maximum distance between any two points in a cluster is controlled by the hyperparameter $c_t$ . It ranges from 0 to 1 where a high value results in large-sized clusters with a small number of total clusters. + +Substantial amount of neurons are redundant In order to evaluate the effect of clustering in combining redundant neurons, we randomly pick a neuron from each cluster and form a reduced set of non-redundant neurons. Recall that the clustering is applied independently on the data without using any task-specific labels. We then build task-specific classifiers for each task on the reduced set and analyze the average accuracy. If the average accuracy of a reduced set is close to that of the full set of neurons, we conclude that the reduced set has filtered out redundant neurons. Figure 2 shows the effect of clustering on BERT and XLNet using different values of $c_{t}$ with respect to average performance across all tasks. It is remarkable to observe that $85\%$ of neurons can be removed without any loss in accuracy $(c_{t} = 0.7)$ in BERT, alluding to a high-level of neuron-level redundancy. We observe an even higher reduction in XLNet. At + +$c_{t} = 0.7$ , $92\%$ of XLNet neurons can be removed while maintaining oracle performance. We additionally visualize a few neurons within a cluster. The activation patterns are quite similar in their behavior, though not identical, highlighting the efficacy of CC in clustering neurons with analogous behavior. An activation heatmap for several neurons is provided in Appendix A.2. + +Higher neuron redundancy within and among neighboring layers We analyze the general makeup of the clusters at $c_{t} = 0.3$ . Figure 3 shows the percentage of clusters that contain neurons from the same layer (window size 1), neighboring layers (window sizes 2 and 3) and from layers further apart. We can see that a vast majority of clusters ( $\approx 95\%$ ) either contain neurons from the same layer or from adjacent layers. This reflects that the main source of redundancy is among the individual representation units in the same layer or neighboring layers of the network. The finding motivates pruning of models by compressing layers as oppose to reducing the overall depth in a distilled version of a model. + +# 6 Task-specific Redundancy + +While pretrained models have a high amount of general redundancy as shown in the previous section, they may additionally exhibit redundancies specific to a downstream task. Studying redundancy in relation to a specific task helps us understand pretrained models better. It further reflects on how much of the network, and which parts of the network, suffice to perform a task efficiently. + +# 6.1 Layer-level Redundancy + +To analyze layer-level task-specific redundancy, we train linear probing classifiers (Shi et al., 2016b; Belinkov et al., 2017) on each layer $l_{i}$ (layer-classifier). We consider a classifier's performance as a proxy for the amount of task-specific knowledge learned by a layer. Linear classifiers are a popular choice in analyzing deep NLP models due to their better interpretability (Qian et al., 2016; Belinkov et al., 2020). Hewitt and Liang (2019) have shown linear probes to have higher Selectivity, a property deemed desirable for more interpretable probes. + +We compare each layer-classifier with an oracle-classifier trained over concatenation of all layers + +![](images/12ca4dd5d7418f43ddc5e9373ab288054d59c09e919e96217fffe534f79ce56e.jpg) +Figure 4: Task-specific layer-wise redundant layers represented by the colored blocks. Appendix A.3 presents fine-grained graphs for a few tasks. + +of the network. For all individual layers that perform close to oracle (maintaining $99\%$ of the performance in our results), we imply that they encode sufficient knowledge about the task and are therefore redundant in this context. Note that this does not necessarily imply that those layers are identical or that they represent the knowledge in a similar way – instead they have redundant overall knowledge specific to the task at hand. + +High redundancy for core linguistic tasks Figure 4 shows the redundant layers that perform within a $1\%$ performance threshold with respect to the oracle on each task. We found high layer-level redundancy for sequence labeling tasks. There are up to 11 redundant layers in BERT and up to 10 redundant layers in XLNet, across different tasks. This is expected, because the sequence labeling tasks considered here are core language tasks, and the information related to them is spread across the network. Comparing models, we found such core language information to be distributed amongst fewer layers in XLNet. + +Substantially less amount of redundancy for higher-level tasks The amount of redundancy is substantially lower for sequence classification tasks, with RTE having the least number of redundant layers in both models. Especially in BERT, we did not find any layer that matched the oracle performance for RTE. It is interesting to observe that all the sequence classification tasks are learned at higher layers and none of the lower layers were found to be redundant. These results are intuitive given that the sequence classification tasks require complex linguistic knowledge, such as long range contextual dependencies, which are only learned + +at the higher-layers of the model. Lower layers do not have the sufficient sentence-level context to perform these tasks well. + +XLNet is more redundant than BERT While XLNet has slightly fewer redundant layers for sequence labeling tasks, on average across all downstream tasks it shows high layer-level task-specific redundancy. Having high redundancy for sequence-level tasks reflects that XLNet learns the higher-level concepts much earlier in the network and this information is then passed to all the subsequent layers. This also showcases that XLNet is a much better candidate for model compression where several higher layers can be pruned with marginal loss in performance, as shown by Sajjad et al. (2020). + +# 6.2 Neuron-level Redundancy + +Pretrained models being a universal feature extractor contain redundant information with respect to a downstream task. We hypothesize that they may also contain information that is not necessary for the underlying task. In task-specific neuron analysis, we consider both redundant and irrelevant neurons as redundancy with respect to a task. Unlike layers, it is combinatorially intractable to exhaustively try all possible neuron permutations that can carry out a downstream task. We therefore aim at extracting only one minimal set of neurons that suffice the purpose, and consider the remaining neurons redundant or irrelevant for the task at hand. + +Formally, given a task and a set of neurons from a model, we perform feature selection to identify a minimal set of neurons that match the oracle performance. To accomplish this, we use the Linguistic Correlation Analysis method (Dalvi et al., 2019) to ranks neurons with respect to a downstream task, referred as FS (feature selector) henceforth. For each downstream task, we concatenate representations from all layers $L$ and use FS to extract a minimal set of top ranked neurons that maintain the oracle performance, within a defined threshold. Oracle is the task-specific classification performance obtained using all the neurons for training. The minimum set allows us to answer how many neurons are redundant and irrelevant to the given task. Tables 1 and 2 show the minimum set of top neurons for each task that maintains at least $97\%$ of the oracle performance. + +Complex core language tasks require more neurons CCG and Chunking are relatively complex tasks compared to POS and SEM. On average + +
Task# NeuronsTask# Neurons
POS290POS280
SEM330SEM290
CCG330CCG690
Chunk.750Chunk.660
(a) BERT(b) XLNet
+ +Table 1: Task-specific neuron-level analysis for sequence labeling tasks. + +
Task# NeuronsTask# Neurons
SST-230SST-270
MRPC190MRPC170
MNLI30MNLI90
QNLI40QNLI20
QQP10QQP20
RTE320RTE400
STS-B290STS-B300
(a) BERT(b) XLNet
+ +Table 2: Task-specific neuron-level analysis for sequence classification tasks. + +across both models, these complex tasks require more neurons than POS and SEM. It is interesting to see that the size of minimum neurons set is correlated with the complexity of the task. + +Less task-specific redundancy for core linguistic tasks compared to higher-level tasks While the minimum set of neurons per task consists of a small percentage of total neurons in the network, the core linguistic tasks require substantially more neurons compared to higher-level tasks (comparing Tables 1 and 2). It is remarkable that some sequence-level tasks require as few as only 10 neurons to obtain desired performance. One reason for the large difference in the size of minimum set of neurons could be the nature of tasks, since core linguistic tasks are word-level tasks, a much higher capacity is required in the pretrained model to store the knowledge for all of the words. While in the case of sequence classification tasks, the network learns to filter and mold the features to form fewer "high-level" sentence features. + +# 7 Efficient Transfer Learning + +In this section, we build upon the redundancy analysis presented in the previous sections and propose a novel method for efficient feature-based transfer learning. In a typical feature-based transfer learning setup, contextualized embeddings are first + +extracted from a pretrained model, and then a classifier is trained on the embeddings towards the downstream NLP task. The bulk of the computational expense is incurred from the following sources: + +- A full forward pass over the pretrained model to extract the contextualized vector, a costly affair given the large number of parameters. +- Classifiers with large contextualized vectors are: a) cumbersome to train, b) inefficient during inference, and c) may be sub-optimal when supervised data is insufficient (Hameed, 2018). + +We propose a three step process to target these two sources of computation bottlenecks: + +1. Use the task-specific layer-classifier (Section 6.1) to select the lowest layer that maintains oracle performance. Differently from the analysis, a concatenation of all layers until the selected layer is used instead of just the individual layers. +2. Given the contextualized embeddings extracted in the previous step, use CC (Section 5.2) to filter-out redundant neurons. +3. Apply FS (Section 6.2) to select a minimal set of neurons that are needed to achieve optimum performance on the task. + +The three steps explicitly explicitly target task-specific layer redundancy, general neuron redundancy and task-specific neuron redundancy respectively. We refer to Step 1 as LayerSelector (LS) and Step 2 and 3 as CCFS (Correlation clustering + Feature selection) later on. For all experiments, we use a performance threshold of $1\%$ for LS and CCFS each. It is worth mentioning that the tradeoff between loss in accuracy and efficiency can be controlled through these thresholds, which can be adjusted to serve faster turn-around or better performance. + +# 7.1 Results + +Table 3 presents the average results on all sequence labeling and sequence classification tasks. Detailed per-task results are provided in Appendix A.5.1. As expected from our analysis, a significant portion of the network can be pruned by LS for sequence labeling tasks, using less than 6 layers out of 13 (Embedding + 12 layers) for BERT and less than 3 layers for XLNet. Specifically, this reduces the parameters required for a forward pass for BERT + +
Sequence ClassificationSequence Labeling
BERTXLNetBERTXLNet
Oracle Neurons93.0%93.4%85.5%84.8%
9984
LS Layers92.3%93.2%85.0%84.5%
5.32.511.68.1
CCFS Neurons92.0%92.2%84.0%84.0%
42540090150
% Reduct.95.7%↓96.0%↓99.0%↓98.5%↓
+ +Table 3: Average results using LS and CCFS with performance thresholds of $1\%$ for each. Oracle is using a concatenation of all layers. Layers shows the average number of selected layers. Neurons are the final number of neurons (features) used for classification. $\%$ Reduct. shows the percentage reduction in neurons compared to the full network. + +by $65\%$ for POS and SEM, and $33\%$ for CCG and $39\%$ for Chunking. On XLNet, LS led to even larger reduction in parameters; $70\%$ for POS and SEM, and $65\%$ for CCG and Chunking. The results were less pronounced for sequence classification tasks, with LS using 11.6 layers for BERT and 8.1 layers for XLNet on average, out of 13 layers. + +Applying CCFS on top of the reduced layers led to another round of significant efficiency improvements. The number of neurons needed for the final classifier reducing to just $5\%$ for sequence labeling tasks and $1.5\%$ for sequence classification tasks. The final number of neurons is surprising low for some tasks compared to the initial 9984, with some tasks like QNLI using just 10 neurons. + +More concretely, taking the POS task as an example: the pre-trained oracle BERT model has 9984 features and 110M parameters. LS reduced the feature set to 2304 (embedding + 2 layers) and the number of parameters used in the forward pass to 37M. CCFS further reduced the feature set to 300, maintaining a performance close to oracle BERT's performance on this task (95.2% vs. 93.9%). + +An interesting observation in Table 3 is that the sequence labeling tasks require fewer layers but a higher number of features, while sequence classification tasks follow the opposite pattern. As we go deeper in the network, the neurons are much more richer and tuned for the task at hand, and only a few of them are required compared to the much more word-focused neurons in the lower layers. These observations suggest pyramid-shaped architectures + +![](images/971e22ded530321c178bf7d27096ba92f1be37125c16ef5c04cb5c6206a77c76.jpg) +Figure 5: BERT: Runtime of the classifier w.r.t. number of neurons (features). The dots on the line mark the number of features selected by our method. Note that the X-axis is not linear, the lower half of the spectrum has been stretched for clarity. + +that have wider lower layers and narrow higher layers. Such a design choice leads to significant savings of capacity in higher layers where a few, rich neurons are sufficient for good performance. In terms of neuron-based compression methods, these findings propose aggressive pruning of higher layers while preserving the lower layers in building smaller and accurate compressed models. + +# 7.2 Efficiency Analysis + +While the algorithm boosts the theoretical efficiency in terms of the number of parameters reduced and the final number of features, it is important to analyze how this translates to real world performance. Using LS leads to an average speed up of $2.8\mathrm{x}$ and $6.2\mathrm{x}$ with BERT and XLNet respectively on sequence labeling tasks. On sequence classification tasks, the average speed ups are $1.1\mathrm{x}$ and $1.6\mathrm{x}$ with BERT and XLNet respectively. Detailed results are provided in Appendix A.5.2. + +For the classifier built on the reduced set, we simulate a test scenario with 100,000 tokens and compute the total runtime for 10 iterations of training. The numbers were computed on a 6-core 2.8 GHz AMD Opteron Processor 4184, and were averaged across 3 runs. Figure 5 shows the runtime of each run (in seconds) against the number of features selected. The runtime of the classifier reduced from 50 to 10 seconds in the case of BERT. The $5 \times$ speedup can be very useful in a heavy-use scenarios where the classifier is queried a large number times in a short duration. + +Training time efficiency: Although the focus of the current application is to improve inference-time efficiency, it is nevertheless important to understand how much computation complexity is added + +during training time. Let $T$ be the total number of tokens in our training set, and $N$ be the total number of neurons across all layers in a pre-trained model. The application presented in this section consists of 5 steps. + +1. Feature extraction from pre-trained model: Extraction time scales linearly with the number of tokens $T$ . +2. Training a classifier for every layer LS: With a constant number of neurons $N$ , training time per layer scales linearly with the number of tokens $T$ . +3. Correlation clustering CC: With a constant number of neurons $N$ , running correlation clustering scales linearly with the number of tokens $T$ . +4. Feature ranking: This step involves training a classifier with the reduced set of features, which scales linearly with the number of tokens $T$ . Once the classifier is trained, the weights of the classifier are used to extract a feature ranking, with the number of weights scaling linearly with the number of selection neurons $N$ . +5. Minimal feature set: Finding the minimal set of neurons is a brute-force search process, starting with a small number of neurons. For each set of neurons, a classifier is trained, the time for which scales linearly with the total number of tokens $T$ . As the feature set size increases, the training time also goes up as described in Figure 5. + +Appendix A.5.3 provides additional experiments and results used to analyze the training time complexity of our application. + +# 8 Conclusion and Future Directions + +We defined a notion of redundancy and analyzed pre-trained models for general redundancy and task-specific redundancy exhibited at layer-level and at individual neuron-level. Our analysis on general redundancy showed that i) adjacent layers are most redundant in the network with an exception of final layers which are close to the objective function, and ii) up to $85\%$ and $92\%$ neurons are redundant in BERT and XLNet respectively. We further showed that networks exhibit varying + +amount of task-specific redundancy; higher layer-level redundancy for core language tasks compared to sequence-level tasks. We found that at least $92\%$ of the neurons are redundant with respect to a downstream task. Based on our analysis, we proposed an efficient transfer learning procedure that directly targets layer-level and neuron-level redundancy to achieve efficiency in feature-based transfer learning. + +While our analysis is helpful in understanding pretrained models, it suggests interesting research directions towards building compact models and models with better architectural choices. For example, a high amount of neuron-level redundancy in the same layer suggests that layer-size compression might be more effective in reducing the pretrained model size while preserving oracle performance. Similarly, our finding that core-linguistic tasks are learned at lower-layers and require a higher number of neurons, while sequence-level tasks are learned at higher-layers and require fewer neurons, suggests pyramid-style architectures that have wide lower layers and compact higher layers and may result in smaller models with performance competitive with large models. + +# Acknowledgements + +This research was carried out in collaboration between the HBKU Qatar Computing Research Institute (QCRI) and the MIT Computer Science and Artificial Intelligence Laboratory (CSAIL). Y.B. was also supported by the Harvard Mind, Brain, and Behavior Initiative (MBB). + +# References + +Lasha Abzianidze and Johan Bos. 2017. Towards universal semantic tagging. In Proceedings of the 12th International Conference on Computational Semantics (IWCS 2017) - Short Papers, pages 1-6, Montpellier, France. +Galen Andrew, Raman Arora, Jeff A. Bilmes, and Karen Livescu. 2013. Deep canonical correlation analysis. In Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013, volume 28 of JMLR Workshop and Conference Proceedings, pages 1247-1255. JMLR.org. +Nikhil Bansal, Avrim Blum, and Shuchi Chawla. 2004. Correlation clustering. Machine Learning, 56(13):89113. +D. Anthony Bau, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2019. + +Identifying and controlling important neurons in neural machine translation. In International Conference on Learning Representations (ICLR). +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2017. What do Neural Machine Translation Models Learn about Morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (ACL), Vancouver. Association for Computational Linguistics. +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2020. On the linguistic representational power of neural machine translation models. Computational Linguistics, 45(1):1-57. +Luisa Bentivogli, Ido Dagan, Hoa Trang Dang, Danilo Giampiccolo, and Bernardo Magnini. 2009. The fifth PASCAL recognizing textual entailment challenge. In Proceedings of the Second Text Analysis Conference, TAC 2009, Gaithersburg, Maryland, USA, November 16-17, 2009. NIST. +Diane Bouchacourt and Marco Baroni. 2018. How agents see things: On visual representations in an emergent language game. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 981-985, Brussels, Belgium. Association for Computational Linguistics. +Qingqing Cao, Harsh Trivedi, Aruna Balasubramanian, et al. 2020. Faster and just as accurate: A simple decomposition for transformer models. *ICLR Open-review*. +Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. 2017. SemEval-2017 task 1: Semantic textual similarity multilingual and crosslingual focused evaluation. In Proceedings of the 11th International Workshop on Semantic Evaluation (SemEval-2017), pages 1-14, Vancouver, Canada. Association for Computational Linguistics. +Grzegorz Chrupa. 2019. Symbolic inductive bias for visually grounded learning of spoken language. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6452-6462, Florence, Italy. Association for Computational Linguistics. +Grzegorz Chrupała and Afra Alishahi. 2019. Correlating neural and symbolic representations of language. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2952-2962, Florence, Italy. Association for Computational Linguistics. +Alexis Conneau, German Kruszewski, Guillaume Lample, Loic Barrault, and Marco Baroni. 2018. What you can cram into a single vector: Probing sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (ACL). + +Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, D. Anthony Bau, and James Glass. 2019. What is one grain of sand in the desert? analyzing individual neurons in deep nlp models. In Proceedings of the Thirty-Third AAAI Conference on Artificial Intelligence (AAAI, Oral presentation). +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), Minneapolis, Minnesota. Association for Computational Linguistics. +William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005). +Nadir Durrani, Fahim Dalvi, Hassan Sajjad, Yonatan Belinkov, and Preslav Nakov. 2019. One size does not fit all: Comparing NMT representations of different granularities. 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 1504-1516, Minneapolis, Minnesota. Association for Computational Linguistics. +Nadir Durrani, Hassan Sajjad, Fahim Dalvi, and Yonatan Belinkov. 2020. Analyzing individual neurons in pretrained language models. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP-2020), Online. Association for Computational Linguistics. +Kawin Ethayarajh. 2019. How contextual are contextualized word representations? comparing the geometry of BERT, ELMo, and GPT-2 embeddings. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 55–65, Hong Kong, China. Association for Computational Linguistics. +Angela Fan, Edouard Grave, and Armand Joulin. 2020. Reducing transformer depth on demand with structured dropout. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Mitchell A. Gordon, Kevin Duh, and Nicholas Andrews. 2020. Compressing BERT: studying the effects of weight pruning on transfer learning. In Proceedings of the 5th Workshop on Representation Learning for NLP, RepL4NLP@ACL 2020, Online, July 9, 2020, pages 143-155. Association for Computational Linguistics. +Isabelle Guyon and André Elisseeff. 2003. An introduction to variable and feature selection. Journal of Machine Learning Research, 3:1157-1182. + +Shilan Hameed. 2018. Filter-wrapper combination and embedded feature selection for gene expression data. International Journal of Advances in Soft Computing and its Applications, 10:90-105. +Yaru Hao, Li Dong, Furu Wei, and Ke Xu. 2019. Visualizing and understanding the effectiveness of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4141-4150, Hong Kong, China. Association for Computational Linguistics. +John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +Julia Hockenmaier. 2006. Creating a CCGbank and a wide-coverage CCG lexicon for German. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, ACL '06, pages 505-512, Sydney, Australia. +Dieuwke Hupkes, Sara Veldhoen, and Willem Zuidema. 2018. Visualisation and 'diagnostic classifiers' reveal how recurrent and recursive neural networks process hierarchical structure. Journal of Artificial Intelligence Research, 61:907-926. +Taeuk Kim, Jihun Choi, Daniel Edmiston, and Sanggoo Lee. 2020. Are pre-trained language models aware of phrases? simple but strong baselines for grammar induction. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Simon Kornblith, Mohammad Norouzi, Honglak Lee, and Geoffrey Hinton. 2019. Similarity of neural network representations revisited. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 3519-3529, Long Beach, California, USA. PMLR. +Nikolaus Kriegeskorte, Marieke Mur, and Peter Bandettini. 2008. Representational similarity analysis - connecting the branches of systems neuroscience. Frontiers in Systems Neuroscience, 2:4. +Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. 2019. Linguistic knowledge and transferability of contextual representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1073-1094, Minneapolis, Minnesota. Association for Computational Linguistics. + +Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. 1993. Building a large annotated corpus of English: The Penn Treebank. Computational Linguistics, 19(2):313-330. +Paul Michel, Omer Levy, and Graham Neubig. 2019. Are sixteen heads really better than one? 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 14014-14024. Curran Associates, Inc. +Jiaqi Mu, Suma Bhat, and Pramod Viswanath. 2018. All-but-the-top: Simple and effective postprocessing for word representations. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. +Tiago Pimentel, Josef Valvoda, Rowan Hall Maudslay, Ran Zmigrod, Adina Williams, and Ryan Cotterell. 2020. Information-theoretic probing for linguistic structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 4609-4622. Association for Computational Linguistics. +Peng Qian, Xipeng Qiu, and Xuanjing Huang. 2016. Analyzing Linguistic Knowledge in Sequential Model of Sentence. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 826-835, Austin, Texas. Association for Computational Linguistics. +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. +Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. 2017. SVCCA: Singular Vector Canonical Correlation Analysis for Deep Learning Dynamics and Interpretability. 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 6078-6087. Curran Associates, Inc. +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. +Hassan Sajjad, Fahim Dalvi, Nadir Durrani, and Preslav Nakov. 2020. Poor man's bert: Smaller and faster transformer models. ArXiv, abs/2004.03844. +Erik F. Tjong Kim Sang and Sabine Buchholz. 2000. Introduction to the CoNLL-2000 shared task chunking. In Fourth Conference on Computational Natural Language Learning, CoNLL 2000, and the Second Learning Language in Logic Workshop, LLL + +2000, Held in cooperation with ICGI-2000, Lisbon, Portugal, September 13-14, 2000, pages 127-132. ACL. +Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. +Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W. Mahoney, and Kurt Keutzer. 2020. Q-BERT: hessian based ultra low precision quantization of BERT. 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 8815-8821. AAAI Press. +Xing Shi, Kevin Knight, and Deniz Yuret. 2016a. Why neural translations are the right length. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2278-2282, Austin, Texas. Association for Computational Linguistics. +Xing Shi, Inkit Padhi, and Kevin Knight. 2016b. Does string-based neural MT learn source syntax? In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, EMNLP 2016, Austin, Texas, USA, November 1-4, 2016, pages 1526-1534. The Association for Computational Linguistics. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. +Xavier Suau, Luca Zappella, and Nicholas Apostoloff. 2020. Finding experts in transformer models. CoRR, abs/2005.07647. +Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. 2019. Patient knowledge distillation for BERT model 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 4322-4331, Hong Kong, China. Association for Computational Linguistics. +Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R. Thomas McCoy, Najoung Kim, Benjamin Van Durme, Samuel R. Bowman, Dipanjan Das, and Ellie Pavlick. 2019. What do you learn from context? probing for sentence structure in contextualized word representations. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. + +Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Well-read students learn better: The impact of student initialization on knowledge distillation. CoRR, abs/1908.08962. +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. +Elena Voita and Ivan Titov. 2020. Information-theoretic probing with minimum description length. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing. 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. +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112-1122, New Orleans, Louisiana. Association for Computational Linguistics. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rmi 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. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +John M. Wu, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James R. Glass. 2020. Similarity analysis of contextual word representation models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 4638-4655. Association for Computational Linguistics. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. XLNet: Generalized autoregressive pretraining for language understanding. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, 8-14 December 2019, Vancouver, BC, Canada, pages 5754-5764. + +# A Appendices + +# A.1 Data + +For Sequence labeling tasks, we use the first 150,000 tokens for training, and standard development and test data for all of the four tasks (POS, SEM, CCG super tagging and Chunking). The links to all datasets is provided in the code README instructions. The statistics for the datasets are provided in Table 4. + +
TaskTrainDevTestTags
POS149973443204734444
SEM14998611253722642673
Chunking150000443464737222
CCG14999045396553531272
+ +For the sequence classification tasks, we study tasks from the GLUE benchmark (Wang et al., 2018), namely i) sentiment analysis (SST-2) using the Stanford sentiment treebank (Socher et al., 2013), ii) semantic equivalence classification using the Microsoft Research paraphrase corpus (MRPC) (Dolan and Brockett, 2005), iii) natural language inference corpus (MNLI) (Williams et al., 2018), iv) question-answering NLI (QNLI) using the SQUAD dataset (Rajpurkar et al., 2016), iv) question pair similarity using the Quora Question Pairs' dataset (QQP), v) textual entailment using recognizing textual entailment dataset(RTE) (Bentivogli et al., 2009), and vi) semantic textual similarity using the STS-B dataset (Cer et al., 2017). The statistics for the datasets are provided in Table 5. + +# A.2 General Neuron-level Redundancy + +Table 6 presents the detailed results for the illustration in Figures 2a and 2b. As a concrete example, 6 out of 12 tasks (POS, SEM, CCG, Chunking, SST-2, STS-B) can do away with more than $85\%$ reduction in the number of neurons (threshold=0.7) with very little loss in performance. + +Figure 6 visualizes heatmaps of a few neurons that belong to the same cluster built using CC at $c_{t} = 0.3$ as a qualitative example of a cluster. + +Table 4: Data statistics (number of tokens) on training, development and test sets used in the experiments and the number of tags to be predicted + +
TaskTrainDev
SST-267349872
MRPC3668408
MNLI3927029815
QNLI1047435463
QQP36384640430
RTE2490277
STS-B57491500
+ +Table 5: Data statistics (number of sequences) on the official training and development sets used in the experiments. All tasks are binary classification tasks, except for STS-B which is a regression task. Recall that the test sets are not publicly available, and hence we use $10\%$ of the official train as development, and the official development set as our test set. Exact split information is provided in the code README. + +# A.3 Task-Specific Layer-wise redundancy + +Tables 7a and 7a provide detailed results used to produce the illustrations in Figure 4. + +Figures 7, 8 and 9 show the layer-wise task-specific redundancy for individual classes within POS, SEM and Chunking respectively. We do not present these fine-grained plots for CCG (over 1000 classes) or sequence classification tasks (binary classification only). + +# A.4 Task-Specific Neuron-level Redundancy + +Tables 8a and 8b provide the per-task detailed results along with reduced accuracies after running task-specific neuron-level redundancy analysis. + +# A.5 Application: Efficient Feature Selection + +# A.5.1 Transfer Learning Detailed Results + +Tables 9 and 10 show the detailed per-task results for our proposed feature selection algorithm. + +# A.5.2 Pretrained model timing analysis + +The average runtime per instance was computed by dividing the total number of seconds taken to run the forward pass for all batches by the total number of sentences. All computation was done on an NVidia GeForce GTX TITAN X, and the numbers are averaged across 3 runs. Figures 10 and 11 show the results of various number of layers (with the selected layer highlighted for each task). + +# A.5.3 Training time analysis + +Figures 12, 13 and 14 show the runtimes of the various steps of the proposed efficient feature se + +![](images/09c5be1146d42181a40e26a34b38c8888014db67428de81316705461da529bab.jpg) +Figure 6: Redundant neurons as clustered by correlation clustering on two sentences. The dark red and dark blue refer to high negative and positive activation values respectively. + +lection for transfer learning application. Extraction of features and correlation clustering both scale linearly as the number of input tokens increases, while ranking the various features scales linearly with the number of total features. + +# A.6 Center Kernel Alignment + +For layer-level redundancy, we compare representations from various layers using linear Center Kernel Alignment (cka - Kornblith et al. (2019)). Here, we briefly present the mathematical definitions behind cka. Let $\mathbf{Z}$ denote a column centering transformation. As denoted in the paper, $z_{j}^{i}$ represents the contextualized embedding for some word $w_{j}$ at some layer $l_{i}$ . Let $z^{i}$ represent the contextual embeddings over all $T$ words, i.e. it is of size $T\times N$ (where $N$ is the total number of neurons). Given two layers $x$ and $y$ , + +$$ +\mathbf {X}, \mathbf {Y} = \mathbf {Z} z ^ {x}, \mathbf {Z} z ^ {y} +$$ + +the CKA similarity is + +$$ +\operatorname {c k a} (z ^ {x}, z ^ {y}) := \frac {\| \mathbf {X} ^ {T} \mathbf {Y} \| ^ {2}}{\| \mathbf {X} ^ {T} \mathbf {X} \| \| \mathbf {Y} ^ {T} \mathbf {Y} \|} +$$ + +where $\| \cdot \|$ is the Frobenius norm. + +![](images/5e43fb64c3925f20f9b9ee8b0305b991fd393e2f433ec178ebca355f2e82bddd.jpg) + +![](images/d78b5accf806cbfe2d07f797342b1eeadec12cccf3dce8a15286e4d3c15792a2.jpg) +(a) BERT +(b) XLNet + +![](images/28b2d9820719027bbcc296925638c7074f62485aeb71f147e606fbf6b7db7b77.jpg) +Figure 7: Layer-wise task specific redundancy for POS task. Redundant layers are represented by the colored blocks. + +![](images/1601f30ae273ebfeb598f57f7a051e72a790d26933131cb3356580a2ca25e96b.jpg) +(a) BERT +(b) XLNet +Figure 8: Layer-wise task specific redundancy for SEM task. Redundant layers are represented by the colored blocks. + +
ThresholdPOSSEMCCGChunkingSST-2MRPCMNLIQNLIQQPRTESTS-BAverage
0.0998499849984998499849984998499849984998499849984
0.095.7%92.0%89.8%94.5%90.5%85.8%81.7%90.3%91.2%70.0%89.5%88.3%
0.1684168096844674974159441939885258993964781298072
0.195.4%92.3%90.3%94.8%89.8%86.3%81.7%90.2%91.2%69.3%89.7%88.3%
0.2404440454052400862078486837672257697870563776293
0.295.9%92.9%90.6%95.0%90.6%86.8%81.7%90.1%91.2%69.0%89.6%88.5%
0.3255625662570257349947328704961316413715749494935
0.396.2%93.1%91.3%95.1%90.6%86.0%81.8%89.9%91.1%67.1%89.5%88.3%
0.4172917521729170938125779568149615077558736743772
0.496.2%93.3%91.4%95.2%90.4%86.5%81.7%89.4%91.0%67.5%89.3%88.4%
0.5121511901221121727464420428937473789424127212800
0.596.4%93.2%91.6%94.9%90.3%86.3%81.6%89.6%91.1%66.4%89.0%88.2%
0.687686987387619623287304127122767317019622036
0.696.2%93.3%91.5%94.4%90.0%85.5%81.8%89.7%91.1%66.8%88.8%88.1%
0.779278979279514042258202518671907231514191488
0.796.2%93.2%91.6%94.1%89.8%86.3%81.7%89.3%91.1%69.0%87.8%88.2%
0.8764758762748982136712391191122615319821050
0.896.1%93.2%91.3%94.0%89.2%85.0%80.6%88.3%90.0%62.8%82.6%86.7%
0.9443378429357778812798797814854785659
0.995.6%91.8%89.9%91.0%56.5%70.3%53.2%80.0%77.6%59.2%32.5%72.5%
+ +(a) BERT + +
ThresholdPOSSEMCCGChunkingSST-2MRPCMNLIQNLIQQPRTESTS-BAverage
0.0998499849984998499849984998499849984998499849984
0.096.2%91.8%90.6%93.5%93.2%86.5%78.9%89.1%87.4%69.7%89.0%87.8%
0.1901990219046894174359206791380565844993191259006.75
0.196.3%92.2%90.7%93.9%93.0%86.5%80.3%89.2%89.7%71.8%89.0%88.4%
0.2533853925346530262577685666873934952924480115344.5
0.296.2%92.3%90.5%93.9%93.0%86.8%80.4%89.9%90.2%70.4%88.9%88.4%
0.3364636513660360652066241598866134482763564073640.75
0.396.2%92.5%91.0%93.8%92.9%86.8%80.8%89.8%90.1%71.5%88.7%88.5%
0.4259225712599257341814896525255833987599649322583.75
0.496.3%92.7%90.8%93.7%93.1%88.0%81.0%89.7%90.1%70.4%88.5%88.6%
0.5175417461756175832073675417244263271457336691753.5
0.596.5%92.8%91.3%94.4%93.2%87.7%80.8%89.6%90.1%71.8%88.3%88.8%
0.6109010851091107223552549290532482370334626661084.5
0.696.7%93.0%91.8%93.8%93.1%88.0%81.0%90.4%90.0%70.4%88.4%88.8%
0.78338338308241663173518832224162723481859830
0.796.6%93.0%91.9%93.2%92.0%88.2%79.9%90.1%89.7%71.1%87.7%88.5%
0.87737757737621127110811891399109114691232770.75
0.896.5%92.9%91.9%93.0%92.4%85.5%77.3%89.4%87.4%69.3%84.5%87.3%
0.9470412471414799790805839791832801441.75
0.996.0%91.5%91.0%90.5%84.4%75.0%65.8%79.7%88.3%63.9%46.6%79.3%
+ +(b) XLNet + +Table 6: Accuracies and number of neurons across all tasks after running correlation clustering. Recall that the clustering is run without any task specific labels, and the evaluation is done across all tasks to analyze the efficacy of correlation clustering as a method to remove redundant neurons. + +
POSSEMCCGChunkingSST-2MRPCMNLIQNLIQQPRTESTS-B
Oracle95.2%92.0%90.1%94.6%90.6%86.0%81.7%90.2%91.2%69.3%89.7%
1% Loss94.2%91.1%89.2%93.6%89.7%85.2%80.9%89.3%90.2%68.6%88.8%
Embedding89.6%81.5%70.0%77.5%50.9%68.4%31.8%49.5%63.2%52.7%0.0%
Layer 193.1%87.6%78.9%82.1%78.4%68.9%42.8%59.7%71.4%52.7%6.0%
Layer 295.3%91.7%86.6%91.0%80.2%71.3%45.0%61.2%73.3%56.0%10.4%
Layer 395.5%92.3%88.0%92.0%80.6%69.6%54.0%74.4%77.2%54.9%54.5%
Layer 496.0%93.0%89.6%94.0%81.2%75.5%61.8%81.3%80.1%55.6%84.9%
Layer 596.0%93.2%90.4%94.0%82.3%76.2%65.9%82.9%84.4%59.6%85.8%
Layer 696.3%93.4%91.6%94.9%86.2%77.5%71.6%83.2%85.8%62.1%86.4%
Layer 796.2%93.3%91.9%95.1%88.6%79.4%74.9%83.8%86.9%62.5%86.8%
Layer 896.0%93.1%91.9%94.8%90.6%77.5%76.4%84.4%87.1%63.5%87.1%
Layer 995.8%92.9%91.6%94.5%90.5%83.3%79.8%84.8%87.7%63.2%87.0%
Layer 1095.6%92.5%91.2%94.1%90.6%82.6%80.3%86.1%89.0%64.3%87.3%
Layer 1195.4%92.3%90.9%93.9%90.4%85.8%81.7%89.8%91.0%66.4%88.9%
Layer 1295.1%92.0%90.2%93.2%90.1%87.3%82.0%90.4%91.1%66.1%89.7%
+ +(a) BERT + +
POSSEMCCGChunkingSST-2MRPCMNLIQNLIQQPRTESTS-B
Oracle95.9%92.5%90.8%94.2%92.4%86.5%78.9%88.7%87.2%71.1%88.9%
1% Loss95.0%91.5%89.9%93.3%91.5%85.7%78.1%87.8%86.4%70.4%88.0%
Embedding89.5%82.6%70.5%77.0%50.9%68.4%32.7%50.5%63.2%52.7%0.6%
Layer 196.3%92.9%88.7%90.8%79.6%70.6%44.2%58.9%72.0%47.3%8.8%
Layer 296.7%93.6%91.0%93.4%81.1%70.1%45.1%58.6%73.8%45.8%11.0%
Layer 396.8%93.5%91.8%94.2%84.7%71.1%61.6%74.2%82.4%47.3%81.1%
Layer 496.7%93.4%92.1%94.2%88.3%76.0%63.7%74.1%85.0%53.1%82.8%
Layer 596.6%93.2%92.4%93.9%88.6%79.4%68.4%81.3%89.2%62.1%84.9%
Layer 696.3%92.6%92.0%94.2%90.1%83.1%73.9%83.3%89.9%63.5%85.9%
Layer 796.1%92.3%91.9%94.0%92.9%85.3%79.1%88.1%89.9%67.1%86.7%
Layer 895.8%91.9%91.6%93.5%93.6%87.7%80.7%90.0%89.2%65.0%87.6%
Layer 995.3%91.6%91.4%93.1%94.2%87.5%80.1%90.3%88.4%69.3%88.2%
Layer 1094.9%91.2%90.8%92.1%93.8%86.5%80.1%90.4%88.9%71.8%88.2%
Layer 1194.6%90.8%90.2%91.1%94.5%86.8%80.1%90.5%88.5%71.8%88.5%
Layer 1292.0%87.4%86.0%85.9%93.8%86.5%80.8%90.6%89.3%71.1%88.5%
+ +(b) XLNet +Table 7: Task specific layer wise results across all tasks. The oracle is trained on all 13 layers combined. Bold numbers highlight layers for each task that maintain $99\%$ of the Oracle's performance + +
TaskOracle#NeuronsReduced Accuracy
POS95.7%29094.3%
SEM92.2%33090.8%
CCG89.9%33088.7%
Chunking94.4%75093.8%
Word Average93.1%42591.9%
SST-290.6%3088.4%
MRPC86.3%19085.0%
MNLI81.7%3081.8%
QNLI90.3%4089.1%
QQP91.2%1090.8%
RTE69.7%32068.6%
STS-B89.6%29088.3%
Sentence Average85.6%13084.6%
+ +(a) BERT + +
TaskOracle#NeuronsReduced Accuracy
POS96.1%28095.6%
SEM92.2%29091.1%
CCG90.2%69089.8%
Chunking94.1%66093.0%
Word Average93.2%48092.4%
SST-292.9%7091.3%
MRPC85.8%17085.0%
MNLI79.0%9077.9%
QNLI88.3%2088.5%
QQP87.4%2088.0%
RTE70.4%40071.1%
STS-B88.9%30086.6%
Sentence Average84.7%15284.1%
+ +(b) XLNet + +Table 8: Accuracies after running linguistic correlation analysis and extracting the minimal set of neurons from all 9984 neurons + +![](images/02fc9ca67bda12263ed10fbfd96fbbb540d89265dfa0d6f9277ca797da653676.jpg) +(a) BERT + +![](images/2bcc4962280f8b10162a16b5d2f7e25030b9f93372052596e1a0d654bd02d3e7.jpg) +(b) XLNet + +
POSSEMCCGChunking
BERTOracle +Neurons95.2%92.0%90.1%94.6%
9984
LS +Layers94.8%91.2%89.2%94.0%
3387
CCFS +Neurons93.9%90.1%90.2%93.7%
300400400600
% Reduct.97%↓96%↓96%↓94%↓
XLNetOracle +Neurons95.9%92.5%90.8%94.2%
9984
LS +Layers96.3%92.9%90.3%93.5%
2233
CCFS +Neurons95.6%91.9%89.5%91.8%
300400300600
% Reduct.97%↓96%↓97%↓94%↓
+ +Table 9: Results of sequence labeling tasks using LayerSelector(LS) with performance threshold $= 1$ and CCFS with performance threshold $= 1$ . Oracle is using a concatenation of all layers. Layers shows the number of the selected layer. Neurons are the final number of neurons (features) used for classification. % Reduct. shows the percentage reduction in neurons compared to the full network. + +![](images/64bed3ecffb138058552baa489258bc983ffb399fe8895202f2cffdf9ab5e22c.jpg) +Figure 10: Average runtime per instance computed across all sequence classification tasks for BERT. Sequence classification tasks all have a near $2\mathrm{x}$ speed up, while most sequence labeling tasks have a $1.08\mathrm{x}$ speedup. + +![](images/3455cda3171250304226b7eff8e88b85e6ca7ce36ba09579ca9c552970120ca2.jpg) +Figure 9: Layer-wise task specific redundancy for Chunking task. Redundant layers are represented by the colored blocks. +Figure 11: Average runtime per instance computed across all sequence classification tasks for XLNet. Sequence classification tasks all have a near $2\mathrm{x}$ speed up, while most sequence labeling tasks have a $1.08\mathrm{x}$ speedup. + +
SST-2MRPCMNLIQNLIQQPRTESTS-B
BERTOracle +Neurons90.6%86.0%81.7%90.2%91.2%69.3%89.7%
9984
LS +Layers88.2%86.0%81.6%89.9%90.9%69.3%89.1%
8121212121312
CCFS +Neurons87.0%86.3%81.3%89.1%89.9%65.7%88.6%
3010030102030400
% Reduction99.7%↓99.0%↓99.7%↓99.9%↓99.8%↓99.9%↓96.0%↓
XLNetOracle +Neurons92.4%86.5%78.9%88.7%87.2%71.1%88.9%
9984
LS +Layers88.2%86.0%79.9%88.8%89.3%71.1%88.1%
69886119
CCFS +Neurons87.5%89.0%78.4%88.3%88.8%69.0%87.2%
5010050200100100400
% Reduction99.5%↓99.0%↓99.5%↓98.0%↓99.0%↓99.0%↓96.0%↓
+ +Table 10: Results of sequence classification tasks using LayerSelector(LS) with performance threshold= 1 and CCFS with performance threshold= 1. Oracle is using a concatenation of all layers. Layers shows the number of the selected layer. Neurons are the final number of neurons (features) used for classification. % Reduct. shows the percentage reduction in neurons compared to the full network. + +![](images/46640d36eed0db48cd946f006e5ae0c3c4729ea633dc4b93b5f2665f8b2feb44.jpg) +Figure 12: Runtime vs number of examples when extracting contextual embeddings using BERT + +![](images/0149917b61bbdd077fd20d0cb12d79351051e853d2dd84c99846c1202b243f2c.jpg) +Figure 13: Runtime vs number of examples when performing correlation clustering + +![](images/bb7ae1bde726607c468a34b810f29693d24c92cdbca99a24a0138f32250218f9.jpg) +Figure 14: Runtime vs number of features when performing feature ranking using the weights of a trained classifier \ No newline at end of file diff --git a/analyzingredundancyinpretrainedtransformermodels/images.zip b/analyzingredundancyinpretrainedtransformermodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a1cdd92b5dfbeae30345d53cc3ac7befb4b246e6 --- /dev/null +++ b/analyzingredundancyinpretrainedtransformermodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d83e8db5c998e9f2f37a9927b86d8079a67da6578015405d675ea3517dfe1ef +size 1598130 diff --git a/analyzingredundancyinpretrainedtransformermodels/layout.json b/analyzingredundancyinpretrainedtransformermodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5c118ad0982f431978a38ea8e14db0c890b5fc87 --- /dev/null +++ b/analyzingredundancyinpretrainedtransformermodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f26499ca9a2493f473b0cad5d60775f00b9f232daf050ce60957e2a2dffd170 +size 573566 diff --git a/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_content_list.json b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..442ec27055eb2f166ad828978bcd6d8f97ee44f9 --- /dev/null +++ b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73ad4d5ef3f153aedb68c27226d0ed41c6e7e818281d1c42746992a903032644 +size 87141 diff --git a/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_model.json b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_model.json new file mode 100644 index 0000000000000000000000000000000000000000..be4ee393db4402d1a138f0a5f62746ed194f9c06 --- /dev/null +++ b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bb0a9ff692991c0eba1a12ca123bd5c2bf9a120dae253bfe0590a3ba09c71da +size 106079 diff --git a/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_origin.pdf b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..31d842b6764f9a3e68d1f6d3e77d95b835fc3322 --- /dev/null +++ b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8c939891037e3dff05be448e05188b4f383a2793e40c180f50f4fc08e1809b3 +size 330304 diff --git a/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/full.md b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..77965d5e59ac8ff4ddf7a034efebccb03e7a68b2 --- /dev/null +++ b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/full.md @@ -0,0 +1,271 @@ +# An Analysis of Natural Language Inference Benchmarks through the Lens of Negation + +Md Mosharaf Hossain, $^{e}$ Venelin Kovatchev, $^{3}$ Pranoy Dutta, $^{e}$ Tiffany Kao, $^{e}$ Elizabeth Wei, $^{e}$ and Eduardo Blanco $^{e}$ + +6University of North Texas 5University of Barcelona + +mdmosharafhossain@my.unt.edu vkovatchev@ub.edu + +{PranoyDutta,TiffanyKao,ElizabethWei}@my.unt.edu eduardo.blanco@unt.edu + +# Abstract + +Negation is underrepresented in existing natural language inference benchmarks. Additionally, one can often ignore the few negations in existing benchmarks and still make the right inference judgments. In this paper, we present a new benchmark for natural language inference in which negation plays an important role. We also show that state-of-the-art transformers struggle making inference judgments with the new pairs. + +# 1 Introduction + +Natural language understanding remains an elusive goal except in limited scenarios. It is arguably the ultimate problem in natural language processing: to empower machines to understand language as generated by humans. The state of the art has seen tremendous progress in recent years, and has moved from symbolic representations (Bos et al., 2004; Artzi and Zettlemoyer, 2013) to distributional representations often learned from massive datasets (Devlin et al., 2019). Recognizing entailments (Dagan et al., 2006), identifying paraphrases (Das and Smith, 2009), determining semantic textual similarity (Agirre et al., 2012), and sentiment analysis (Pang and Lee, 2008) are but a few problems that require natural language understanding to a lesser or greater degree. + +There are many benchmarks targeting the problems above, and they usually cast them as classification problems. A couple of popular evaluation platforms, GLUE (Wang et al., 2018) and SuperGLUE (Wang et al., 2019), aggregate benchmarks for some of the problems above and provide a single score for many tasks under the umbrella of natural language inference. State-of-the-art models are close to or even surpass human performance (Wang et al., 2019). This fact, however, is true only when + +evaluating models and humans with existing benchmarks. Indeed, researchers have pointed out weaknesses in benchmarks suggesting that we are evaluating models with examples that are much simpler than what humans are capable of (Section 3). Source text selection, annotation artifacts (Gururangan et al., 2018), and asking annotators—either experts or crowd workers—to write examples as opposed to retrieving real examples from previously generated language are a few of the culprits. + +In this paper, we investigate the role of negation in a core natural language understanding task: natural language inference—in its most basic form, determining whether a text entails a hypothesis. Recognizing entailments has many applications including question answering (Trivedi et al., 2019), summarization (Pasunuru et al., 2017) and machine translation evaluation (Padó et al., 2009). + +Negation relates an expression $e$ to another expression with a meaning that is in some way opposed to the meaning of $e$ (Horn and Wansing, 2017), thus it plays an important role in natural language understanding. Additionally, negation is ubiquitous in regular English texts: approximately $25\%$ of English sentences contain negation depending on the domain and genre (Section 4). Despite these facts, negation is underrepresented and mostly irrelevant in existing benchmarks—one can literally disregard the negations and still make correct inference judgments in popular datasets. The work presented here addresses these shortcomings and makes the following contributions: + +1. We show that negation is underrepresented and often irrelevant in existing benchmarks. +2. We create new benchmarks for natural language inference in which negation plays a critical role to make inference judgments. +3. We demonstrate that state-of-the-art trans + +formers trained with the original benchmarks are not robust when negation is present. + +4. We provide empirical evidence that transformers may be unable to learn the intricacies of negation in the most challenging benchmark, which includes longer texts from many genres. + +# 2 Background + +The task of natural language inference or recognizing textual entailment consists in determining whether a hypothesis is true given a text. The original task considers two labels: entailment or no_ entailment (Dagan et al., 2006), and a newer formulation considers three labels: entailment, contradiction or neutral (Giampiccolo et al., 2007). For example, the text "A person on a horse jumps over an airplane" entails hypothesis "A person is outdoors, on a horse," contradicts "A person is at a diner, ordering an omelette," and is neutral with respect to "A person is training his horse for a competition." We work with three existing benchmarks: a collection of RTE datasets (Dagan et al., 2006; Bar-Haim et al., 2006; Giampiccolo et al., 2007; Bentivogli et al., 2009), SNLI (Bowman et al., 2015) and MNLI (Williams et al., 2018). The RTE datasets are smaller (5,767 text-hypothesis pairs) than SNLI and MNLI (569,033 and 431,997 pairs). MNLI is more challenging than RTE and SNLI: texts are longer and were selected from 10 genres including fiction and non-fiction as well as conversation transcripts. On the other hand, the texts in SNLI were selected from image captions. The hypotheses in SNLI and MNLI were crowdsourced, i.e., manually generated by non-experts. + +Tables 2 and 4 show examples in the RTE, SNLI and MNLI benchmarks. We work with the formatted versions of these datasets in the GLUE (Wang et al., 2018) and SuperGLUE (Wang et al., 2019) benchmarks for convenience. + +# 3 Previous Work + +Previous work has revealed weaknesses with the benchmarks we work with and that adversarial examples can break models for many natural language processing tasks. Adversarial examples consist of arguably trivial modifications to inputs that trick computational models. Some of them include misspellings (Pruthi et al., 2019), syntactically controlled paraphrases (Iyyer et al., 2018), lexical substitutions (Alzantot et al., 2018), and more elaborate substitutions (Ribeiro et al., 2018). More re + +cently, Ribeiro et al. (2020) propose CHECKLIST, a task-agnostic strategy for testing NLP models. Their strategy can be used to identify which linguistic capabilities a model lacks. For example, they show that commercial systems for sentiment analysis are not robust when negation is present. + +Regarding natural language inference, Poliak et al. (2018) show that models taking into account only hypotheses significantly outperform majority baselines, and Gururangan et al. (2018) discuss annotation artifacts, e.g., negation cues (not, never, etc.) are a strong indicator of contradictions. Glockner et al. (2018) show that models trained with SNLI fail to resolve new pairs that require simple lexical substitution, e.g., holding a saxophone contradicts holding an electric guitar. Naik et al. (2018) conclude that models are not robust to negation, but their only test is concatenating the tautology "and false is not true" to hypotheses. Wallace et al. (2019) introduce universal triggers and show that concatenating negation cues to SNLI hypotheses decreases accuracy to almost zero when the gold label is entailment or neutral. + +The task of identifying paraphrases consists in determining whether two sentences have the same meaning, and can be casted—at least from a definitional perspective—as recognizing bidirectional entailments. Pruthi et al. (2019) show that computational models underperform in MRPC (Dolan et al., 2004) with adversarial misspellings, and Kovatchev et al. (2019) present a qualitative analysis of 11 state-of-the-art models (overall accuracies: $68 - 84\%$ ). When negation is present, however, accuracies drop to $33\%$ (6 models) $67\%$ (4 models) and $1\%$ (1 model). Finally, Zhang et al. (2019) present a dataset for paraphrase identification including adversarial sentence pairs that are not paraphrases but have high word overlap. The new pairs helps training models robust to word scrambling. + +The aforementioned works do not investigate the role of negation in depth. Regarding paraphrase identification, previous work only has shown that models underperform with negation. Regarding natural language inference and negation, previous work considers negations only in the hypotheses—not the texts. Additionally, they only work with unrealistic negations that do not require models to do anything but ignore the negations. Indeed, they concatenate tokens including negations cues that are label-preserving and unrelated to the original texts and hypotheses. Unlike them, we (a) show + +
#sents.% w/ neg.
General English Online Reviews
books4,845,15422.64
movies616,28728.97
Conversations
oral538,97327.43
written510,45829.92
Wikipedia2,735,9308.69
Books1,809,18428.45
OntoNotes63,91817.14
NLI benchmarks
RTE16,3897.16
SNLI1,138,5981.19
MNLI883,43622.63
+ +Table 1: Percentage of sentences containing negation in general-purpose English corpora (reviews, conversations, Wikipedia, books and OntoNotes) and existing natural language inference benchmarks (also in English). Negation is underrepresented in RTE and SNLI. + +that existing benchmarks do not properly account for negation in terms of frequency and difficulty, (b) create new benchmarks that require understanding negations, and (c) show that state-of-the-art models trained with existing corpora struggle with the new pairs including negation, and that the issue persists even if we fine-tune models with the new pairs in the most challenging benchmark, MNLI. + +# 4 Negation in English and Natural Language Inference Benchmarks + +Negation is pervasive in English (Morante and Sporleder, 2012), although there is limited empirical evidence from previous work (Council et al., 2010; Elkin et al., 2005). In order to conduct a large-scale analysis and compare how often negation is present in English and existing natural language inference benchmarks, we employ a negation cue detector using a Bi-LSTM neural architecture with an additional CRF layer (Hossain et al., 2020). Trained and tested with CD-SCO, a corpus publicly available (Morante and Blanco, 2012), it obtains 0.92 F1. The supplemental materials provide more details regarding the architecture of the negation cue detector and the negation cues it detects. + +Table 1 details the percentage of sentences with at least one negation in several large general-purpose English corpora. We work with online + +reviews (Wan et al., 2019; Maas et al., 2011), conversations (Chang et al., 2019), Wikipedia (50,000 pages with at least 20 views), 500 books from Project Gutenberg (Lahiri, 2014), and OntoNotes (Hovy et al., 2006) as released by Pradhan et al. (2011). The percentage of sentences containing negation is high: it ranges from $8.69\%$ to $29.92\%$ in all corpora, and is over $17\%$ in all but Wikipedia. We note that negation is pervasive across domains and genres, including informal texts such as online reviews and both oral and written conversations $(22.64 - 29.92\%)$ . Perhaps surprisingly, the percentage is very high in books $(28.45\%)$ . + +Table 1 also presents the percentage of sentences with negation in the three natural language inference benchmarks. Negation is clearly underrepresented in all of them except MNLI. These percentages do not invalidate the benchmarks. They show, however, that SNLI and RTE do not account for intricate linguistic phenomena such as negations. The reason for the low percentage in SNLI is that it uses texts from picture captions (Section 3), and captions describe pictures with affirmative statements (see examples in Tables 2 and 4). + +The Role of Negation in Existing Natural Language Inference Benchmarks We conduct a manual qualitative analysis in order to (a) characterize the negations in RTE, SNLI and MNLI, and (b) assess how critical negation is to solve the few text-hypothesis pairs that include at least one negation in these benchmarks. We conduct the analysis with 100 text-hypothesis pairs containing negation from each benchmark (300 pairs total). From a linguistic perspective, most negations: + +- are particles (no, not, n't, etc.) whose only function is to indicate negation (RTE: $62\%$ , SNLI: $60\%$ , MNLI: $84\%$ ), +- grammatically modify a verb (RTE: $62\%$ , SNLI: $55\%$ , MNLI: $81\%$ ), and +- scope over the main predicate (RTE: 52%, SNLI: 53%, MNLI: 62%). + +These percentages are roughly uniformly distributed across labels. + +In addition to looking at the negation cues in isolation, we also analyze the role of negation in making judgments. The first key distinction is whether dropping the negation changes the inference judgment (entailment or no_ entailment in RTE; and entailment, neutral or contradiction in SNLI and MNLI). If it does not, we say the negation is unimportant (important otherwise). The + +
Example
RTE1) T: Mr Lopez Obrador, who lost July's presidential election by less than one percentage point, declared himself Mexico's "legitimate" president. H: Mr Lopez Obrador didn't loose the presidential election in July.
2) T: If toxic waste containing cyanide is not disposed of properly, it may drain into ponds, streams, sewers, and reservoirs. H: Leaks into environment are caused by bad disposal of toxic waste containing cyanide.
3) T: Toshiba has produced a fuel cell with no moving parts. H: Toshiba has no moving parts.
SNLI4) T: A fighter jet plane is landed outside. H: The fighter jet plane is not moving.
5) T: A man with no shirt on is performing with a baton. H: A man is doing things with a baton.
6) T: A homeless man carries a sign that says "hungry". H: The man does not have a home.
MNLI7) T: It was summertime the air conditioner was on the door was closed and i couldn't knock because i had to hold the jack with the other hand i finally with my elbow rang the doorbell and mother came to the door. H: The wintertime is when the air conditioning was on, I couldn't ring the doorbell because it was frozen.
8) T: It runs advertisements for its supporters at the top of shows and strikes business deals with MCI, TCI, and Disney, but still insists it's not commercial. H: It runs ads for its supporters at shows and strikes business deals, but insists it is not commercial.
+ +Table 2: Examples of the few text-hypothesis pairs that contain negation in the three natural language inference corpora we work with (RTE, SNLI and MNLI). Negation cues are underlined, and we have made minimal edits to some examples so that they fit within the width of the table. + +second key distinction is whether the negation is aligned, i.e., whether there is a semantic alignment between what is negated in the text (or hypothesis) and a chunk of the hypothesis (or text). We further identify negated alignments, i.e., alignments in which the alignment is also negated. + +Table 2 exemplifies this classification with the three benchmarks. Regarding SNLI, the negation in the hypothesis of Example (4) is important: landed entails not moving, at least according to the SNLI annotators, who were describing pictures thus (presumably) couldn't really tell if the plane was (a) completely stopped or taxiing after landing (and thus still moving). The negation in the text of Example (5), however, is unimportant: A man with no shirt on is performing with a baton entails A man is doing things with a baton regardless of whether the man has a shirt. Simply put, the negation plays no role in making the correct inference judgment. In Examples (4) and (6), the negations align but in Example (5), the negation does not align. Specifically, the alignments of the negations in the text and hypothesis of Example (6) are negated: homeless aligns with does not have a home, and both are negated. The alignment of the negation in the hypothesis of Pair (4), on the other hand, is not negated: not moving aligns with landed, and the latter is not negated. The categorization of the negations in text-hypothesis pairs from RTE and MNLI examples is as follows: + +- RTE. The negation in the hypothesis of Example (1) is important, and it aligns but the alignment is not negated (didn't loose - lost). In Example (2), the negation in the text falls under the same categories: important and aligned, and the alignment is not negated (not disposed of properly - bad disposal). In Example (3), on the other hand, the negations are unimportant and aligned, in fact, there is an identical (and negated) alignment (no moving parts in both the text and hypothesis). +- MNLI. The negation in the text of Example (7), I couldn't knock, is unimportant and not aligned. Indeed, the first clause in both the text and hypothesis, which do not contain negation, are sufficient to solve the pair: the air conditioning being on in wintertime is not entailed by the air conditioning being on in summertime. The negation in the hypothesis of Example (7), however, is also unimportant but aligned (I couldn't ring the doorbell - my elbow rang the doorbell), although the alignment is not negated. This negation is unimportant for the same reason: one can make the correct inference judgment disregarding the negation altogether. The negations in Example (8) are similar to the ones in Example (3): unimportant and aligned, although this time the alignments are almost identical (it's not commercial - it is not commercial). + +
RTESNLIMNLI
E→EAllECNAllECNAll
% unimportant7775763824934878248352
% aligned2517206276175539762353
w/ negation15410250131026298
+ +Table 3: Analysis of the few negations in the text-hypothesis pairs from the three natural language inference corpora we work with (RTE: $7.16\%$ of pairs, SNLI: $1.19\%$ , MNLI: $22.63\%$ ; Table 1). E stands for entailment, $\neg \mathrm{E}$ for no_ entailment, C for contradiction and N for neutral. Many negations are unimportant, i.e., one can ignore them and still make the correct inference judgment. + +Table 3 presents the analysis of the role of negation based on these categories. First, we note that one can often ignore negations without consequences: $76\%$ of negations are unimportant in RTE, $48\%$ in SNLI and $52\%$ in MNLI. In RTE, negations are unimportant in text-hypothesis pairs regardless of the inference judgment $(75 - 76\%)$ . In SNLI and MNLI, however, negations are almost always unimportant in neutral text-hypothesis pairs $(93\%$ in SNLI and $83\%$ in MNLI), and they tend to be unimportant when the text entails the hypothesis $(78\%$ in MNLI and $38\%$ in SNLI). Second, we note that few negations align in RTE (entailment: $25\%$ , no_ entailment: $17\%$ ), but about half of them align in SNLI and MNLI $(55\%$ and $53\%)$ . The percentage of aligned negations heavily depends on the inference judgment in SNLI and MNLI, and in RTE to a lesser degree (entailment is $50\%$ more likely). More interestingly, whether the alignment is negated is a clear sign of the inference judgment. In RTE, the alignments are rarely negated in no_ entailment pairs $(4\%$ overall, $23.5\%$ of aligned pairs), but that is not the case with entailment pairs $(15\%$ overall, $60\%$ of aligned pairs). In SNLI, the differences are larger: $40.3\%$ of aligned pairs labeled entailment are negated. We observe a similar pattern in the negations from MNLI: alignments are rarely negated in contradictions $(2.6\%$ of aligned pairs), and most alignments are negated in entailment pairs $(66.7\%$ of aligned pairs). + +# 5 A Benchmark for Natural Language Understanding with Negation + +We create new benchmarks in which negation plays an important role for natural language inference. The starting points are the original benchmarks, more specifically, we selected at random 500 text-hypothesis pairs from RTE, SNLI and MNLI (1,500 text-hypothesis pairs total). We work with pairs + +from the training and development splits as GLUE and SuperGLUE do not include gold labels for some test splits. Then, we follow three steps for each of the selected original pairs. In the remaining of the paper, we use T and H to refer to texts and hypotheses in RTE, SNLI and MNLI. + +1. Add negation manually to the main verb in T and H to obtain $\mathrm{T}_{\text{neg}}$ and $\mathrm{H}_{\text{neg}}$ . +2. Generate three new pairs automatically by combining the elements in the original pair (T and H) and the results of Step (1) $\mathrm{(T_{neg}}$ and $\mathrm{H_{neg}}$ ). This results in the following pairs: $\mathrm{T_{neg} - H}$ , $\mathrm{T - H_{neg}}$ and $\mathrm{T_{neg} - H_{neg}}$ . +3. Manually annotate the pairs from Step (2) using the labels from the original benchmarks (RTE: entailment or no_ entailment; SNLI and MNLI: entailment, contradiction or neutral). + +These steps result in 4,500 new pairs and their judgments (3 per original pair, 1,500 from each RTE, SNLI and MNLI). Note that the negations are rather simple—adding not to the main verb, and adding auxiliaries and fixing verb tense if needed—but are realistic in the sense that the resulting texts and hypotheses follow proper English grammar. Additionally, the new pairs including negation are not more difficult than the original pairs except for the presence of negation. In particular, they do not require additional lexical inference and the overall topic described does not change. + +Table 4 exemplifies the new pairs with negation. While negating the main verb (Step 1) is a relatively straightforward step, note that annotating the three new pairs including negation (Step 3) requires more attention from annotators. In other words, the inference judgment for the original T-H pair does not unequivocally indicate the inference judgment for the three new pairs that include negation. Indeed, the two examples generated from RTE in Table 4 show that when the original text entails the + +
Original pairNew pair w/ negation
RTET: Tropical Storm Debby is blamed for several deaths across the Caribbean.Tneg: Tropical Storm Debby is not blamed for several deaths across the Caribbean.
H: A tropical storm has caused loss of life.Hneg: A tropical storm has not caused loss of life.
Judgments: T-H: entailment, Tneg-H: no_ entailment, T-Hneg: no_ entailment, Tneg-Hneg: entailment
T: Dr. Pridi was forced into exile, and Field Marshal Pibul again assumed power.Tneg: Dr. Pridi was not forced into exile, and Field Marshal Pibul again assumed power.
H: Pibul was a field marshal.Hneg: Pibul was not a field marshal.
Judgments: T-H: entailment, Tneg-H: entailment, T-Hneg: no_ entailment, Tneg-Hneg: no_ entailment
SNLIT: Two people are working on computers.Tneg: Two people are not working on computers.
H: Two people are near the computers.Hneg: Two people are not near computers.
Judgments: T-H: entailment, Tneg-H: neutral, T-Hneg: contradiction, Tneg-Hneg: neutral
T: Young man walking dog.Tneg: Young man is not walking dog.
H: The man is walking his cat.Hneg: The man is not walking his cat.
Judgments: T-H: contradiction, Tneg-H: neutral, T-Hneg: entailment, Tneg-Hneg: neutral
MNLIT: The lot upon which it is built had been vacant.Tneg: The lot upon which it is built had not been vacant.
H: The lot had been vacant.Hneg: The lot had not been vacant.
Judgments: T-H: entailment, Tneg-H: contradiction, T-Hneg: contradiction, Tneg-Hneg: entailment
T: Thursday's judge, the Honorable Charles Adams of the Coconino County Superior Court, agreed, but highly discouraged self-representation.Tneg: Thursday's judge, the Honorable Charles Adams of the Coconino County Superior Court, did not agree, but highly discouraged self-representation.
H: Self-representation was encouraged by the Honorable Charles Adams.Hneg: Self-representation was not encouraged by the Honorable Charles Adams.
Judgments: T-H: contradiction, Tneg-H: contradiction, T-Hneg: entailment, Tneg-Hneg: entailment
+ +Table 4: Examples of original pairs and new pairs generated after we manually introduce negation. Note that we (a) generate three new pairs after combining texts and hypotheses with and without negation (T-H is the original pair), and (b) manually annotate inference judgments for the three new pairs. + +hypothesis, the three new text-hypothesis pairs may receive different inference judgments (in particular the judgments for $\mathrm{T}_{\text{neg}}$ -H and $\mathrm{T}_{\text{neg}}$ -H $_{\text{neg}}$ are the opposite). The same is true across text-hypothesis pairs including negation and generated from different natural language inference benchmarks. For example, the text entails the hypothesis in the first examples shown from SNLI and MNLI, but the three new pairs including negation receive different judgments: neutral, contradiction and neutral; and contradiction, contradiction and entailment). The second examples created from SNLI and MNLI show the same phenomenon but with an original T-H pair labeled contradiction. + +Annotation Process and Agreements. Three annotators and an additional adjudicator did the annotations described above in two phases. + +In the first phase, the three annotators added negation to the main verbs of texts and hypotheses (Step 1). After a short training session, we decided to have only one annotator add negation in + +each original pair as the task is relatively straightforward. Any issues in this phase were detected during Phase 2. Text-hypothesis pairs with issues were discarded (only $5\%$ ) and additional pairs were collected to account for the discarded pairs (and still have 1,500 text-hypothesis pairs including negation and generated from each of the three benchmarks, 4,500 new text-hypothesis pairs in total). + +In the second phase, the three annotators read the new pairs including negation (automatically generated in Step 2: $\mathrm{T}_{\text{neg}}$ -H, $\mathrm{T}-\mathrm{H}_{\text{neg}}$ and $\mathrm{T}_{\text{neg}}$ - $\mathrm{H}_{\text{neg}}$ ) and manually labeled them with inference judgments (Step 3). In this phase, each pair was annotated by two annotators independently, and the adjudicator resolved any disagreements. We calculated inter-annotator agreement prior to adjudication using Cohen's $\kappa$ (Cohen, 1960). $\kappa$ coefficients were 0.85 (RTE), 0.81 (SNLI) and 0.72 (MNLI). $\kappa$ coefficients between 0.6 and 0.8 are considered substantial, and between 0.8 and 1.0 nearly perfect (Artstein and Poesio, 2008). + +
RTESNLIMNLI
%E%-E%E%C%N%E%C%N
Tneg-H19.880.26.032.062.011.845.842.4
T-Hneg9.091.021.441.037.624.047.628.4
Tneg-Hneg34.465.622.28.069.838.614.447.0
All21.178.916.527.056.524.835.939.3
+ +Table 5: Label distribution in the new text-hypothesis pairs including negation depending on the source pairs they were generated from (RTE, SNLI or MNLI). Unlike the authors of the original benchmarks, we do not artificially force a uniform distribution. The pairs generated from MNLI, which are the longest and the only ones from many genres, are the most balanced (majority baseline accuracy: $39.3\%$ ). + +
RTESNLIMNLI
E→EAllECNAllECNAll
% unimportant5256561724614212196343
% aligned7660627876425984844261
w/ negation52101728025483714
+ +Table 6: Analysis of the negations in the text-hypothesis pairs in the new benchmarks. E stands for entailment, $\neg \mathrm{E}$ for no_ entailment, C for contradiction and N for neutral. Some negations are unimportant, but the percentage of important negations in the new text-hypothesis pairs is higher than those in the original corpora (Table 3). + +Label Distributions. The original RTE, SNLI and MNLI benchmarks contain, by design, text-hypothesis pairs with roughly uniform judgment distributions. Thus, the majority baseline obtains roughly $50\%$ accuracy in RTE (2 labels) and $33\%$ in SNLI and MNLI (3 labels). + +Our new benchmarks including negation do not have a uniform judgment distribution (Table 5), although the pairs generated from MNLI are close (entailment: $24.8\%$ , contradiction: $35.9\%$ , and neutral: $39.3\%$ ). We acknowledge that the label distribution in the new pairs generated from RTE (majority baseline: $78.9\%$ ) and, to a certain degree, SNLI (majority baseline: $56.5\%$ ) are not as challenging as the label distributions in the original pairs. As we shall see in Section 6, however, our experiments show that the ones from MNLI are a challenge for state-of-the-art transformers. + +The Role of Negation. Table 6 presents the analysis of the role of negation in the new benchmarks using the categories presented in Section 4. We analyze 100 text-hypothesis pairs generated from each original benchmark (RTE, SNLI and MNLI). There are less unimportant negations in our new benchmarks than in the original corpora (Table 3). While many negations in the new pairs generated from RTE are unimportant (entailment: $52\%$ , + +no_ entailment: $56\%$ ), few negations in the pairs generated from SNLI and MNLI are unimportant, especially when the text entails or contradicts the hypothesis (SNLI: $17\%$ and $24\%$ , MNLI: $12\%$ and $19\%$ ). Unsurprisingly, the percentage of aligned negations is higher in our corpus due to the steps we use to introduce negation, especially with in the new pairs generated from RTE ( $62\%$ vs. $20\%$ ). + +# 6 Experiments and Results + +In order to assess whether state-of-the-art systems can solve the task of natural language inference when negation is present, we experiment with three state-of-the-art transformers: BERT (Devlin et al., 2019), XLNet (Yang et al., 2019) and RoBERTa (Liu et al., 2019). We use the implementation and pretrained models by Wolf et al. (2019), and tune them to solve each benchmark. The supplemental materials provide details about (a) the hyperparameter settings we use to fine-tune these transformers, and (b) other implementation decisions. + +We conduct two experiments. First, we assess whether these transformers tuned with the original train splits in RTE, SNLI and MNLI are capable of solving our new benchmarks including negation (Section 6.1). Second, we investigate if tuning with the new text-hypothesis pairs including negation improves the results (Section 6.2). + +
Test pairsRTESNLIMNLI
MB[1][2][3]MB[1][2][3]MB[1][2][3]
Original
dev52.775.869.966.133.891.690.689.935.587.986.783.2
\( dev_{neg} \)51.278.173.263.454.491.790.389.450.288.086.783.0
New w/ neg.
\( T_{neg}-H \)80.270.869.065.262.046.439.832.645.866.263.865.6
T-\( H_{neg} \)91.051.444.239.241.063.667.458.847.670.469.862.4
\( T_{neg}-H_{neg} \)65.665.469.668.469.845.847.241.847.063.665.463.6
All78.962.560.957.656.551.951.544.439.366.766.363.9
+ +Table 7: Results obtained with state-of-the-art models trained with the original training split for each benchmark and evaluated with (a) the original development split (dev), (b) pairs in the original development split containing negation $(\mathrm{dev}_{\mathrm{neg}})$ , and (c) the new pairs containing negation. MB stands for the majority baseline, [1] for RoBERTa (Liu et al., 2019), [2] for XLNet (Yang et al., 2019) and [3] for BERT (Devlin et al., 2019). + +
Train pairsRTESNLIMNLI
[1][2][3][1][2][3][1][2][3]
Original64.461.159.352.053.143.364.064.463.8
+ 70% new w/ neg.88.287.383.875.374.269.167.370.466.4
+ +Table 8: Results obtained testing with $30\%$ of the new text-hypothesis pairs containing negation and training with either (a) the original train split from each benchmark or (b) the original train split from each benchmark and $70\%$ of the new pairs containing negation. [1] stands for RoBERTa (Liu et al., 2019), [2] for XLNet (Yang et al., 2019) and [3] for BERT (Devlin et al., 2019). None of the transformers benefit from training with a portion of the pairs that include negation when tested with MNLI, which contains longer and more diverse text-hypothesis pairs. + +# 6.1 Training with Existing Benchmarks + +Can transformers solve the new text-hypothesis pairs including negation if trained with existing benchmarks? No, they cannot (Table 7). Indeed, the three transformers obtain worse results with the new pairs including negation, especially with SNLI ( $\approx 50\%$ drop with the three transformers). These results might be unsurprising with SNLI and RTE since the original text-hypothesis pairs included few negations (1.19% and 7.16%, Table 1). The pattern is also true, however, with MNLI: we observe relative drops ranging from 23.0 to 24.2% despite 22.63% of text-hypothesis contain a negation in MNLI (Table 1). Comparing with the results obtained with the majority baseline, we observe that the transformers do not learn to solve pairs with negation unless they are tuned with pairs including negation (Section 6.2). Indeed, all of them obtain worse results than the majority baseline in RTE and SNLI, but not in MNLI. + +We make a couple additional observations from the results in Table 7. First, the transformers solve the few text-hypothesis pairs including negation in + +the original benchmarks $(\mathrm{dev}_{neg})$ as good (SNLI, MNLI) or better (RTE) than all pairs (dev). In other words, as our analysis of the role of negation in existing benchmarks points out (Section 4), negations do not bring additional complexity in these benchmarks. Second, RoBERTa and XLNet obtain roughly the same results with the new pairs including negation, but BERT falls slightly behind. + +# 6.2 Fine-Tuning with New Pairs Containing Negation + +Can transformers solve the new text-hypothesis pairs including negation if retrained with some of the new pairs including negation? Only to a certain degree: with SNLI, they benefit but underperform with respect to the original pairs; and with MNLI, they only benefit slightly. + +In order to investigate whether the transformers can learn to make inference judgments when negation must be considered, we divide the new text-hypothesis pairs containing negation into training (70%) and test (30%) splits. Table 8 shows the results obtained with the new test split and the three + +transformers trained with (a) the training split in the original benchmarks and (b) the training split in the original benchmarks combined with the training split with pairs containing negation. We observe that the transformers only learn to solve the new pairs including negation in the latter training scenario, but only partially. Indeed, we only observe a large improvement (59.3–64.4% vs. 83.8–88.2%) with the new pairs generated from RTE, which are also the only pairs that obtain higher accuracies than the original development split (83.8–88.2% vs. 66.1–75.8%). With the new pairs generated from SNLI, there is a substantial improvement after fine-tuning (43.3–53.1% vs. 69.1–75.3%) but the three transformers still obtain substantially worse results than with the original development split (69.1–75.3% vs. 89.9–91.6%). Finally, the transformers only benefit marginally from fine-tuning with the new pairs including negation and generated from MNLI (63.8–64.4% vs. 66.4–70.4%). Similar to the results obtained with pairs generated from SNLI, the transformers obtain substantially worse results than with the original development split in MNLI (66.4–70.4% vs. 83.2–87.9%). These results lead to the conclusion that natural language inference when negation is present remains an unsolved challenge. + +# 7 Conclusions + +Negation is ubiquitous in English and critical to understand language and make inferences, as it denies or inverts meaning. Despite these facts, negation is underrepresented in some natural language inference benchmarks (RTE and SNLI). Additionally, one can ignore negation and still make the correct inference judgment with many text-hypothesis pairs in existing natural language inference benchmarks (RTE, SNLI and MNLI). + +In this paper, we have presented a new benchmark of text-hypothesis pairs containing negation (4,500 pairs). We generate and annotate these pairs after systematically adding negation to the main verb of the texts and hypotheses—either one or both—from RTE, SNLI and MNLI thus they are as difficult to solve as the original pairs except for the presence of negation. State-of-the-art transformers trained with the original training splits from RTE, SNLI and MNLI obtain much worse results with the new benchmark than with the original pairs—including the few original text-hypothesis pairs that do contain negation. In addi + +tion, our experimental results show that transformers struggle even after fine-tuning with new pairs containing negation. + +# Acknowledgements + +This material is based upon work supported by the National Science Foundation under Grant No. 1845757. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the NSF. Funding was also provided by the Spanish Ministry of Science, Innovation, and Universities Project PGC2018-096212-B-C33. The Titan Xp used for this research was donated by the NVIDIA Corporation. Computational resources were also provided by the UNT office of High-Performance Computing. We also thank the reviewers for insightful comments. + +# References + +Eneko Agirre, Daniel Cer, Mona Diab, and Aitor Gonzalez-Agirre. 2012. SemEval-2012 task 6: A pilot on semantic textual similarity. In *SEM 2012: The First Joint Conference on Lexical and Computational Semantics – Volume 1: Proceedings of the main conference and the shared task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Evaluation (SemEval 2012), pages 385–393, Montréal, Canada. Association for Computational Linguistics. +Moustafa Alzantot, Yash Sharma, Ahmed Elghohary, Bo-Jhang Ho, Mani Srivastava, and Kai-Wei Chang. 2018. Generating natural language adversarial examples. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2890–2896, Brussels, Belgium. Association for Computational Linguistics. +Ron Artstein and Massimo Poesio. 2008. Inter-coder agreement for computational linguistics. Computational Linguistics, 34(4):555-596. +Yoav Artzi and Luke Zettlemoyer. 2013. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association for Computational Linguistics, 1:49-62. +Roy Bar-Haim, Ido Dagan, Bill Dolan, Lisa Ferro, Danilo Giampiccolo, Bernardo Magnini, and Idan Szpektor. 2006. The second pascal recognising textual entailment challenge. In Proceedings of the second PASCAL challenges workshop on recognising textual entailment, volume 6, pages 6-4. Venice. +Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. 2009. The fifth pascal recognizing textual entailment challenge. + +Johan Bos, Stephen Clark, Mark Steedman, James R. Curran, and Julia Hockenmaier. 2004. Wide-coverage semantic representations from a CCG parser. In COLING 2004: Proceedings of the 20th International Conference on Computational Linguistics, pages 1240–1246, Geneva, Switzerland. COLING. +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 632-642, Lisbon, Portugal. Association for Computational Linguistics. +Jonathan P. Chang, Caleb Chiam, Liye Fu, Andrew Wang, Justine Zhang, and Cristian Danescu-Niculescu-Mizil. 2019. Convokit: The cornell conversational analysis toolkit. +Jacob Cohen. 1960. A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20(1):37-46. +Isaac Councill, Ryan McDonald, and Leonid Velikovich. 2010. What's great and what's not: learning to classify the scope of negation for improved sentiment analysis. In Proceedings of the Workshop on Negation and Speculation in Natural Language Processing, pages 51-59, Uppsala, Sweden. University of Antwerp. +Ido Dagan, Oren Glickman, and Bernardo Magnini. 2006. The pascal recognising textual entailment challenge. In Proceedings of the First International Conference on Machine Learning Challenges: Evaluating Predictive Uncertainty Visual Object Classification, and Recognizing Textual Entailment, MLCW'05, pages 177-190, Berlin, Heidelberg. Springer-Verlag. +Dipanjan Das and Noah A. Smith. 2009. Paraphrase identification as probabilistic quasi-synchronous recognition. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP, pages 468-476, Suntec, Singapore. 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. +Bill Dolan, Chris Quirk, and Chris Brockett. 2004. Unsupervised construction of large paraphrase corpora: Exploiting massively parallel news sources. In *COLING* 2004: Proceedings of the 20th International + +Conference on Computational Linguistics, pages 350-356, Geneva, Switzerland. COLING. +Peter L Elkin, Steven H Brown, Brent A Bauer, Casey S Husser, William Carruth, Larry R Bergstrom, and Dietlind L Wahner-Roedler. 2005. A controlled trial of automated classification of negation from clinical notes. BMC medical informatics and decision making, 5(1):13. +Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. 2007. The third PASCAL recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, pages 1-9, Prague. Association for Computational Linguistics. +Max Glockner, Vered Shwartz, and Yoav Goldberg. 2018. Breaking NLI systems with sentences that require simple lexical inferences. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 650-655, Melbourne, Australia. Association for Computational Linguistics. +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. +Matthew Honnibal and Ines Montani. 2017. spacy 2: Natural language understanding with bloom embeddings, convolutional neural networks and incremental parsing. To appear, 7. +Laurence R. Horn and Heinrich Wansing. 2017. Negation. In Edward N. Zalta, editor, The Stanford Encyclopedia of Philosophy, spring 2017 edition. Metaphysics Research Lab, Stanford University. +Md Mosharaf Hossain, Kathleen Hamilton, Alexis Palmer, and Eduardo Blanco. 2020. Predicting the focus of negation: Model and error analysis. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8389-8401, Online. Association for Computational Linguistics. +Eduard Hovy, Mitchell Marcus, Martha Palmer, Lance Ramshaw, and Ralph Weischedel. 2006. OntoNotes: The $90\%$ solution. In Proceedings of the Human Language Technology Conference of the NAACL, Companion Volume: Short Papers, pages 57-60, New York City, USA. Association for Computational Linguistics. +Mohit Iyyer, John Wieting, Kevin Gimpel, and Luke Zettlemoyer. 2018. Adversarial example generation with syntactically controlled paraphrase networks. In Proceedings of the 2018 Conference of the North + +American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1875-1885, New Orleans, Louisiana. Association for Computational Linguistics. +Venelin Kovatchev, M. Antonia Marti, Maria Salamo, and Javier Beltran. 2019. A qualitative evaluation framework for paraphrase identification. In Proceedings of the International Conference on Recent Advances in Natural Language Processing (RANLP 2019), pages 568-577, Varna, Bulgaria. INCOMA Ltd. +Shibamouli Lahiri. 2014. Complexity of Word Collocation Networks: A Preliminary Structural Analysis. In Proceedings of the Student Research Workshop at the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 96-105, Gothenburg, Sweden. Association for Computational Linguistics. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +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. +Roser Morante and Eduardo Blanco. 2012. *SEM 2012 shared task: Resolving the scope and focus of negation. In *SEM 2012: The First Joint Conference on Lexical and Computational Semantics – Volume 1: Proceedings of the main conference and the shared task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Evaluation (SemEval 2012), pages 265–274, Montréal, Canada. Association for Computational Linguistics. +Roser Morante and Walter Daelemans. 2012. ConanDoyle-neg: Annotation of negation cues and their scope in conan doyle stories. In Proceedings of the Eighth International Conference on Language Resources and Evaluation (LREC'12), pages 1563-1568, Istanbul, Turkey. European Language Resources Association (ELRA). +Roser Morante and Caroline Sporleder. 2012. Modality and negation: An introduction to the special issue. Computational Linguistics, 38(2):223-260. +Aakanksha Naik, Abhilasha Ravichander, Norman Sadeh, Carolyn Rose, and Graham Neubig. 2018. Stress test evaluation for natural language inference. In Proceedings of the 27th International Conference on Computational Linguistics, pages 2340-2353, Santa Fe, New Mexico, USA. Association for Computational Linguistics. + +Vinod Nair and Geoffrey E Hinton. 2010. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10), pages 807-814. +Sebastian Padó, Michel Galley, Dan Jurafsky, and Christopher D. Manning. 2009. Robust machine translation evaluation with entailment features. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP, pages 297-305, Suntec, Singapore. Association for Computational Linguistics. +Bo Pang and Lillian Lee. 2008. Opinion mining and sentiment analysis. Foundations and trends in information retrieval, 2(1-2):1-135. +Ramakanth Pasunuru, Han Guo, and Mohit Bansal. 2017. Towards improving abstractive summarization via entailment generation. In Proceedings of the Workshop on New Frontiers in Summarization, pages 27-32, Copenhagen, Denmark. Association for Computational Linguistics. +Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pages 1532-1543. +Adam Poliak, Jason Naradowsky, Aparajita Haldar, Rachel Rudinger, and Benjamin Van Durme. 2018. Hypothesis only baselines in natural language inference. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pages 180-191, New Orleans, Louisiana. Association for Computational Linguistics. +Sameer Pradhan, Lance Ramshaw, Mitchell Marcus, Martha Palmer, Ralph Weischedel, and Nianwen Xue. 2011. CoNLL-2011 shared task: Modeling unrestricted coreference in OntoNotes. In Proceedings of the Fifteenth Conference on Computational Natural Language Learning: Shared Task, pages 1-27, Portland, Oregon, USA. Association for Computational Linguistics. +Danish Pruthi, Bhuwan Dhingra, and Zachary C. Lipton. 2019. Combating adversarial misspellings with robust word recognition. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5582-5591, Florence, Italy. Association for Computational Linguistics. +Nils Reimers and Iryna Gurevych. 2017. Optimal hyperparameters for deep LSTM-networks for sequence labeling tasks. arXiv preprint arXiv:1707.06799. +Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2018. Semantically equivalent adversarial rules for debugging NLP models. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 856-865, Melbourne, Australia. Association for Computational Linguistics. + +Marco Tulio Ribeiro, Tongshuang Wu, Carlos Guestrin, and Sameer Singh. 2020. Beyond accuracy: Behavioral testing of NLP models with CheckList. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4902-4912, Online. Association for Computational Linguistics. +Tijmen Tieleman and Geoffrey Hinton. 2012. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26-31. +Harsh Trivedi, Heeyoung Kwon, Tushar Khot, Ashish Sabharwal, and Niranjan Balasubramanian. 2019. Repurposing entailment for multi-hop question answering tasks. 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 2948-2958, Minneapolis, Minnesota. Association for Computational Linguistics. +Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. 2019. Universal adversarial triggers for attacking and analyzing NLP. 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 2153-2162, Hong Kong, China. Association for Computational Linguistics. +Mengting Wan, Rishabh Misra, Ndapa Nakashole, and Julian McAuley. 2019. Fine-grained spoiler detection from large-scale review corpora. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2605-2610, Florence, Italy. Association for Computational Linguistics. +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 Advances in Neural Information Processing Systems 32, pages 3261-3275. Curran Associates, Inc. +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. +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112–1122. Association for Computational Linguistics. + +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierrick Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. arXiv preprint arXiv:1906.08237. +Yuan Zhang, Jason Baldridge, and Luheng He. 2019. PAWS: Paraphrase adversaries from word scrambling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1298-1308, Minneapolis, Minnesota. Association for Computational Linguistics. + +# A Identifying Negations + +In order to identify negations in general English corpora as well as natural language inference corpora (RTE, SNLI, and MNLI, Section 4 in the paper), we develop a negation cue detector that consists of two-layer Bidirectional Long Short-Term Memory network with a Conditional Random Field layer (BiLSTM-CRF). This architecture (Figure 1) is similar to the one proposed by Reimers and Gurevych (2017). We train and evaluate the model with CD-SCO, a corpus of Conan Doyle stories with negation annotations (Morante and Daelemans, 2012; Morante and Blanco, 2012). CD-SCO includes common negation cues (e.g., never, no, n't), as well as prefixal (e.g., impossible, unbelievable) and suffixal negation (e.g., motionless). + +We map each token in the input sentence to its 300-dimensional pre-trained GloVe embedding (Pennington et al., 2014). In addition, we extract token level universal POS tags using spaCy (Honnibal and Montani, 2017) and leverage another embedding (300-dimensional) to encode them. Embedding weights for universal POS are learned from scratch as part of the training of the network. We concatenate the word and POS embeddings, and feed them to the BILSTM-CRF architecture (size of cell state: 200 units). The learnt representations from the 2-layer BiLSTM are fed to a fully connected layer with ReLU activation function (Nair and Hinton, 2010). Finally, the CRF layer yields the final output. + +We use the following labels to indicate whether a token is a negation cue: S_C (single-token negation cue, e.g., never, not), P_C (prefixal negation, + +
HyperparameterRTESNLIMNLI
[1][2][3][1][2][3][1][2][3]
Batch size1688323232323232
Learning rate2e-52e-52e-51e-51e-51e-52e-52e-52e-5
Epochs105050333333
Weight decay0.00.00.00.10.10.10.00.00.0
+ +Table 9: Hyperparameters for fine-tuning the state-of-the-art systems on RTE, SNLI, and MNLI. [1] stands for RoBERTa (Liu et al., 2019), [2] for XLNet (Yang et al., 2019) and [3] for BERT (Devlin et al., 2019). + +![](images/61c84553349e36bb4546b83f3b56e4ccdae6b92bc6dae11ecf429b908051eae8.jpg) +Figure 1: The BiLSTM-CRF architecture to identify negation cues. The input is a sentence. Each token is the concatenation of the word and its universal part-of-speech tag. The model outputs a sequence of labels indicating negation presence (S_C, P_C, SF_C or N_C). The example input sentence is "Holmes/NOUN would/VERB not/ADV listen/VERB to/ADP such/ADJ fancies/NOUN ,/PUNCT and/CCONJ I/PRON am/VERB his/DET agent/NOUN." + +e.g., inconsistent), SF_C (suffixal negation, e.g., emotionless), and N_C (not a cue). + +Training details. We merge the train and development instances from CD-SCO, and use $85\%$ of the result as training and the remaining $15\%$ as development. We evaluate our cue detector with the original test split from CD-SCO. We use the stochastic gradient descent algorithm with RMSProp optimizer (Tieleman and Hinton, 2012) for tuning weights. We set the batch size to 32, and the dropout and recurrent dropout are set to $30\%$ for the LSTM layers. We stop the training process after the accuracy in the development split does not increase for 20 epochs, and the final model is the one which yields the highest accuracy in the development accuracy during the training process (not necessarily the model from the last epoch). Evaluating with the test set yields the following results: 92.75 Precision, 92.05 Recall, and 92.40 F1. While not perfect, the output of the cue detector is reliable, + +and an automatic detector is the only way to count negations in large corpora. The code is available at https://github.com/mosharafhossain/negation-cue. + +The neural model has nearly 4.3 million parameters and takes 30 minutes on average to train on a CPU machine (Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz) with 64 GB of RAM. + +# B Fine-tuning Hyperparameters for State-of-the-Art Systems + +For all the Transformer models, we set the maximum sequence length to 128. We use the Hugging Face implementation and pretrained models (Wolf et al., 2019). We work with the default settings for most of the hyperparameters except a few used to fine-tune to each benchmark. Table 9 shows the fine-tuned hyperparameters for the 3 transformers. Also, we use the base architectures for all the transformers (12-layer, 768-hidden, 12-heads). \ No newline at end of file diff --git a/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/images.zip b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..6ac0f9e71d62fbb6664b7ba83a3d8cc68fba133c --- /dev/null +++ b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81d8a87fa5e1aa007ed189f26a5992b5822f95888d5de12846bd38ef3171cdbb +size 655539 diff --git a/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/layout.json b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c6812b70846f16b9baa927ee1361db27c64314f3 --- /dev/null +++ b/ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:383dab421af37a14e83f5a559945437a46d0e79cff648bb2d4bab95e0fb9d10d +size 379906 diff --git a/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_content_list.json b/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..377f777d7a8c159932bdd347adabc821dfb00b24 --- /dev/null +++ b/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10faf4eb650d470aedbbb542408a4412e0fd2a13c70c5cfb7a76784aee6d3f32 +size 42771 diff --git a/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_model.json b/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9fc297b754a3fe622305dacf99f8905a90878ac5 --- /dev/null +++ b/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0eea0a51507ca2f71bcdf6a05b50006233dccc0570bbdd09d5544ec7ea629dc5 +size 50816 diff --git a/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_origin.pdf b/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..56187e8bf08eb3af6bbfd818addf3ccf6610a629 --- /dev/null +++ b/anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2cbdc9c4b3d292a8b4ceb72a3d2d31c6556589e7049774cfb24b03f940007eed +size 1511809 diff --git a/anelementawaremultirepresentationmodelforlawarticleprediction/full.md b/anelementawaremultirepresentationmodelforlawarticleprediction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d83ba7925d52cc322ae2358818f215e92c34e7b4 --- /dev/null +++ b/anelementawaremultirepresentationmodelforlawarticleprediction/full.md @@ -0,0 +1,251 @@ +# An Element-aware Multi-representation Model for Law Article Prediction + +Huilin Zhong $^{1}$ , Junsheng Zhou $^{*1}$ , Weiguang $\mathbf{Q}^{\mathbf{u}}$ $^{1}$ , Yunfei Long $^{2}$ , and Yanhui Gu $^{1}$ + +1 School of Computer and Electronic Information, Nanjing Normal University, China + +$^{2}$ School of Computer Science and Electronic Engineering, University of Essex, Colchester, UK CO2 8JT + +{zhoujs, wgqu}@njnu.edu.cn, yanhgu@gmail.com + +yl20051@essex.ac.uk, elaine1027zhl@hotmail.com + +# Abstract + +Existing works have proved that using law articles as external knowledge can improve the performance of the Legal Judgment Prediction. However, they do not fully use law article information and most of the current work is only for single label samples. In this paper, we propose a Law Article Element-aware Multi-representation Model (LEMM), which can make full use of law article information and can be used for multi-label samples. The model uses the labeled elements of law articles to extract fact description features from multiple angles. It generates multiple representations of a fact for classification. Every label has a law-aware fact representation to encode more information. To capture the dependencies between law articles, the model also introduces a self-attention mechanism between multiple representations. Compared with baseline models like TopJudge, this model improves the accuracy of $5.84\%$ , the macro F1 of $6.42\%$ , and the micro F1 of $4.28\%$ . + +# 1 Introduction + +Legal Judgment Prediction(LJP) aims to predict a law case's judgment results given a fact description text. LJP mainly contains three sub-tasks, law article prediction, charge prediction, and terms of penalty prediction. In the civil law system, the correct prediction of law article prediction can help improve the accuracy of charge prediction(Luo et al., 2017). The investigation of law article prediction has significant meaning for LJP. + +The law article prediction aims to predict the case's relevant law articles given the fact description (hereinafter abbreviated fact) of a case. In the law article prediction, law articles play an essential role as external information. Luo et al. (2017) uses some candidate law articles to improve the performance of the charge prediction task. However, current researches have two main limitations. One + +is that certain law articles are considerably similar which makes them difficult to distinguish. Using the representation of overall law articles to extract fact information is not intuitive enough. Another one is that most of the works (Zhong et al., 2018a; Yang et al., 2019; Liu et al., 2019) only predict on single label examples. Meanwhile, in the actual judgment, many cases contain multiple relevant law articles (Zhong et al., 2018b). + +Human judge process mainly compares the elements of law article with the case description(Hu et al., 2018), such as the subject of crime (person or specific identity), the object of the crime (person or thing), the purpose and motive of the crime, the harmful behavior, the adverse result, and the crime scene (time or place). + +To make full use of the law article information and reduce the confusion in distinguishing different law articles, we have designed a Law Article Element-aware Multi-representation Model (LEMM). LEMM is more related to human cognitive logic and more intuitive based on the law element. We call it LEMM because it extracts fact features specifically by using law article elements and generates multiple law-aware fact representations. Each label has a particular fact representation in classification, which benefits the law article prediction task. Using one vector to distinguish correct law article is inappropriate because the number of relevant law articles is more than 100. Considering law-aware fact representation takes law article as an individual unit, and there are some dependencies between law articles, we capture the relationship between them via the self-attention mechanism. Our LEMM model makes an excellent performance in all evaluation indicators. + +![](images/4a0f19418eeb77029f2eee7805aeca5ce78864ece6e8e324b89119ce6c3943dc.jpg) +Figure 1: Labeled Law Article + +# 2 Structurally Labeling the Law Articles + +Judging whether the law article and case are relevant mainly depends on whether the key elements (including the subject, object, purpose, motive, the harmful behavior, the result of the harm, and the circumstances of the crime) are consistent with the law. Therefore, we divide the law articles into seven elements: 1. the crime subject, 2. the crime object, 3. the purpose and motive of the crime, 4. the harmful behavior, 5. the harmful result, 6. the crime occasion and 7. the supplementary explanation. Since a law article may contain multiple crimes, such law article has multiple groups of elements which correspond to different crimes. As shown in Figure 1, we first divide the content of the law according to the crime and then label the various elements. For elements that are not specified or restricted, we mark them as None. We label 183 candidate law articles of the CAIL dataset (Xiao et al., 2018), which contains a total of 202 crimes. + +# 3 LEMM Model + +The fact is a word sequence $\{w_{1},w_{2},\ldots ,w_{m}\}$ . The model uses labeled law articles to help extract features of the fact. The labeled law articles contain the name of crime and the elements of the crime. The name of crime is a word sequence: $\{w_{1},w_{2},\dots ,w_{n}\}$ . The elements of crime contain seven word sequences: $\{ele_1,ele_2,\dots ,ele_7\}$ , where $ele_{i}$ is $\{w_{1},w_{2},\dots ,w_{ik}\}$ . + +Our model contains five components: + +Encoder: encode law article elements and fact. + +Feature Extraction: use element representa + +tions to extract word-level and document-level fact representation by attention mechanism. + +Fusion: fuse the word-level and document-level fact representation to law-aware representations. + +Relation Extraction: extract the dependencies between law articles by self-attention. + +Classification: classify whether the law article is relevant. + +# 3.1 Encoder + +The Encoder component contains two encoders, which are element encoder and fact encoder. + +# 3.1.1 Element Encoder + +Element Encoder uses BiGRU (Cho et al., 2014) to encoder crime name and crime elements. It takes the hidden state of the last token as the representation of the input. This process is shown as below: + +$$ +c h = B i G R U _ {c r i m e} \left(\left\{w _ {1}, w _ {2}, \dots , w _ {n} \right\}\right) \tag {1} +$$ + +$$ +e l e _ {i} = B i G R U _ {i} \left(\left\{w _ {1}, w _ {2}, \dots , w _ {i k} \right\}\right) \tag {2} +$$ + +# 3.1.2 Fact Encoder + +Fact Encoder also uses BiGRU. It takes the hidden state of the last token as document level representation of the fact $F$ and each hidden state as corresponding word representation $x_{i}$ . + +$$ +F = \left\{\overrightarrow {h _ {0}}; \overrightarrow {h _ {m}} \right\} \tag {3} +$$ + +$$ +x _ {i} = \left\{\overrightarrow {h _ {i}}; \overrightarrow {h _ {i} ^ {\prime}} \right\} \tag {4} +$$ + +$$ +\overrightarrow {h _ {i}}, \overleftarrow {h _ {i}} = \overrightarrow {G R U} (\overrightarrow {h _ {i - 1}}, e _ {i}), \overleftarrow {G R U} (\overleftarrow {h _ {i + 1}}, e _ {i}) \quad (5) +$$ + +![](images/3a337082bc6507947c613907f0be899d1aec27043f205513e0f973782b67e8a5.jpg) +Figure 2: Overview of our LEMM for law article prediction + +![](images/c9fcb64309b762362a1f6b4e8b22f367804a7e2dd9fef61e71604c14c24dbb2d.jpg) +Figure 3: The components of LEMM for law article prediction + +# 3.2 Feature Extraction + +Different from Luo et al. (2017) which uses fact information to extract features of law article, we use law elements to extract features of fact and generate multiple representations for one fact. Feature Extraction contains word-level features and document-level features. + +# 3.2.1 Word-level Feature Extraction + +We use each law article element as a query to generate word-level representations of the fact by attention mechanism. The calculation is shown as below, where $rep_{wi}$ is the word-level representation of fact extracted by $ele_i$ and $f$ is a non-linear function. + +$$ +\alpha_ {i j} = \frac {\exp \left(f _ {e l e i} \left(e l e _ {i} ^ {T}\right) f _ {x} \left(x _ {j}\right)\right)}{\sum_ {k = 1} ^ {m} \exp \left(f _ {e l e i} \left(e l e _ {i} ^ {T}\right) f _ {x} \left(x _ {k}\right)\right)} \tag {6} +$$ + +$$ +r e p _ {w i} = \sum_ {j = 1} ^ {m} \alpha_ {i j} x _ {j} \tag {7} +$$ + +# 3.2.2 Document-level Feature Extraction + +To further strengthen the interaction between the fact and the law articles, we also use crime name + +representations to extract the document-level features of the fact $rep_d$ via element-wise product. + +$$ +r e p _ {d} = f _ {c h} (c h) \cdot f _ {F} (F) \tag {8} +$$ + +# 3.3 Fusion + +The Fusion is used to fuse word-level representation and document-level representation. Considering the word-level representations are based on the crime element, the document-level representations are affected by crime name, and crime belongs to law article, we do the crime-level Fusion firstly and then do the law article-level Fusion. + +# 3.3.1 Crime-aware Fusion + +We use linear fusion to fuse crime name and the seven elements corresponding to the crime. The document-level case description representation generated by the crime name and the word-level case description representation generated by the elements of the crime are concatenated and put into a linear function for fusion. + +$$ +c h A w a r e = f ([ r e p _ {d}; r e p _ {w 1}; \dots ; r e p _ {w 7} ]) \tag {9} +$$ + +$f$ is a linear function and $[\cdot ,]$ means concatenate. chAwareiscrime-aware representation. + +# 3.3.2 Law-aware Fusion + +The Law-aware Fusion is to fuse crime-aware representation based on a law article unit. Some of the law articles only contain one crime, so that we take the crime-aware representation as the article-aware representation. + +$$ +a r t i c l e A w a r e _ {s} = c h A w a r e _ {u} \tag {10} +$$ + +articleAware is the fact representation generated by $k$ -th law article and $chAware_u$ is the fact representation generated by $u$ -th crime. The $crime_u$ belongs to $lawarticle_s$ and the $lawarticle_s$ only has one crime $u$ in content. + +When multiple crimes occur in one law article, we hope to select the prominent features of crime-aware presentation. Considering that argmax will cause for failing to return gradients, we use softmax instead. + +$$ +s _ {m v t} = \frac {\exp (c h A w a r e _ {v t})}{\sum_ {i \in m} \exp (c h A w a r e _ {i t})} \tag {11} +$$ + +$$ +a r t i c l e A w a r e _ {m} = \sum_ {i \in m} s _ {i} \cdot c h A w a r e _ {i} \tag {12} +$$ + +$chAware_{vt}$ is the $t$ -th position of the $v$ -th crime-aware representation vector. $s_{mvt}$ is the softmax score of the $t$ -th position of the $v$ -th crime-aware representation. + +# 3.4 Relation Extraction + +Considering the entire process from the Encoder to the Feature Extraction, and then to the Fusion, each law article is regarded as an independent individual. So far we have not taken the interaction between law articles into consideration. To extract the interaction between law articles, we use the self-attention mechanism (Vaswani et al., 2017) to calculate the interaction between them. + +$$ +q _ {i}, k _ {i}, v _ {i} = W _ {(q, k, v)} ^ {T} \text {a r t i c l e A w a r e} _ {i} + b _ {(q, k, v)} \tag {13} +$$ + +$$ +\beta_ {i j} = \frac {\exp \left(q _ {j} ^ {T} k _ {i}\right)}{\sum_ {n = 1} ^ {| k |} \exp \left(q _ {j} ^ {T} k _ {n}\right)} \tag {14} +$$ + +$$ +i n p u t _ {i} = \sum_ {j = 1} ^ {| k |} \beta_ {i} v _ {j} \tag {15} +$$ + +$input_{i}$ is the new fact representation used to discriminate whether the $i$ -th law article is relevant. + +# 3.5 Classification + +We have generated multiple article-aware representations for one fact, and each representation $input_{i}$ corresponds to a law article. We will use these representations to make classification respectively. Each label has a vector for prediction, which helps to retain more feature information. Unlike other multi-label classifications, where a threshold selects the softmax output results, we use multiple binary classifications. + +$$ +o u t _ {i} = \operatorname {s i g m o i d} \left(M L P \left(\text {i n p u t} _ {i}\right)\right) \tag {16} +$$ + +MLP is a multi-layer perceptron. + +# 4 Experiments + +This part includes data selection, experimental parameter setting, baseline model, and detailed experimental results. + +# 4.1 Dataset and Evaluation + +We use CAIL 2018 small dataset (Xiao et al., 2018). CAIL(Chinese AI and Law Challenge) is a criminal case dataset for competition released by the Supreme People's Court of China. The details of CAIL can be found in Xiao et al. (2018). Considering the serious long-tail distribution of the sample in the dataset, we only select the samples with more than 300 occurrences of the relevant law. To study the model's performance on low-frequency samples, we also conducted experiments on the complete small dataset. + +We use the correct rate, micro/macro accuracy, precision, recall, and F1 as evaluation indicators. + +# 4.2 Experimental Parameter Setting + +We use the Thulac (Li and Sun, 2009) tool to segment words, and use CBOw (Rong, 2014) to train word vector on the training data and law article content. The dimension of the word vector is 300. Due to the enormous length of the fact, we only keep the first 256 words of fact. The hidden size is 512. The optimizer is Adam, and the learning rate is 2e-4. + +# 4.3 Experimental Results + +We compared our model with LSTM(Cheng et al., 2016), BiLSTM, CNN(Kim, 2014), and the current state-of-the-art TopJudge model. The hidden size is 512, the max word length is 256, the kernel size is [3, 3, 3], and the pooling size is [3, 3, 3]. + +
ModelAccMacroMicro
PRF1PRF1
TopJudge71.4181.2073.8876.0480.3179.4079.85
CNN71.3678.6073.8875.5479.3278.8979.10
LSTM72.0880.5176.5877.6679.8780.4280.14
BiLSTM72.2779.4578.0178.0778.5981.8180.17
LEMM77.2583.9182.1182.4683.7384.5584.13
+ +Table 1: Results on CAIL 2018 small (filtered) + +
ModelAccMacroMicro
PRF1PRF1
TopJudge65.4561.1146.6550.1778.1372.4775.19
CNN67.1862.5551.0253.9177.6675.2076.41
LSTM68.9964.5256.7158.5777.0578.2677.65
BiLSTM70.3265.0759.6360.5176.7380.5378.58
LEMM72.1373.5361.2164.6981.4781.6581.56
+ +We tested our model on the complete and filtered CAIL small dataset. The experimental results are shown in Tabel 1 and Tabel 2. The experiment results show: + +(1) Our model has achieved outstanding performance in all evaluation indicators. Compared with TopJudge, our model has achieved $12.42\%$ and $3.34\%$ improvement in macro accuracy and micro accuracy respectively, and $14.56\%$ and $9.18\%$ improvement in macro recall and micro recall respectively. +(2) The performance of TopJudge(current state-of-the-art model) on the two datasets is worse than that of LSTM and BiLSTM. Base on the result, we suspect that joint learning of TopJudge's three subtasks causes more error propagation, and terms of penalty prediction is greatly affected by external factors. + +# 4.4 Ablation Experiment + +We compared the LEMM model with some variant models on the screened dataset. The experimental results are shown in Tabel 3. -R means to remove the law article relationship extraction module. The model fact-art puts the entire word sequence of the + +Table 2: Results on CAIL 2018 small (whole) + +
ModelAccMacroMicro
PRF1PRF1
LEMM77.2583.9182.1182.4683.7384.5584.13
-R75.8585.1378.7781.1884.4882.9383.70
fact-art72.6883.0579.6680.6282.0682.8882.47
+ +Table 3: Ablation Experiment Results + +law article into BiGRU for encoding and use the law article representation to extract features of the fact. + +The ablation experiment shows that the law article relationship significantly contributes to the improvement of the accuracy rate and recall rate. Nevertheless, the precision of the model has been slightly dropped with law article relationship. There might be some noise information in extracting the relationships, which affects the accuracy of the model. + +The performance has a sharp drop without manual labeling law article elements. This verifies the labeled law article information is useful in extracting facts. + +# 5 Conclusion + +We propose a model that predicts relevant law articles on multi-label samples by simulating the human judging process. Our proposed LEMM model uses elements of the manually labeled law articles to generate multiple representations of a fact. It uses self-attention to capture dependencies between law articles and makes a unique representation for each candidate label for prediction. The experiments verify that the element-aware multi-representation can better extract features of the factual information and the dependencies between law articles are beneficial to the law article prediction task. The model achieves state-of-the-art performance in benchmark datasets. It also fills the gap between experimental and practical applications on multi-label samples. + +# Acknowledgments + +We thank all reviewers for the valuable comments. This work is supported by the National Natural Science Foundation of China (No. 61472191 and No. 61772278). + +# References + +Jianpeng Cheng, Li Dong, and Mirella Lapata. 2016. Long short-term memory-networks for machine reading. CoRR, abs/1601.06733. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gülcehre, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning phrase representations using RNN encoder-decoder for statistical machine translation. CoRR, abs/1406.1078. +Zikun Hu, Xiang Li, Cunchao Tu, Zhiyuan Liu, and Maosong Sun. 2018. Few-shot charge prediction + +with discriminative legal attributes. In Proceedings of the 27th International Conference on Computational Linguistics, pages 487-498, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. CoRR, abs/1408.5882. +Zhongguo Li and Maosong Sun. 2009. Punctuation as implicit annotations for chinese word segmentation. Computational Linguistics. +Zonglin Liu, Meishan Zhang, Ranran Zhen, Zuoquan Gong, Nan Yu, and Guohong Fu. 2019. Multitask learning model for legal judgment predictions with charge keywords. Journal of Tsinghua University (Science and Technology), 59(7):497. +Bingfeng Luo, Yansong Feng, Jianbo Xu, Xiang Zhang, and Dongyan Zhao. 2017. Learning to predict charges for criminal cases with legal basis. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2727-2736, Copenhagen, Denmark. Association for Computational Linguistics. +Xin Rong. 2014. word2vec parameter learning explained. CoRR, abs/1411.2738. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. CoRR, abs/1706.03762. +Chaojun Xiao, Haoxi Zhong, Zhipeng Guo, Cunchao Tu, Zhiyuan Liu, Maosong Sun, Yansong Feng, Xianpei Han, Zhen Hu, Heng Wang, and Jianfeng Xu. 2018. CAIL2018: A large-scale legal dataset for judgment prediction. CoRR, abs/1807.02478. +Wenmian Yang, Weijia Jia, Xiaojie Zhou, and Yutao Luo. 2019. Legal judgment prediction via multiperspective bi-feedback network. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 4085-4091. AAAI Press. +Haoxi Zhong, Zhipeng Guo, Cunchao Tu, Chaojun Xiao, Zhiyuan Liu, and Maosong Sun. 2018a. Legal judgment prediction via topological learning. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3540-3549, Brussels, Belgium. Association for Computational Linguistics. +Haoxi Zhong, Chaojun Xiao, Zhipeng Guo, Cunchao Tu, Zhiyuan Liu, Maosong Sun, Yansong Feng, Xianpei Han, Zhen Hu, Heng Wang, and Jianfeng Xu. 2018b. Overview of CAIL2018: legal judgment prediction competition. CoRR, abs/1810.05851. \ No newline at end of file diff --git a/anelementawaremultirepresentationmodelforlawarticleprediction/images.zip b/anelementawaremultirepresentationmodelforlawarticleprediction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cb50dc10798457e3a665dbaf6a879c014be78d12 --- /dev/null +++ b/anelementawaremultirepresentationmodelforlawarticleprediction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d87c97b0b6df639735b2d334d213f36e8623009e2641d6efebb40bb2ccffe31 +size 315541 diff --git a/anelementawaremultirepresentationmodelforlawarticleprediction/layout.json b/anelementawaremultirepresentationmodelforlawarticleprediction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5e2b7cded10d2259dd122a712ebdac481bd64df9 --- /dev/null +++ b/anelementawaremultirepresentationmodelforlawarticleprediction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e55fbd5aff3f32df56c20cde9f171ba59b366a6ae079e1ef63bbca60197793e6 +size 212782 diff --git a/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_content_list.json b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..eabda1ab128e7bdf1cac43a1fd5da8ecaa2e4398 --- /dev/null +++ b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1feda2bd88aa9ace8622298c6eaa25b0d0bfafc67a9fce91abe85b8500c18237 +size 95562 diff --git a/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_model.json b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_model.json new file mode 100644 index 0000000000000000000000000000000000000000..ea6e2530f970e805f296062993e4b2a434ba0487 --- /dev/null +++ b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbcf3535dffc7262d5519f1f164181c72e5f6ef0ffc00b663f9b85d9fcc1f607 +size 111673 diff --git a/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_origin.pdf b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1fd1b2e169f24d268d0c8002d4e81d318cda006e --- /dev/null +++ b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e58e6f4ed8764b976577b5bbbcc7437f74e65532f21e2167634d5074e75b9ca +size 2127032 diff --git a/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/full.md b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ff028290fbab8dcedb5b69f9562152febe0a90aa --- /dev/null +++ b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/full.md @@ -0,0 +1,389 @@ +# An Embedding Model for Estimating Legislative Preferences from the Frequency and Sentiment of Tweets + +Gregory P. Spell + +Duke University / Durham, N.C. + +gregory.spell@duke.edu + +D. Sunshine Hillygus + +Duke University / Durham, N.C. + +hillygus@duke.edu + +Brian Guay + +Duke University / Durham, N.C. + +brian.guay@duke.edu + +Lawrence Carin + +Duke University / Durham, N.C. + +carin@duke.edu + +# Abstract + +Legislator preferences are typically represented as measures of general ideology estimated from roll call votes on legislation, potentially masking important nuances in legislators' political attitudes. In this paper we introduce a method of measuring more specific legislator attitudes using an alternative expression of preferences: tweeting. Specifically, we present an embedding-based model for predicting the frequency and sentiment of legislator tweets. To illustrate our method, we model legislators' attitudes towards President Donald Trump as vector embeddings that interact with embeddings for Trump himself constructed using a neural network from the text of his daily tweets. We demonstrate the predictive performance of our model on tweets authored by members of the U.S. House and Senate related to the president from November 2016 to February 2018. We further assess the quality of our learned representations for legislators by comparing to traditional measures of legislator preferences. + +# 1 Introduction + +Legislator preferences are typically estimated as general measures of ideology using roll-call votes on legislation. However, such measures fail to capture aspects of preferences not reflected in legislation, such as attitudes towards a sitting president. For instance, Sen. Bob Corker (R-TN) famously referred to the Trump White House as an "adult day-care center," John McCain (R-AZ) said Trump "is often poorly informed," and Jeff Flake (R-AZ) called him a "danger to a democracy," yet all of these Republican Senators cast more than $80\%$ of their legislative votes in line with president (Silver and Bycoffe, 2019). Generally, the political science research recognizes that the public's views of the president have spillover effects on evaluations of + +legislators, which incentivizes strategic communication about the president. For example, Senate Majority Leader Mitch McConnell recently encouraged Republican senators in vulnerable re-election campaigns to distance themselves from Trump. Understanding legislators' attitudes toward the president enables greater understanding and measurement of such strategic communications. Furthermore, these attitudes also matter for understanding the president's ability to pass his legislative agenda. + +In this paper, we propose a new method for estimating legislator preferences from the frequency and sentiment of their tweets using a novel combination of spatial models based on item response theory and the modeling of count data. We use this method to estimate legislator preferences about Donald Trump using tweets by members of Congress and Donald Trump in the 15-month period following election day in November 2016. In our model, legislator embeddings interact with embedding representations of Donald Trump himself, constructed from a neural network using the text (and timing) of his tweets during the same time frame. Thus, our model leverages the text feature extraction capabilities of neural networks and incorporates the legislator sentiment in tweets about Trump as well as the strategic decision about whether and when to tweet about him. We quantitatively assess the quality of our learned legislator representations by demonstrating the model's predictive performance on a test set of tweets, and we also compare our model-obtained embeddings to DW-NOMINATE scores, traditional measures of legislator ideology.1 Our analysis not only validates the modeling approach but also highlights that attitudes towards Trump are not being entirely captured by legislative voting behavior. More + +broadly, a method for estimating domain-specific preferences, rather than general ideological ideal points, broadens the range of hypotheses than can be tested by political researchers. + +# 2 Measuring Legislator Preferences + +The predominant method of measuring legislator preferences over the past half-century has been the modeling of the ideal point of a legislator from recorded votes on policy legislation. These ideal points constitute a spatial model for legislative behavior, as both legislators and policies are represented in a low-dimensional Euclidean space (Poole and Rosenthal, 1997; Clinton et al., 2004). Such ideal points are interpreted as measures of ideological preferences and have been used to test hypotheses on topics such as political polarization, political representation, and cross-institutional relationships (Tausanovitch and Warshaw, 2018). + +A key limitation of initial methods for estimating ideal points was the inability to perform out-of-sample predictions. Thus, they could not be used to predict votes on new legislation. To address this shortcoming, Gerrish and Blei (2011) extended the ideal point model by placing legislation into a "political space" based upon the latent topics of the legislation's text and perform prediction using these topics. Xing et al. (2017) use a nonparametric Bayesian model to incorporate constituency data into a factor model for legislative roll calls and text, with the text again being analyzed using a topic model. Further efforts to incorporate bill text using topic models come from Wang et al. (2010), Gerrish and Blei (2012), Nguyen et al. (2015), and Gu et al. (2014). The incorporation of text into ideal point modeling is not limited to legislators: Sim et al. (2016) model U.S. Supreme Court behavior using a generative model for amicus briefs. + +Efforts to incorporate text into vote prediction were improved by moving to an embedding paradigm rather than topic models. Kraft et al. (2016) incorporate word embeddings into a model for vote prediction by representing a piece of legislation as the average of its word embeddings and further representing legislators using ideal vectors as a multi-dimensional extension to ideal points. Kornilova et al. (2018) augment bill text with bill metadata (i.e., bill sponsor information) to improve the predictive capabilities of legislator embeddings, and use a convolutional neural network (CNN, Kim (2014)), rather than the average over bill word em + +beddings, to model bill text. + +While tweets have increasingly been used to measure political preferences of the mass public (Wang et al., 2016; Preojiuc-Pietro et al., 2017), little attention has been paid to the potential of using tweets to measure legislators' preferences. One notable exception, Barbera (2015), uses the structure of social networks on Twitter to learn ideological positions of both political elites and the general public, but does not incorporate information from the tweets themselves. As all legislators in the U.S. House and Senate now use Twitter to communicate with constituents on a wide variety of topics, we recognize an opportunity to observe nuances in legislator preferences not captured by broader ideological measures that rely on roll call votes. + +Here we focus specifically on legislators' attitudes toward the sitting president. While attitudes toward the president are among the most frequently measured aspects of public opinion, there is currently no method for explicitly measuring these preferences among legislators. We develop an embedding model that jointly predicts the frequency and sentiment of legislator tweets about Donald Trump. Similar to the Kraft et al. (2016) modeling of legislator votes in response to the text of legislation, here legislator tweets are considered as a response to text features extracted from Donald Trump's tweets. Whereas embedding models for vote prediction analyze only one outcome of legislator behavior (i.e., the vote itself), our embedding model is trained to predict multiple outcomes of legislator behavior in both tweet counts and content in the form of sentiment. Moreover, because our model does not rely on votes casts by legislators, it could be used to estimate preferences among a wider range of political actors (e.g., candidates, cabinet members) on a variety of domains, and with texts other than tweets. + +# 3 Tweet Dataset + +We obtained all publicly-available tweets by members of Congress from TweetCongress, a Sunlight Foundation initiative. We restricted the sample to only those tweets that contained any of a specific set of terms related to Donald Trump (in addition to his Twitter handle): "Donald Trump," "Trump," "realDonaldTrump," "MAGA," (an acronym for Trump's campaign slogan "Make America Great Again") "whitehouse," "WhiteHouse," "POTUS," (acronym for "President of the United States"), and + +![](images/525acaf5800e9aa89078876e34b2a357a5a46d005dc32f01b33fd48a9df12611.jpg) +Figure 1: Number of tweets by Republican and Democratic legislators about Trump, as well as tweets by Trump, over time. + +"potus." Of these, we further restricted the tweets to span in time from November 2016 to February 2018, when the data was collected. This culling process yielded 29,696 tweets from 451 legislators. + +The model also incorporates tweets from Trump, which we obtained from the website www.trumptwitterarchive.com. For each day included in the dataset, the text of all tweets by Donald Trump was agglomerated and preprocessed by removing excess whitespace and lowercase all letters. The text was tokenized and each word-token mapped to an integer identifier, with a vocabulary mapping of 2783 words. For each day, we obtain a sequence of integers representing the words composing the text of Donald Trump's tweets from that day, and these are the inputs to the model described in Section 4.3. + +Figure 1 plots the number of tweets by Republicans, Democrats, and Trump over time for the period we examine. There were only 13 days for which Trump did not tweet $(2.79\%)$ , and the most tweets that he sent in a single day was 32. The most tweets by a Democrat in a single day was 99, while the most tweets by a Republican in a single day was 25. The variation in tweets across time highlights one of the key features of the model—the incorporation of not only the sentiment of tweets about Trump by also the number of daily tweets. + +Of the 29,696 Trump-related legislator tweets, a subset of 4,661 tweets were randomly selected to be manually labeled with respect to their sentiment about Trump, using a three-point "positive," "negative," "neutral" scale based on the text of the + +tweet² from November 2016 to February 2018. + +We divided the tweets temporally by day into disjoint training, validation, and test sets, such that all tweets from each day were randomly assigned to one of the three sets. The training, validation, and test sets contain $70\%$ , $10\%$ , and $20\%$ of all days, respectively. Table 1 outlines how many days and tweets are included in each set. + +
# Days# Labeled# Total
Training324306920116
Validation474122441
Test9511807139
+ +Table 1: Split of Training, Validation, and Test sets. + +# 4 Legislator Tweet Model Formulation + +Our proposed model combines an embedding model for legislators with models for ordinal and count data, predicting both the number of daily tweets about Donald Trump sent by each legislator and the sentiment of labeled tweets. The joint nature of this model not only enables a more nuanced representation of legislators, but also accounts for the fact that a legislator who consistently tweets in favor (or against) the president is different from one who tweets occasionally, even if both express similar sentiment. The model also incorporates text features from Trump's tweets to provide context for legislator tweets as reactions to Trump. + +Underpinning our model is the assumption of a latent political space of dimension $K$ . In this space, we learn a set of "day embeddings" (or "Trump embeddings") that interact with a set of legislator embeddings. For a particular day $t$ , let $\pmb{\tau}_t \in \mathbb{R}^K$ be a vector that represents Donald Trump on that day. Indexing legislators by $i \in \{1, 2, \dots, N\}$ , we endow a legislator $i$ with a vector $\mathbf{v}_i \in \mathbb{R}^K$ as well as a bias term $b_i \in \mathbb{R}$ , which captures a legislator's propensity to react to Trump regardless of how he presents himself via Twitter. While the legislator embeddings are learned as free parameters of the model, the Trump embeddings are constructed using the text of Donald Trump's tweets. We now describe how we use legislator and Trump embeddings to predict tweet counts and sentiment. + +# 4.1 Tweet Count Model + +Understanding legislator-president interactions requires understanding not only the sentiment of legislators' remarks about the president, but also whether and how often they remark about him. This distinguishes, for instance, a legislator who criticizes Trump every week from one who criticizes Trump only once during his tenure. Even when the sentiment expressed in these two legislators' tweets is identical, the fact that one legislator expresses that sentiment more frequently likely reflects a more negative attitude toward Trump. Furthermore, since we model tweets as a response to a daily representation of Trump, modeling counts reveals legislators who respond in concert with each other and may share similar preferences. + +Let $x_{it}$ be the number of tweets that legislator $i$ sends about Donald Trump on day $t$ . We consider two distributions with which to construct our tweet count model: Poisson and Negative Binomial. While the former offers simplicity, the latter is more flexible and suitable for overdispersed data because of its additional parameter. In Section 5, we compare the Poisson and Negative Binomial model performances. We will parameterize the Negative Binomial using $(p_{it}, r)$ : + +$$ +x _ {i t} \sim \mathrm {N e g B i n} (p _ {i t}, r), p _ {i t} = \sigma (\pmb {\tau} _ {t} ^ {\top} \mathbf {v} _ {i}) \quad (1) +$$ + +where $\sigma(\cdot)$ is the sigmoid function defined by $\sigma(x) = \frac{1}{1 + \exp(-x)}$ , which is used to transform the input onto $(0,1)$ to represent a probability. The remaining parameter $r$ is learned as a common free parameter for all legislators and days. For the Poisson case, we model the rate parameter of the distribution as the exponential of the dot-product between the Trump and legislator embeddings. This choice ensures the rate parameter is non-negative while also modeling an "interaction" between legislators and Trump. + +We train the count model by minimizing the negative log-likelihood (NLL) of the training data under either of the assumed distributions. We denote the total count-loss over a training set $\mathcal{X}_{tr}$ as: + +$$ +\mathcal {L} _ {\text {c o u n t}} = \sum_ {x _ {i t} \in \mathcal {X} _ {t r}} \mathrm {N L L} _ {\text {c o u n t}} \left(x _ {i t}; \boldsymbol {\tau} _ {t}, \mathbf {v} _ {i}\right) \tag {2} +$$ + +# 4.2 Tweet Sentiment Model + +Let $y_{it}$ be an ordinal variable that encodes the sentiment legislator $i$ expresses in a tweet about Donald + +Trump on day $t$ . We consider an ordinal model to account for the possible gradations of approval. Assuming $L$ sentiment levels, the model is parameterized by a set of cutpoints, $\mathcal{C} = \{c_0 < c_1 \leq c_2 \leq \dots \leq c_{L-1} < c_L\}$ , where $c_0$ and $c_L$ are defined to be $-\infty$ and $\infty$ , respectively. The remaining cutpoints are learned during model training. + +Let $z_{it} \in \mathbb{R}$ be a latent variable underlying the ordinal response. Then for a thresholded ordinal model, the predicted sentiment takes value $l$ for which: $c_{l-1} < z_{it} < c_l$ . Under a cumulative link model (CLM) $^3$ for ordinal regression, the predicted probability of a particular sentiment level $l$ is: + +$$ +p (y _ {i t} = l | z _ {i t}; \mathcal {C}) = \sigma (c _ {l} - z _ {i t}) - \sigma (c _ {l - 1} - z _ {i t}) (3) +$$ + +where again $\sigma(\cdot)$ is the sigmoid function. The latent variable $z_{it}$ is a function of the attributes of legislator $i$ and of Trump at day $t$ . As with the count model, we seek to employ a map that captures the interaction between the legislator and Trump embeddings, and thus we employ a weighted inner product. Additionally, we expect that legislators maintain a concrete bias towards Trump, which we include in the term $b_i$ for each legislator. Thus, we obtain the variable $z_{it}$ through the following map: + +$$ +z _ {i t} = g (\mathbf {v} _ {i}, \boldsymbol {\tau} _ {t}, b _ {i}) = \boldsymbol {\tau} _ {t} ^ {\top} \mathbf {H} _ {g} \mathbf {v} _ {i} + b _ {i} \qquad (4) +$$ + +where $\mathbf{H}_g\in \mathbb{R}^{K\times K}$ is a learned weight matrix. + +As with the count model, the sentiment model is trained by optimizing the negative log-likelihood of the sentiment-labeled tweets in the training set. With the predicted probability of the correct label, $p(y_{it} = l)$ , given by equation 3, and the set of all labeled tweets in the training set being $\mathcal{V}_{tr}$ then the total loss for the sentiment model is given by: + +$$ +\mathcal {L} _ {s e n t} = \sum_ {y _ {i t} \in \mathcal {Y} _ {t r}} \sum_ {l \in \{1, 2, \dots L \}} - \mathbb {I} \left(y _ {i t} = l\right) \log p \left(y _ {i t} = l\right) \tag {5} +$$ + +where $\mathbb{I}(\cdot)$ denotes the indicator function, in which $\mathbb{I}(\cdot) = 1$ when the argument is true and 0 otherwise. + +# 4.3 Trump Embedding Construction + +In the ideal point/vector models that consider roll call data, legislator behavior is a response to policies as captured by the text of bills. As we seek an alternative to legislation as a method of measuring + +preferences, we rely instead on Twitter behavior but similarly construct embeddings that legislators respond to. Since Donald Trump is our entity of investigation, we use the text of his tweets to construct such embeddings. + +To map Donald Trump's tweet text to a political embedding representation, we employ a Simple Word-Embedding Model (SWEM), (Shen et al., 2018). SWEMs rely upon word embeddings (Bengio et al., 2003; Mikolov et al., 2013) and pooling operations to encode the compositionality of text without the heavy parameterization required of such models as recurrent neural networks (RNNs, see Socher et al., 2011) or CNNs (Kalchbrenner et al., 2014; Kim, 2014). Endowing each word-token $u_{i}$ in a lexicon with an embedding $\mathbf{w}_i \in \mathbb{R}^d$ , we may represent a sequence of $n$ words as a matrix of stacked embeddings: $\{\mathbf{w}_1, \ldots, \mathbf{w}_L\} = \mathbf{W} \in \mathbb{R}^{n \times d}$ . To extract the most salient features from every word-embedding dimension, we employ a max-pooling operation, which amounts to a column-wise maximum of matrix $\mathbf{W}$ . Supposing that $\mathbf{W}_t$ contains the embeddings from all Donald Trump tweets on day $t$ , then we will denote $\alpha_t \in \mathbb{R}^d$ as the max-pooled vector. These text features are subsequently mapped to the daily Trump vector by an affine transformation: + +$$ +\boldsymbol {\tau} _ {t} = \mathbf {M} \boldsymbol {\alpha} _ {t} + \mathbf {a} \tag {6} +$$ + +where $\mathbf{M} \in \mathbb{R}^{d \times K}$ and $\mathbf{a} \in \mathbb{R}^K$ are a weight matrix and bias vector that are shared by all days $t$ . This transformation can be made more flexible by introducing a non-linear activation function, $\phi(\cdot)$ , such as the rectified linear unit (ReLU). This nonlinear "hidden" layer is described by: + +$$ +\boldsymbol {\tau} _ {t} = \mathbf {M} _ {2} \phi \left(\mathbf {M} _ {1} \boldsymbol {\alpha} _ {t} + \mathbf {a} _ {1}\right) + \mathbf {a} _ {2} \tag {7} +$$ + +where an additional weight matrix and bias vector have been appended. + +# 4.4 Model Training & Parameter Learning + +The parameters in the model to be learned include the legislator embeddings and biases, the word embeddings, the parameters of the maps to count and ordinal variables, and the parameters of the map from text features to Trump embeddings. We refer to this collection as $\Theta$ . The optimization objective is the combination loss of the negative-log likelihood of the count and ordinal models: + +$$ +\mathcal {L} (\Theta) = \gamma \mathcal {L} _ {\text {c o u n t}} + (1 - \gamma) \mathcal {L} _ {\text {o r d}} \tag {8} +$$ + +where $\mathcal{L}_{count}$ and $\mathcal{L}_{ord}$ are given by equations 2 and 5, respectively, and $\gamma$ is a hyperparameter that controls the relative importance of the two component losses. The construction of equation 8 allows the researcher to only admit tweet count information by setting $\gamma = 1$ and only admit tweet sentiment information by setting $\gamma = 0$ ; a balance may be achieved by choosing $\gamma \in (0,1)$ . The Adam algorithm (Kingma and Ba, 2015) is used for gradient-based optimization of 8 with a learning rate of $\eta = 10^{-4}$ . + +# 5 Predictive Results + +To demonstrate the efficacy of our model for legislator tweeting behavior with respect to President Donald Trump, we first show that the construction of Trump embeddings from the language of his own tweets provides an informational signal for legislators to react to. We train our model using the days for the training set and present the predictive results for days in the test set. Since the model seeks to capture two aspects of legislator tweeting behavior, we evaluate the model using two metrics: the negative-log likelihood of the count model and the mean-absolute-error (MAE) of the sentiment model. Overall model performance is also captured by the total loss of the model, which is the weighted negative-log likelihood of both the count and sentiment models, equation 8. MAE is used rather than accuracy to account for the ordinal nature of the sentiment model. + +The hyperparameter $\gamma$ controls the balance between the two components of our model, counts and sentiment. We present our results for three settings of $\gamma$ , which allows us to analyze the two components of our model separately before analyzing the joint model. A full description of the process used to tune hyperparameters and a comparison of the model with linear and nonlinear text maps can be found in Appendix B. For all results presented here, we set $K = 2$ , and use a linear text map. The number of epochs for which the model was trained varies depending on model setting, but in all cases each training batch comprises 128 tweets. The model was implemented in TensorFlow (Abadi et al., 2015) and trained on a single NVIDIA Titan X GPU. Code can be found on the author's Github at: github.com/gspell/CongressionalTweets. + +# 5.1 $\gamma = 1$ (only count model): + +When $\gamma = 1$ , only the loss from the part of the model that handles tweet counts contributes to the total loss in equation 8. We present the final negative log-likelihood of the count model for both the Poisson and Negative Binomial models described in Section 4.1, and for both the case in which the text of Donald Trump's tweets is used to construct his daily embedding representation and the case in which the Trump embeddings are free parameters of the model. For the negative binomial model, the model was trained for 75 epochs, which was the amount of training required to perform best on the validation (rather than test) set of tweets. The Poisson model was trained for 100 epochs while using the text and 2000 epochs without text. The predictive results are shown in Table 2. + +
TextNo Text
LossMAELossMAE
Poisson20,8820.69249,1280.693
Neg. Bin.16,6920.72618,4610.696
+ +Modeling legislator tweet counts using the Negative Binomial distribution achieves superior performance to modeling using the Poisson distribution, as the Negative Binomial can better accommodate the overdispersion in the tweet counts. Additionally, using the text of Donald Trump's tweets to construct his daily embedding that legislator embeddings interact with provides significantly better results than neglecting the text and allowing the Trump embeddings to be free parameters of the model. This effect is more pronounced for the Poisson distribution, but is present for the Negative Binomial model as well. Indeed, this aspect of the model is to be expected, since the model is evaluated on days of which there are no examples in the training set. Without using the text, there is no way for the model to represent an "unseen" day. + +# 5.2 $\gamma = 0$ (only sentiment model): + +When $\gamma = 0$ , only the loss from the part of the model that handles legislator tweet sentiment contributes to the total loss in equation 8. We present the final model loss — which is the negative log-likelihood of the sentiment model — as well as the model MAE. Again, we show results for the case + +in which Trump's tweet text is used to construct embeddings and the case in which the text is not used. We also toggle an additional model setting for analysis: the inclusion of the legislator bias term, $b_{i}$ , from equation 4. We adjust the number of epochs to 150 for training with text. We train the model without text for 1000 and 3000 epochs, including and excluding the legislator bias term, respectively. The results are presented in Table 3. + +Table 2: Predictive evaluation metrics on test for our model with $\gamma = 1$ . Note that because only the count loss is being optimized, MAE does not reflect model performance here. Best model result bolded. + +
TextNo Text
LossMAELossMAE
No Bias549.630.1401714.480.878
Bias548.800.140831.240.390
+ +Table 3: Predictive evaluation metrics on test for our model with $\gamma = 0$ . Best model result with respect to MAE is bolded. Comparison between the sentiment model with/without the legislator bias term as well as with/without Trump tweet text + +In addition to the MAE of the ordinal model, we note that the model accuracy — which is more intuitive but less exact than MAE — is $88.4\%$ for the best performing model, when both the legislator bias and Trump's tweet text are used. Note that when the text of Donald Trump's tweets is used, the model performs as well with respect to MAE with the inclusion of the legislator bias as without it. Additionally, when the bias term is included but Trump's text is excluded, the model is able to achieve better performance than when both the text and bias term are excluded. In fact, for the case of no Trump text and no legislator bias, the model is incapable of achieving test MAE better than how it performs upon initialization. We note that while the model does train, performance on the test (and validation) never improves in that case. + +Table 3 suggests that the legislator bias (when present) accounts for much of the model's ability to predict legislator tweet sentiment, since the model achieves decent results even when no Trump text is used to construct meaningful Trump embeddings to interact with the trained legislator embeddings. Without the bias term, the interaction between Trump and legislator embeddings is the only means toward predicting tweet sentiment, which is why the necessity of text is so critical in that case. + +# 5.3 $\gamma = 0.03$ (both counts & sentiment): + +For any other value of $\gamma \in (0,1)$ , the total loss in equation 8 will have contributions from both the count and sentiment losses, and thus both aspects of the model are trained jointly. Using the validation + +set, we determined that setting $\gamma = 0.03$ achieves a good balance between both the count and sentiment parts of the model $^{4}$ , obtaining a good MAE without neglecting modeling of the counts. Given the considerations discussed for $\gamma = 0,1$ , we only examine the Negative Binomial count model and the inclusion of the legislator bias term. When the model was trained using the text of Donald Trump's tweets, it was trained for 200 epochs, while it was trained for 1500 epochs when the text was not used, and the runtimes were 3.12 and 12.9 minutes, respectively. The joint model performance is shown in Table 4, with MAE, total loss, and unweighted count model negative log-likelihood shown. + +
Count NLLMAETotal Loss
No Text28,5710.2131583.97
Text16,7820.127994.76
+ +Table 4: Predictive evaluation metrics on test for our model with $\gamma = {0.03}$ . Best model result bolded + +As with the cases for $\gamma = 0,1$ , we have found that for our final model configuration with $\gamma = 0.03$ , model predictive performance is superior when Donald Trump's tweet text is used to construct his daily embedding representation. Additionally, the MAE on the test set for $\gamma = 0.03$ is less than the MAE for the case that $\gamma = 0$ when only the sentiment model is trained. This demonstrates that the inclusion of tweet count information mitigates sentiment prediction as well, since more information is being used to model legislators. + +# 6 Legislator Embeddings + +Training our legislator tweeting model yields a key byproduct: the legislator embeddings. As with previous spatial representations of legislator preferences, our model enables the visualization of the positions of legislators in space. In Figure 2 we plot the two dimensions of legislator embeddings from the model presented in Table 4.5 + +The most noticeable characteristic of the embeddings is how they separate legislators across party lines into Democrats and Republicans, even though party affiliations were not incorporated into the model. In the first dimension, senators are perfectly separated by party with the exception of five Democrats who have lower values on the first + +![](images/2604e4fd0ad3be693ab3f1b49eba806e323f734c749d8e0733266990bcfd0611.jpg) +Legislator Embeddings +Figure 2: Learned legislator embeddings. Legislators are identified by party, chamber, and the number of tweets authored about Trump. The darker points indicate known Senate Republican critics of Trump. + +embedding dimension than John McCain, the Republican Senator with the highest value: Dianne Feinstein, Heidi Heitkamp, Claire McCaskill, Angus King, and Joe Manchin. Excepting Dianne Feinstein, these senators are generally considered to be more conservative Democrats. + +In the figure we also see that embeddings are not simply an artifact of the number of tweets about Trump authored by the legislator, nor whether the legislator is a member of the House or Senate. Legislators with more extreme values of Twitter sentiment relative to other members of their party can be found in both chambers of Congress and range from having authored fewer than 100 tweets about Trump to over 500.[6] + +Another initial validating characteristic of the embeddings is the clustering of prominent Republican senators who have been publicly critical of Trump. We examine the spatial positions of Republican senators whom a 2017 Washington Post analysis identified as critical of the President based on their responses to controversial events in Trump's presidency, such as Trump's firing of FBI Director James Comey and response to the Charlottesville protests, as well as overall rhetoric used when discussing Trump (Lewis et al., 2017). The positions + +![](images/e204901bb6f33a90d1175238e5e9d09a02a5c2fe9354fd23864265a20f81e20d.jpg) +Comparisons of Embeddings with: DW-NOMINATE Voting with Trump + +![](images/7be5a41c63e31d76c1acaddb12d1299f8b5a3a4e417c586e0d0c99bcb5eb928d.jpg) +Figure 3: Comparisons of the learned legislator embeddings to DW-NOMINATE (left) and percentage of time voting with Trump (right) as measures of legislator preferences. + +of these senators are highlighted (dark black points) in Figure 2. These senators are clustered together in the two-dimensional embedding space: John McCain, Jeff Flake, Joe Hoeven, Bob Corker, Marco Rubio, Shelley Capito, Dean Heller, Dan Sullivan, Lamar Alexander, and Lisa Murkowski. + +Considering which Democratic legislators are interspersed near the cluster of Republicans in the two-dimensional embedding space is also informative. The two most extreme Democratic outliers were Angus King, an Independent Senator from Maine who caucuses with the Democratic party but has openly considered caucusing with the Republican party and Joe Manchin, a notably conservative Democratic senator in whose state Trump won $68.5\%$ of the vote. We observe fewer outliers among Republicans. Among the most extreme outliers, are Ileana Ros-Lehtinen and Carlos Curbelo, whose districts Hillary Clinton won in 2016 by 19.6 and 16.3 percentage points, respectively. Ros-Lehtinen, in particular, tweeted many scathing responses to Trump regarding his controversial stance on immigration. + +We next compare the embeddings to an existing measure of general legislator preferences. Figure 3 illustrates the relationship between the first dimension of DW-NOMINATE — a canonical measure of legislator ideology in political science — and the first dimension of our learned legislator embeddings. Generally, legislators who are ideolog- + +ically conservative have lower embedding values, whereas liberals have higher values. At the same time, this comparison does identify legislators who are more or less critical of Trump than might be expected based on ideology alone, thereby offering new empirical leverage to scholars examining the behavior and attitudes of legislators. + +Figure 3 also compares our legislator embeddings to an approximation of how legislators might feel toward Trump: the proportion of time that they vote in line with him during the period in which legislator tweets were collected. This metric was calculated using a dataset published by Fifthirtyeight and includes only legislation on which the Trump administration publicly expressed a clear position (Silver and Bycoffe, 2019). While this measure is limited by many of the same constraints as other vote-based measures (e.g., DW-NOMINATE), it is the closest existing measure of legislators' attitudes toward Trump. In the right panel of Figure 3, we observe little variation in the extent to which legislators vote with Trump, particularly for Republicans. Indeed, many of the President's most prominent critics frequently voted with the president during this time period. For instance, John McCain voted with Trump $85\%$ of the time, Bob Corker voted with Trump $84\%$ of the time, and Jeff Flake voted with Trump $83\%$ of the time. Meanwhile, we observe far more variation in legislator embeddings among both Republicans and Democrats. In Ap + +pendix C, we further compare our embeddings to alternative measures of legislative preferences: Campaign Finance Scores (Bonica, 2018) and Trump vote-share in a legislator's constituency during the 2016 presidential election. + +# 7 Conclusion + +In this paper, we modeled legislator tweeting behavior towards Donald Trump, predicting the frequency and sentiment of their tweets. The proposed model yields embedding representations for legislators that we interpret as measures of legislator attitudes towards Trump. Our application suggests that ideal points estimated from roll call votes can miss this critical aspect of political preferences for members of Congress. Whereas legislative voting might recover ideological similarities and differences with the president, it is not well suited to measure attitudes toward the president orthogonal to policy preferences, such as criticisms of his rhetoric and tone. To address this shortcoming and obtain representations of legislators' attitudes toward Trump, we have proposed a model that assigns a vector to each legislator based on the content of their tweets about Trump. We similarly represent Donald Trump with a vector for each day he tweets, constructed using the text of his daily tweets. Legislator vectors and Trump vectors interact to produce predictions of both the sentiment of legislator tweets about Donald Trump and the number of tweets produced each day. From this model we obtain representations of legislators that capture their attitudes toward the president. + +Our model's predictive performance is robust to a variety of settings and achieves sentiment predictive performance of 0.127 mean-absolute-error and $89.3\%$ accuracy, demonstrating its capability to predict legislator tweeting behavior. When visualizing the two dimensions of learned legislator embeddings we find that the model separates legislators across party lines (despite not being trained on the party of legislators) and groups together Republican senators who are well-known critics of Trump (despite overwhelmingly voting with him on legislation). + +Though our model demonstrates the capability of representing legislators' attitudes toward Trump and performs well with respect to predicting tweet counts and sentiment based upon Donald Trump's tweets, our method has some limitations. For one, as is the case for Rheault and Cochrane (2020), our + +model is not able to produce uncertainty bounds, as deriving uncertainty measures from neural networks remains an open area of research without a clear solution within the field of machine learning.7 An avenue for improving the model is to allow it to capture legislators' dynamic attitudes toward Trump over time. While legislator attitudes are currently modeled as static embeddings, allowing each legislator's embedding to change over time would enable the exploration of temporal dynamics and hypothesis testing about when legislators are more likely to tweet negatively about Trump, what factors contribute to a legislator's decision to tweet about Trump, and how the Trump's tweets interact with legislator's tweets over time. + +While our aims in this paper were to develop a method of modeling attitudes toward Trump beyond legislative policy preferences, this method can be used to test a wide range of hypotheses about modern U.S. politics. Legislator embeddings can be used to explore how legislators appeal to different audiences, such as party leaders and constituents. The method presented here could similarly be used to evaluate how members of Congress are punished and rewarded in elections for their criticism of praise of the president. Moreover, because our model does not rely on roll call votes, it can also be used to model attitudes by any of the growing number of political elites using Twitter, such as non-incumbent political candidates, state legislators, and pundits. Possible extensions of this work could investigate enriching Trump vectors by incorporating other sources of text, such as White House press releases and speeches. While we restrict ourselves to Twitter data in this paper to maintain consistency across the sources of data for vectors representing Trump and legislators, the incorporation of auxiliary text data could provide additional context. + +# Acknowledgments + +We thank Chris McCroskey, Tweet Congress, and Todd Shields for enabling access to the sample of legislator tweets. Gregory Spell thanks David Carlson for his invaluable mentorship and encouragement in practicing the craft of Deep Learning. + +# References + +Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. 2015. TensorFlow: Large-scale machine learning on heterogeneous systems. Software available from tensorflow.org. +Pablo Barbera. 2015. Birds of the same feather tweet together: Bayesian ideal point estimation using twitter data. Political Analysis. +Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Janvin. 2003. A neural probabilistic language model. The Journal of Machine Learning Research. +Adam Bonica. 2018. Inferring roll-call scores from campaign contributions using supervised machine learning. American Journal of Political Science. +Joshua Clinton, Simon Jackman, and Douglas Rivers. 2004. The statistical analysis of roll call data. *The American Political Science Review*. +Skyler J. Cranmer and Bruce A. Desmarais. 2017. What can we learn from predictive modeling? Political Analysis, 25(2):145-166. +Sean Gerrish and David M. Blei. 2011. Predicting legislative roll calls from text. International Conference of Machine Learning 28. +Sean Gerrish and David M. Blei. 2012. How they vote: Issue-adjusted models of legislative behavior. Advances in Neural Information Processing Systems 25. +Yupeng Gu, Yizhou Sun, Ning Jiang, Bingyu Wang, and Ting Chen. 2014. Topic-factorized ideal point estimation model for legislative voting network. KDD 2014. +P. A. Gutiérrez, M. Pérez-Ortiz, J. Sánchez-Monedero, F. Fernández-Navarro, and C. Hervás-Martínez. 2016. Ordinal regression methods: Survey and experimental study. IEEE Transactions on Knowledge and Data Engineering, 28(1):127-146. +Kosuke Imai, James Lo, and Jonathan Olmsted. 2016. Fast estimation of ideal points with massive data. American Political Science Review, 110(4):631-656. +Nal Kalchbrenner, Edward Grefenstette, and Phil Blumson. 2014. A convolutional neural network for + +modelling sentences. Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. Conference on Empirical Methods in Natural Language Processing. +Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. Proceedings of the 3rd Annual International Conference for Learning Representations. +Anastassia Kornilova, Daniel Argyle, and Vlad Eidelman. 2018. Party matters: Enhancing legislative embeddings with author attributes for vote prediction. Proceedings of the Conference for the Association for Computational Linguistics. +Peter Kraft, Hirsh Jain, and Alexander M. Rush. 2016. An embedding model for predicting roll-call votes. Proceedings of the Conference on Empirical Methods in Natural Language Processing. +Nicole Lewis, Amber Phillips, Kevin Schaul, and Leslie Shapiro. 2017. Where Republican senators stand on President Trump. Available online at https://www.washingtonpost.com/graphics/politics/senate-trump-support/?noredirect=on&utm_term=.711bfd810514. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Distributed representations of words and phrases and their compositionality. Advances in Neural Information Processing Systems. +Viet-An Nguyen, Jordan Boyd-Graber, Philip Resnik, and Kristina Miler. 2015. Tea party in the house: A hierarchical ideal point topic model and its applications to republican legislators in the 112th congress. Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics. +Keith T. Poole and Howard Rosenthal. 1997. Congress: A Political-Economic History of Roll Call Voting. Oxford University Press. +Daniel Preoticiuc-Pietro, Ye Liu, Daniel Hopkins, and Lyle Ungar. 2017. Beyond binary labels: political ideology prediction of twitter users. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 729-740. +Ludovic Rheault and Christopher Cochrane. 2020. Word embeddings for the analysis of ideological placement in parliamentary corpora. Political Analysis, 28(1):112-133. +Dinghan Shen, Guoyin Wang, Wenlin Wang, Martin Renqiang Min, Qinliang Su, Yizhe Zhang, Chunyuan Li, Ricardo Henao, and Lawrence Carin. 2018. Baseline needs more love: On simple word-embedding-based models and associated pooling + +mechanisms. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics. + +Nate Silver and Aaron Bycoffe. 2019. Tracking Congress In The Age Of Trump. Available online at https://projects.fivethirtyeight.com/ congress-trump-score/. + +Yanchuan Sim, Bryan Routledge, and Noah A. Smith. 2016. Friends with motives: Using text to infer influence on SCOTUS. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1724-1733, Austin, Texas. Association for Computational Linguistics. + +Richard Socher, Cliff Chiung-Yu Lin, Andrew Y. Ng, and Christopher D. Manning. 2011. Parsing natural scenes and natural language with recursive neural networks. Proceedings of the 28th International Conference on Machine Learning. + +Chris Tausanovitch and Christopher Warshaw. 2018. Does the Ideological Proximity Between Candidates and Voters Affect Voting in US House Elections? Political Behavior, 40(1):223-245. + +Eric Wang, Dehong Liu, Jorge Silva, David Dunson, and Lawrence Carin. 2010. Joint analysis of time-evolving binary matrices and associated documents. Advances in Neural Information Processing Systems 23. + +Yu Wang, Richard Niemi, and Jiebo Luo. 2016. Tactics and tallies: A study of the 2016 u.s. presidential campaign using twitter 'likes'. KDD. + +Zhengming Xing, Sunshine Hillygus, and Lawrence Carin. 2017. Evaluating U.S. Electoral Representation with a Joint Statistical Model of Congressional Roll-Calls, Legislative Text, and Voter Registration Data. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '17, page 1205-1214. + +# A Data Description + +In Section 3, we describe how tweets were selected for our dataset. We provide more information about the dataset here. In total, legislators sent 29,696 tweets about Trump. On average, each legislator sent 65.84 tweets about Trump, though there is substantial variation (standard deviation $= 88.78$ , median number of tweets about Trump $= 36.0$ ). + +Democratic legislators tweeted about Trump more than twice as much as Republicans. The mean number of tweets about Trump among Democrats was 97.12 (standard deviation $= 115.27$ ), but only 40.22 among Republicans (standard deviation $= 44.81$ ). In both cases, the mean was inflated by outliers with a large number of tweets (e.g., one Democrat authored 746 tweets about Trump and one Republican authored 288 tweets about Trump). Still, + +the median number of tweets among Democrats (56) was still substantially larger than among Republicans (27). Only $8.6\%$ of legislators had fewer than 5 tweets related to Trump. + +The 10 Republicans with the most tweets about Trump were, in order: Paul Ryan Bradley Byrne, Sean Duffy, Paul Gosar, Bill Flores, Orrin Hatch, Mitch McConnell, Roger Wicker, Steve Scalise, Kevin McCarthy. The 10 Democrats with the most tweets about Trump were: Donald Beyer, Betty McCollum, Yvette Clarke, Jerrold Nadler, Edward Markey, James McGovern, Nancy Pelosi, Tom Udall, Robert Case, Joseph Crowley. In both cases we observe leadership in both parties among the most frequent authors of tweets about the president. Perhaps unsurprisingly, the days with both the most positive and the most negative tweets about Trump were those in which Trump addressed Congress: his joint address on February 28, 2017 (597 positive, 288 negative) and the 2018 State of the Union (512 positive and 340 negative). + +Of the 29,696 Trump-related tweets from legislators, a subset of 4,661 tweets were randomly selected to be coded with respect to their sentiment about Trump. Five undergraduate research assistants were trained to categorize the sentiment of each tweet about Trump given the text of the tweet, the name of the legislator who sent it, and the legislator's party affiliation. A random $1\%$ sample of tweets was selected to be coded by each of the five coders in order to assess inter-coder reliability. The mean level of agreement in the coding of the tweets as positive, neutral, or negative was $91.7\%$ . A table describing the percentage breakdowns for the labeled tweet sentiment classes according to party is provided in Table 5. + +
% Positive% Negative% Neutral
Democratic1.5692.046.40
Republican81.872.1715.96
+ +Table 5: Breakdown of labeled tweet sentiment classes according to party + +See Section 3 for description of the splits into training, validation, and test datasets. + +# B Model Selection Decisions + +We examine our proposed model's performance under different hyperparameters, including the dimensionality of the latent political space and the parameter $\gamma$ that controls the tradeoff between the sentiment and count components of the model loss. + +We select model hyperparameters based upon performance on a held-out validation set. We described in Section 3 the creation of our validation dataset. Using a validation set allows for evaluation of the model as it is developed, without exposing the model to the test set. This practice prohibits overfitting by ensuring a tuned model generalizes to wholly unseen data. + +# B.1 Tuning Model Dimension + +We begin our selection of model hyperparameters with the model dimension: the dimension, $K$ , of the political space of the legislator embeddings and Trump embeddings. In choosing this dimension, we fix all other attributes of the model and sweep through a range of possible model dimensions. For our dimension sweep, we fixed $\gamma = 0.01$ . For each possible dimension, we fully train the model and obtain evaluative metrics - MAE on the labeled data, loss of the count model, and total loss - on the validation set. We then compare these metrics across dimension. + +In Figure 4, we show the three evaluation metrics across of sweep of dimensions from 1 to 64. Between particularly the metrics of count loss and MAE, there is a trend of sharp decrease between dimension 1 and 2 and then a less discernible trend between dimension and metric for dimensions greater than 2. This indicates that across model dimension (greater than $K = 2$ ), performance with respect to our evaluative metrics remains relatively consistent. This allows the researcher a degree of flexibility in choosing model dimension. We further note that the evaluation metrics across dimension do not necessarily increase or decrease together. This further obfuscates the choice in model dimension, since the researcher may value optimizing a different metric depending on the chosen application. For the work presented in this paper – with predictive results and legislator embeddings shown in Sections 5 and 6, respectively – we selected a dimension of $K = 2$ to balance multiple research-defined objectives: to balance MAE, total loss, and count loss; to facilitate comparison to canonical DW-Nominate legislator representations; + +to inhibit overfitting; and to allow for easy analysis. Furthermore, choosing $K = 2$ lends parsimony to our model without sacrificing performance across our evaluative metrics. We note that Cranmer and Desmarais (2017) discuss using predictive performance as an impartial means for choosing the parsimony of a model and refer interested readers to their discussion. + +# B.2 Tuning Loss Tradeoff Parameter $\gamma$ + +Similarly to tuning model dimension, $K$ , we tune the loss tradeoff parameter $\gamma$ by fixing all other attributes of the model and performing a sweep through a range of possible loss tradeoff values. We fixed the model dimension at $K = 2$ . As with tuning model dimension, we fully train the model at each possible tradeoff value, and we again evaluate using the metrics of MAE, loss of the count model, and total loss on the validation set. + +In Figure 5, we show the three evaluation metrics across of sweep of loss tradeoff values from 0.005 to 0.25. Unlike with model dimension, $K$ , there is a discernible trend between evaluative metrics and the tradeoff parameter as it is swept. To balance the tradeoffs between the count model and sentiment model, we choose $\gamma = 0.03$ for the predictive results presented in our paper. + +# B.3 Comparing Model with Nonlinear Map + +As mentioned in Section 4.3, when mapping from the text of Trump's tweets to an embedding representation for Donald Trump, we may insert a nonlinear hidden layer to the model on top of an affine transformation. In this appendix, we compare the performance of the affine model against using a nonlinearity. The nonlinearity that we investigate is the rectified linear unit (ReLU). + +Rather than comparing the affine and nonlinear models for only one dimension, we again perform a sweep over model dimension to investigate whether the superior model setting depends on region of the parameter space. In Figure 6, we show our three evaluation metrics, with a series for the model with and without the nonlinearity. The plots demonstrate that, in general, the affine model actually outperforms the nonlinear model. This is contrary to our initial expectation, since we would expect the nonlinear model to admit more flexibility, but given the results presented here, we use an affine model for our investigator in Sections 5 and 6. + +![](images/90821e81effaaac985ad768747f363b7bf3c6f1fd9b6000528de1c07a195b8bb.jpg) +Evaluation Metrics Across Model Dimension Sweep + +![](images/cfcada91ea1da3e953905b3dd349da28e0e8ccfc2c3173c2982e67805b7efcb9.jpg) + +![](images/adc48026f786723fc955ffcb1c27789b9fd36c6925f3b4b0ed2910993208b3b6.jpg) +Figure 4: Evaluation metrics for the Basic model across a sweep of different model dimensions + +![](images/3e425fa0a84d27985307183d517958f67a56a0ac3f5d00382c48944bc7e453e4.jpg) +Evaluation Metrics Across Loss Tradeoff Parameter + +![](images/5d42cc8559e88d39003d108a518a56a8c04c2a71e07211cf27420d8df0c0c131.jpg) + +![](images/5f2f716688f4047210564d439ac4a91794c2b7702c22f2bac5f6d9315180b114.jpg) +Figure 5: Evaluation metrics for the Basic model across a sweep of different loss tradeoff parameter values + +![](images/4211a319eb2d465cb2718222233f9aa62bede571863683619e9ab5179de01ee0.jpg) +Evaluation Metrics Across Model Dimension Sweep + +![](images/3af8a1fcee8b0a3a3cb4273ecdebd935c8925c560fdb0f898ac9452bb99eef3e.jpg) + +![](images/4612b83941f495b67f217d6bb74d62bcb63cce86e15cc10fe31e3959e6f25d3d.jpg) +Figure 6: Evaluation metrics for the nonlinear and affine models over a sweep of model dimension + +![](images/7480d1f38c50ed73dd06eacf7af15747ce7c47cd3a16baefec5d705e308afc64.jpg) +Comparison of Model Embeddings to Other Measures + +![](images/8f54f12c9938c79933ab960f861f3720ab215b523068d4149ce3de504b5a5163.jpg) +Campaign Finance Score + +2016 Trump Vote Margin in District +Figure 7: Comparisons of the learned legislator embeddings to general measures of legislator preferences and proxies for a legislator's support for Trump. +![](images/b53693bc0aef8bbe5aefd5cf2271f1ec1482754e868a8a0bfcd27a725c528901.jpg) +Party Democrats Republicans + +Voting Against Trump +![](images/2f6d30d826b94111dfdf40d0a9f6060a9e0923a4c3ae670f11335539b632b3df.jpg) +Chamber House Senate + +# C Comparison with Other Preference Measures + +In addition to the embedding comparisons provided in Section 6, we provide comparisons to Campaign Finance Scores Bonica (2018) and Trump's vote margin in the 2016 presidential election for each legislator's district or state, for representatives and senators, respectively. In the fourth panel of Figure 7 we observe a clear relationship between support for the president in the election and legislator embeddings—legislators representing constituencies that voted for Trump have lower embedding values. + +# D Legislator Embeddings with Labels + +We reproduce the plot of our model-learned embeddings from Section 6 with explicit labels for Republican senators whom a 2017 Washington Post analysis identified as critical of the President based on their responses to controversial events in Trump's presidency, such as Trump's firing of FBI Director James Comey and response to the Charlottesville protests, as well as overall rhetoric used when discussing Trump (Lewis et al., 2017). This is presented in Figure 8. + +![](images/f1d77a1733c690c21ccf61cb226d2e35883e760ab24ec2671dc41c63931a7a0f.jpg) +Legislator Embeddings +Figure 8: The two dimensions of learned legislator embeddings. Legislators are identified by party, chamber, and the number of tweets authored about Trump. The darker points represent the location of known Republican critics of Trump in the Senate. \ No newline at end of file diff --git a/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/images.zip b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b18189206064092d58eacd85ca046563b24a7cab --- /dev/null +++ b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d3dacdaab9d50a42b1dc9aab73f3d73c719f96e5c51ba647b558994ff01931f +size 475590 diff --git a/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/layout.json b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..50f1b7d5e543de0af45e3c174f444dca60b069be --- /dev/null +++ b/anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52e19d3c01fb756390e8aff0c18bca6b7ce0d41a7aed05a6527c991013adf6ef +size 452504 diff --git a/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_content_list.json b/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..14ad147e9baacebdfa4392013691181de6bda254 --- /dev/null +++ b/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8eb2e364ee4426a77d450297734520d5a998a59bb516df808a637147cd6028ef +size 75444 diff --git a/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_model.json b/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..753735b62954461e6fde56cddc0cb25cde395ce1 --- /dev/null +++ b/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:805f6ad8b1055cdd0a8f4069f6bbb877448fc73e2d31d88851a6f29548d4d95f +size 88610 diff --git a/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_origin.pdf b/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8ead6adba9fc6307a2845c51c10f49330b63c491 --- /dev/null +++ b/anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:680738177664439a67b334e1e1b967668e9a044a256a5546b5378f8b956d8a31 +size 579293 diff --git a/anempiricalinvestigationofcontextualizednumberprediction/full.md b/anempiricalinvestigationofcontextualizednumberprediction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..01582408fc14385ca5701e80b3e57edd61eb7e8a --- /dev/null +++ b/anempiricalinvestigationofcontextualizednumberprediction/full.md @@ -0,0 +1,341 @@ +# An Empirical Investigation of Contextualized Number Prediction + +Daniel Spokoyny + +Carnegie Mellon University + +dspokoyn@cs.cmu.edu + +Taylor Berg-Kirkpatrick + +UC San Diego + +tberg@ucsd.edu + +# Abstract + +We conduct a large scale empirical investigation of contextualized number prediction in running text. Specifically, we consider two tasks: (1) masked number prediction – predicting a missing numerical value within a sentence, and (2) numerical anomaly detection – detecting an errorful numeric value within a sentence. We experiment with novel combinations of contextual encoders and output distributions over the real number line. Specifically, we introduce a suite of output distribution parameterizations that incorporate latent variables to add expressivity and better fit the natural distribution of numeric values in running text, and combine them with both recurrent and transformer-based encoder architectures. We evaluate these models on two numeric datasets in the financial and scientific domain. Our findings show that output distributions that incorporate discrete latent variables and allow for multiple modes outperform simple flow-based counterparts on all datasets, yielding more accurate numerical prediction and anomaly detection. We also show that our models effectively utilize textual context and benefit from general-purpose unsupervised pretraining.1 + +# 1 Introduction + +Pretraining large neural architectures (e.g. transformers (Devlin et al., 2019; Raffel et al., 2019)) on vast amounts of unlabeled data has lead to great improvements on a variety of NLP tasks. Typically, such models are trained using a masked language modeling (MLM) objective and the resulting contextualized representations are finetuned for a particular downstream task like question answering or sentence classification (Devlin et al., 2019; Lan et al., 2020). In this paper, we focus on a + +related modeling paradigm, but a different task. Specifically, we investigate contextualized number prediction: predicting a real numeric value from its textual context using an MLM-style modeling objective. We conduct experiments on two specific variants: (1) masked number prediction (MNM), in which the goal is to predict the value of a masked number token in a sentence, and (2) numerical anomaly detection (NAD), with the goal of deciding whether a specific numeric value in a sentence is errorful or anomalous. In contrast with more standard MLM training setups, here we specifically care about the accuracy of the trained masked conditional distributions rather than the contextualized representations they induce. While successful models for these tasks are themselves useful in applications like typo correction and forgery detection (Chen et al., 2019), better models of numeracy are essential for further improving downstream tasks like question answering, numerical information extraction (Mirza et al., 2017; Saha et al., 2017) or numerical fact checking (Thorne and Vlachos, 2017), as well as for processing number-heavy domains like financial news, technical specifications, and scientific articles. Further, systems that detect anomalous numbers in text have applications in practical domains – for example, medicine (Thimbleby and Cairns, 2010) – where identification of numerical entry errors is critical. + +Our modeling approach to contextualized number prediction combines two lines of past work. First, following Chen et al. (2019), we treat number prediction as a sentence-level MLM problem where only numerical quantities are masked. However, Chen et al. (2019) focused on predicting the discrete exponent of masked numbers as a classification problem. In contrast, Spithourakis and Riedel (2018) demonstrate the utility of predicting full numerical quantities in text, represented as real numbers, but do so in a language modeling frame + +work, conditioned only on left context. Here, we propose a novel setup that combines full-context encoding (i.e. both left and right contexts) with real-valued output distributions for modeling numerical quantities in text. In Figure 1, we illustrate an example where we aim to predict "2 trillion" as a quantity on the real number line. + +We expand upon past work by conducting a large scale empirical investigation that seeks to answer three questions: (1) Which encoding strategies yield more effective representations for numbers in surrounding context? (2) Which encoding architectures provide the best representations of surrounding context? (3) What are the most effective real-valued output distributions to model masked number quantities in text? To answer these questions, we propose a suite of novel real-valued output distributions that add flexibility through the use of learned transformation functions and discrete latent variables. We conduct experiments for both MNM and NAD tasks on two large datasets in different domains, combining output distributions with both recurrent and transformer-based encoder architectures, as well as different numeric token encoding schemes. Further, while Chen et al. (2019) studied a specific type of NAD (detecting exaggerated numbers in financial comments), we examine several NAD variants with different types of synthetic anomalies that are found to arise in practice across different domains of data. Finally, we further compare results with a strong discriminative baseline. + +# 2 Models + +Our goal is to predict numbers in their textual contexts. The way we approach this is similar to masked language modeling (MLM), but instead of masking and predicting all token types, we only mask and predict tokens that represent numeric values. For example in Figure 1 we wish to predict that the value of the masked number [#MASK] should be $2 \times 10^{12} \in \mathbb{R}$ given the surrounding context. + +For notational simplicity, we describe our model as predicting a single missing numeric value in a single sentence. However, like other MLMs (see section 4.3), during training we will mask and predict multiple numeric values simultaneously. Let $\mathbf{X}$ be a sentence consisting of $N$ tokens where the $k$ th token is a missing numerical value, $y$ . The goal of our model is to predict the value of $y$ con + +ditioned on $X$ . We will use common notation for from similar setups and simply treat the $k$ th token in $X$ as a masked numeric value, [MASK]. + +Our models $P_{\theta, \gamma}(y | X)$ consist of three main components: an input representation of the sentence, a contextual encoder with parameters $\gamma$ which summarizes the sentence, and an output distribution with parameters $\theta$ over the real number line. In this section we will describe our strategies for numerical input representation, the two types of contextual encoders we use, along with different formulations of numerical output distributions. + +# 2.1 Input Context Representation + +We first describe the input representation for the textual context $X$ that will be passed into our model's encoder. We let $x_{i}$ represent the $i$ th token in the input sequence. Like related MLMs that leverage transformers (which is one type of encoder we consider in experiments) we separate the representation of $x_{i}$ into several types of embeddings. We include a positional embedding $e^{\mathrm{Pos}}$ and a wordpiece token embedding $e^{\mathrm{TOK}}$ like the original BERT. We also introduce our new numeric value embedding $e^{\mathrm{NUM}}$ to help us learn better numerical representations. Finally, as shown in Figure 1, the input representation for token $x_{i}$ is the sum of these three H-dimensional embeddings. + +If the token at position $i$ represents a numerical quantity, we replace it with a special symbol [#MASK], and represent its numerical value using $e_i^{\mathrm{NUM}}$ . We use the extraction rules detailed in Section 3.1 to find the numbers in our input sequence. In the next section we will describe two strategies for numerical representation $e^{\mathrm{NUM}}$ . + +# 2.1.1 Digit-RNN Embedding + +The large range $\left([1, 1e^{16}]\right.$ in our data) of numerical values prevents them from being used directly as inputs to neural network models as this results in optimization problems due to the different scales of parameters. One strategy to learn embeddings of numerical values has been shown by Saxton et al. (2019) which used character-based RNNs to perform arithmetic operations such as addition and multiplication. We conduct experiments with a similar strategy and represent each number in scientific notation (d.ddde+d) with 6 digits of precision as + +![](images/1385b9e582adca18087751adf16408c07e717019b402b025413a7290b95b1bcd.jpg) +Figure 1: Outline of our model architecture consisting of a sentence representation $X$ which is fed to the encoder with parameters $\gamma$ and an output distribution over the real number line with parameters $\theta$ . In this example our masked numerical objective is to predict the masked out "2 trillion" quantity $y$ . Note that our model is able to use a numerical embedding of the unmasked input $3 * 10^7$ value ("thirty million") as part of the context. + +a string. We then use a digit-RNN to encode the string and use the last output as $e^{\mathrm{NUM}}$ . + +# 2.1.2 Exponent Embedding + +A simpler approach to represent numbers would be to explicitly learn embeddings for their magnitudes. Magnitudes have been shown to be a key component of the internal numerical representation of humans and animals (Ansari, 2016; Whalen et al., 1999; Dehaene et al., 1998). We conduct experiments with an encoding scheme that learns embeddings for base-10 exponents. + +# 2.2 Context Encoder + +The encoder's goal is to summarize the surrounding text, along with other numbers that appear therein. We define $\pmb{H} = f_{\gamma}(\pmb{X})$ where the encoder $f_{\gamma}$ is a function of the context $\pmb{X}$ , and $\pmb{H}$ is the hidden representation of the encoder's last layer. Next, we describe two encoder architectures: a transformer and a recurrent approach. + +# 2.2.1 Transformer Encoder + +Transformer architectures pretrained on vast amounts of data have led to breakthroughs in textual representation learning (Yang et al., 2019; Liu et al., 2019; Lan et al., 2020; Raffel et al., 2019). We use the 12-layer BERT-base architecture (Devlin et al., 2019) with the implementation provided by Huggingface (Wolf et al., 2019). We use the original BERT's word-piece vocabulary with 30,000 tokens and add a new [#MASK] token. + +# 2.2.2 BiGru Encoder + +Previous methods focusing on the related task of predicting the order of magnitude of a missing number in text showed that RNNs were strong models for this task (Chen et al., 2019). In our real-valued output task we use a bidirectional Gated Recurrent Unit (BiGRU), the best performing model from Chen et al. (2019). We use a one-layer BiGRU with a 64-dimensional hidden state and a dropout layer with a 0.3 dropout rate. We use the same pretrained word-piece embeddings from BERT as this allows us to directly compare the two encoders. + +# 2.3 Real-valued Output Distributions + +In early experiments, we observed that simple continuous distributions (e.g. Gaussian or Laplace) performed poorly. Since numbers can have ambiguous or underspecified units, and further, since numbers in text are heavy-tailed, asymmetric or multi-modal output distributions may be desirable. For this reason, we propose several more flexible output distributions, some which include learned transforms and others which include latent variables (both well-known methods for adding capacity to real-valued distributions), to parameterize $P(y|\mathbf{X})$ . + +# 2.3.1 Log Laplace + +A common method for constructing expressive probability density functions is to pass a simple density through a transformation (e.g. a flow or invertible mapping function). As an initial example (and our first output distribution), we describe the log Laplace distribution as a type of flow. Since + +![](images/dd0e9e97ab4ff5683cbf222bc258e57d8a7f1074125c79b912e923cb8e90953c.jpg) +(a) Transformed Laplace +Figure 2: Left (a): We depict our LogLP and FlowLP graphical models along with the latent and output distributions. Right (b): Probabilistic graphical model of our latent DExp model. + +![](images/b415edf3e46f2ed035198ef3d10b7d23e140bb01e4133d4adc77ed86d21ccde2.jpg) +(b) Latent Exponent + +numbers in text are not distributed evenly on the number line due to a long tail of high magnitudes, a simple trick is to instead model the log of numeric values. If the base distribution is Laplace, this yields a log Laplace distribution, which we describe next as an exponential transformation. + +In Figure 2, we illustrate our LogLP model with a continuous intermediate variable $z$ , encoder $f_{\gamma}$ with $\exp$ as the transformation, $g_{\theta}$ , and consequently $\log$ as $g_{\theta}^{-1}$ . In equation 1 we show our generative process and training objective where both $g_{\theta}$ and $g_{\theta}^{-1}$ are deterministic functions with no parameters. We let $\mu_{\theta}(\pmb{H})$ denote a single layer MLP that outputs the location parameter of the base Laplace distribution on $z$ , which is transformed to produce the output variable, $y$ . More precisely: + +# Generative Process: + +$$ +z \sim L a p l a c e (\mu_ {\theta} (H), 1) +$$ + +$$ +y = g _ {\theta} (z) = \exp z +$$ + +# Training Objective: + +$$ +g _ {\theta} ^ {- 1} (y) = \log y +$$ + +$$ +\log P (y \mid \mathbf {X}) = - \left| g _ {\theta} ^ {- 1} (y) - \mu_ {\theta} (H) \right| - C + \log J _ {d e t} (y) +$$ + +$$ +\log J _ {d e t} (y) = \log \left| \frac {d g ^ {- 1}}{d y} (y) \right| = \log \left| \frac {1}{y} \right| \tag {1} +$$ + +# 2.3.2 Flow-transformed Laplace + +The exp transformation may not be the ideal choice for our data. For this reason we consider a parameterized transform (flow) to add further capacity to the model. For our purposes, we are restricted to 1-dimensional transformations $g: \mathbb{R} \to \mathbb{R}$ . Further, by restricting the class of functions, we ensure an efficient way of computing the log-derivative of the inverse flow, which allows us to efficiently compute likelihood. We conduct experiments with the + +simple parameterized flow described in Equation 2. We use a single layer MLP to independently predict each parameter $a, b, c$ from $\pmb{H}$ , the output of $f_{\gamma}(\pmb{X})$ . We also scale the range of $b, c$ to be between [0.1, 10] using a Sigmoid activation. Similarly to the LogLP setting, $\mu_{\theta}(\pmb{H})$ is a single layer MLP which predicts the location parameter of the Laplace. + +# Generative Process: + +$$ +z \sim L a p l a c e (\mu_ {\theta} (H), 1) +$$ + +$$ +y = g _ {\theta} (z) = \frac {\exp (\frac {z - a}{b})}{c} +$$ + +# Training Objective: + +$$ +g _ {\theta} ^ {- 1} (y) = a + b \log c y +$$ + +$$ +\log P (y \mid \mathbf {X}) = - \left| g _ {\theta} ^ {- 1} (y) - \mu_ {\theta} (H) \right| - C + \log J _ {d e t} (y) +$$ + +$$ +\log J _ {d e t} (y) = \log \left| \frac {d g ^ {- 1}}{d y} (y) \right| = \log \left| \frac {b}{y} \right| \tag {2} +$$ + +This parameterization of flow is designed to allow for (1) re-centering of the input variable (via parameter $a$ ), (2) re-scaling of the input (via parameter $b$ ), and (3) re-scaling of the output (via parameter $c$ ). Together, this leads to a family of inverse flows that are all log-shaped (i.e. they compress higher values), yet have some flexibility to change intercept and range. + +# 2.3.3 Discrete Latent Exponent + +While $FlowLP$ adds flexibility over the $LogLP$ model, both have the drawback of only being able to produce unimodal output distributions. A well-established approach to parameterizing multimodal densities is to use a mixture model. The mixture component is determined by a discrete latent + +variable in contrast with the continuous intermediate variable introduced in the flow-based models. In Figure 2 we show our $DExp$ model where $e$ represents an exponent sampled from a multinomial distribution, and $m$ is the mantissa sampled from a truncated Gaussian. + +Prior work has shown the effectiveness of cross-entropy losses on numerical training (Saxton et al., 2019; Chen et al., 2019). For this reason we use a truncated Gaussian on the range of [0.1,1] to generate $m$ , which effectively restricts back-propagation to a single mixture component for a given observation. The combination of exponent and mantissa prediction allows us to benefit from the effectiveness of cross-entropy losses, while at the same time getting more fine-grained signal from the mantissa loss. In Equation 3 we show the DExp generative process and training objective. We let $\pi_{\theta}(\pmb{H})$ denote a single layer MLP that outputs the multinomial parameters of $P(e|X)$ . Similarly, we let $\mu_{\theta}(\pmb{H},e)$ denote a two layer MLP with a [.1,1] scaled Sigmoid that outputs the mean parameter of the mantissa normal distribution. + +# Generative Process: + +$$ +e \sim M u l t (\pi_ {\theta} (H)) +$$ + +$$ +y \sim \mathcal {N} _ {\text {t r u n k} [ 0. 1, 1 ]} \left(\mu_ {\theta} (H, e), 0. 0 5\right) +$$ + +# Training Objective: + +$$ +e ^ {*} (y) = \left\lfloor \log_ {1 0} (y) \right\rfloor +$$ + +$$ +\begin{array}{l} \log P (y \mid \mathbf {X}) = \log \left[ P \left(e = e ^ {*} (y)\right) \right. \\ \left. \cdot \frac {1}{C} \exp \left(- 1 0 \left(\frac {y}{1 0 ^ {e * (y)}} - \mu_ {\theta} (H, e ^ {*} (y))\right) ^ {2}\right) \right] \tag {3} \\ \end{array} +$$ + +# 2.3.4 Gaussian Mixture Model + +Inspired by the best performing model from Spithourakis and Riedel (2018) we also compare with a Gaussian mixture model (GMM). This model assumes that numbers are sampled from a weighted mixture of $K$ independent Gaussians. During training the mixture from which a particular point was sampled from is not observed and so it is treated as a latent variable. We can optimize the marginal log-likelihood objective by summing over the $K$ mixtures. In equation 4, GMM has $K$ mixtures parameterized by $K$ means and variances $\mu, \sigma$ , respectively. Following Spithourakis and Riedel (2018), we pre-train the parameters $\mu, \sigma$ on all the numbers in our training data $\mathcal{D}$ using EM. The means and variances are then fixed and our masked number prediction model only predicts mixture weights during training and inference. We let $\pi_{\theta}(\pmb{H})$ denote a single layer MLP that outputs the mixture + +weights $P(e|X)$ + +# Generative Process: + +$$ +\begin{array}{l} \mu = \left[ \mu_ {1}, \mu_ {2}, \dots \mu_ {k} \right]; \sigma = \left[ \sigma_ {1}, \sigma_ {2}, \dots \sigma_ {k} \right] \\ e \sim M u l t (\pi_ {0} (H)) \\ y \sim \mathcal {N} (\mu_ {e}, \sigma_ {e}) \\ \end{array} +$$ + +Training Objective: + +$$ +\log P (y \mid \mathbf {X}) = \log \sum_ {k = 1} ^ {K} \left[ P (e = k) \cdot \frac {1}{C} \exp \left(\frac {- \left(y - \mu_ {k}\right) ^ {2}}{2 \sigma_ {k} ^ {2}}\right) \right] \tag {4} +$$ + +# 3 Data + +Financial news Financial news documents are filled with many different ratios, quantities and percentages which make this domain an ideal testbed for MNM. The FinNews is a collection of 306,065 financial news and blog articles from websites like Reuters4. We randomly break the documents into [train, valid, test] splits with [246065, 30000, 30000] respectively. + +Since FinNews has many occurrences of dates and years, we also evaluate on a subset corpus, FinNews-\$, to measure effectiveness at modeling only dollar quantities in text. FinNews-\$ is constructed exactly as FinNews , with the added requirement that the number is preceded by a dollar sign token (\$. For all training and testing on FinNews-\$, we only predict dollar values. + +Academic papers Academic papers have diverse semantic quantities and measurements that make them an interesting challenge numeracy modeling. For this reason, we also use S2ORC, a newly constructed dataset of academic papers (Lo et al., 2020). We use the first 24,000 full text articles, randomly splitting into [20000, 2000, 2000] [train, valid, test] splits. We refer to this dataset as Sci. All three datasets follow the same preprocessing discussed below and summary statistics are provided in Table 1. + +# 3.1 Preprocessing + +Financial news, academic papers, and Wikipedia articles all have different style-guides that dictate how many digits of precision to use or whether certain quantities should be written out as words. While such stylistic queues might aid models in better predicting masked number strings, we are + +specifically focused on modeling actual numeric values for two reasons: (1) reduced dependence on stylistic features of the text domain leads to better generalization to new domains, and (2) the numerical value of a numeric token conveys its underlying meaning and provides a finer-grained learning signal. For example currencies are usually written as a number and magnitude like \(32 million however, many quantities can be written out as cardinals sixty thousand trucks. We normalize our input numbers so that changing the style from five to 5 does not change our output predictions. + +As exemplified in Figure 1, the aim of our approach is to incorporate both numbers as context and numbers as predictions (i.e. 2 trillion and thirty million in the example). For this reason, before tokenization we employ heuristics to combine numerals, cardinals and magnitudes into numerical values, whilst removing their string components. We also use heuristics to change ordinals into numbers. By following this normalization preprocessing procedure we get higher diversity of naturally occurring quantitative data and mitigate the bias towards some particular style guide. + +For both FinNews and Sci we lowercase the text and ignore signs $(+, -)$ , so all numbers are positive and restrict magnitudes to be in $[1, 1e^{16}]$ . We discard sentences that do not have numbers or where the numbers are outside of our specified range. We also filter out sentences that have less than eight words and break up sentences longer than 50 words. We do not use the special token [SEP] and all examples are truncated to a maximum length of 128 tokens. + +# 4 Experiments + +In this section we explain our experimental setup, starting with our evaluation metrics, implementation details, results, and ablation analyses. We use the following naming convention for models: we specify the encoder (BiGRU, BERT) first, followed by one of our four output distributions (LogLP, FlowLP, DExp, GMM). + +# 4.1 Evaluation + +For the MNM task on $\mathcal{D}_{\mathrm{valid}}$ and $\mathcal{D}_{\mathrm{test}}$ splits we randomly select a single number to mask out from the input and predict. We let $\hat{y}$ denote the model's arg max prediction from $P(y|\mathbf{X})$ and $y$ as the ac + +tual observed number. In equation 5 and 6 we show how we calculate log-MAE (LMAE) and exponent accuracy $(E - Acc)$ , both of which use log base 10. + +$$ +L M A E = \frac {1}{\left| \mathcal {D} _ {\text {t e s t}} \right|} \sum_ {\mathcal {D} _ {\text {t e s t}}} \left| \log y - \log \hat {y} \right| \tag {5} +$$ + +$$ +E - A c c = \frac {1}{\left| \mathcal {D} _ {\text {t e s t}} \right|} \sum_ {\mathcal {D} _ {\text {t e s t}}} \mathbb {1} \left[ \left\lfloor \log y \right\rfloor = \left\lfloor \log \hat {y} \right\rfloor \right] \tag {6} +$$ + +# 4.2 Numerical Anomaly Detection + +Both LMAE and $E$ -Acc metrics test the model's argmax prediction and not the entire $P(y|\mathbf{X})$ distribution. We next consider the NAD task where our models need to discern the true number versus some anomaly. We let $\tilde{y}$ denote an anomaly and describe two different ways, [string, random], we construct an anomalous example. For string we use the true $y$ and randomly perform one of three operations [add, del, swap]: inserting a new digit, deleting an existing digit, and swapping the first two digits respectively. For random, we randomly sample a number from the training data $\mathcal{D}$ as our anomaly. We choose these string functions as they constitute a large part of numerical entry errors (Thimbleby and Cairns, 2010; Wiseman et al., 2011). Further, random mimics a copy-paste error. We report the AUC of a ROC curve for both types as random-anomaly (R-AUC) and string-anomaly (S-AUC) respectively, using the model's output density to rank the true value against the anomaly. + +# 4.3 Implementation Details + +We train all models with stochastic gradient descent using a batch-size of 32 for 10 epochs. We use early stopping with a patience of three on the validation loss. For pretrained BERT encoder experiments, we use two learning rates $\{3e^{-5}, 1e^{-2}\}$ for all pretrained parameters and newly added parameters respectively. For all non-pretrained BERT experiments and all BiGRU encoders we use a single learning rate of $2e^{-2}$ . + +Devlin et al. (2019) propose a two step process to generate masked tokens. First, select tokens for masking with an independent probability of $15\%$ . Second, for a selected token: With $80\%$ probability replace it with a [MASK], $10\%$ replace it with a random token, and $10\%$ leave it unchanged. Since there are fewer numbers than text tokens, we use a higher probability of $50\%$ for selection. We follow a similar strategy for masking numbers: $80\%$ of the time masking out the number, $10\%$ of the time + +
FinNewsFinNews-\$Sci
trainvalidtesttrainvalidtesttrainvalidtest
#instances522996580956443318828622338232813605143652336104
avg-length102.5108.3108.9115.2115.4116.1125.6126.4126.5
%numbers8.89.39.613.012.713.27.17.27.1
min1.01.01.01.01.01.01.01.01.0
median 50313.0250.0329.02016.02016.02016.09.08.09.0
median 753141.02558.03500.0~ 10^4~ 10^4~ 10^442.040.043.0
median 90~ 10^6~ 10^6~ 10^6~ 10^7~ 10^7~ 10^71959.01948.01972.1
max~ 10^15~ 10^14~ 10^15~ 10^15~ 10^14~ 10^15~ 10^15~ 10^14~ 10^15
+ +Table 1: Statistics on our datasets. The top half of the table reveals the number of examples per data split, the average length of sentences, and the fraction of tokens that are numbers. The bottom half shows summary statistics for number values in both datasets. + +randomly substituting it with a number from train, and $10\%$ of the time leaving it unchanged. + +Baselines: We also consider a fully discriminative baseline trained to predict real vs. fake numbers with binary cross entropy loss. The negative numerical samples are randomly drawn from training set numbers to match exactly the random-anomaly task. During training each positive datum has one negative example and is trained in the same batch-wise fashion. When this model uses exponent embeddings for output numbers, $emb_{exp}$ , we can also calculate the exponent accuracy by selecting the exponent embedding with highest model score as a predicted value. We include this approach in experiments as a non-probabilistic alternative to our four output distributions. + +# 4.4 Results + +We ran all combinations of encoders and output distributions using input exponent embeddings on FinNews and show the results in Table 2. We train the GMM model with four different settings of $K \in \{31, 63, 127, 255\}$ and report results for the highest-performing setting. + +Comparing the two encoders, we find that BERT results in stronger performance across all metrics and all output distributions. Although both settings share the same pretrained embedding layers, the pretrained transformer architecture has higher capacity and is able to extract more relevant numerical information for both MNM and NAD. + +We find that the parameterized FlowLP model was generally better across all metrics under both encoders compared to the LogLP model. With the weaker BiGRU encoder, the LogLP model's S-AUC is only 0.04 better than random guessing. + +The $DExp$ model was the best performing output distribution across all metrics and both encoders, yielding on average $10\%$ higher $E$ -Acc and a gain of 0.13 on AUC. This means that $DExp$ had the best overall fit in terms of the predicted mode (arg max) as well as the overall density $P(y|\mathbf{X})$ . + +In contrast, GMM, which is also a discrete latent variable model capable of outputting a multimodal distribution, underperformed across all metrics. There was little effect from adjusting the number of mixture components, with slight improvements using more mixtures. One possible reason for the GMM model's worse performance is that the mixtures are fit and fixed before training without any of the surrounding textual information. Quantities such as dates and years have many textual clues, but the model's initial clustering may group them together with other quantities. We also found that, empirically, optimization for this model was somewhat unstable. + +Finally the Disc baseline was the second best performing model on NAD, though on MNM it showed worse $E$ -Acc than LogLP and FlowLP models. This baseline benefited from being directly trained for NAD, which may explain it's underperformance on MNM metrics. Due to the comparatively worse performance of both the BiGRU encoder and the GMM output distribution, we exclude them from the remainder of our experiments. + +# 4.5 Ablations + +Ablations on Numerical Embedding We select our best performing model, BERT-DExp, and ablate the numerical input representation on FinNews. We compare using $emb_{dig}$ , $emb_{exp}$ , and a version of ExpBert which has no numerical input representation. The top half of Table 3 displays the results. + +
ModelLMAE↓E-Acc ↑r-AUC↑s-AUC↑
Train-Mean7.691.03--
Train-Median1.885.52--
BiGRU-Disc-55.80.7560.646
BiGRU-LogLP0.67158.80.6750.548
BiGRU-FlowLP0.62261.80.6940.591
BiGRU-DExp0.57671.50.8430.821
BERT-Disc-62.70.7620.656
BERT-GMM K=2551.1821.30.5850.440
BERT-LogLP0.566664.90.6860.557
BERT-FlowLP0.573265.50.7170.609
BERT-DExp0.50074.60.8610.828
+ +Table 2: Results on FinNews where all models use input exponent embeddings $emb_{exp}$ and all BERT encoders are pretrained. We also include the mean and median number from training $\mathcal{D}$ as simple baselines. + +
Ablation TypeLMAE↓E-Acc ↑r-AUC↑s-AUC↑all-LMAE↓all-E-Acc ↑
Numerical Input Embedding
BERT-DExp (All #'s Masked)0.65666.50.8310.8090.65666.5
BERT-DExp + embexp0.50074.60.8610.8280.88862.2
BERT-DExp + embdig0.50674.40.8580.8260.92062.1
BERT-DExp + embdig + embdig0.49874.90.8610.8280.89962.3
No Pretraining
BERT-DExp + embexp0.61568.80.8400.8100.88960.6
BERT-FlowLP + embexp0.76957.90.6700.5630.86154.4
BERT-Disc + embexp-26.90.6320.599--
BERT-LogLP + embexp0.63063.20.6780.5500.85057.1
+ +Table 3: Ablation on FinNews dataset. The top half of the table shows the effect of the numerical input representation. The bottom half shows performance for models trained from scratch, without leveraging pretrained BERT parameters. + +We see that $emb_{dig}$ and $emb_{exp}$ perform equally well. Using no input number embeddings reduces performance by $8\%$ on $E$ -Acc and 0.03 AUC on both anomaly metrics. We also see that there is no benefit from combining both of these input representations, which implies that the model is able to extract similar information from each. + +Ablations One-vs-All To measure our model's effectiveness at using the other numbers in the input we construct an ablated evaluation $All$ , where all input numbers are masked out. In Table 3 we see that all models that have a numerical embedding suffer a performance drop of around $12\%$ $E$ -Acc and an increase of 0.4 on LMAE. This suggests that the model is in fact using the other quantities for its predictions. We also find that the model with no input number embeddings does better on the All setting since it was effectively trained with fully masked input numbers. + +Ablations on Pretraining In the bottom half of Table 3, we compare the effect of starting from a pretrained transformer versus training from scratch. We see that training from scratch hurts all models + +by around $6\%$ on $E$ -Acc and 0.02 on $R$ -AUC. We also note that BERT-LogLP seems least affected, dropping only $1\%$ on $E$ -Acc. + +Modeling Additional Domains In this section we explore how different models behave on the alternative domain of academic papers, and how modeling is affected by focusing only dollar quantities in financial news. In Table 4, we show results for pretrained BERT encoder models with input exponent embeddings, trained and evaluated on Sci and FinNews- $\$ 6$ datasets. + +On the Sci data, the generative models have similar performance on LMAE and $E$ -Acc. We further find that BERT-DExp is still the best performing model across most metrics on both Sci and FinNews- $data. The BERT-Disc baseline, which is directly trained to predict anomalies, is consistently the second best across all datasets on NAD. Finally, we find that the FinNews-$ is the most challenging of the three datasets, with BERT-DExp dropping on $E$ -Acc by $20\%$ compared to FinNews data. This supports our initial reasoning that the distribution of dollar amounts is more difficult to characterize than other quantities, such as dates, which tend to cluster to smaller ranges. + +
ModelFinNews-\$Sci
LMAE↓E-Acc ↑r-AUC↑s-AUC↑LMAE↓E-Acc ↑r-AUC↑s-AUC↑
BERT-Disc-46.90.8280.588-68.80.7220.657
BERT-LogLP1.0443.60.6410.5280.37478.20.6240.609
BERT-DExp0.9156.90.8670.6780.38581.00.7860.836
BERT-FlowLP1.1139.30.5380.5180.37477.60.6580.672
+ +Table 4: Results on FinNews-\$ and Sci where all models use input exponent embeddings $emb_{exp}$ and all BERT encoders are pretrained. + +# 5 Related Work + +Math & Algebraic Word Problems: There is a wide literature on using machine learning to solve algebraic word problems (Ling et al., 2017; Roy and Roth, 2016; Zhang et al., 2019), building novel neural modules to directly learn numerical operations (Trask et al., 2018; Madsen and Johansen, 2020) and solving a variety of challenging mathematical problems (Saxton et al., 2019; Lee et al., 2020; Lample and Charton, 2020). In these tasks, numbers can be treated as symbolic variables and computation based on these values leverages a latent tree of arithmetic operations. This differs from our task setting since there is no "true" latent computation that generates all the quantities in our text given the available context. + +Numerical Question Answering The DROP dataset (Dua et al., 2019) is a new dataset that requires performing discrete numerical reasoning within a traditional question answering framework. Andor et al. (2019) treat DROP as a supervised classification problem, while recent work by Geva et al. (2020) show how synthetic mathematical training data can build better numerical representations for DROP. Unlike work on DROP, our primary focus is on the task of contextualized number prediction and numerical anomaly detection in text, which involve correlative predictions based on lexical context rather than concrete computation. + +String Embeddings Recently, word and token embeddings have been analyzed to see if they record numerical properties (for example, magnitude or sorting order) (Wallace et al., 2019; Naik et al., 2019). This work finds evidence that common embedding approaches are unable to generalize to large numeric ranges, but that character-based embeddings fare better than the rest. However, this line of work also found mixed results on overall numeracy of existing embedding methods and further investigation is required. + +Numerical Prediction Spithourakis and Riedel (2018) trained left-to-right language models for modeling quantities in text as tokens, digits, and real numbers using a GMM. Our empirical investigation focuses on MNM and considers both left and right contexts of numbers, along with a broader class of generative output distributions. Chen et al. (2019) predict magnitudes of numbers in text and also consider a type of NAD to detect numerical exaggerations on financial data. However, this modeling approach is restricted: it can only distinguish anomalies that result in a change of exponent. In contrast, our real-valued distributions allow us to focus on a broader suite of harder anomaly detection tasks, such as random substitutions and string input error. + +# 6 Conclusion + +In this work we carried out a large scale empirical investigation of masked number prediction and numerical anomaly detection in text. We showed that using the base-10 exponent as a discrete latent variable outperformed all other competitive models. Specifically, we found that learning the exponent representation using pretrained transformers that can incorporate left and right contexts, combined with discrete latent variable output distributions, results is the most effective way to model masked number quantities in text. Future work might explore combining more expressive flows with discrete latent variables. + +# Acknowledgements + +We thank Volkan Cirik and the anonymous conference reviewers for providing valuable feedback. This project is funded in part by the NSF under grants 1618044 and 1936155, and by the NEH under grant HAA256044-17. The first author is supported in part by an NSF GRFP. Findings and observations do not necessarily reflect the views of funding agencies. + +# References + +Daniel Andor, Luheng He, Kenton Lee, and Emily Pitler. 2019. Giving bert a calculator: Finding operations and arguments with reading comprehension. In EMNLP/IJCNLP. +Daniel Ansari. 2016. Number symbols in the brain. In Development of Mathematical Cognition, pages 27-50. Elsevier. +Chung-Chi Chen, Hen-Hsen Huang, Hiroya Takamura, and Hsin-Hsi Chen. 2019. Numeracy-600K: Learning numeracy for detecting exaggerated information in market comments. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6307–6313, Florence, Italy. Association for Computational Linguistics. +Stanislas Dehaene, Ghislaine Dehaene-Lambertz, and Laurent Cohen. 1998. Abstract representations of numbers in the animal and human brain. Trends in Neurosciences, 21:355-361. +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. +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 Proc. of NAACL. +Mor Geva, Ankit Gupta, and Jonathan Berant. 2020. Injecting numerical reasoning skills into language models. In ACL. +Guillaume Lample and François Charton. 2020. Deep learning for symbolic mathematics. In International Conference on Learning Representations. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. Albert: A lite bert for self-supervised learning of language representations. ArXiv, abs/1909.11942. +Dennis Lee, Christian Szegedy, Markus Rabe, Sarah Loos, and Kshitij Bansal. 2020. Mathematical reasoning in latent space. In International Conference on Learning Representations. +Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunson. 2017. Program induction by rationale generation: Learning to solve and explain algebraic word problems. arXiv preprint arXiv:1705.04146. +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. +Kyle Lo, Lucy Lu Wang, Mark Neumann, Rodney Kinney, and Daniel S. Weld. 2020. S2ORC: The Semantic Scholar Open Research Corpus. In Proceedings of ACL. +Andreas Madsen and Alexander Rosenberg Johansen. 2020. Neural arithmetic units. In International Conference on Learning Representations. +Paramita Mirza, Simon Razniewski, Fariz Darari, and Gerhard Weikum. 2017. Cardinal virtues: Extracting relation cardinalities from text. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 347-351, Vancouver, Canada. Association for Computational Linguistics. +Aakanksha Naik, Abhilasha Ravichander, Carolyn Rose, and Eduard Hovy. 2019. Exploring numeracy in word embeddings. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3374-3380, Florence, Italy. Association for Computational Linguistics. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv e-prints. +Subhro Roy and Dan Roth. 2016. Solving general arithmetic word problems. arXiv preprint arXiv:1608.01413. +Swarnadeep Saha, Harinder Pal, and Mausam. 2017. Bootstrapping for numerical open IE. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 317-323, Vancouver, Canada. Association for Computational Linguistics. +David Saxton, Edward Grefenstette, Felix Hill, and Pushmeet Kohli. 2019. Analysing mathematical reasoning abilities of neural models. In International Conference on Learning Representations. +Georgios P Spithourakis and Sebastian Riedel. 2018. Numeracy for language models: Evaluating and improving their ability to predict numbers. arXiv preprint arXiv:1805.08154. +Harold Thimbleby and Paul Cairns. 2010. Reducing number entry errors: solving a widespread, serious problem. Journal of the Royal Society Interface, 7(51):1429-1439. +James Thorne and Andreas Vlachos. 2017. An extensible framework for verification of numerical claims. In Proceedings of the Software Demonstrations of the 15th Conference of the European Chapter of the Association for Computational Linguistics, pages 37-40, Valencia, Spain. Association for Computational Linguistics. + +Andrew Trask, Felix Hill, Scott E Reed, Jack Rae, Chris Dyer, and Phil Blunsom. 2018. Neural arithmetic logic units. In Advances in Neural Information Processing Systems, pages 8035-8044. +Eric Wallace, Yizhong Wang, Sujian Li, Sameer Singh, and Matt Gardner. 2019. Do nlp models know numbers? probing numeracy in embeddings. In Empirical Methods in Natural Language Processing. +John Whalen, Charles R Gallistel, and Rochel Gelman. 1999. Nonverbal counting in humans: The psychophysics of number representation. *Psychological science*, 10(2):130-137. +Sarah Wiseman, Paul Cairns, and Anna Cox. 2011. A taxonomy of number entry error. In Proceedings of HCI 2011 The 25th BCS Conference on Human Computer Interaction 25, pages 187-196. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In NeurIPS. +Dongxiang Zhang, Lei Wang, Luming Zhang, Bing Tian Dai, and Heng Tao Shen. 2019. The gap of semantic parsing: A survey on automatic math word problem solvers. IEEE transactions on pattern analysis and machine intelligence. \ No newline at end of file diff --git a/anempiricalinvestigationofcontextualizednumberprediction/images.zip b/anempiricalinvestigationofcontextualizednumberprediction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8580db7cedfd6ad65666912945e207e7b5fcdfdd --- /dev/null +++ b/anempiricalinvestigationofcontextualizednumberprediction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7d8aa082fbdef9b028bbc874656cf18a9aa18cb4cd9ee36afc4fc4f0500f5d8c +size 386604 diff --git a/anempiricalinvestigationofcontextualizednumberprediction/layout.json b/anempiricalinvestigationofcontextualizednumberprediction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6f7c41f6a9037cc051d6783b6db64d502b9e1a3a --- /dev/null +++ b/anempiricalinvestigationofcontextualizednumberprediction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8c353e9361b358511ad893518a3fa55f680ee71fde719ac1f33afd7305c98c4 +size 378211 diff --git a/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_content_list.json b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..4188b7fa44981a07855bd49063190b481b9e1dcd --- /dev/null +++ b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dabd45fda090ddd80ae849343e612a910292cccd1a9f3a5619824c0496867720 +size 78955 diff --git a/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_model.json b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_model.json new file mode 100644 index 0000000000000000000000000000000000000000..557f2e43c78f5eddf046a2bbb07a1484fc4fe04f --- /dev/null +++ b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae77e77dbc20baaa3eff4261b43ec907aaea6bf073a26d1f7f57978ad500d8e1 +size 94983 diff --git a/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_origin.pdf b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0db512d5f84b10e228009152261c9809e3aacf31 --- /dev/null +++ b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dba3f60b65427c7b20360e6071218880470bc301758b18cd67bfbebb07b17c65 +size 1234712 diff --git a/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/full.md b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6a48bd0456db39a5ac026486a28699c4fcba9c7d --- /dev/null +++ b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/full.md @@ -0,0 +1,304 @@ +# An Empirical Investigation Towards Efficient Multi-Domain Language Model Pre-training + +Kristjan Arumae, Qing Sun, & Parminder Bhatia + +Amazon + +Seattle, USA + +{arumae, qinsun, paramib}@amazon.com + +# Abstract + +Pre-training large language models has become a standard in the natural language processing community. Such models are pretrained on generic data (e.g. BookCorpus and English Wikipedia) and often fine-tuned on tasks in the same domain. However, in order to achieve state-of-the-art performance on out of domain tasks such as clinical named entity recognition and relation extraction, additional in domain pre-training is required. In practice, staged multi-domain pre-training presents performance deterioration in the form of catastrophic forgetting (CF) when evaluated on a generic benchmark such as GLUE. In this paper we conduct an empirical investigation into known methods to mitigate CF. We find that elastic weight consolidation provides best overall scores yielding only a $0.33\%$ drop in performance across seven generic tasks while remaining competitive in bio-medical tasks. Furthermore, we explore gradient and latent clustering based data selection techniques to improve coverage when using elastic weight consolidation and experience replay methods. + +# 1 Introduction + +Transformer (Vaswani et al., 2017) based language modeling has taken over many previous pretraining and initialization approaches (Devlin et al., 2019; Radford et al., 2019; Yang et al., 2019; Liu et al., 2019). Fine-tuning using these architectures yields state-of-the-art results in the order of a few hours. The caveat to these models is that the initial training can be on the scale of many days if not weeks, distributed across multiple GPUs (Strubell et al., 2019), a costly endeavour. + +Pre-trained language models are adapted to perform strongly in more specific domains as well. For example, while the original BERT models (Devlin et al., 2019) were trained on English Wikipedia articles and BooksCorpus (Zhu et al., 2015), the + +![](images/4f6ed31e2eb8f38158db9419561c377b0aa0d9c811796596d682b674bea5a873.jpg) +Figure 1: Traditional approaches (top) train independent domain specific language models (newswire, bio-medical, and clinical) which share no cross domain knowledge. They are further fine-tuned on their respective in-domain tasks. Our approach (bottom) shows how several domains are introduced in sequence, with knowledge retention using mitigation techniques across all domains. Here the final model has the capability to properly fine-tune on any domain specific task. + +same masked language modeling was continued on bio-medical data. BioBERT (Lee et al., 2019) was trained using Pubmed abstracts and full articles, meanwhile Clinical BERT (Alsentzer et al., 2019) was further refined using MIMIC-III clinical notes (Johnson et al., 2016). Evidence suggests that understanding the syntactic structure of scientific literature and clinical data from pre-training boosts performance in their respective downstream tasks (Peng et al., 2019). Pre-training is performed with the expectation of building robust, high capacity generalized language models which continue to absorb new domain knowledge. + +Unfortunately, continual learning (Ring, 1997) suffers from catastrophic forgetting (McCloskey and Cohen, 1989; Ratcliff, 1990) when incorporating domain data in a sequential manner. Parameters shift towards capturing the current task (or domain) and if previous data is no longer available the model will lose representation of it. For + +many tasks the straightforward solution is to combine datasets during training and approach this as a multi-task learning (MTL) (Ruder, 2017) problem. Mixing data has the desired effect of constraining parameters to find a space where both tasks reach close to optimal performance. + +We argue that these expensive pre-trained models are an example where MTL is not feasible in practice for several reasons. Time and hardware accessibility are the largest constraints for developing such systems. Access to large scale training data is generally not possible (Radford et al., 2019; Devlin et al., 2019), and exact training configurations are equally difficult to gather with results being arduous to reproduce. Resource usage has recently been criticized from another perspective as well. Strubell et al. (2019) show that as deep neural architectures in the natural language community grow we increasingly trade results for carbon emissions. + +Our work conducts an empirical investigation into suitable methods for multi-domain pre-training in a continual learning setting. We focus our efforts towards three methods: (i) elastic weight consolidation (EWC), (ii) learning rate control (LRC), and (iii) experience replay (ER). EWC (Kirkpatrick et al., 2017) is a parameter constraining method, an upgrade to vanilla regularization (e.g. $L_{2}$ ). LRC is borrowed from stage two of ULMFiT (Howard and Ruder, 2018) pre-training as a data independent method. Finally, as a scaled back version of MTL we investigate experience replay (ER), reintroducing data at a fixed scale from previous domains during pre-training. Furthermore we explore data selection approaches to improve efficiency for both ER, and EWC. + +Our goal is to understand the trade-offs across these models in terms of resources and setup. To this end we conduct experiments across multiple domain shifts while pre-training. To evaluate the efficacy of the methods we use downstream finetuning tasks in the domains we study. To better understand how knowledge across domains is transferred, we perform layer-wise analysis and observe that outer layer are the most transferable. + +Our contributions are as follows: + +- We provide empirical evidence of catastrophic forgetting mitigation with experience replay, learning rate control, and elastic weight con + +solidation, applied towards large scale language model pre-training. To this we add multiple domain shifts into bio-medical, and clinical data. + +- We explore various data selection approaches for both elastic weight consolidation and replay based models. +- We investigate layer-wise understanding for continual pre-training across several domains to understand how best to mitigate forgetting and transfer knowledge understanding. + +# 2 Continual Learning + +We empirically study three forms of mitigation for catastrophic forgetting. Constraint based training in the form of EWC and learning rate control, and experience replay. + +# 2.1 Elastic Weight Consolidation + +EWC makes use of a simple Bayesian factorization of model representation (Kirkpatrick et al., 2017). This isolates the posterior of a learned task (A) while maintaining the objective of a current task (B). Due to the intractability of the true posterior, EWC makes use of a Fisher information (Frieden, 2004) matrix diagonal to approximate the effect of Task A on the parameters of a model. Intuitively speaking, if a parameter had a large effect on task A the Fisher value would be small yielding low variance to adapt to task B. This holds true inversely for when the Fisher value is large. + +In practice, we initialize the Fisher matrix using gradients calculated with data sampled from Task A, which has already converged (Spall, 2005). This is demonstrated in Eq. 1 where $i$ and $j$ index parameters and data samples respectively. + +$$ +F _ {i, i} = \frac {1}{N} \sum_ {j = 1} ^ {N} \left(\frac {\partial \mathcal {L} _ {A} ^ {(j)}}{\partial \theta_ {i}}\right) ^ {2} \tag {1} +$$ + +$$ +\mathcal {L} (\theta) = \mathcal {L} _ {B} (\theta) + \sum_ {i} \lambda F _ {i, i} \left(\theta_ {i} - \theta_ {A, i} ^ {*}\right) ^ {2} \tag {2} +$$ + +The full objective for task B is given in Eq. 2 where $\mathcal{L}_B(\theta)$ is the loss function of Task B, and EWC is represented as the second term regularizing model parameters. Specifically by weighting the shift of model parameters while training on Task B (here $\theta_{i}$ and $\theta_{A,i}^{*}$ being the currently updated and frozen Task A parameters at index $i$ respectively). The EWC objective component is further adjusted by the hyperparameter $\lambda$ . + +
ModelCoLASST-2MRPCSTS-BQQPMNLIQNLIRTEWNLI
BERTBASE57.8292.0986.7488.1387.4984.0190.7964.9853.52
BioBERT37.7889.6888.4487.4086.9683.1989.7960.2928.17
Delta20.042.41-1.690.730.530.821.014.6925.35
+ +Table 1: Performance drop of BioBERT after further pre-training on Pubmed articles. The last row shows a positive value indicating the degree to which performance has dropped, and a negative value when it has increased. + +# 2.2 Learning rate control + +Our approach models the second stage of ULMFiT (Howard and Ruder, 2018), namely target task finetuning. We begin with a layer wise modifications by applying a decaying learning rate as a function of layer depth moving from the last layer towards model input. + +$$ +\eta^ {(l - 1)} = \frac {\eta^ {(l)}}{\rho} \tag {3} +$$ + +Here $\eta$ , $l$ , and $\rho$ denote learning rate, layer index and decay rate respectively. Depth plays a factor in our model since the network consists of 14 layers (i.e. 12 transformer layers, one layer for input, and one for the LM head). + +# 2.3 Experience Replay + +Given a replay buffer of a fixed, limited size we empirically investigate sample efficiency over a number of heuristic data selection methods. We focus our attention on how best to select data for this buffer, hypothesizing that domain coverage will increase performance. Recent work (de Masson d'Autume et al., 2019) has shown how this is crucial in strict lifelong learning when updating a fixed buffer size. + +# 3 Catastrophic Forgetting in Language Modeling + +We motivate our own experiments by first exploring off-the-shelf models to get a sense of the problem. To this end we fine tuned a $\mathrm{BERT}_{\mathrm{BASE}}$ architecture on all nine GLUE (Wang et al., 2018) tasks. These were compared directly against BioBERT, which has been further trained on full Pubmed articles. As reported in Table 1 an overall trend of performance deterioration is apparent with a relative increased error of $7.64\%$ in the bio-medical model. Furthermore, we observed that on tasks which BERT struggles with, such as CoLA and WNLI, the performance decrease is amplified when switching pre-training domains. + +# 4 Experimental Details + +We first cover the data domains, fine-tuning tasks, and general modeling setup used in both our heuristic search as well as our main experiments in Section 6.2.2. + +# 4.1 Pre-training Data + +We processed publicly available bio-medical and non-bio-medical corpora for pre-training our models. For non-bio-medical data, we use BookCorpus and English Wikipedia data, CommonCrawl Stories (Trinh and Le, 2018), and OpenWebText (Gokaslan and Cohen, 2019). This combined corpus contains roughly 18B tokens. For bio-medical data, we use full Pubmed2 articles which we processed to remove all tables, references, equations, and figures. This yields a dataset of over 4B tokens. For all datasets we retain training, validation, and test splits sampled at the document level with a respective ratio of 8:1:1. + +# 4.2 Evaluation Data + +We report the average accuracy across GLUE (Wang et al., 2018) tasks to track the performance of the model on generic natural language understanding. For measuring performance on GLUE, we further limit the selection of tasks to be the five most deteriorated (i.e. CoLA (Warstadt et al., 2018), SST-2 (Socher et al., 2013), MNLI (Williams et al., 2018), QNLI (Rajpurkar et al., 2016) and RTE (Giampiccolo et al., 2007)). Tasks such as $\mathrm{QQP^3}$ and MRPC (Dolan and Brockett, 2005) are generally robust against domain change and perform well regardless of initialization. These five tasks reflect our findings from Table 1. Additionally we evaluate on CoNLL-03 (Tjong Kim Sang and De Meulder, 2003) named entity recognition (NER), and SQuAD 1.1 (Rajpurkar et al., 2016) question answering (QA). To demon + +strate domain shift we evaluate using BC5CDR (Li et al., 2016), Chemprot (Krallinger et al., 2017) and BioASQ (Nentidis et al., 2019) which are biomedical NER, relation extraction (RE), and QA tasks respectively. The first dataset is from the 2015 CDR challenge for identifying chemicals and diseases expertly annotated from Pubmed abstracts ${}^{4}$ . Chemprot contains annotations of chemical-protein reactions, also taken from Pubmed articles. Finally BioASQ appears in our paper using the same format and splits as described by Gu et al. (2020). Namely QA is treated as a binary classification of whether the answer to the query exists in the provided context. + +# 4.3 Modeling + +For modeling we use the RoBERTa architecture (Liu et al., 2019), and implement EWC, learning rate control, and experience replay changes directly into the model5. This extension of the original BERT removed next sentence prediction and is trained using only masked language modeling using very large batch sizes. We utilize all training hyperparameters as provided by Liu et al. (2019) unless otherwise noted, and use RoBERTaBASE as parameter initialization for all experiments. As a form of deterioration understanding, we continue to train a model using Pubmed articles (denoted as PMC) with no mitigation techniques. + +# 5 Data Selection Methods + +Data selection is an important component of both supervised, and unsupervised training. In our case, there is an abundance of data to build both the Fisher matrix, as well as the replay buffer. To do this efficiently for EWC and ER we need to severely restrict the number of datapoints we utilize. For example a mere $1.0\%$ of generic pre-training data makes up over 400k segments. We require this subset to be comprehensively representative of the domain. Therefore, rather than randomly sampling data, we can use model generated features to induce better coverage of previous domains. + +# 5.1 Gradient Analysis + +We begin by treating the sum of squared gradients as a one-dimensional feature for data selection. The generic data is a skewed distribution with a mean at + +
Sampling TypeGLUESQuADAvg.
RoBERTa BASE87.5690.2088.00
RoBERTa PMC83.0088.7383.95
ERRandom84.2389.4385.10
High84.5987.9985.15
Low83.9988.9784.82
Uniform84.6989.7085.53
EWCRandom86.9390.3287.50
High87.0890.2787.61
Low86.6490.4987.28
Uniform87.0390.4387.60
+ +Table 2: Four sampling techniques used for pre-training and evaluated on GLUE and SQuAD 1.1. The results are compared against RoBERTa $\mathrm{BASE}$ and an unmitigated model trained on Pubmed articles (denoted using PMC). The average column takes into account each of the individual GLUE tasks. + +$1.04e^{7}$ and a standard deviation and max values of $4.89e^{8}$ , and $1.82e^{11}$ respectively. The lower bound is, of course, 0 and arguably the samples closer towards that bound are more representative of the model in its generic state given this long tail. + +To be thorough we sampled data from this domain in four different ways: (i) randomly, (ii) low, (iii) high, and (iv) uniformly. For low and high sampling we order the samples according to this feature value and slice the list from the front or back. For uniform sampling we bin the data according to the gradient value, and sample from the bins uniformly, whereas random sampling is performed by treating all samples equally. For each of these experiments we sample $0.1\%$ of the total corpus (roughly 42k segments). Furthermore in the same way that ER uses data to construct the replay buffer, EWC uses the samples to build the Fisher diagonal. We therefore test each sampling method across both mitigation techniques. + +To test the effectiveness of our methods we pretrain RoBERTa $\mathrm{BASE}$ on one epoch of Pubmed data (with and without mitigation) and test retention performance by fine-tuning our models across GLUE and SQuAD 1.1. Looking at Table 2 we see that above all, using low gradients is the least useful signal. For ER, using uniform rather than low value selection has an average performance increase of 0.71 points. The other methods fall in line with uniform sampling indicating that including samples with larger gradients is helpful in representing of the source domain. EWC appears to be more robust + +
PCAGMMER Avg.EWC Avg.
^S50585.0487.46
501085.6787.25
100585.4687.61
1001085.7487.28
AVG. POOL50585.0687.24
501085.0487.20
100584.9687.83
1001085.3987.24
+ +Table 3: GLUE and SQuAD average performance for both ER and EWC when using two pooling techniques. + +to data sampling with lower variance (1.8e-2 vs. 6.4e-2 for ER) across all models, with high and uniform selection improving most. + +# 5.2 Sampling Latent Clusters + +We further investigate more feature-rich representations in the form of sentence embeddings. Aharoni and Goldberg (2020) have demonstrated that transformer based LMs exhibit a keen ability to distinguish domains via clustering. The pre-training data for RoBERTa also comes from a variety of sources, with variation in prose, diction, and formality. We therefore cluster this data to see both how it is distributed and if uniformly sampling from these groups yields good performance for both EWC and ER. + +Aharoni and Goldberg (2020) used average pooling across the last encoder layer to represent each segment, we test this method against using the vector representation of $\langle s \rangle$ ([CLS] in BERT) since it is frequently used in practice for sentence labeling. We then use PCA (Wold et al., 1987) to reduce the dimensionality to $d \in \{50, 100\}$ and apply a Gaussian Mixture Model (Reynolds, 2009) using $k \in \{5, 10\}$ as the number of clusters. + +The resulting experiments for both ER and EWC can be seen in Table 3. Using PCA at 100 provides higher metrics for both ER and EWC, while the number of clusters for GMM does not give an interpretable signal across the experiments. + +We note that from a practical perspective it is much faster to process data using clustering than gradients, largely due to the ability to batch data for clustering. Accumulating gradients for 1MM samples takes roughly five days using an NVIDIA V100, whereas acquiring latent representations from the same amount of data finishes in less than + +four hours (this does not account for PCA and clustering which takes an additional four to five hours). + +# 6 Mitigation of Catastrophic Forgetting + +We provide results for one and two stage domain shifts as given by fine-tuning tasks. Again, we apply mitigation only to pre-training and express our model performance by using them to fine-tune downstream tasks. + +# 6.1 Setup + +For a baseline and potential upper bound of performance we train a multi-domain learning (denoted as MDL) model which utilizes the full combined generic and bio-medical training sets as input data. For EWC (+EWC) we tune both $\lambda$ [0.5, 1.0, 5.0, 10.0], and the size of the data used for fisher initialization [0.1%, 1.0%, 10.0%]; best values are underlined. For experience replay (+ER) we experiment with mixing non-bio-medical data (the same subset used for EWC init.) in each batch with a ratio proportional to their sizes. Additionally we showcase both a gradient based sampling (denoted with a subscript unif), and the GMM-PCA (subscript GMM) ( $k = 5$ , $d = 100$ ) for both ER and EWC. We tuned the decay rate, $\rho$ in Eq. 3 [1.3, 1.7, 2.6] for LRC. + +# 6.2 Results + +Our experimental results are reported in Table 4. The first two rows contain the off-the-shelf RoBERTa as well as the PMC setting which received no catastrophic forgetting mitigation when further trained on bio-medical data. The lower section lists all mitigation based experimental settings as described above. For all models pre-trained using Pubmed data we fine-tune on tasks after a single epoch of pre-training. + +We divide columns by task domain. The first three tasks (i.e. GLUE, SQuAD, and CoNLL) cover generic domain understanding. Just as in Section 5.1 we use the five worst GLUE tasks. For an overall understanding of forgetting we provide the average across all generic tasks. bio-medical tasks are displayed next followed by overall performance weighing the bio-medical and generic tasks equally $^{6}$ . NER and RE scores are reported using micro- $F_{1}$ ; all GLUE tasks we report accuracy on + +
Modelgenericbio-medicalOverall
GLUESQuADCoNLLAvg.BC5CDRChemprotBioASQAvg.
RoBERTa_BASE87.5690.2090.1188.3084.9463.2775.4174.6981.49
PMC83.0088.7387.3584.4486.6865.1375.4175.7480.09
MDL84.8988.9289.7286.1585.7665.1675.4175.4480.79
PMC +LRC86.7890.3589.7687.7285.4762.3075.4174.3981.05
PMC +ERunif84.6989.7089.1086.0487.2067.4077.1377.2481.64
PMC +ERGMM84.2588.5089.7885.6586.8363.7082.4277.6581.65
PMC +EWCunif87.0390.4389.7787.9086.2365.9079.7377.2882.59
PMC +EWCGMM87.0890.2290.4688.0186.0565.5076.1875.9081.96
+ +Table 4: Single stage domain adaptation. Other than RoBERTa $\mathrm{BASE}$ , each model is pre-trained further on one epoch of bio-medical data. We average generic performance across five GLUE tasks, as well as QA (from SQuAD), and NER (CoNLL). The average across generic tasks considers all nine tasks equally. bio-medical performance is for BC5CDR (NER), Chemprot (RE), and BioASQ (QA) with the overall performance being the mean for bio-medical and generic averages. + +the development set; SQuAD is evaluated using $F_{1}$ ; BioASQ uses accuracy. + +# 6.2.1 Catastrophic Forgetting + +Unsurprisingly among the first two rows RoBERTa BASE performs best overall on generic tasks with an average performance increase of $4.47\%$ over the unmitigated (PMC) model. Conversely it underperforms on the bio-medical tasks, validating the need to further pre-train on domain specific data. When averaging across the three bio-medical tasks the PMC model has a 1.05 point $F_{1}$ edge. It should be noted here that four of the models achieved the same BioASQ $F_{1}$ score, this was not reported in error. + +# 6.2.2 Mitigation Based Models + +EWC and LRC both respond well during domain shifts, are our best candidates for combating catastrophic forgetting, and average only half a point in deterioration amongst the three of them when compared against RoBERTa $\mathrm{BASE}$ . LRC has the benefit of tuning a single hyperparameter, the decay rate $(\rho)$ . Due to the depth of the models we found that a high value $(\rho = 2.6)$ yields a model which has a negligible drop in performance for generic tasks (with an average of 88.28) but had a more difficult time with later domains. + +We observed during hyper-parameter optimization that EWC was quite sensitive to $\lambda$ values. With higher coefficients ( $\lambda > 1.0$ ) EWC was able to halt deterioration nearly completely but performed quite poorly on bio-medical tasks. To better understand the importance of the Fisher values, we trained EWC with no Fisher (i.e. removing $F_{i,i}$ from Eq. 2). We found that this resulted in less competitive bio-medical results (averaging $3.68\%$ worse + +than the listed bio-medical EWC scores, and having overall the worst scores for both bio-medical tasks across all models), illustrating that giving equal weight to all the parameters results in poor generalization across source and target domains. MDL performed surprisingly average compared to the resource trade-off of the model. While it does produce better results than RoBERTa $\mathrm{BASE}$ in the bio-medical domain, the model struggles to retain generic knowledge. Experience replay grapples most with domain retention and produced the highest mitigated BC5CDR, Chemprot, and BioASQ results coupled with the lowest generic results. + +When comparing sampling techniques across a larger number of fine-tuning experiments we echo results from Section 5. Experience replay is stronger when using gradient based sampling, while EWC functions better using clustered latent representations. Therefore, in practice, we would suggest latent representations for better efficiency. + +# 6.2.3 Two Stage Domain Adaptation + +To further evaluate mitigation methods we continue pre-training models using clinical data. We chose the clinical domain since although it may appear close to bio-medical text, health records have been shown to differ drastically in prose and diction even when the underlying information may be similar (Gu et al., 2020). We processed 659M tokens of de-identified clinical notes and continued training using the PMC +LRC, PMC +ER_unif, and PMC +EWC_GMM from Table 4 (with this stage of model denoted with a subscript 2). RoBERTa_BASE is the untouched model as presented in Table 4, and we continue to train (unmitigated) the PMC model from the same table (now denoted as PMC, clin.). We evaluate models on RE and NER from the i2b2 + +
ModelGenericbio-medicali2b2 NERi2b2 READE REClin. Avg.Overall
RoBERTa BASE88.3074.6981.1277.1687.8282.0381.67
PMC, clin.82.9876.5385.9679.4488.9684.7981.43
LRC287.4774.3385.0377.9386.8483.2681.69
ER284.5175.8585.1679.2088.2384.2081.52
EWC286.9975.0485.4379.5986.0783.4781.91
+ +Table 5: Averaged performance for all generic, and bio-medical tasks (i.e. as seen in Table 4). Clinical average is across i2b2 NER and RE as well as n2c2 ADE RE are given as Micro- $F_{1}$ + +challenge after 5 epochs7. Additionally we use the n2c2 adverse drug reaction (ADE) (Henry et al., 2020) RE task. + +Stage two results are reported in Table 5. The last column in this table indicates that average overall performance is about the same across models, however, when we take a closer look at the domain breakdown we see this is not the case. As expected the unmitigated model (PMC, clin.) suffers from performance deterioration in generic tasks, with GLUE dropping drastically (an error increase to $6.21\%$ compared to RoBERTa $\mathrm{BASE}$ ). We find that LRC is still firmly holding onto generic representation, with the smallest drop in average generic performance of 0.83 points, when compared to stage one. Here we found that tuning $\rho$ became more prevalent, with the range of average clinical scores for LRC being 1.49 points. ER, and EWC are the only mitigated models which achieve competitive numbers for clinical tasks, although they both show a drop in generic, and bio-medical results. Both of the latter models outperform the base model in average bio-medical and clinical metrics. + +# 7 Analysis + +To further understand learning and forgetting across different mitigation strategies, we conduct analyses to investigate how different layers of the model adapt to in-domain pre-training, whether the adaptation helps in transferring knowledge to downstream tasks, and how knowledge learned from in & out of domain data cooperates together. + +# 7.1 Layer-wise analyses + +# 7.1.1 Weight Similarity + +Figure 2 displays layer-wise weight (cosine-) similarity between models before and after pre-training + +on bio-medical data. We compare RoBERTa $\mathrm{BASE}$ (denoted as Generic) against the PMC model (row 2 in Table 4 and denoted as bio-medical in the Figure). In Figure 2a we discern similarity in layers closer towards the input. By comparing Figures 2b and 2c which illustrate how mitigated models behave compared to one another, we find that ER allows the model parameters to shift much closer towards the bio-medical data while EWC finds a shared space for parameters in both models. This is consistent with what we have observed in Section 6.2.2 where we find EWC is better at mitigating catastrophic forgetting compared to ER. It was important to see how LRC weights behave as well. Intuitively since the learning rate is close to 0 near the model input, these layers will change very little. This is indeed the case with only the last layer showing significant shift. + +We investigate if constraining the weights to a shared space is enough to produce a good overall model. We observed that without the Fisher matrix, weight similarity between EWC and RoBERTa BASE is lower than 0.2, which is confirmed by the low $F_{1}$ scores noted in Section 6.2.2. This indicates that the Fisher diagonal plays an important role in fluctuating variance. + +# 7.1.2 Transferability via Probing Tasks + +To evaluate layer-wise transferability of pre-trained LMs, we use NER as a probing task and limit the capacity of task-specific layers to focus on what information has been learned by the model. We evaluate each layer of pre-trained LMs by extracting the model output as features and only fine-tuning task-specific layers. We observe in Figure 3 that (1) outer layers are most transferable to downstream tasks except for the last layer and (2) the performance of domain specific NER increases much faster than generic NER across layers, which indicates that grammatical understanding occurs in earlier layers, whereas segment level domain spe + +![](images/e500cc18271d9551f2bc74ea8b30f0b1b981cd08c8f762cf54aa9e11ad3dc87c.jpg) +(a) Generic vs. bio-medical + +![](images/dac635f77bd7fd824c5418d2e31400db1cfdf5a997b8ec5a6889d476adae1fc3.jpg) +(b) Mitigated Models vs. Generic +Figure 2: Weight distance vs. Depth across two domains. We compare RoBERTa $\mathrm{BASE}$ (trained on generic data) against PMC (denoted as bio-medical) and two mitigated models. Distance is given using cosine similarity. + +![](images/5b0fb0a51ff134bc538c12962f56b94042e50a0b97b283932e1e0440adbec6ab.jpg) +(c) Mitigated Models vs. bio-medical + +![](images/fe37dbbfc5b8bb01b353a659d758a4f91c143411a53deaa3ac28d6055818aa98.jpg) +Figure 3: Transferability vs. Depth. Dashed curves denote generic models and solid curves denote mitigated models. After fine-tuning on bio-medical data, the performance of CoNLL drops while the performance of BC5CDR is boosted. + +cific perception (i.e. semantics) appears in later layers. Both (1) and (2) are consistent with Figure 2a where weights change more in outer layers. This trend was also observed in previous works Belinkov et al. (2017); Jawahar et al. (2019). + +Base on layer-wise analyses in this section, we empirically find that the adaptation in outer layers plays a key role in mitigation, which suggests that a decaying learning rate as a function of layer depth is worth being incorporated into different mitigation strategies. + +# 7.2 Qualitative Examples + +We observe that CF mitigation techniques are able to assist in generalization on rare words by composing knowledge from both generic and bio-medical domains. In Figure 4 (i) we observe that "Norilsk" occurs quite rarely in Newswire data, which is used for pre-training generic domain, however, it is frequent in Pubmed but size of pre-training data is small. Combining the two datasets in the form ER and EWC helps generalise the model understanding. We provide additional examples of this phenomenon in Figure 4 (ii) & (iii). + +# 8 Related Work + +Current work in catastrophic forgetting mitigation in NLP has been limited. Howard and Ruder (2018) introduced a multi stage training scheme for fine tuning LSTM based universal language models (ULMFiT). The authors proposed that current methods, rather than data, are ineffective and focused on learning rate control across layers, as well as modifying learning rate scheduling. A larger category of work deals with constraining model parameters to a latent space where they continue to capture previous tasks. Initial work focused on model regularization and varying activations (Goodfellow et al., 2013). Kirkpatrick et al. (2017) provided a more sophisticated solution constraining weights individually termed elastic weight consolidation (EWC). We make use of both EWC and ULMFiT and provide further technical detail in this paper. The final approach is focused on experience replay. Using small samples of data from previous tasks coupled with local adaptation de Masson d'Autume et al. (2019) demonstrate improvement in a lifelong learning training scheme. Chaudhry et al. (2019) also explore lifelong learning by experimenting with updating the memory bank for experience replay. Our work focuses on both of these techniques with the major difference being problem scale. Many existing works apply these solutions on small networks whereas we experiment on architectures having several orders of magnitude more parameters. + +There has been a recent focus on more effective pre-training which focuses on narrowing the pretraining domain as we move closer towards finetuning. STILTs (Phang et al., 2018) and TandA (Garg et al., 2019) use intermediate tasks (in a data rich domain) training to lower variance during target task fine-tuning. This intuition was also covered + +
TextModelLabelconf.
(i):Entire social infrastructures in the icy Far North where Norilsk is based depend on the company, and government has said that expenditure could far outstrip Norilsk 's debts. [Norilsk] officials declined to comment.Ground TruthS-ORG-
RoBERTa BASES-MISC0.609
PMCS-MISC0.983
PMC+ERS-ORG1.000
(ii):President Arafat's position is clear that such a meeting should come after successful negotiations so that the meeting would have positive results. Especially since the [Hebron] issue has not been agreed yet and the crucial disputed issues have not been resolved.Ground TruthS-LOC-
RoBERTa BASES-PER0.998
PMCO1.000
PMC+ERS-LOC0.994
(iii):The committee said the Italian club had violated regulations by failing to inform Feyenoord, with whom the player was under contract. Blinker was fined 75,000 Swiss francs ($57,600) for failing to inform the English club of his previous commitment to [Udinese].Ground TruthS-ORG-
RoBERTa BASES-LOC0.815
PMCS-LOC1.000
PMC+ERS-ORG1.000
+ +Figure 4: Multi-task effect: generalization of a model on rare words using shared knowledge of pre-training on Newswire and Pubmed data. Example spans (taken from the CoNLL test split) are passed through an NER system initialized with various pre-trained encoders. We provide the labels and confidences for each. + +in the visio-linguistic domain by Singh et al. (2020). Finally Gururangan et al. (2020) work on MLM pretraining and provide conclusive evidence at scale of the works listed above. This last body of work, although dealing with pre-training is different from our work in that we study mitigation of domain forgetting, rather than reducing variance by adding intermediate domains or tasks to pre-training. + +# 9 Conclusion + +In this work, we empirically investigated the existence of catastrophic forgetting in large language model pre-training. We further explored constraint and replay based mitigation techniques to close the performance gap between general and domain specific natural language tasks. We find that training a single model across multiple domains is possible. Due to practical considerations, we would suggest using latent representation for data selection when working with a data dependent model such as ER or EWC. When no previous data is available LRC provides a simple yet powerful solution for retaining prior domain knowledge. In the future work wish to explore more data independent methods such as LRC, for both speed and lack of data dependency, as well as manipulation of the decay w.r.t. what we have discovered from our layer-wise analysis. + +# Acknowledgments + +We would like to thank Byron Wallace, Kevin Small, Ramesh Nallapati, and members of Amazon Comprehend Medical for their help in shaping this work over the last year, as well as the conference reviewers for providing thoughtful feedback. + +# References + +Roee Aharoni and Yoav Goldberg. 2020. Unsupervised domain clusters in pretrained language models. + +Emily Alsentzer, John Murphy, William Boag, WeiHung Weng, Di Jindi, Tristan Naumann, and Matthew McDermott. 2019. Publicly available clinical BERT embeddings. In Proceedings of the 2nd Clinical Natural Language Processing Workshop, pages 72-78, Minneapolis, Minnesota, USA. Association for Computational Linguistics. + +Yonatan Belinkov, Lluis Marquez, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2017. Evaluating layers of representation in neural machine translation on part-of-speech and semantic tagging tasks. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1-10, Taipei, Taiwan. Asian Federation of Natural Language Processing. + +Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet Kumar Dokania, Philip H. S. Torr, and Marc'Aurelio Ranzato. 2019. Continual learning with tiny episodic memories. CoRR, abs/1902.10486. + +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. + +William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005). + +B Roy Frieden. 2004. Science from Fisher information: a unification. Cambridge University Press. +Siddhant Garg, Thuy Vu, and Alessandro Moschitti. 2019. Tanda: Transfer and adapt pre-trained transformer models for answer sentence selection. +Danilo Giampiccolo, Bernardo Magnini, Ido Dagan, and Bill Dolan. 2007. The third PASCAL recognizing textual entailment challenge. In Proceedings of the ACL-PASCAL Workshop on Textual Entailment and Paraphrasing, pages 1-9, Prague. Association for Computational Linguistics. +Aaron Gokaslan and Vanya Cohen. 2019. Openweb-text (gokaslan's distribution, 2019), gpt-2 tokenized. +Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. 2013. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211. +Yu Gu, Robert Tinn, Hao Cheng, Michael Lucas, Naoto Usuyama, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. 2020. Domain-specific language model pretraining for biomedical natural language processing. arXiv preprint arXiv:2007.15779. +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. +S. Henry, Kevin P. Buchan, Michele Filannino, A. Stubbs, and Ozlem Uzuner. 2020. 2018 n2c2 shared task on adverse drug events and medication extraction in electronic health records. Journal of the American Medical Informatics Association: JAMIA. +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. +Ganesh Jawahar, Benoit Sagot, and Djamé Seddah. 2019. What does BERT learn about the structure of language? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3651-3657, Florence, Italy. Association for Computational Linguistics. +Alistair EW Johnson, Tom J Pollard, Lu Shen, H Lehman Li-wei, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. 2016. Mimiciii, a freely accessible critical care database. Scientific Data, 3:160035. +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. +Martin Krallinger, Obdulia Rabal, Saber A Akhondi, et al. 2017. Overview of the biocreative vi chemicalprotein interaction track. In Proceedings of the sixth BioCreative challenge evaluation workshop, volume 1, pages 141-146. +Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, and Jaewoo Kang. 2019. BioBERT: a pretrained biomedical language representation model for biomedical text mining. Bioinformatics, 36(4):1234-1240. +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 v cdr task corpus: a resource for chemical disease relation extraction. Database, 2016. +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. +Cyprien de Masson d'Autume, Sebastian Ruder, Lingpeng Kong, and Dani Yogatama. 2019. Episodic memory in lifelong language learning. 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 13143-13152. Curran Associates, Inc. +Michael McCloskey and Neal J. Cohen. 1989. Catastrophic interference in connectionist networks: The sequential learning problem. volume 24 of Psychology of Learning and Motivation, pages 109-165. Academic Press. +Anastasios Nentidis, Konstantinos Bougiatiotis, Anastasia Krithara, and Georgios Paliouras. 2019. Results of the seventh edition of the bioasq challenge. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 553-568. Springer. +Yifan Peng, Shankai Yan, and Zhiyong Lu. 2019. Transfer learning in biomedical natural language processing: An evaluation of BERT and ELMo on ten benchmarking datasets. In Proceedings of the 18th BioNLP Workshop and Shared Task, pages 58-65, Florence, Italy. Association for Computational Linguistics. +Jason Phang, Thibault Févry, and Samuel R. Bowman. 2018. Sentence encoders on stilts: Supplementary training on intermediate labeled-data tasks. CoRR, abs/1811.01088. + +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. OpenAI Blog, 1(8). +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. +Roger Ratcliff. 1990. Connectionist models of recognition memory: constraints imposed by learning and forgetting functions. *Psychological review*, 97(2):285. +Douglas Reynolds. 2009. Gaussian Mixture Models, pages 659-663. Springer US, Boston, MA. +Mark B. Ring. 1997. Child: A first step towards continual learning. In Machine Learning, pages 77-104. +Sebastian Ruder. 2017. An overview of multitask learning in deep neural networks. CoRR, abs/1706.05098. +Amanpreet Singh, Vedanuj Goswami, and Devi Parikh. 2020. Are we pretraining it right? digging deeper into visio-linguistic pretraining. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. +James C Spall. 2005. Monte carlo computation of the fisher information matrix in nonstandard settings. Journal of Computational and Graphical Statistics, 14(4):889-909. +Emma Strubell, Ananya Ganesh, and Andrew McCallum. 2019. Energy and policy considerations for deep learning in NLP. CoRR, abs/1906.02243. +Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 142-147. +Trieu H. Trinh and Quoc V. Le. 2018. A simple method for commonsense reasoning. CoRR, abs/1806.02847. +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. +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. +Alex Warstadt, Amanpreet Singh, and Samuel R. Bowman. 2018. Neural network acceptability judgments. CoRR, abs/1805.12471. +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112-1122. Association for Computational Linguistics. +Svante Wold, Kim Esbensen, and Paul Geladi. 1987. Principal component analysis. Chemometrics and Intelligent Laboratory Systems, 2(1):37-52. Proceedings of the Multivariate Statistical Workshop for Geologists and Geochemists. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 5753-5763. Curran Associates, Inc. +Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of the IEEE international conference on computer vision, pages 19-27. \ No newline at end of file diff --git a/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/images.zip b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3023eaffeb1f84dbebf9d84139b13a78a134512b --- /dev/null +++ b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f75329eddc7c442714bb154e98dfc00c787106198a4ae9207dcf5ff0880f5f2 +size 453894 diff --git a/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/layout.json b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..17412ccc7720501837c71ae6657bcce49b079425 --- /dev/null +++ b/anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea6f6ff4266d6adc722abb7827d0b38e27aa0c94f41fe4e9090fd442f0641b9e +size 336434 diff --git a/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_content_list.json b/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f9f266802eee7b17cbafc0faecc8403280698e3e --- /dev/null +++ b/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:600d416f1265a5e21362d423e5df6b55821ee7bf4e489a196020bd8b186fa3d6 +size 67304 diff --git a/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_model.json b/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..76fe7b05099d1dc63ebf39764fef25128621eea0 --- /dev/null +++ b/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e95b5fb24cafa54da4755a9fee02d76b09390b2e3c51f50a784a9f0744d66c2 +size 76022 diff --git a/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_origin.pdf b/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bb3350e630b4061b9c45d544623f9291013b5fcc --- /dev/null +++ b/anempiricalstudyofgenerationorderformachinetranslation/9a3b09e0-c528-44d9-9f1b-9a26b816f56a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b0de9bf3e7b973132ac71116d7e3cf695711020e8c6ed1d1f4a03fdf3e1c5a6 +size 437508 diff --git a/anempiricalstudyofgenerationorderformachinetranslation/full.md b/anempiricalstudyofgenerationorderformachinetranslation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7e93847395566f1b50a547d24cf5dba6fb2bb973 --- /dev/null +++ b/anempiricalstudyofgenerationorderformachinetranslation/full.md @@ -0,0 +1,258 @@ +# An Empirical Study of Generation Order for Machine Translation + +William Chan* + +Google Research, Brain Team +williamchan@gmail.com + +Jamie Kiros + +Google Research, Brain Team +kiros@google.com + +Mitchell Stern* + +University of California, Berkeley +mitchell@berkeley.edu + +Jakob Uszkoreit + +Google Research, Brain Team uszkoreit@google.com + +# Abstract + +In this work, we present an empirical study of generation order for machine translation. Building on recent advances in insertion-based modeling, we first introduce a soft order-reward framework that enables us to train models to follow arbitrary oracle generation policies. We then make use of this framework to explore a large variety of generation orders, including uninformed orders, location-based orders, frequency-based orders, content-based orders, and model-based orders. Curiously, we find that for the WMT'14 English $\rightarrow$ German and WMT'18 English $\rightarrow$ Chinese translation tasks, order does not have a substantial impact on output quality. Moreover, for English $\rightarrow$ German, we even discover that unintuitive orderings such as alphabetical and shortest-first can match the performance of a standard Transformer, suggesting that traditional left-to-right generation may not be necessary to achieve high performance. + +# 1 Introduction + +Neural sequence models (Sutskever et al., 2014; Cho et al., 2014) have been successfully applied to a broad range of tasks in recent years. While these models typically generate their outputs using a fixed left-to-right order, there has also been some investigation into non-left-to-right and order-independent generation in pursuit of quality or speed. For example, Vinyals et al. (2015) explored the problem of predicting sets using sequence models. While this is a domain where generation order should intuitively be unimportant, they nevertheless found it to make a substantial difference in practice. Ford et al. (2018) explored treating language modeling as a two-pass process, where words from certain classes are generated first, and the remaining words are filled + +in during the second pass. They found that generating function words first followed by content words second yielded the best results. Separately, Gu et al. (2018) and Lee et al. (2018) developed non-autoregressive approaches to machine translation where the entire output can be generated in parallel in constant time. These models do away with order selection altogether but typically lag behind their autoregressive counterparts in translation quality. + +More recently, a number of novel insertion-based architectures have been developed for sequence generation (Gu et al., 2019; Stern et al., 2019; Welleck et al., 2019). These frameworks license a diverse set of generation orders, including uniform (Welleck et al., 2019), random (Gu et al., 2019), or balanced binary trees (Stern et al., 2019). Some of them also match the quality of state-of-the-art left-to-right models (Stern et al., 2019). In this paper, we utilize one such framework to explore an extensive collection of generation orders, evaluating them on the WMT'14 English-German and WMT'18 English-Chinese translation tasks. We find that a number of non-standard choices achieve BLEU scores comparable to those obtained with the classical approach, suggesting that left-to-right generation might not be a necessary ingredient for high-quality translation. Our contributions are as follows: + +- We introduce a general soft order-reward framework that can be used to teach insertion-based models to follow any specified ordering. +- We perform a large empirical study on various orders, including: uniform, random, left-to-right, right-to-left, common-first, rare-first, shortest-first, longest-first, alphabetical, and model-adaptive. +- We show that there is little variation in BLEU regardless of generation order. On the competitive WMT 2014 English $\rightarrow$ German task, we + +![](images/4d70535abcecc59c1e4bcddbe94378be49b48193dfd92fbf555f642bfb530b3c.jpg) +Figure 1: A schematic of the Insertion Transformer model for a Chinese-English translation pair. The model is encouraged to predict the correct set of remaining words within each slot. Using our order-reward framework (Section 3), we can derive the necessary weight distribution to apply to the set of correct actions in order to train the model to follow any oracle generation policy of interest. +Figure 2: Example decoding paths for serial and parallel generation using the Insertion Transformer. + +Serial generation: + +
HypothesisInsertion
[](ate, 0)
[ate](snack, 1)
[ate, snack](man, 0)
[man, ate, snack](the, 0)
[the, man, ate, snack](a, 3)
[the, man, ate, a, snack](〈EOS〉, 5)
+ +Parallel generation: + +
HypothesisInsertions
[](ate, 0)
[ate](man, 0), (snack, 1)
[man, ate, snack](the, 0), (a, 2)
[the, man, ate, a, snack](⟨EOS⟩, 5)
+ +further find that most orders are able to match the performance of a standard base Transformer. + +# 2 Background + +Neural sequence models have traditionally been designed with left-to-right prediction in mind. In the classical setting, output sequences are produced by repeatedly appending tokens to the rightmost end of the hypothesis until an end-of-sequence token is generated. Though high-performing across a wide range of application areas, this approach lacks the flexibility to accommodate other types of inference such as parallel generation, constrained decoding, infilling, etc. Moreover, it also leaves open the possibility that a non-left-to-right factorization of the joint distribution over output sequences could outperform the usual monotonic ordering. + +To address these concerns, several recent approaches have been proposed for insertion-based sequence modeling, in which sequences are constructed by repeatedly inserting tokens at arbitrary locations in the output rather than only at the right- + +most position. We use one such insertion-based model, the Insertion Transformer (Stern et al., 2019), for our empirical study. We give a brief overview of the model in this section before moving on to the details of our investigation. + +# 2.1 Insertion Transformer + +The Insertion Transformer (Stern et al., 2019) is a sequence-to-sequence model in which the output is formed by successively inserting one or more tokens at arbitrary locations into a partial hypothesis. This type of generation is made possible through the use of a joint distribution over tokens and slots. More formally, given an input $x$ and a partial output $\hat{y}_t$ at time $t$ , the Insertion Transformer gives the joint distribution + +$$ +p (c, l \mid x, \hat {y} _ {t}) = \operatorname {I n s e r t i o n T r a n s f o r m e r} (x, \hat {y} _ {t}), +$$ + +where $c \in V$ is the content being selected from the vocabulary $V$ and $0 \leq l \leq |\hat{y}_t|$ is the insertion location. + +As its name suggests, the Insertion Transformer extends the Transformer model (Vaswani et al., + +2017) with a few key modifications to generalize from ordinary next-token modeling to joint token-and-slot modeling. First, the Insertion Transformer removes the causal attention mask from the decoder, allowing for fully contextualized output representations to be derived after each insertion. Second, the Insertion Transformer pads the length- $n$ decoder input on both ends so that $n + 2$ output vectors are produced. It then concatenates adjacent pairs of output vectors to obtain $n + 1$ slot representations, which in turn inform the conditional distributions over tokens within each slot, $p(c \mid l)$ . Lastly, it performs an additional attention step over the slot representations to obtain a location distribution $p(l)$ , which is multiplied with the conditional content distributions to obtain the full joint distribution: $p(c, l) = p(c \mid l)p(l)$ . A schematic of the architecture is given in Figure 1 for reference. + +We note that Stern et al. (2019) also experimented with a number of other architectural variants, but we use the baseline version of the model described above in our experiments for simplicity. + +# 2.2 Decoding + +Once the model has been trained, it can be used for greedy autoregressive sequence generation as follows. At each step of decoding, we compute the joint argmax + +$$ +(\hat {c} _ {t}, \hat {l} _ {t}) = \operatorname * {a r g m a x} _ {c, l} p (c, l \mid x, \hat {y} _ {t}) +$$ + +to determine what content $\hat{c}_t$ should be inserted at which location $\hat{l}_t$ . We then apply this insertion, increasing the sequence length by one, and repeat this process until an end-of-sequence token is produced. This is the serial decoding procedure shown in the left half of Figure 2. + +The model can also be used for parallel partially-autoregressive decoding. Instead of computing the joint argmax across all locations, we instead compute the best content for each location: + +$$ +\hat {c} _ {l, t} = \underset {c} {\operatorname {a r g m a x}} p (c \mid l, x, \hat {y} _ {t}). +$$ + +We then insert the highest-scoring tokens in parallel for all slots that are not yet finished, increasing the sequence length by anywhere between one and $n + 1$ tokens. This strategy visualized in the right half of Figure 2. + +
OrderOrder Function O(a)
Uniform0
Balanced Binary Tree|s-(i+j)/2|
Randomrank hash(w))
Sequential (L2R vs. R2L)±s
Frequency (Common vs. Rare)±rank(frequency(w))
Length (Short vs. Long)±rank(length(w))
Alphabetical (A→z vs. z→A)±rank(w)
Adaptive (Easy vs. Hard)±log p(a)
+ +Table 1: Order functions for an action $a$ corresponding to the insertion of word $w$ into slot $s$ within span $\left( {i,j}\right)$ . The rank terms are computed with respect to the set of words from the valid action set ${A}^{ * }$ . + +# 3 Soft Order-Reward Framework + +Having presented our model of interest, we now describe a general soft order-reward framework that can be used to train the model to follow any oracle ordering for sequence generation. Let $O(a)$ be an order function mapping insertion actions to real numbers, where lower values correspond to better actions, and let $p(a)$ be the probability assigned by the model to action $a$ . From these, we construct a reward function $R(a)$ , an oracle policy $q_{\mathrm{oracle}}$ , and a per-slot loss $\mathcal{L}$ : + +$$ +\begin{array}{l} R (a) = \left\{ \begin{array}{l l} - O (a) & \forall a \in A ^ {*} \\ - \infty & \forall a \notin A ^ {*} \end{array} \right. \\ q _ {\text {o r a c l e}} (a) = \frac {\exp (R (a) / \tau)}{\sum_ {a ^ {\prime} \in A ^ {*}} \exp (R (a ^ {\prime}) / \tau)} \\ \mathcal {L} = \mathrm {K L} (q _ {\text {o r a c l e}} \| p) \\ \end{array} +$$ + +Here, $A^{*}$ is the set of all valid actions. The temperature $\tau \in (0,\infty)$ controls the sharpness of the distribution, where $\tau \rightarrow 0$ results in a one-hot distribution with all mass on the best-scoring action under the order function $O(a)$ , and $\tau \rightarrow \infty$ results in a uniform distribution over all valid actions. Intermediate values of $\tau$ result in distributions which are biased towards better-scoring actions but allow for other valid actions to be taken some of the time. + +Having defined the target distribution, we take the slot loss $\mathcal{L}$ for insertions within a particular slot to be the KL-divergence between the oracle distribution $q_{\mathrm{oracle}}$ and the model distribution $p$ . Substituting $\mathcal{L}$ in for the slot loss within the training framework of Stern et al. (2019) then gives the full sequence generation loss, which we can use to train an Insertion Transformer under any oracle policy rather than just the specific one they propose. We describe a wide variety of generation + +orders which can be characterized by different order functions $O(a)$ in the subsections that follow. A summary is given in Table 1. + +# 3.1 Uninformed Orders + +We evaluate two uninformed orders, uniform and random. The uniform order $O(a) = 0$ gives equal reward or equivalently probability mass to any valid action. Consequently, this means we give each order a uniform probability treatment. We also experiment with random order $O(a) = \operatorname{rank}(\operatorname{hash}(w))$ , wherein we hash each word and use the sorted hash ID as the generation order. The random order forces the model to follow a specific random path, whereas the uniform order gives equal probability mass to any order. + +# 3.2 Location-based Orders + +We explore two types of location-based orders, balanced binary tree and monotonic orders. The balanced binary tree order $O(a) = |s - (i + j)/2|$ encourages the model to place most of its probability mass towards the middle tokens in a missing span. Consequently, this encourages the model to generate text in a balanced binary tree order. We also experiment with soft monotonic orders $O(a) = \pm s$ , or soft left-to-right and soft right-to-left, which differ slightly from the left-to-right teacher forcing traditionally used in seq2seq. First, we still maintain a uniform roll-in policy (see Section 3.6), which increases diversity during training and helps avoid label bias. Additionally, this endows the model with the ability to "look back" and insert missing tokens in the middle of the sequence during inference, as opposed to always being forced to append only at one end of the sequence. The order reward is also soft (as described by the $\tau$ term above), wherein we do not place all the probability mass on the next monotonic token, but merely encourage it to generate in a monotonic fashion. + +# 3.3 Frequency-based Orders + +We evaluate two frequency-based orders: rare words first via $O(a) = \text{rank}(\text{frequency}(w))$ and common words first via $O(a) = -\text{rank}(\text{frequency}(w))$ . For these orders, we simply sort the words based on their frequencies and used their rank as the order. We note the most frequent words tend to be punctuation and stop words, such as commas, periods, and "the" in English. + +# 3.4 Content-based Orders + +We also explore content-based orders. One class of orders is based on the word length: $O(a) = \pm \operatorname{rank}(\operatorname{length}(w))$ . This encourages the model to either emit all the shortest words first or all the longest words first. + +We also explore alphabetical orderings $O(a) = \pm \mathrm{rank}(w)$ , where sorting is based on Unicode order. We note that in Unicode, uppercase letters occur before lower case letters. This biases the model to produce words which are capitalized first (or last), typically corresponding to nouns in German. Additionally, for Chinese, the characters are roughly sorted by radical and stroke count, which bears a loose relation to the complexity and frequency of the character. + +# 3.5 Model-based Orders + +The orders presented thus far are static, meaning they are independent of the model. We also explore orders which are adaptive based on the model's posterior. We also introduce "easy" and "hard" adaptive orders induced by $O(a) = \pm \log p(a)$ . The adaptive orders look at the model's posterior to determine the oracle policy. Consequently the loss is adaptive, as when the model updates after each gradient step, the order adapts to the model's posterior. + +In the "easy" version, we use $O(a) = +\log p(a)$ , which is similar to a local greedy soft EM loss. We renormalize our current model's posterior over valid actions and optimize towards that distribution. This pushes the model's posterior to what is correct and where it has already placed probability mass. Intuitively, this reinforces the model to select what it thinks are the easiest actions first. Conversely, the "hard" variant uses $O(a) = -\log p(a)$ which encourages the model to place probability mass on what it thinks are the hardest valid actions. This is akin to a negative feedback system whose stationary condition is the uniform distribution. + +# 3.6 Roll-in Policy + +We follow Stern et al. (2019) and use a uniform roll-in policy when sampling partial outputs at training time in which we first select a subset size uniformly at random, then select a random subset of the output of that size. Repeated tokens are handled via greedy left or right alignment to the true output. + +Input: It would of course be a little simpler for the Germans if there were a coherent and standardised European policy, which is currently not the case. + +Output: Es ware für die Deutschen natürlich ein weniger einfacher, wenn es eine kohärente und einheitliche europäische Politik gabe, was derzeit nicht der Fall ist. + +# Parallel decode (alphabetical): + +
Es.äre_für die.Deutschen_naturlich_ein_wenig_einfacher,_wenn es eine_kohärent e_und_einheitliche_europäischePolitik_gäbe,_was_derzeit_nicht_der_Fall_ist._
Es.äre_für die.Deutschen_naturlich_ein_wenig_einfacher,_wenn es eine_kohärent e_und_einheitliche_europäischePolitik_gäbe,_was_derzeit_nicht_der_Fall_ist._
Es.äre_für die.Deutschen_naturlich_ein_wenig_einfacher,_wenn es eine_kohärent e_und_einheitliche_europäischePolitik_gäbe,_was_derzeit_nicht_der_Fall_ist._
Es.äre_für die.Deutschen_naturlich_ein_wenig_einfacher,_wenn es eine_kohärent e_und_einheitliche_europäischePolitik_gäbe,_was_derzeit_nicht_der_Fall_ist._
Es.äre_für die.Deutschen_naturlich_ein.wenig_einfacher,_wenn es eine_kohärent e_und_einheitliche_europäischePolitik_gäbe,_was_derzeit_nicht_der_Fall_ist._
Es.äre_für die.Deutschen_naturlich_ein_wenig_einfacher,_wenn es eine_kohärent e_und_einheitliche_europäischePolitik_gäbe,_was_derzeit_nichderr_Fall_ist._
+ +Input: according to the data of National Bureau of Statistics, the fixed asset investment growth, total imports and other data in July have come down. + +Output: 根据国家统计局的数据,7月份的固定资产投资增长、进口总额和其他数据有所下降。 + +# Parallel decode (alphabetical): + +
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、进口_总额_和_其他_数据_有所_下降_。
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、进口_总额_和_其他_数据_有所_下降_。
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、进口_总额_和_其他_数据_有所_下降_。
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、、进口_总额_和_其他_数据_有所_下降_。
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、进口_总额_和_其他_数据_有所_下降_。
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、进口_总额_和_其他_数据_有所_下降_。
根据_国家统计局_的数据_, _7_月份_的_固定资产_投资_增长_、进口_总额_和_其他_数据_有所_下降_。
+ +Figure 3: Example decodes for models trained to generate tokens in alphabetical (Unicode) order. Blue tokens correspond those being inserted at the current time step, and gray tokens correspond to those not yet generated. Note that the desired ordering applies on a per-slot basis rather than a global basis. + +Input: It will be sung by all the artists at all the three concerts at the same time. + +Output: Es wird von allen Künstlern bei allen drei Konzerten gleichzeitig gesungen. + +# Parallel decode (longest-first): + +
Es. wird. von. allen. Künstler n. bei. allen. drei. Konzert en. gleichzeitig. ges ungen. ...
Es. wird. von. allen. Künstler n. bei. allen. drei. Konzert en. gleichzeitig. ges ungen. ...
Es. wird. von. allen. Künstler n. bei. allen. drei. Konzert en. gleichzeitig. ges ungen. ...
Es. wird. von. allen. Künstler n. bei. allen. drei. Konziert en. gleichzeitig. ges ungen. ...
Es. wird. von. allen. Künstler n. bei. allen. drei. Konzert en. gleichzeitig. ges ungen. ...
Es. wird. von. allen. Künstler n. bei. allen. drei. Konzert en. gleichzeitig. ges ungen. ...
+ +Figure 4: An example of longest-first generation. + +Input: imagine eating enough peanuts to serve as your dinner. + +Output: 想象一下,吃足够的花生作为你的晚餐。 + +# Parallel decode (common-first): + +
想象_一下_,吃_足够_的_花生_作为_你的_晚餐_。
想象_一下_,吃_足够_的_花生_作为_你的_晚餐_。
想象_一下_,吃_足够_的_花生_作为_你的_晚餐_。
想象_一下_,吃_足够_的_花生_作为_你的_晚餐_。
想象_一下_,吃_足够_的_花生_作为_你的_晚餐_。
+ +Figure 5: An example of common-first generation. + +# 4 Experiments + +For our experiments, we train and evaluate models for each order on two standard machine translation datasets: WMT14 En-De and WMT18 En-Zh. For WMT14 En-De, we follow the standard setup with newstest2013 as our development set and newstest2014 as our test set. For WMT18 En-Zh, we use the official preprocessed data1 with no additional data normalization or filtering, taking newstest2017 to be our development set and newstest2018 our test set. En-Zh evaluation is carried + +out using sacreBLEU $^2$ (Post, 2018). In both cases, we train all models for 1M steps using sequence-level knowledge distillation (Hinton et al., 2015; Kim and Rush, 2016) from a base Transformer (Vaswani et al., 2017). We perform a sweep over temperatures $\tau \in \{0.5, 1, 2\}$ and EOS penalties $\in \{0, 0.5, 1, 1.5, \dots, 8\}$ (Stern et al., 2019) on the development set, but otherwise perform no additional hyperparameter tuning, borrowing all other model and optimization settings from the base Transformer. + +
OrderEn → DeEn → Zh
τ0.51.02.00.51.0
Binary Tree91%86%80%88%83%78%
Random86%81%72%82%77%68%
Left-to-Right95%88%77%88%82%70%
Right-to-Left95%90%78%92%83%72%
Common First92%88%80%88%84%76%
Rare First88%81%73%83%77%67%
Shortest First93%88%80%91%84%76%
Longest First92%86%77%92%84%76%
Alphabetical (A → z)93%87%77%88%82%73%
Alphabetical (z → A)90%84%74%85%78%69%
+ +Table 2: Percentage of insertions that follow the target order exactly, averaged over the development set. + +# 4.1 Ability to Learn Different Orders + +By and large, we find that the Insertion Transformer is remarkably capable of learning to generate according to whichever order it was trained for. We give example decodes for three different generation orders in Figures 3, 4, and 5. In the first example, we see that the alphabetical En-De model adheres to the Unicode ordering for Latin characters (punctuation $\rightarrow$ uppercase $\rightarrow$ lowercase), and that the En-Zh model similarly adheres to the Unicode order for Chinese (punctuation $\rightarrow$ CJK characters sorted by radical and stroke count). In the second example, the longest-first En-De model generates subwords in decreasing order of length as expected. Finally, in the third example, the common-first En-Zh model begins with common particles and punctuation before generating the main content words. + +We give a quantitative measurement of the success of each model in Table 2, computing the percentage of insertions across the development set that adhered to the best-scoring action under the desired ordering. Most models exhibit similar trends, with the majority of En-De models achieving accuracies in excess of $90\%$ when a low temperature is used, and with corresponding results in the mid-to-upper $80\%$ range for En-Zh. Even the random order based on token hashes has accuracies exceeding $80\%$ for both languages, demonstrating that the model has a strong capacity to adapt to any oracle policy. + +# 4.2 Test Results + +Next, we measure the quality of our models by evaluating their performance on their respective + +test sets. The resulting BLEU scores are reported in Table 3. The uniform loss proposed by Stern et al. (2019) serves as a strong baseline for both language pairs, coming within 0.6 points of the original Transformer for En-De at 26.72 BLEU, and attaining a respectable score of 33.1 BLEU on En-Zh. We note that there is a slightly larger gap between the normal Transformer and the Insertion Transformer for the latter of 2.7 points, which we hypothesize is a result of the larger discrepancy between word orders in the two languages combined with the more difficult nature of the Insertion Transformer training objective. + +Most of the content-based orderings (frequency-based, length-based, alphabetical) perform comparably to the uniform loss, and even the random order is not far behind. The adaptive orders perform similarly well, with easy-first attaining one of the highest scores on En-De. Curiously, in our model adaptive easy-order, we were unable to identify any strong patterns in the generation order. The model did have a slight preference towards functional words (i.e., “,” and “der”), but the preference was weak. As for location-based losses, the binary tree loss is notable in that it achieves the highest score across all losses for both languages. On the other hand, we note that while the soft left-to-right and right-to-left losses perform substantially better than the hard loss employed in the original work by Stern et al. (2019), performance does suffer when using parallel decoding for those models, which is generally untrue of the other orderings. We believe this is due in part to exposure bias issues arising from the monotonic ordering as + +
OrderEn → DeEn → Zh
SerialParallelSerialParallel
TransformerVaswani et al. (2017)This Work
27.335.8
UniformStern et al. (2019)This Work
27.1226.7232.933.1
Binary Tree27.2927.4132.634.0
This Work
Random26.1526.1032.632.4
Left-to-Right26.3725.5631.731.2
Right-to-Left26.6024.4932.430.8
Common First26.8826.8633.532.9
Rare First26.0626.2432.532.2
Shortest First27.0527.1533.032.7
Longest First26.4526.4132.833.2
Alphabetical (A → z)26.8626.5832.732.5
Alphabetical (z → A)27.2226.3733.133.0
Easy First26.9527.0532.532.5
Hard First25.8526.3032.432.9
+ +Table 3: Test BLEU results for WMT14 En-De newtest2014 and WMT18 En-Zh newtest2018 with serial and parallel decoding. + +compared with the uniform roll-in policy that are not shared by the other losses. + +# 4.3 Performance vs. Sentence Length + +For additional analysis, we consider how well our models perform relative to one another conditional on the length of the source sentence. Sentence length can be seen as a rough proxy measurement of the difficulty of translating a sentence. This is to determine if whether some order variations are able to achieve improved BLEU scores over other models depending on the source sentence's length. For each sentence in the En-De and En-Zh development sets, we compute their lengths and bin them into groups of size 5, up to a maximum length of 50. Within each bin, we compute sentence-level BLEU and take the mean score across all sentences. This is done for each of our model variants. Figure 6 illustrates the results of this experiment. We observe a surprisingly small model variance across all bin lengths. This suggests that sentences that are difficult to translate are difficult across all orderings, and no particular ordering appears strictly better or worse than others. One small exception to this is a performance fall-off of hard-first orderings for very long + +sentences across both datasets. We also observe a different distribution of BLEU scores across bin lengths for En-De and En-Zh. In particular, En-De models are approximately monotonic-decreasing in performance as source length increases, while on En-Zh performance is roughly flat across sentence length. This also highlights the importance of taking additional diverse language pairs into consideration, as certain translation properties across one language pair may not be observed in others. + +Ultimately, given the similarity of the development scores across sentence lengths and the test scores for the various models, we come to the surprising conclusion that for single-sentence English-German and English-Chinese translation, generation order is relatively unimportant insofar as end-task performance is concerned. + +# 5 Related Work + +In recent work, several insertion-based frameworks have been proposed for the generation of sequences in a non-left-to-right fashion for machine translation (Stern et al., 2019; Welleck et al., 2019; Gu et al., 2019). Stern et al. (2019) introduced the Insertion Transformer and explored uniform + +![](images/46cce20eb6cbdfbf8f6e9d29573c3927c4839df2cda76a36cf419d0653aea902.jpg) +(a) English $\rightarrow$ German +Figure 6: Sentence-level BLEU scores as a function of sentence length for several of our model variants. Source sentences in each development set are binned into groups of size 5, up to length 50. + +![](images/caae0d21df517dbb7255c34eca9b7d6e11a72fd3f914bd7a3952d39b17a1961c.jpg) +(b) English $\rightarrow$ Chinese + +and balanced binary tree orders. We built upon and generalized this approach in order to explore a much broader set of orders. Welleck et al. (2019) explored insertions using a binary-tree formulation. They also explored uniform and model-based orders, but found them to lag significantly behind their left-to-right baselines. Additionally, despite using a binary-tree formulation for generation, they did not explore tree-based orders. Gu et al. (2019) introduced a model which did not explicitly represent the output canvas arising from insertions, but rather used an implicit representation through conditioning on the insertion sequence. They also performed an exploration of different generation orders, including random, odd-even, common-first, rare-first, and a search-adaptive order. Their search-adaptive order can be seen as a global version of our local model adaptive order, where we use the local greedy posterior as the reward function, and they use the sequence level log-probability as the reward function. Curiously, in their framework, the random order fell significantly behind the left-to-right baseline, while they showed small gains in their search adaptive order. One key difference between our work and Welleck et al. (2019) and Gu et al. (2019) is that we use a soft order-reward framework as opposed to teacher forcing. This might explain some of the performance differences, as our framework allows for + +a more flexible training objective. Additionally, since we use a uniform roll-in policy, our models may have less of a label bias problem, as they are trained to be able to continue from any partial output rather than just those arising from the target policy. + +# 6 Conclusion + +In this work, we investigated a broad array of generation orders for machine translation using an insertion-based sequence generation model, the Insertion Transformer. We found that regardless of the type of strategy selected, be it location-based, frequency-based, length-based, alphabetical, model-based, or even random, the Insertion Transformer is able to learn it with high fidelity and produce high-quality output in the selected order. This opens a wide range of possibilities for generation tasks where monotonic orderings are not the most natural choice, and we would be excited to explore some of these areas in future work. + +# References + +Kyunghyun Cho, Bart van Merrienboer, Caglar Gul- cehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. 2014. Learning Phrase Representations using RNN EncoderDecoder for Statistical Machine Translation. In EMNLP. + +Nicolas Ford, Daniel Duckworth, Mohammad Norouzi, and George E. Dahl. 2018. The Importance of Generation Order in Language Modeling. In EMNLP. +Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher. 2018. Non-Autoregressive Neural Machine Translation. In ICLR. +Jiatao Gu, Qi Liu, and Kyunghyun Cho. 2019. Insertion-based Decoding with Automatically Inferred Generation Order. In arXiv. +Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. 2015. Distilling the Knowledge in a Neural Network. In NIPS Deep Learning and Representation Learning Workshop. +Yoon Kim and Alexander M. Rush. 2016. Sequence-Level Knowledge Distillation. In EMNLP. +Jason Lee, Elman Mansimov, and Kyunghyun Cho. 2018. Deterministic Non-Autoregressive Neural Sequence Modeling by Iterative Refinement. In EMNLP. +Matt Post. 2018. A Call for Clarity in Reporting BLEU Scores. In WMT. +Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. 2019. Insertion Transformer: Flexible Sequence Generation via Insertion Operations. In ICML. +Ilya Sutskever, Oriol Vinyals, and Quoc Le. 2014. Sequence to Sequence Learning with Neural Networks. In NIPS. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention Is All You Need. In NIPS. +Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. 2015. Order Matters: Sequence to sequence for sets. In ICLR. +Sean Welleck, Kiante Brantley, Hal Daume, and Kyunghyun Cho. 2019. Non-Monotonic Sequential Text Generation. In ICML. + +# Appendix + +Full development set results for En-De translation and En-Zh translation. + +
OrderEnglish → GermanEnglish → Chinese
τBLEU (+EOS)BLEU (+EOS)BLEU (+EOS)BLEU (+EOS)
+Parallel+Parallel
UniformStern et al. (2019)This Work
22.39 (25.58)24.31 (24.91)28.6 (31.8)30.4 (31.9)
Binary Tree0.524.49 (25.55)25.33 (25.70)29.3 (31.6)31.3 (31.9)
1.024.36 (25.43)25.43 (25.76)29.6 (32.0)31.4 (32.2)
2.024.59 (25.80)25.33 (25.80)29.1 (32.2)31.4 (32.3)
RandomThis Work
0.523.82 (24.87)23.97 (24.20)28.5 (30.6)29.4 (30.2)
1.024.03 (25.46)24.58 (24.82)28.6 (31.1)30.0 (31.0)
2.024.00 (25.41)24.68 (25.07)28.9 (31.7)30.4 (31.6)
L2R (Left-Aligned)0.521.19 (24.46)21.40 (21.57)24.5 (30.0)25.7 (28.3)
1.021.36 (24.02)20.84 (21.25)24.8 (29.8)25.2 (27.8)
2.021.78 (24.21)20.56 (21.11)25.8 (29.8)24.9 (27.6)
L2R (Right-Aligned)0.521.77 (25.00)22.62 (23.38)25.6 (31.6)27.3 (30.0)
1.021.85 (25.22)22.78 (23.67)25.3 (31.2)27.0 (30.1)
2.021.01 (24.88)22.29 (23.80)23.5 (30.9)25.8 (30.4)
R2L (Left-Aligned)0.523.75 (25.04)23.15 (23.25)27.6 (31.4)27.8 (28.6)
1.023.72 (25.29)22.89 (22.89)28.0 (31.6)28.0 (29.3)
2.024.09 (25.64)23.61 (23.85)28.6 (31.9)28.3 (29.9)
R2L (Right-Aligned)0.519.23 (23.52)19.70 (21.02)21.3 (31.3)22.3 (28.3)
1.019.56 (23.27)20.20 (21.55)20.9 (30.5)21.6 (28.3)
2.020.19 (23.55)20.84 (22.22)20.3 (30.9)21.5 (28.7)
Common First0.525.20 (25.43)25.05 (25.05)29.9 (31.2)30.5 (30.5)
1.025.46 (25.84)25.76 (25.81)30.5 (32.0)31.1 (31.3)
2.025.30 (25.76)25.75 (25.83)30.4 (32.2)31.4 (31.9)
Rare First0.522.83 (24.30)23.19 (23.62)27.0 (29.5)28.7 (29.7)
1.022.75 (24.56)23.42 (23.99)27.9 (30.7)29.5 (30.5)
2.023.10 (24.79)24.00 (24.36)28.1 (31.2)29.8 (31.1)
Shortest First0.524.93 (25.55)24.94 (25.01)27.4 (30.3)29.1 (30.0)
1.024.95 (25.72)25.17 (25.28)28.0 (30.9)29.6 (30.8)
2.025.05 (25.85)25.26 (25.48)28.2 (31.4)30.3 (31.5)
Longest First0.523.59 (25.09)24.24 (24.56)29.2 (31.4)30.5 (31.2)
1.023.53 (25.07)24.68 (25.13)29.2 (31.5)31.0 (31.8)
2.024.09 (25.78)24.93 (25.37)29.0 (31.9)31.1 (32.1)
Alphabetical (A → Z → a → z)0.524.49 (25.15)24.87 (24.91)29.2 (31.0)30.1 (30.6)
1.024.61 (25.19)24.96 (25.12)30.1 (32.0)30.8 (31.4)
2.024.77 (25.67)25.45 (25.71)29.7 (32.1)30.7 (31.8)
Alphabetical (z → a → Z → A)0.524.16 (25.24)24.56 (24.73)29.2 (31.4)30.3 (30.8)
1.024.19 (25.45)24.65 (25.10)29.3 (31.9)30.7 (31.5)
2.024.26 (25.76)25.02 (25.40)29.7 (32.3)31.0 (32.0)
Easy First0.522.58 (24.09)22.16 (22.63)27.5 (30.2)28.4 (29.7)
1.023.68 (25.08)23.66 (24.03)28.9 (31.6)29.3 (30.7)
2.023.87 (25.43)24.64 (25.26)29.1 (31.9)30.4 (31.7)
Hard First0.520.01 (23.46)23.16 (23.61)24.7 (29.7)28.7 (30.2)
1.020.96 (24.36)23.76 (24.56)25.4 (30.1)29.1 (30.7)
2.021.97 (24.90)24.33 (24.70)26.4 (31.1)29.9 (31.4)
+ +Table 4: Development BLEU results for WMT14 En-De newstest2013 and WMT18 En-Zh newstest2017. The first number in each column is the result obtained without an EOS penalty, while the second number in parentheses is the score obtained with the best EOS penalty for that setting. \ No newline at end of file diff --git a/anempiricalstudyofgenerationorderformachinetranslation/images.zip b/anempiricalstudyofgenerationorderformachinetranslation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2e3c99da6ed39cde1cc087f535d32e5c7e220ee0 --- /dev/null +++ b/anempiricalstudyofgenerationorderformachinetranslation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca3c40b298820093fca7f191b564445841e27af01f52f9717b8bfb6143d26cb1 +size 781234 diff --git a/anempiricalstudyofgenerationorderformachinetranslation/layout.json b/anempiricalstudyofgenerationorderformachinetranslation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9d624bc76bdb4707c7a445c49b06fbe614e5043b --- /dev/null +++ b/anempiricalstudyofgenerationorderformachinetranslation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7d868d0146b4d1fb206b095fe582f6033a9bf18ea43c93db776027528d13820 +size 282880 diff --git a/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_content_list.json b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a4d3069ccd7840010e0aa16a6e8abb4037e2112f --- /dev/null +++ b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed9315cb75eef58c4deb1f0a8adf1ff79b7770072fb3be951b1e60331e649baa +size 56618 diff --git a/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_model.json b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..254ef5385b0be797ebce17d33c565d3aff24986c --- /dev/null +++ b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c260a33273695877e0378792245a34acd0d4b511a84c9b195051f6a7d654533 +size 65627 diff --git a/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_origin.pdf b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c6cf8a32c516251a3c8817b0e638013276393e95 --- /dev/null +++ b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/5937d93e-69c6-4c96-85f4-8f306ba37b1f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f72a89dd3aad34691167c4ede92b4962cbe5a448b7f4bd3b9aaa2e895828b0ec +size 256448 diff --git a/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/full.md b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f61cb1c4732a46b0e2d3856eba0664aec2882fb7 --- /dev/null +++ b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/full.md @@ -0,0 +1,164 @@ +# An Empirical Study of Pre-trained Transformers for Arabic Information Extraction + +Wuwei Lan $^{1}$ , Yang Chen $^{2}$ , Wei Xu $^{2}$ , Alan Ritter $^{2}$ + +1 Department of Computer Science and Engineering, Ohio State University + +$^{2}$ School of Interactive Computing, Georgia Institute of Technology + +lan.105@osu.edu {yang.chen, wei.xu, alan.ritter}@cc.gatech.edu + +# Abstract + +Multilingual pre-trained Transformers, such as mBERT (Devlin et al., 2019) and XLM-RoBERTa (Conneau et al., 2020a), have been shown to enable the effective cross-lingual zero-shot transfer. However, their performance on Arabic information extraction (IE) tasks is not very well studied. In this paper, we pre-train a customized bilingual BERT, dubbed GigaBERT, that is designed specifically for Arabic NLP and English-to-Arabic zero-shot transfer learning. We study GigaBERT's effectiveness on zero-short transfer across four IE tasks: named entity recognition, part-of-speech tagging, argument role labeling, and relation extraction. Our best model significantly outperforms mBERT, XLM-RoBERTa, and AraBERT (Antoun et al., 2020) in both the supervised and zero-shot transfer settings. We have made our pre-trained models publicly available at https://github.com/lanwuwei/GigaBERT. + +# 1 Introduction + +Fine-tuning pre-trained Transformer models (Devlin et al., 2019; Liu et al., 2019; Yang et al., 2019) has recently achieved state-of-the-art results on a wide range of NLP tasks where supervised training data is available. When trained on multilingual corpora, BERT-based models have demonstrated the ability to learn multilingual representations that support zero-shot cross-lingual transfer learning surprisingly effectively (Wu and Dredze, 2019; Pires et al., 2019; Lample and Conneau, 2019). + +Without access to any parallel text or target language annotations, multilingual BERT (mBERT; Devlin et al., 2019) even supports cross-lingual transfer for language pairs that are written in different scripts, for example, English-to-Arabic. However, the transfer learning performance still lags far behind where supervised data is available in the + +target language. In this paper, we explore to what extent it is possible to improve performance in the zero-shot scenario by building a customized bilingual BERT for English and Arabic, a particularly challenging language pair for cross-lingual transfer learning. + +We present GigaBERT, a customized BERT for English-to-Arabic cross-lingual transfer that is trained on newswire text in the Gigaword corpus (Graff et al., 2003; Parker et al., 2009) in addition to Wikipedia and web crawl data. We systematically compare our pre-trained models of different configurations against the mBERT (Devlin et al., 2019) and XLM-RoBERTa (XLM-R; Conneau et al., 2020a). By using a customized vocabulary and code-switched data specifically created for English-to-Arabic transfer learning, our GiagBERT outperforms mBERT and XLM- $\mathbf{R}_{\mathrm{base}}$ (both support more than 100 languages) on a range of IE tasks, including named entity recognition, part-of-speech tagging, argument role labeling, and relation extraction. Further performance gains are demonstrated by augmenting the pre-training corpus with synthetically generated code-switched data. This demonstrates the usefulness of anchor points for zero-shot cross-lingual transfer learning. GigaBERT also performs well when annotated Arabic data is available, outperforming AraBERT (Antoun et al., 2020), the state-of-the-art Arabic-specific BERT model, on various Arabic IE tasks. + +# 2 Related Work + +The existing Arabic pre-trained models are either monolingual, such as hULMonA (ElJundi et al., 2019) and AraBERT (Antoun et al., 2020); or multilingual with several or over a hundred languages, such as mBERT (Devlin et al., 2019), XLM (Lample and Conneau, 2019), and XLM-RoBERTa (Conneau et al., 2020a). There is no bilingual pre + +
ModelsTraining DataVocabularyConfiguration
source#tokens (all/en/ar)tokenizationsize (all/en/ar)casedsize#parameters
AraBERTnewswire2.5B/ – /2.5BSentencePiece64k/ – / 58knobase136M
mBERTWiki21.9B/2.5B/153MWordPiece110k/53k/5kyesbase172M
XLM-RbaseCommonCrawl295B/55.6B/2.9BSentencePiece250k/80k/14kyesbase270M
XLM-RlargeCommonCrawl295B/55.6B/2.9BSentencePiece250k/80k/14kyeslarge550M
GiagBERT-v0Gigaword4.7B/3.6B/1.1BSentencePiece50k/28k/19kyesbase125M
GigaBERT-v1Gigaword, Wiki7.4B/6.1B/1.3BWordPiece50k/25k/23kyesbase125M
GigaBERT-v2/3Gigaword, Wiki, Oscar10.4B/6.1B/4.3BWordPiece50k/21k/26knobase125M
GigaBERT-v4Gigaword, Wiki, Oscar (+ code-switch)10.4B/6.1B/4.3BWordPiece50k/21k/26knobase125M
+ +Table 1: Configuration comparisons for AraBERT (Antoun et al., 2020), mBERT (Devlin et al., 2019), XLM-RoBERTa (Conneau et al., 2020a), and GigaBERT (this work). + +trained language model designed specifically for English-Arabic. K et al. (2020) pre-trained small-scale (e.g., 1GB data and 2M training steps) bilingual BERT for English-Hindi, English-Spanish, and English-Russian to study the impact of linguistic properties of the languages, the architecture of the model, and the learning objectives on cross-lingual transfer. Kim et al. (2019) presented a bilingual BERT using multi-task learning for translation quality estimation with regards to English-Russian and English-German. Conneau et al. (2020b) focused on the bilingual XLM for English-French, English-Russian, and English-Chinese to analyze the cross-lingual transfer ability with domain similarity, anchor points, parameter sharing, and language similarity. + +# 3 GigaBERT + +We present five versions of GigaBERT pre-trained using the Transformer encoder (Vaswani et al., 2017) with $\mathrm{BERT}_{\mathrm{base}}$ configurations: 12 attention layers, each has 12 attention heads and 768 hidden dimensions, which attributes 110M parameters. Table 1 shows a detailed summary of the training data and model parameters. + +# 3.1 Training Data + +We pre-train our GigaBERT models using the fifth edition of English and Arabic Gigaword corpora. The Gigaword data consists of 13 million news articles and matches the domain of many NLP tasks. We split English and Arabic sentences without tokenization by a modified version of the Stanford + +CoreNLP tool (Manning et al., 2014). We also add Wikipedia data processed by WikiExtractor for better coverage. As the English Wikipedia (total 2.5B tokens) is much larger than the Arabic Wikipedia (total 0.15B tokens), we balance the pretraining data by (1) up-sampling the Arabic data by repeating the Wikipedia portion five times and the Gigaword portion three times; (2) adding the Arabic section of the Oscar corpus (Ortiz Suárez et al., 2019), a large-scale multilingual dataset filtered from the Common crawl. + +Code-Switched Data Augmentation. To further improve cross-lingual transfer capability, we leverage English-Arabic dictionaries to create synthetic code-switched training data (Conneau et al., 2020a). We experimented with three dictionaries: PanLex (Kamholz et al., 2014), MUSE (Conneau et al., 2018), and Wikipedia parallel titles. We extract parallel article titles in Wikipedia based on the inter-language links and the entities based on the Wikidata (Jiang et al., 2020). The dictionaries of PanLex, MUSE, Wikipedia contain 24K, 44K, 2M entries, respectively, and on average 4.6, 1.4 and 1 translations per entry (English or Arabic). For training GigaBERT-v4, we code-switch up to $50\%$ random sentences for both English and Arabic and up to $30\%$ of tokens for each sentence. During the replacement process, we prioritize substitutions based on the Wikipedia titles, then PanLex and MUSE if the proportion of tokens being replaced has not reached $30\%$ for a given sentence. + +# 3.2 Vocabulary + +The vocabulary size is critical to the performance of pre-training models, as it directly impacts the subword granularity and the number of parameters. The original English BERT (Devlin et al., 2019) uses a 30k vocabulary size for $\sim 3\mathrm{B}$ tokens of training data, while the multilingual BERT and XLM-R have $\sim 5\mathrm{k}$ and $\sim 14\mathrm{k}$ Arabic subwords in their vocabularies respectively (Table 1). We choose a vocabulary size of 50k for our GigaBERT models based on preliminary experiments. For GigaBERTv0, we use the unigram language model in the SentencePiece (Kudo and Richardson, 2018) to create 30k cased English subwords and 20k Arabic subwords separately. For GigaBERT-v1/2/3/4, we did not distinguish Arabic and English subword units, instead, we train a unified 50k vocabulary using WordPiece (Wu et al., 2016). The vocabulary is cased for GigaBERT-v1 and uncased for GigaBERT-v2/3/4, which use the same vocabulary. + +# 3.3 Optimization + +We use the official implementation of BERT (Devlin et al., 2019) in TensorFlow for pre-training. We use Adam optimizer (Kingma and Ba, 2015) with a learning rate of 1e-4, $\beta_{1} = 0.9$ , $\beta_{2} = 0.999$ , L2 weight decay of 0.01. The learning rate is warmed up over the first 100,000 steps to a peak value of 1e-4, then linearly decayed. The dropout is set to 0.1 for all layers. We use the whole word mask for GigaBERT-v0 and the regular subword mask for v1/2/3/4. The batch size is set to 512. GigaBERT-v0/1/2 are trained for 1.2 million steps on Google Cloud TPUs with a max sequence length of 128. GigaBERT-v3 is additionally trained for 140k steps with a max sequence length of 512. The maximum number of masked LM predictions per sequence is set to 20 when max sequence length is 128 and set to 80 when max sequence length is 512. GigaBERT-v4 is trained from the GigaBERT-v3 checkpoint for another 140K steps on the code-switched data. We also experiment with different thresholds for the code-switched data augmentation, as well as training models from scratch on the code-switched data (Appendix A). + +
Task#Train (en/ar)#Dev (en/ar)#Test (en/ar)Metric
NER7634/26831005/3221095/238F1
POS12543/61742002/7862077/704Acc
ARL21875/115873345/12212603/1568F1
RE63177/3298410218/44826861/4638F1
+ +Table 2: Statistics of the datasets for IE tasks. + +# 4 Experiments + +# 4.1 Downstream IE Tasks + +We demonstrate the effectiveness of GigaBERT on named entity recognition (NER), part-of-speech tagging (POS), argument role labeling (ARL), and relation extraction (RE) tasks. We use the ACE 2005 corpus (Walker et al., 2006) in the NER, ARL, and RE evaluations, and use the Universal Dependencies Treebank v1.4 (Nivre et al., 2016) in the POS experiments. All of these datasets are from the news domain, as summarized in Table 2. For NER, we use the same English document splits as Lu and Roth (2015) and randomly shuffle Arabic documents into train/dev/test $(80\% /10\% /10\%)$ . For ARL and RE, we randomly shuffle both English and Arabic documents into train/dev/test $(80\% /10\% /10\%)$ . For POS, we follow the train/dev/test split by Wu and Dredze (2019). In the ARL fine-tuning experiment, we pair each trigger with its argument mentions as positive instances and with other entities in the sentence as negative instances. As for RE, we use gold relation mentions as positive examples and create negative examples by randomly pairing two entities in a sentence. We perform these tasks following the same fine-tuning pipeline as BERT (Devlin et al., 2019). We feed input sentences into a pre-trained model, then extract the necessary hidden representations, i.e., all token representations for NER/POS and argument-entity spans for ARL/RE, before applying one linear layer for classification. We evaluate for each language in the standard supervised learning setting, as well as the zero-shot transfer learning setting from English to Arabic, where the model is trained on the annotated English training data and evaluated on the Arabic test set. + +# 4.2 Implementations + +We implement the fine-tuning experiments with the PyTorch framework (Paszke et al., 2019) and choose hyperparameters by grid search. We set the + +
ModelsNER (F1)POS (Accuracy)ARL (F1)RE (F1)
enaren→arenaren→arenaren→arenaren→ar
AraBERT-78.6--97.6--73.3--83.1-
mBERT80.372.930.8/31.197.097.350.8/50.870.464.544.4/45.977.975.330.1/30.1
XLM-Rbase81.081.543.5/43.597.897.659.6/61.169.456.454.4/53.778.279.240.4/36.0
GigaXLM-Rbase82.080.845.4/45.097.397.760.7/61.470.171.452.6/52.679.679.543.3/44.0
GigaBERT-v079.176.643.9/45.996.897.549.7/54.169.166.142.3/42.276.672.521.5/20.9
GigaBERT-v182.872.949.1/49.197.296.651.9/52.272.867.744.6/45.580.473.236.0/31.1
GigaBERT-v282.575.248.3/48.297.297.853.1/53.472.066.742.5/44.179.474.231.9/36.8
GigaBERT-v383.483.148.9/48.397.197.853.3/54.772.376.551.0/51.079.984.348.2/46.8
GigaBERT-v483.884.151.5/51.597.197.754.6/55.571.973.952.7/56.179.183.643.3/48.2
XLM-Rlarge85.884.849.3/50.498.097.861.7/61.272.373.458.0/57.483.282.152.5/57.5
GigaXLM-Rlarge85.884.551.0/51.097.997.862.0/63.673.171.156.5/51.982.582.354.0/58.2
+ +Table 3: Evaluation on four Arabic IE tasks that compares AraBERT (Antoun et al., 2020), multilingual BERT (Devlin et al., 2019), XLM-RoBERTa (Conneau et al., 2020a), GigaBERT/GigaXLM-R (this work). All models use $\mathrm{BERT}_{\mathrm{base}}$ architecture except XLM- $\mathbf{R}_{\mathrm{large}}$ . GigaBERT-v4 is continued pre-training of GigaBERT-v3 on code-switched data. GigaXLM-R is domain adapted pre-training of XLM-R on Gigaword data. + +learning rate to 2e-5, batch size to 8, max sequence length to 128, and the number of fine-tuning epochs to 7. Some exceptions include a learning rate of 1e-4 in NER experiments, max sequence length of 512, and batch size of 4 in RE experiments. For RE, we also use gradient accumulation to simulate the larger batch size of 32 when using models based on $\mathrm{BERT}_{\mathrm{large}}$ architecture. + +# 4.3 Results and Analysis + +Table 3 shows experimental results for the pre-trained models on both English and Arabic IE tasks. For the zero-shot transfer $(\mathrm{en} \rightarrow \mathrm{ar})$ , we report two scores on the Arabic test set, where the best checkpoint is selected based on the English dev set and the Arabic dev set, respectively. In summary, we find the key factors of improved pre-training performance are a large amount of training data in the target language, customized vocabulary, longer max length of sentence, and more anchor points from code-switched data. We also add experiments with XLM- $\mathbf{R}_{\text{large}}$ models as a reference, but the comparison focuses on the pre-trained models with BERT $_{\text{base}}$ configuration for fairness. + +Single-language Performance. All versions of GigaBERT perform very competitively, especially the GigaBERT-v3/4. After adding Wikipedia and Oscar data, GigaBERT-v2 starts to outperform mBERT and XLM-Rbase on most tasks. We find it crucial to continue training GigaBERT-v2 with a longer max sentence length of 512 word pieces, as the resulting GigaBERT-v3 model shows im + +provements in all four IE tasks. GigaBERT-v3 also outperforms AraBERT (Antoun et al., 2020), the state-of-the-art Arabic-specific BERT model by a large margin, showing that our bilingual GigaBERT does not sacrifice per-language performance. It is worth noting that GigaBERT-v4 also has competitive single-language performance after training on the synthetically created code-switched data. + +Cross-lingual Zero-shot Transfer Learning. All pre-trained models show varied performance when we select checkpoints based on the English dev set and Arabic dev set, indicating that the best single-language performance does not necessarily imply the best cross-lingual performance. Compared to GigaBERT-v0, additional data used to train GigaBERT-v1/2 helps improve zero-shot transfer capability, even though the added data is not from the news domain. Different from previous works (Wu and Dredze, 2019; Pires et al., 2019) that attribute cross-lingual ability to shared subwords, GigaBERT-v3 has nearly no shared word pieces or scripts between English and Arabic, but still shows strong cross-lingual performance. We hypothesize the Transformer encoder projects similar contextual representations and enables cross-lingual transfer (Conneau et al., 2020b). + +Code-Switched Pre-training. We show that we can further improve GigaBERT's cross-lingual transfer capability with a carefully designed code-switching procedure. Our GigaBERT-v4 pretrained with code-switched data shows significant improvement over GigaBERT-v3, achieving + +![](images/4e722f42f54db7a800265a0b4fd099712459539c2ebc0dc466f974da584d705c.jpg) +Figure 1: Cosine similarity between sentence representations of parallel sentences (bitext) and randomly paired sentences (random). + +new state-of-the-art for zero-shot transfer from English to Arabic on NER, ARL, and RE. Our code-switched pre-training differs from Conneau et al. (2020b) in two aspects: 1) we explored multiple bilingual dictionaries, including PanLex (Kamholz et al., 2014), MUSE (Conneau et al., 2018) and Wikipedia titles, while MUSE appears to be the most effective; 2) we keep at least half of the sentences unchanged to balance between real data and artificial data. In practice, the generated data for GigaBERT-v4 has $47.4\%$ of the sentences code-switched. We present more comparison experiments using varied code-switching mixes and different bilingual lexicons in Appendix A. + +Domain-adapted Pre-training. We also explore whether XLM-RoBERTa can be improved by additional pre-training on Gigaword data, as Gururangan et al. (2020) have shown that the continued pre-training with in-domain data is helpful. We create GigaXLM-R models by continuing pre-training from XLM- $\mathbf{R}_{\mathrm{base}}$ and XLM- $\mathbf{R}_{\mathrm{large}}$ checkpoints in the Fairseq toolkit (Ott et al., 2019) for 500k steps on shuffled Arabic and English Gigaword corpus (max sequence length 512 and batch size 4). Although only $\sim 1\%$ of the Gigaword corpus is used in this continued training step due to computing resource limit, GigaXLM-R still improves zero-shot transfer performance for NER, POS, and RE over the original XLM-R models as shown in Table 3. We could expect more performance improvement with a larger batch size and longer training time. + +Embedding Space Analysis. We further analyze the semantic similarity of parallel English-Arabic sentence representations and find that GigaBERT is able to distinguish parallel sentences from randomly paired sentences more effectively compared + +to its counterparts. Our hypothesis is that cross-lingual representations for parallel English-Arabic sentences should be similar, but randomly paired sentences should be dissimilar. To evaluate cross-lingual similarity, we extract sentence representation of 5340 English-Arabic parallel sentences from the GALE corpus10 and the same number of randomly paired sentences with pre-trained models across all 12 layers. We use the average of hidden representations, excluding [CLS] and [SEP], as a sentence representation. Cosine similarity is calculated for each sentence pairs and averaged across the whole corpus. In Figure 1, GigaBERT shows high similarity between parallel sentences and low similarity between randomly paired sentences. A clear separation for two types of paired sentences is shown across all the layers. In contrast, XLM-R is not able to distinguish between them but shows high similarity scores. mBERT shows low similarity in both cases. This suggests that our GigaBERT preserves language independent semantic information in the sentence representations, which might contribute to the competitive performance in downstream IE tasks. + +# 5 Conclusions + +In this paper, we show that the performance of zero-shot cross-lingual transfer can be improved by training customized bilingual BERT for a given language pair and text domain. We pre-trained several masked language models (GigaBERTs) for Arabic-English and conducted a focused study on information extraction tasks in the newswire domain. The experiments show that our GigaBERT model outperforms multilingual BERT, XLM-RoBERTa, and the monolingual AraBERT on NER, POS, ARL and RE tasks. We also achieve the new state-of-the-art performance fro zero-shot transfer learning from English to Arabic. We additionally studied codes-switched pre-training for GigaBERT and domain-adapted pre-training for XLM-RoBERTa. + +# Acknowledgement + +We thank Nizar Habash and anonymous reviewers for their valuable suggestions. We also thank the Google TFRC program for providing free TPU access. This material is based in part on research sponsored by the NSF (IIS-1845670), ODNI, + +and IARPA via the BETTER program (2019-19051600004), DARPA via the ARO (W911NF-17-C-0095) in addition to an Amazon Research Award. 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 ODNI, IARPA, ARO, DARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein. + +# References + +Wissam Antoun, Fady Baly, and Hazem M. Hajj. 2020. AraBERT: Transformer-based model for arabic language understanding. In Proceedings of the International Conference on Language Resources and Evaluation. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishray Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettle-moyer, and Veselin Stoyanov. 2020a. Unsupervised cross-lingual representation learning at scale. In Proceedings of the Association for Computational Linguistics. +Alexis Conneau, Guillaume Lample, Marc'Aurelio Ranzato, Ludovic Denoyer, and Hervé Jégou. 2018. Word translation without parallel data. In Proceedings of International Conference on Learning Representation. +Alexis Conneau, Shijie Wu, Haoran Li, Luke Zettlemoyer, and Veselin Stoyanov. 2020b. Emerging cross-lingual structure in pretrained language models. In Proceedings of the 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 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. +Obeida ElJundi, Wissam Antoun, Nour El Droubi, Hazem Hajj, Wassim El-Hajj, and Khaled Shaban. 2019. hULMonA: The universal language model in Arabic. In Proceedings of the Fourth Arabic Natural Language Processing Workshop. +David Graff, Junbo Kong, Ke Chen, and Kazuaki Maeda. 2003. English Gigaword. Linguistic Data Consortium. +Suchin Gururangan, Ana Marasovic, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and Noah A. Smith. 2020. Don't stop pretraining: Adapt language models to domains and tasks. In + +Proceedings of the Association for Computational Linguistics. +Chao Jiang, Mounica Maddela, Wuwei Lan, Yang Zhong, and Wei Xu. 2020. Neural crf model for sentence alignment in text simplification. In Proceedings of the Association for Computational Linguistics. +Karthikeyan K, Zihan Wang, Stephen Mayhew, and Dan Roth. 2020. Cross-lingual ability of multilingual BERT: An empirical study. In Proceedings of the International Conference on Learning Representations. +David Kamholz, Jonathan Pool, and Susan Colowick. 2014. PanLex: Building a resource for panlingual lexical translation. In Proceedings of the International Conference on Language Resources and Evaluation. +Hyun Kim, Joon-Ho Lim, Hyun-Ki Kim, and Seung-Hoon Na. 2019. QE BERT: Bilingual BERT using multi-task learning for neural quality estimation. In Proceedings of the Fourth Conference on Machine Translation. +Diederik P Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In Proceedings of International Conference on Learning Representation. +Taku Kudo and John Richardson. 2018. SentencePiece: A simple and language independent subword tokenizer and tokenizer for neural text processing. In Proceedings of *Empirical Methods in Natural Language Processing*. +Guillaume Lample and Alexis Conneau. 2019. Crosslingual language model pretraining. In Proceedings of Advances in Neural Information Processing Systems. +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. +Wei Lu and Dan Roth. 2015. Joint mention extraction and classification with mention hypergraphs. In Proceedings of Empirical Methods in Natural Language Processing. +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 the Association for Computational Linguistics. +Joakim Nivre, Željko Agić, Lars Ahrenberg, Maria Jesus Aranzabe, Masayuki Asahara, Aitziber Atutxa, Miguel Ballesteros, John Bauer, Kepa Bengoetxea, Yevgeni Berzak, Riyadh Ahmad Bhat, Eckhard Bick, Carl Borstell, Cristina Bosco, Gosse Bouma, Sam Bowman, Gülsen Cebiroğlu Eryigit, Giuseppe G. A. + +Celano, Fabricio Chalub, Căgni Čoltekin, Miriam Connor, Elizabeth Davidson, Marie-Catherine de Marneffé, Arantza Diaz de Ilarraza, Kaja Dobrovoljc, Timothy Dozat, Kira Droganova, Puneet Dwivedi, Marhaba Eli, Tomaz Erjavec, Richard Farkas, Jennifer Foster, Claudia Freitas, Katarina Gajdosova, Daniel Galbraith, Marcos Garcia, Moe Gardenfors, Sebastian Garza, Filip Ginter, lakes Goenaga, Koldo Gojenola, Memduh Gokirmak, Yoav Goldberg, Xavier Gomez Guinovart, Berta Gonzáles Saavedra, Matias Grioni, Normunds Grüzitis, Bruno Guillaume, Jan Hajic, Linh Hà My, Dag Haug, Barbora Hladka, Radu Ion, Elena Irimia, Anders Johannsen, Fredrik Jorgensen, Hüner Kasikara, Hiroshi Kanayama, Jenna Kanerva, Boris Katz, Jessica Kenney, Natalia Kotsyba, Simon Krek, Veronika Laippala, Lucia Lam, Phuong Lê H'ong, Alessandro Lenci, Nikola Ljubesić, Olga Lyashevskaya, Teresa Lynn, Aibek Makazhanov, Christopher Manning, Cătăina Mărănduc, David Mareček, Héctor Martínez Alonso, Andre Martins, Jan Mašek, Yuji Matsumoto, Ryan McDonald, Anna Missilä, Verginica Mittelelu, Yusuke Miyao, Simonetta Montemagni, Keiko Sophie Mori, Shunsuke Mori, Bohdan Moskalevskyi, Kadri Muischnek, Nina Mustafina, Kaili Mūürisep, Lu'o'ng Nguy'en Thi, Huy'en Nguy'en Thi Minh, Vitaly Nikolaev, Hanna Nurmi, Petya Osenova, Robert Ostling, Lilja Øvrelid, Valeria Paiva, Elena Pascual, Marco Passarotti, Cenel-Augusto Perez, Slav Petrov, Jussi Piitulainen, Barbara Plank, Martin Popel, Lauma Pretkalinja, Prokopis Prokopidis, Tiina Puolakainen, Sampo Pyysalo, Alexandre Rademaker, Loganathan Ramasamy, Livy Real, Laura Rituma, Rudolf Rosa, Shadi Saleh, Baiba Saulite, Sebastian Schuster, Wolfgang Seeker, Mojgan Seraji, Lena Shakurova, Mo Shen, Natalia Silveira, Maria Simi, Radu Simionescu, Katalin Simko, María Šimková, Kiril Simov, Aaron Smith, Carolyn Spadine, Alane Suhr, Umut Sulubacak, Zsolt Szántó, Takaaki Tanaka, Reut Tsarfaty, Francis Tyers, Sumire Uematsu, Larraitz Uria, Gertjan van Noord, Viktor Varga, Veronika Vincze, Lars Wallin, Jing Xian Wang, Jonathan North Washington, Mats Wiren, Zdeněk Žabokrtský, Amir Zeldes, Daniel Zeman and Hanzhi Zhu. 2016. Universal Dependencies 1.4. + +Pedro Javier Ortiz Suárez, Benoit Sagot, and Laurent Romary. 2019. Asynchronous pipeline for processing huge corpora on medium to low resource infrastructures. In Proceedings of the 7th Workshop on the Challenges in the Management of Large Corpora. + +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 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. + +Robert Parker, David Graff, Ke Chen, Junbo Kong, and Kazuaki Maeda. 2009. Arabic Gigaword. + +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 Proceedings of Advances in Neural Information Processing Systems. + +Telmo Pires, Eva Schlinger, and Dan Garrette. 2019. How multilingual is multilingual BERT? In Proceedings of the 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 Proceedings of Advances in Neural Information Processing Systems. + +Christopher Walker, Stephanie Strassel, Julie Medero, and Kazuaki Maeda. 2006. ACE 2005 multilingual training corpus. Linguistic Data Consortium, Philadelphia, 57. + +Shijie Wu and Mark Dredze. 2019. Beto, Bentz, Becas: The surprising cross-lingual effectiveness of BERT. In Proceedings of Empirical Methods in Natural Language Processing and the International Joint Conference on Natural Language Processing. + +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. + +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. XLNet: Generalized autoregressive pretraining for language understanding. In Proceedings of Advances in Neural Information Processing Systems. + +# A Comparison Experiments for Code-Switched Pre-training + +Given the English and Arabic monolingual corpus and the bilingual lexicons, we have different thresholds to control the code-switched data generation: 1) the percentage of sentences being code-switched within the whole corpus, we set sentence replacement threshold to limit the changed sentences; 2) the percentage of tokens being replaced within the sentence, we set token replacement threshold to limit the changed tokens; 3) the choice of bilingual lexicons, where we explore different combinations of PanLex, MUSE and Wiki titles. With the generated code-switched data, we can pre-train GigaBERT from scratch or load the existing checkpoint (GigaBERT-v3) for continued pre-training, which are s1 and s2 in Table 4, respectively. + +As shown in Table 4, it's better to keep some sentences unchanged for code-switched pre-training. The continued pre-training (s2) shows slightly better performance than that training from scratch (s1). During the data augmentation, we need to keep a relatively low ratio for token replacement. The + +results also reveal that the MUSE dictionary is very promising, which outperforms the combinations of all dictionaries in some cases. + +
ModelsNER (F1)POS (Accuracy)ARL (F1)RE (F1)
enaren→arenaren→arenaren→arenaren→ar
s1-0.5-0.3-all82.183.349.797.097.758.372.474.448.680.084.147.0
s1-1.0-0.5-all83.182.948.397.097.755.071.174.646.979.082.740.2
s1-0.5-0.3-pm83.583.951.397.297.856.971.473.438.374.982.847.6
s1-0.5-0.3-m82.484.752.997.197.858.670.772.452.177.383.746.0
s1-0.5-0.1-mw83.183.952.297.297.655.071.772.749.078.284.154.0
s1-0.5-0.3-mw83.383.353.597.197.756.071.972.846.879.284.244.3
s1-1.0-0.3-mw82.784.448.297.197.756.170.672.751.477.984.647.3
s1-1.0-0.001-mw83.483.854.197.297.755.172.373.348.078.783.541.2
s1-0.5-0.3-w82.883.849.997.197.853.871.473.850.877.182.754.3
s2-0.5-0.3-all83.884.151.597.197.755.571.973.956.179.183.648.2
s2-1.0-0.5-all82.283.751.797.097.856.171.374.551.179.282.045.8
s2-0.5-0.3-pm83.283.850.997.197.755.772.073.748.479.382.945.3
s2-0.5-0.3-m83.483.452.997.297.752.971.073.955.078.883.552.5
s2-0.5-0.1-mw83.085.152.797.297.853.671.975.050.079.083.752.2
s2-0.5-0.3-mw83.485.051.097.197.752.472.274.949.381.083.749.8
s2-1.0-0.3-mw83.283.750.297.097.753.571.071.854.767.281.342.9
s2-1.0-0.001-mw83.684.249.697.497.752.371.873.251.279.084.042.6
s2-0.5-0.3-w83.783.950.497.297.753.172.674.448.276.283.647.4
+ +Table 4: Comparison experiments of different code-switching configurations. The model name is composed of four parts: s1 (pre-train from scratch)/ s2 (continue pre-training), sentence replacement threshold, token replacement threshold and bilingual lexicons, where all uses PanLex, MUSE and Wiki titles, pm uses PanLex and MUSE, mw uses MUSE and Wiki, m uses MUSE only and w uses Wiki only. The model s2-0.5-0.3-all is GigaBERT-v4 in the paper. The best checkpoint for en→ar is selected with Arabic dev set. \ No newline at end of file diff --git a/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/images.zip b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5754ad70e171e0fa9ff209726548d14af6e17cf4 --- /dev/null +++ b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3efdff38930fa28b5cf9d554ffffbb0f89bcb905ab188f42758550edd6d5de32 +size 360621 diff --git a/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/layout.json b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..e51cef64210a578bb14ead6d9672a0a2ac0390ff --- /dev/null +++ b/anempiricalstudyofpretrainedtransformersforarabicinformationextraction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50299f22cbaf95c5ef1c355a804744ea5481b9fde8ae53a473c6440479d87651 +size 199101 diff --git a/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_content_list.json b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..91f61e69502743e910fcd95655a7434e0716436e --- /dev/null +++ b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f55850ad983355ceaa6ef5dfee7de73509835654ee5229795c49019c75f233e9 +size 94818 diff --git a/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_model.json b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1b37f67f7011ada1aa7bdaacf1bf615bfae9e9e7 --- /dev/null +++ b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34a41cced347e3a1d6b3655a23c0e56d8d591742848d5ce685c8091875166946 +size 110649 diff --git a/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_origin.pdf b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..1ac7b8deba1692e33c0d701fe60f7085384bcfec --- /dev/null +++ b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/4d529dfd-b5a4-46fd-8e7b-ba794cc388dc_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:561b0e041dbefbeb9634683ad3ad457766dcdd4eb4284bc2013f815087edb7b1 +size 460160 diff --git a/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/full.md b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0141afab54686006dce0b83bef5136eacdd386e5 --- /dev/null +++ b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/full.md @@ -0,0 +1,298 @@ +# An Empirical Study on Large-Scale Multi-Label Text Classification Including Few and Zero-Shot Labels + +Ilias Chalkidis †‡ Manos Fergadiotis †‡ Sotiris Kotitsas † +Prodromos Malakasiotis †‡ Nikolaos Aletras * Ion Androutsopoulos †‡ +† Department of Informatics, Athens University of Economics and Business ‡ Institute of Informatics & Telecommunications, NCSR “Demokritos” * Computer Science Department, University of Sheffield, UK [ihalk, fergadiotis, kotitsas, rulller, ion]@aueb.gr n.aletras@sheffield.ac.uk + +# Abstract + +Large-scale Multi-label Text Classification (LMTC) has a wide range of Natural Language Processing (NLP) applications and presents interesting challenges. First, not all labels are well represented in the training set, due to the very large label set and the skewed label distributions of LMTC datasets. Also, label hierarchies and differences in human labelling guidelines may affect graph-aware annotation proximity. Finally, the label hierarchies are periodically updated, requiring LMTC models capable of zero-shot generalization. Current state-of-the-art LMTC models employ Label-Wise Attention Networks (LWANS), which (1) typically treat LMTC as flat multi-label classification; (2) may use the label hierarchy to improve zero-shot learning, although this practice is vastly understudied; and (3) have not been combined with pre-trained Transformers (e.g. BERT), which have led to state-of-the-art results in several NLP benchmarks. Here, for the first time, we empirically evaluate a battery of LMTC methods from vanilla LWANS to hierarchical classification approaches and transfer learning, on frequent, few, and zero-shot learning on three datasets from different domains. We show that hierarchical methods based on Probabilistic Label Trees (PLTs) outperform LWANS. Furthermore, we show that Transformer-based approaches outperform the state-of-the-art in two of the datasets, and we propose a new state-of-the-art method which combines BERT with LWAN. Finally, we propose new models that leverage the label hierarchy to improve few and zero-shot learning, considering on each dataset a graph-aware annotation proximity measure that we introduce. + +# 1 Introduction + +Large-scale Multi-label Text Classification (LMTC) is the task of assigning a subset of labels from a large predefined set (typically thousands) to a given document. LMTC has a wide range of applications in Natural Language Processing (NLP), + +![](images/f2a318d372a9d5cc87824a5b20910ffdd88ca8466d1643494859b2c1cb3db30a.jpg) +Figure 1: Examples from LMTC label hierarchies. $\varnothing$ is the root label. $L_{l}$ is the number of labels per level. Yellow nodes denote gold label assignments. In EURLEX57K, documents have been tagged with both leaves and inner nodes (GAP: 0.45). In MIMIC-III, only leaf nodes can be used, causing the label assignments to be much sparser (GAP: 0.27). In AMAZON13K, documents are tagged with leaf nodes, but it is assumed that all the parent nodes are also assigned, leading to dense label assignments (GAP: 0.86). + +such as associating medical records with diagnostic and procedure labels (Mullenbach et al., 2018; Rios and Kavuluru, 2018), legislation with relevant legal concepts (Mencia and FURNkranzand, 2007; Chalkidis et al., 2019b), and products with categories (Lewis et al., 2004; Partalas et al., 2015). + +Apart from the large label space, LMTC datasets often have skewed label distributions (e.g., some labels have few or no training examples) and a label hierarchy with different labelling guidelines (e.g., they may require documents to be tagged only with leaf nodes, or they may allow both leaf and other nodes to be used). The latter affects graph-aware annotation proximity (GAP), i.e., the proximity of the gold labels in the label hierarchy (see Section 4.1). Moreover, the label set and the hierarchies are periodically updated, thus requiring zero- and few-shot learning to cope with + +newly introduced labels. Figure 1 shows a sample of label hierarchies, with different label assignment guidelines, from three standard LMTC benchmark datasets: EUR-LEX (Chalkidis et al., 2019b), MIMIC-III (Johnson et al., 2017), and AMAZON (McAuley and Leskovec, 2013)). + +Current state-of-the-art LMTC models are based on Label-Wise Attention Networks (LWANs) (Mullenbach et al., 2018), which use a different attention head for each label. LWANs (1) typically do not leverage structural information from the label hierarchy, treating LMTC as flat multi-label classification; (2) may use the label hierarchy to improve performance in few/zero-shot scenario, but this practice is vastly understudied; and (3) have not been combined with pre-trained Transformers. + +We empirically evaluate, for the first time, a battery of LMTC methods, from vanilla LWANs to hierarchical classification approaches and transfer learning, in frequent, few, and zero-shot learning scenarios. We experiment with three standard LMTC datasets (EURLEX57K; MIMIC-III; AMA-ZON13K). Our contributions are the following: + +- We show that hierarchical LMTC approaches based on Probabilistic Label Trees (PLTs) (Prabhu et al., 2018; Khandagale et al., 2019; You et al., 2019) outperform flat neural state-of-the-art methods, i.e., LWAN (Mullenbach et al., 2018) in two out of three datasets (EURLEX57K, AMAZON13K). +- We demonstrate that pre-trained Transformer-based approaches (e.g., BERT) further improve the results in two of the three datasets (EURLEX57K, AMAZON13K), and we propose a new method that combines BERT with LWAN achieving the best results overall. +- Finally, following the work of Rios and Kavuluru (2018) for few and zero-shot learning on MIMIC-III, we investigate the use of structural information from the label hierarchy in LWAN. We propose new LWAN-based models with improved performance in these settings, taking into account the labelling guidelines of each dataset and a graph-aware annotation proximity (GAP) measure that we introduce. + +# 2 Related Work + +# 2.1 Advances and limitations in LMTC + +In LMTC, deep learning achieves state-of-the-art results with LWANs (You et al., 2018; Mullenbach + +et al., 2018; Chalkidis et al., 2019b), in most cases comparing to naive baselines (e.g., vanilla CNNs or vanilla LSTMs). The computational complexity of LWANs, however, makes it difficult to scale them up to extremely large label sets. Thus, Probabilistic Label Trees (PLTs) (Jasinska et al., 2016; Prabhu et al., 2018; Khandagale et al., 2019) are preferred in Extreme Multi-label Text Classification (XMTC), mainly because the linear classifiers they use at each node of the partition trees can be trained independently considering few labels at each node. This allows PLT-based methods to efficiently handle extremely large label sets (often millions), while also achieving top results in XMTC. Nonetheless, previous work has not thoroughly compared PLT-based methods to neural models in LMTC. In particular, only You et al. (2018) have compared PLT methods to neural models in LMTC, but without adequately tuning their parameters, nor considering few and zero-shot labels. More recently, You et al. (2019) introduced ATTENTION-XML, a new method primarily intended for XMTC, which combines PLTs with LWAN classifiers. Similarly to the rest of PLT-based methods, it has not been evaluated in LMTC. + +# 2.2 The new paradigm of transfer learning + +Transfer learning (Ruder et al., 2019; Rogers et al., 2020), which has recently achieved state-of-the-art results in several NLP tasks, has only been considered in legal LMTC by Chalkidis et al. (2019b), who experimented with BERT (Devlin et al., 2019) and ELMO (Peters et al., 2018). Other BERT variants, e.g. ROBERTA (Liu et al., 2019), or BERT-based models have not been explored in LMTC so far. + +# 2.3 Few and zero-shot learning in LMTC + +Finally, few and zero-shot learning in LMTC is mostly understudied. Rios and Kavuluru (2018) investigated the effect of encoding the hierarchy in these settings, with promising results. However, they did not consider other confounding factors, such as using deeper neural networks at the same time, or alternative encodings of the hierarchy. Chalkidis et al. (2019b) also considered few and zero-shot learning, but ignoring the label hierarchy. + +Our work is the first attempt to systematically compare flat, PLT-based, and hierarchy-aware LMTC methods in frequent, few-, and zero-shot learning, and the first exploration of the effect of transfer learning in LMTC on multiple datasets. + +# 3 Models + +# 3.1 Notation for neural methods + +We experiment with neural methods consisting of: (i) a token encoder $(\mathcal{E}_w)$ , which makes token embeddings $(w_{t})$ context-aware $(h_t)$ ; (ii) a document encoder $(\mathcal{E}_d)$ , which turns a document into a single embedding; (iii) an optional label encoder $(\mathcal{E}_l)$ , which turns each label into a label embedding; (iv) a document decoder $(\mathcal{D}_d)$ , which maps the document to label probabilities. Unless otherwise stated, tokens are words, and $\mathcal{E}_w$ is a stacked BIGRU. + +# 3.2 Flat neural methods + +BIGRU-LWAN: In this model (Chalkidis et al., 2019b), $\mathcal{E}_d$ uses one attention head per label to generate $L$ document representations $d_l$ : + +$$ +a _ {l t} = \frac {\exp (h _ {t} ^ {\top} u _ {l})}{\sum_ {t ^ {\prime}} \exp (h _ {t ^ {\prime}} ^ {\top} u _ {l})}, d _ {l} = \frac {1}{T} \sum_ {t = 1} ^ {T} a _ {l t} h _ {t} \quad (1) +$$ + +$T$ is the document length in tokens, $h_t$ the context-aware representation of the $t$ -th token, and $u_l$ a trainable vector used to compute the attention scores of the $l$ -th attention head; $u_l$ can also be viewed as a label representation. Intuitively, each head focuses on possibly different tokens of the document to decide if the corresponding label should be assigned. In this model, $\mathcal{D}_d$ employs $L$ linear layers with sigmoid activations, each operating on a different label-wise document representation $d_l$ , to produce the probability of the corresponding label. + +# 3.3 Hierarchical PLT-based methods + +In PLT-based methods, each label is represented as the average of the feature vectors of the training documents that are annotated with this label. The root of the PLT corresponds to the full label set. The label set is partitioned into $k$ subsets using $k$ -means clustering, and each subset is represented by a child node of the root in the PLT. The labels of each new node are then recursively partitioned into $k$ subsets, which become children of that node in the PLT. If the label set of a node has fewer than $m$ labels, the node becomes a leaf and the recursion terminates. During inference, the PLT is traversed top down. At each non-leaf node, a multi-label classifier decides which children nodes + +(if any) should be visited by considering the feature vector of the document. When a leaf node is visited, the multi-label classifier of that node decides which labels of the node will be assigned to the document. + +PARABEL, BONSAI: We experiment with PARABEL (Prabhu et al., 2018) and BONSAI (Khandagale et al., 2019), two state-of-the-art PLT-based methods. PARABEL employs binary PLTs $(k = 2)$ , while BONSAI uses non-binary PLTs $(k > 2)$ , which are shallower and wider. In both methods, a linear classifier is used at each node, and documents are represented by TF-IDF feature vectors. + +ATTENTION-XML: Recently, You et al. (2019) proposed a hybrid method that aims to leverage the advantages of both PLTs and neural models. Similarly to BONSAI, ATTENTION-XML uses nonbinary trees. However, the classifier at each node of the PLT is now an LWAN with a BILSTM token encoder $(\mathcal{E}_w)$ , instead of a linear classifier operating on TF-IDF document representations. + +# 3.4 Transfer learning based LMTC + +BIGRU-LWAN-ELMO: In this model, we use ELMO (Peters et al., 2018) to obtain context-sensitive token embeddings, which we concatenate with the pre-trained word embeddings to obtain the initial token embeddings $(w_{t})$ of BIGRU-LWAN. Otherwise, the model is the same as BIGRU-LWAN. + +BERT, ROBERTA: Following Devlin et al. (2019), we feed each document to BERT and obtain the top-level representation $h_{\mathrm{CLS}}$ of BERT's special CLS token as the (single) document representation. $\mathcal{D}_d$ is now a linear layer with $L$ outputs and sigmoid activations which operates directly on $h_{\mathrm{CLS}}$ , producing a probability for each label. The same arrangement applies to ROBERTA (Liu et al., 2019). + +BERT-LWAN: Given the large size of the label set in LMTC datasets, we propose a combination of BERT and LWAN. Instead of using $h_{\mathrm{CLS}}$ as the document representation and pass it through a linear layer with $L$ outputs (as with BERT and ROBERTA), we pass all the top-level output representations of BERT into a label-wise attention mechanism. The entire model (BERT-LWAN) is jointly trained, also fine-tuning the underlying BERT encoder. + +# 3.5 Zero-shot LMTC + +C-BIGRU-LWAN is a zero-shot capable extension of BIGRU-LWAN. It was proposed by Rios and Kavuluru (2018), but with a CNN encoder; instead, we use a BIGRU. In this method, $\mathcal{E}_l$ creates $u_{l}$ as the centroid of the token embeddings of the corresponding label descriptor. The label representations $u_{l}$ are then used by the attention heads. + +$$ +v _ {t} = \tanh \left(W h _ {t} + b\right) \tag {2} +$$ + +$$ +a _ {l t} = \frac {\exp (v _ {t} ^ {\top} u _ {l})}{\sum_ {t ^ {\prime}} \exp (v _ {t ^ {\prime}} ^ {\top} u _ {l})}, d _ {l} = \frac {1}{T} \sum_ {t = 1} ^ {T} a _ {l t} h _ {t} \quad (3) +$$ + +Here $h_t$ are the context-aware embeddings of $\mathcal{E}_w$ , $a_{lt}$ is the attention score of the $l$ -th attention head for the $t$ -th document token, viewed as $v_t$ (Eq. 2), $d_l$ is the label-wise document representation for the $l$ -th label. $\mathcal{D}_d$ also relies on the label representations $u_l$ to produce each label probability $p_l$ . + +$$ +p _ {l} = \operatorname {s i g m o i d} \left(u _ {l} ^ {\top} d _ {l}\right) \tag {4} +$$ + +The centroid label representations $u_{l}$ of both encountered (during training) and unseen (zero-shot) labels remain unchanged, because the token embeddings in the centroids are not updated. This keeps the representations of unseen labels close to those of similar labels encountered during training. In turn, this helps the attention mechanism (Eq. 3) and the decoder (Eq. 4) cope with unseen labels that have similar descriptors with encountered labels. + +GC-BIGRU-LWAN: This model, originally proposed by Rios and Kavuluru (2018), applies graph convolutions (GCNs) to the label hierarchy. The intuition is that the GCNs will help the representations of rare labels benefit from the (better) representations of more frequent labels that are nearby in the label hierarchy. $\mathcal{E}_l$ now creates graph-aware label representations $u_l^3$ from the corresponding label descriptors (we omit the bias terms for brevity) as follows: + +$$ +u _ {l} ^ {1} = f \left(W _ {s} ^ {1} u _ {l} + \sum_ {j \in N _ {p, l}} \frac {W _ {p} ^ {1} u _ {j}}{\left| N _ {p , l} \right|} + \sum_ {j \in N _ {c, l}} \frac {W _ {c} ^ {1} u _ {j}}{\left| N _ {c , l} \right|}\right) \tag {5} +$$ + +$$ +u _ {l} ^ {2} = f \left(W _ {s} ^ {2} u _ {l} ^ {1} + \sum_ {j \in N _ {p, l}} \frac {W _ {p} ^ {2} u _ {j} ^ {1}}{\left| N _ {p , l} \right|} + \sum_ {j \in N _ {c, l}} \frac {W _ {c} ^ {2} u _ {j} ^ {1}}{\left| N _ {c , l} \right|}\right) (6) +$$ + +$$ +u _ {l} ^ {3} = \left[ u _ {l}; u _ {l} ^ {2} \right] \tag {7} +$$ + +where $u_{l}$ is again the centroid of the token embeddings of the descriptor of the $l$ -th label; $W_{s}^{i}$ , $W_{p}^{i}$ , $W_{c}^{i}$ are matrices for self, parent, and children nodes of each label; $N_{p,l}$ , $N_{c,l}$ are the sets of parents and children of the $l$ -th label; and $f$ is the tanh activation. The label-wise document representations $d_{l}$ are again produced by $\mathcal{E}_{d}$ , as in C-BIGRU-LWAN (Eq. 2-3), but they go through an additional dense layer with tanh activation (Eq. 8). The resulting document representations $d_{l,o}$ and the graph-aware label representations $u_{l}^{3}$ are then used by $\mathcal{D}_{d}$ to produce a probability $p_{l}$ for each label (Eq. 9). + +$$ +d _ {l, o} = \tanh \left(W _ {o} d _ {l} + b _ {o}\right) \tag {8} +$$ + +$$ +p _ {l} = \operatorname {s i g m o i d} \left(\left(u _ {l} ^ {3}\right) ^ {\top} d _ {l o}\right) \tag {9} +$$ + +DC-BIGRU-LWAN: The stack of GCN layers in GC-BIGRU-LWAN (Eq. 5-6) can be turned into a plain two-layer Multi-Layer Perceptron (MLP), unaware of the label hierarchy, by setting $N_{p,l} = N_{c,l} = \emptyset$ . We call DC-BIGRU-LWAN the resulting (deeper than C-BIGRU-LWAN) variant of GC-BIGRU-LWAN. We use it as an ablation method to evaluate the impact of the GCN layers on performance. + +DN-BIGRU-LWAN: As an alternative approach to exploit the label hierarchy, we used a recent improvement of NODE2VEC (Grover and Leskovec, 2016) by Kotitsas et al. (2019) to obtain alternative hierarchy-aware label representations. NODE2VEC is similar to WORD2VEC (Mikolov et al., 2013), but pre-trains node embeddings instead of word embeddings, replacing WORD2VEC's text windows by random walks on a graph (here the label hierarchy). In a variant of DC-BIGRU-LWAN, dubbed DN-BIGRU-LWAN, we simply replace the initial centroid $u_{l}$ label representations of DC-BIGRU-LWAN in Eq. 5 and 7 by the label representations $g_{l}$ generated by the NODE2VEC extension. + +DNC-BIGRU-LWAN: In another version of DC-BIGRU-LWAN, called DNC-BIGRU-LWAN, we replace the initial centroid $u_{l}$ label representations of DC-BIGRU-LWAN by the concatenation $[u_{l};g_{l}]$ . + +GNC-BIGRU-LWAN: Similarly, we expand GC-BIGRU-LWAN with the hierarchy-aware label representations of the NODE2VEC extension. Again, we replace the centroid $u_{l}$ label representations of GC-BIGRU-LWAN in Eq. 5 and 7 by the label representations $g_{l}$ of the NODE2VEC extension. The resulting + +model, GNC-BIGRU-LWAN, uses both NODE2VEC and the GCN layers to encode the label hierarchy, thus obtaining knowledge from the label hierarchy both in a self-supervised and a supervised fashion. + +# 4 Experimental Setup + +# 4.1 Graph-aware Annotation Proximity + +In this work, we introduce graph-aware label proximity (GAP), a measure of the topological proximity (on the label hierarchy) of the gold labels assigned to documents. GAP turns out to be a key factor in the performance of hierarchy-aware zero-shot capable extensions of BIGRU-LWAN. Let $G(L,E)$ be the graph of the label hierarchy, where $L$ is the set of nodes (label set) and $E$ the set of edges. Let $L_d \subseteq L$ be the set of gold labels a particular document $d$ is annotated with. Finally, let $G_d^+(L_d^+,E_d^+)$ be the minimal (in terms of $|L_d^+|$ ) subgraph of $G(L,E)$ , with $L_d \subseteq L_d^+ \subseteq L$ and $E_d^+ \subseteq E$ , such that for any two nodes (gold labels) $l_1,l_2 \in L_d$ , the shortest path between $l_1,l_2$ in the full graph $G(L,E)$ is also a path in $G_d^+(L_d^+,E_d^+)$ . Intuitively, we extend $L_d$ to $L_d^+$ by including additional labels that lie between any two assigned labels $l_1,l_2$ on the shortest path that connects $l_1,l_2$ in the full graph. We then define $\mathrm{GAP}_d = \frac{|L_d|}{|L_d^+|}$ . By averaging $\mathrm{GAP}_d$ over all the documents $d$ of a dataset, we obtain a single GAP score per dataset (Fig. 1). When the assigned (gold) labels of the documents are frequently neighbours in the full graph (label hierarchy), we need to add fewer labels when expanding the $L_d$ of each document to $L_d^+$ ; hence, $\mathrm{GAP} \to 1$ . When the assigned (gold) labels are frequently remote to each other, we need to add more labels ( $|L_d^+| \gg |L_d|$ ) and $\mathrm{GAP} \to 0$ . + +GAP should not be confused with label density (Tsoumakas and Katakis, 2009), defined as $\mathrm{D} = \frac{1}{N}\sum_{d = 1}^{N}\frac{|L_d|}{|L|}$ , where $N$ is the total number of documents. Although label density is often used in the multi-label classification literature, it is graph-unaware, i.e., it does not consider the positions (and distances) of the assigned labels in the graph. + +# 4.2 Data + +EURLEX57K (Chalkidis et al., 2019b) contains 57k English legislative documents from EURLEX. Each document is annotated with one or more concepts (labels) from the 4,271 concepts of EUROVOC. The average document length is + +approx. 727 words. The labels are divided in frequent (746 labels), few-shot (3,362), and zero-shot (163), depending on whether they were assigned to $n > 50$ , $1 < n \leq 50$ , or no training documents. They are organized in a 6-level hierarchy, which was not considered in the experiments of Chalkidis et al. (2019b). The documents are labeled with concepts from all levels (Fig. 1), but in practice if a label is assigned, none of its ancestor or descendant labels are assigned. The resulting GAP is 0.45. + +MIMIC-III (Johnson et al., 2017) contains approx. $52\mathrm{k}$ English discharge summaries from US hospitals. The average document length is approx. $1.6\mathrm{k}$ words. Each summary has one or more codes (labels) from 8,771 leaves of the ICD-9 hierarchy, which has 8 levels (Fig. 1).7 Labels are divided in frequent (4,112 labels), few-shot (4,216 labels), and zero-shot (443 labels), depending on whether they were assigned to $n > 5$ , $1 < n \leq 5$ , or no training documents. All discharge summaries are annotated with leaf nodes (5-digit codes) only, i.e., the most fine-grained categories (Fig. 1), causing the label assignments to be much sparser compared to EURLEX57K (GAP 0.27). + +AMAZON13K (Lewis et al., 2004) contains approx. 1.5M English product descriptions from Amazon. Each product is represented by a title and a description, which are on average 250 words when concatenated. Products are classified into one or more categories (labels) from a set of approx. 14k. Labels are divided in frequent (3,108 labels), few-shot (10,581 labels), zero-shot (579 labels), depending on whether they were assigned to $n > 100$ , $1 < n \leq 100$ , or no training documents. The labels are organized in a hierarchy of 8 levels. If a product is annotated with a label, all of its ancestor labels are also assigned to the product (Fig. 1), leading to dense label assignments (GAP 0.86). + +# 4.3 Evaluation Measures + +The most common evaluation measures in LMTC are label precision and recall at the top $K$ predicted labels $(P@K, R@K)$ of each document, and $nDCG@K$ (Manning et al., 2009), both averaged over test documents. However, $P@K$ and $R@K$ unfairly penalize methods when the gold labels of a document are fewer or more than $K$ , respectively. R-Precision@K $(RP@K)$ (Chalkidis et al., 2019b), a top- $K$ version of R-Precision (Manning et al., + +
ALL LABELSFREQUENTFEW
RP@KnDCG@KRP@KnDCG@KRP@KnDCG@K
EURLEX57K (LAVG = 5.07, K = 5)
FLAT NEURAL METHODS
BIGRU-LWAN (Chalkidis et al., 2019b)77.180.181.082.465.661.7
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)76.880.080.682.366.261.8
HIERARCHICAL PLT-BASED METHODS
PARABEL (Prabhu et al., 2018)78.180.682.483.359.957.3
BONSAI (Khandagale et al., 2019)79.381.883.484.365.061.6
ATTENTION-XML (You et al., 2019)78.180.081.983.168.964.9
TRANSFER LEARNING
BIGRU-LWAN-ELMO (Chalkidis et al., 2019b)78.181.182.183.566.861.9
BERT-BASE (Devlin et al., 2019)79.682.383.484.669.364.4
ROBERTA-BASE (Liu et al., 2019)79.381.983.484.467.562.4
BERT-BASE-LWAN (new)80.382.984.385.469.965.0
MIMIC-III (LAVG = 15.45, K = 15)
FLAT NEURAL METHODS
BIGRU-LWAN (Chalkidis et al., 2019b)66.270.166.870.621.714.3
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)64.969.165.669.635.921.1
HIERARCHICAL PLT-BASED METHODS
PARABEL (Prabhu et al., 2018)58.763.359.363.79.66.0
BONSAI (Khandagale et al., 2019)59.464.060.064.411.87.9
ATTENTION-XML (You et al., 2019)69.373.470.073.826.919.5
TRANSFER LEARNING
BIGRU-LWAN-ELMO (Chalkidis et al., 2019b)66.870.967.571.321.213.0
BERT-BASE (Devlin et al., 2019)52.758.153.258.418.210.0
ROBERTA-BASE (Liu et al., 2019)53.758.954.359.218.110.9
BERT-BASE-LWAN (new)50.155.250.655.515.39.1
AMAZON13K (LAVG = 5.04, K = 5)
FLAT NEURAL METHODS
BIGRU-LWAN (Chalkidis et al., 2019b)83.985.484.986.180.073.6
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)77.479.879.181.053.745.8
HIERARCHICAL PLT-BASED METHODS
PARABEL (Prabhu et al., 2018)85.186.786.387.476.871.9
BONSAI (Khandagale et al., 2019)85.186.686.287.378.373.2
ATTENTION-XML (You et al., 2019)84.986.786.087.476.069.7
TRANSFER LEARNING
BIGRU-LWAN-ELMO (Chalkidis et al., 2019b)85.186.686.287.479.973.5
BERT-BASE (Devlin et al., 2019)86.888.588.589.670.362.2
ROBERTA-BASE (Liu et al., 2019)84.185.985.787.070.661.3
BERT-BASE-LWAN (new)87.388.988.890.077.268.9
+ +Table 1: Results (\%) of experiments across base methods for all, frequent, and few label groups. All base methods are incapable of zero-shot learning. The best overall results are shown in bold. The best results in each zone are shown underlined. We show results for $K$ close to the average number of labels $L_{AVG}$ . + +2009), is better; it is the same as $P@K$ if there are at least $K$ gold labels, otherwise $K$ is reduced to the number of gold labels. When the order of the top- $K$ labels is unimportant (e.g., for small $K$ ), $RP@K$ is more appropriate than $nDCG@K$ . + +# 4.4 Implementation Details + +We implemented neural methods in TENSORFLOW 2, also relying on the HuggingFace Transformers library for BERT-based models. We use the BASE versions of all models, and the Adam optimizer (Kingma and Ba, 2015). All hyper-parameters were tuned selecting values with the best loss on the + +development data. $^{9}$ For all PLT-based methods, we used the code provided by their authors. $^{10}$ + +# 5 Results + +# 5.1 Overall predictive performance + +PLTs vs. LWANs: Interestingly, the TF-IDF-based PARABEL and BONSAI outperform the best previously published neural LWAN-based models on EURLEX57K and AMAZON13K, while being comparable to ATTENTION-XML, when all or frequent + +labels are considered (Table 1). This is not the case with MIMIC-III, where BIGRU-LWAN and ATTENTION-XML have far better results for all and frequent labels. The poor performance of the two TF-IDF-based PLT-based methods on MIMIC-III seems to be due to the fact that their TF-IDF features ignore word order and are not contextualized, which is particularly important in this dataset. To confirm this, we repeated the experiments of BIGRU-LWAN on MIMIC-III after shuffling the words of the documents, and performance dropped by approx. $7.7\%$ across all measures, matching the performance of PLT-based methods. $^{11}$ The dominance of ATTENTION-XML in MIMIC-III further supports our intuition that word order is particularly important in this dataset, as the core difference of ATTENTION-XML with the rest of the PLT-based methods is the use of RNN-based classifiers that use word embeddings and are sensitive to word order, instead of linear classifiers with TF-IDF features, which do not capture word order. Meanwhile, in both EURLEX57K and AMAZON13K, the performance of ATTENTION-XML is competitive with both TF-IDF-based PLT-based methods and BIGRU-LWAN, suggesting that the bag-of-words assumption holds in these cases. Thus, we can fairly assume that word order and global context (long-term dependencies) do not play a drastic role when predicting labels (concepts) on these datasets. + +Effects of transfer learning: Adding context-aware ELMO embeddings to BIGRU-LWAN (BIGRU-LWAN-ELMO) improves performance across all datasets by a small margin, when considering all or frequent labels. For EURLEX57K and Amazon13K, larger performance gains are obtained by fine-tuning BERT-BASE and ROBERTA-BASE. Our proposed new method (BERT-BASE-LWAN) that employs LWAN on top of BERT-BASE has the best results among all methods on EURLEX57K and Amazon13K, when all and frequent labels are considered. However, in both datasets, the results are comparable to BERT-BASE, indicating that the multi-head attention mechanism of BERT can effectively handle the large number of labels. + +Poor performance of BERT on MIMIC-III: Quite surprisingly, all three BERT-based models perform poorly on MIMIC-III (Table 1), so we examined two possible reasons. First, we hypothesized that this poor performance is due to the distinctive + +
MethodTFnDCG@15
ATTENTION-XML (You et al., 2019)full-text-73.4
BERT-BASE (Devlin et al., 2019)5121.5158.1
ROBERTA-BASE (Liu et al., 2019)5121.4558.9
CLINICAL-BERT (Alsentzer et al., 2019)5121.6058.6
SCI-BERT (Beltagy et al., 2019)5121.3560.5
HIER-SCI-BERT (new)40961.3561.9
+ +Table 2: Performance of BERT and its variants compared to ATTENTION-XML on MIMIC-III. $\hat{\mathbf{T}}$ is the maximum number of (possibly sub-word) tokens used per document. $\hat{\mathbf{F}}$ is the fragmentation ratio, i.e., the number of tokens (BPEs or wordpieces) per word. + +writing style and terminology of biomedical documents, which are not well represented in the generic corpora these models are pre-trained on. To check this hypothesis, we employed CLINICAL-BERT (Alsentzer et al., 2019), a version of BERT-BASE that has been further fine-tuned on biomedical documents, including discharge summaries. Table 2 shows that CLINICAL-BERT performs slightly better than BERT-BASE on the biomedical dataset, partly confirming our hypothesis. The improvement, however, is small and CLINICAL-BERT still performs worse than ROBERTA-BASE, which is pre-trained on larger generic corpora with a larger vocabulary. Examining the token vocabularies (Gage, 1994) of the BERT-based models reveals that biomedical terms are frequently overfragmented; e.g., 'pneumonothorax' becomes [p', '#ne', '#um', '#ono', '#th', '#orax'], and 'schizophreniform becomes [s', '#chi', '#zo', '#ph', '#ren', '#iform']. This is also the case with CLINICAL-BERT, where the original vocabulary of BERT-BASE was retained. We suspect that such long sequences of meaningless sub-words are difficult to re-assemble into meaningful units, even when using deep pre-trained Transformer-based models. Thus we also report the performance of SCI-BERT (Beltagy et al., 2019), which was pretrained from scratch (including building the vocabulary) on scientific articles, mostly from the biomedical domain. Indeed SCI-BERT performs better, but still much worse than ATTENTION-XML. + +A second possible reason for the poor performance of BERT-based models on MIMIC-III is that they can process texts only up to 512 tokens long, truncating longer documents. This is not a problem in EURLEX57K, because the first 512 tokens contain enough information to classify EURLEX57K documents (727 words on average), as shown by Chalkidis et al. (2019b). It is also not a problem in AMAZON13K, where texts are short (250 words on average). In MIMIC-III, however, the average document length is approx. 1.6k words and documents + +
EURLEX57K (K = 5)MIMIC-III (K = 15)AMAZON13K (K = 5)
FEW (n < 50)ZEROFEW (n < 5)ZEROFEW (n < 100)ZERO
BIGRU-LWAN (Chalkidis et al., 2019b)61.7-14.3-73.6-
C-BIGRU-LWAN (Rios and Kavuluru, 2018)51.033.515.031.59.920.8
DC-BIGRU-LWAN (new)62.141.519.339.339.048.9
DN-BIGRU-LWAN (new)52.223.810.022.320.427.2
DNC-BIGRU-LWAN (new)62.039.323.833.641.647.6
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)61.842.621.135.245.846.1
GNC-BIGRU-LWAN (new)62.636.318.434.245.351.9
+ +Table 3: Results (\%) of experiments performed with zero-shot capable extensions of BIGRU-LWAN. All scores are nDCG@K, with the same K values as in Table 1. Best results shown in bold. Best results in each zone shown underlined. n is the number of training documents assigned with a label. Similar conclusions can be drawn when evaluating with $RP@K$ (See the appendix). + +are severely truncated. $^{12}$ To check the effect of text truncation, we employed a hierarchical version of SCI-BERT, dubbed HIER-SCI-BERT, similar to the hierarchical BERT of Chalkidis et al. (2019a). $^{13}$ This model encodes consecutive segments of text (each up to 512 tokens) using a shared SCI-BERT encoder, then applies max-pooling over the segment encodings to produce a final document representation. HIER-SCI-BERT outperforms SCI-BERT, confirming that truncation is an important issue, but it still performs worse than ATTENTION-XML. We believe that a hierarchical BERT model pre-trained from scratch on biomedical corpora, especially discharge summaries, with a new BPE vocabulary, may perform even better in future experiments. + +# 5.2 Zero-shot Learning + +In Table 1 we intentionally omitted zero-shot labels, as the methods discussed so far, except GC-BIGRU-LWAN, are incapable of zero-shot learning. In general, any model that relies solely on trainable vectors to represent labels cannot cope with unseen labels, as it eventually learns to ignore unseen labels, i.e., it assigns them near-zero probabilities. In this section, we discuss the results of the zero-shot capable extensions of BIGRU-LWAN (Section 3.5). + +In line with the experiments of Rios and Kavuluru (2018), Table 3 shows that GC-BIGRU-LWAN (with GCNs) performs better than C-BIGRU-LWAN in zero-shot labels on all three datasets. These two zero-shot capable extensions of BIGRU-LWAN also obtain better few-shot results on MIMIC-III comparing to BIGRU-LWAN; GC-BIGRU-LWAN is also comparable to BIGRU-LWAN in few-shot learning + +on EURLEX57K, but BIGRU-LWAN is much better than its two zero-shot extensions on AMAZON13K. The superior performance of BIGRU-LWAN on EURLEX57K and AMAZON13K, compared to MIMIC-III, is due to the fact that in the first two datasets few-shot labels are more frequent ( $n \leq 50$ , and $n \leq 100$ , respectively) than in MIMIC-III ( $n \leq 5$ ). + +Are graph convolutions a key factor? It is unclear if the gains of GC-BIGRU-LWAN are due to the GCN encoder of the label hierarchy, or the increased depth of GC-BIGRU-LWAN compared to C-BIGRU-LWAN. Table 3 shows that DC-BIGRU-LWAN is competitive to GC-BIGRU-LWAN, indicating that the latter benefits mostly from its increased depth, and to a smaller extent from its awareness of the label hierarchy. This motivated us to search for alternative ways to exploit the label hierarchy. + +Alternatives in exploiting label hierarchy: Table 3 shows that DN-BIGRU-LWAN, which replaces the centroids of token embeddings of the label descriptors of DC-BIGRU-LWAN with label embeddings produced by the NODE2VEC extension, is actually inferior to DC-BIGRU-LWAN. In turn, this suggests that although the NODE2VEC extension we employed aims to encode both topological information from the hierarchy and information from the label descriptors, the centroids of word embeddings still capture information from the label descriptors that the NODE2VEC extension misses. This also indicates that exploiting the information from the label descriptors is probably more important than the topological information of the label hierarchy for few and zero-shot learning generalization. + +DNC-BIGRU-LWAN, which combines the centroids with the label embeddings of the NODE2VEC extension, is comparable to DC-BIGRU-LWAN, while being better overall in few-shot labels. Combining the GCN encoder and the NODE2VEC extension (GNC-BIGRU-LWAN) leads to a large im + +provement in zero-shot labels (46.1% to 51.9% $nDCG@K$ ) on AMAZON13K. On EURLEX57K, however, the original GC-BIGRU-LWAN still has the best zero-shot results; and on MIMIC-III, the best zero-shot results are obtained by the hierarchy-unaware DC-BIGRU-LWAN. These mixed findings seem related to the GAP of each dataset (Fig. 1). + +The role of graph-aware annotation proximity: When gold label assignments are dense, neighbouring labels co-occur more frequently, thus models can leverage topological information and learn how to better cope with neighbouring labels, which is what both GCNs and NODE2VEC do. The denser the gold label assignments, the more we can rely on more distant neighbours, and the better it becomes to include graph embedding methods that conflate larger neighbourhoods, like NODE2VEC (included in GNC-BIGRU-LWAN) on AMAZON13K (GAP 0.86), when predicting unseen labels. + +For medium proximity gold label assignments, as in EURLEX57K (GAP 0.45), it seems preferable to rely on closer neighbours only; hence, it is better to use only graph encoders that conflate smaller neighbourhoods, like the GCNs which apply convolution filters to neighbours up to two hops away, as in GC-BIGRU-LWAN (excl. NODE2VEC extension). + +When label assignments are sparse, as in MIMIC-III (GAP 0.27), where only non-neighbouring leaf labels are assigned in the same document, leveraging the topological information (e.g., knowing that a rare label shares an ancestor with a frequent one) is not always helpful, which is why encoding the label hierarchy shows no advantage in zero-shot learning in MIMIC-III; however, it can still be useful when we at least have few training instances, as the few-shot results of MIMIC-III indicate. + +Overall, we conclude that the GCN label hierarchy encoder does not always improve LWANs in zero-shot learning, compared to equally deep LWANs, and that depending on the proximity of label assignments (based on the label annotation guidelines) it may be preferable to use additional or no hierarchy-aware encodings for zero-shot learning. + +# 6 Conclusions + +We presented an extensive study of LMTC methods in three domains, to answer three understudied questions on (1) the competitiveness of PLT-based methods against neural models, (2) the use of the label hierarchy, (3) the benefits from transfer learning. A condensed summary of our findings is that + +(1) TF-IDF PLT-based methods are definitely worth considering, but are not always competitive, while ATTENTION-XML, a neural PLT-based method that captures word order, is robust across datasets; (2) transfer learning leads to state-of-the-art results in general, but BERT-based models can fail spectacularly when documents are long and technical terms get over-fragmented; (3) the best way to use the label hierarchy in neural methods depends on the proximity of the label assignments in each dataset. An even shorter summary is that no single method is best across all domains and label groups (all, few, zero) as the language, the size of documents, and the label assignment strongly vary with direct implications in the performance of each method. + +In future work, we would like to further investigate few and zero-shot learning in LMTC, especially in BERT models that are currently unable to cope with zero-shot labels. It is also important to shed more light on the poor performance of BERT models in MIMIC-III and propose alternatives that can cope both with long documents (Kitaev et al., 2020; Beltagy et al., 2020) and domain-specific terminology, reducing word over-fragmentation. Pretraining BERT from scratch on discharge summaries with a new BPE vocabulary is a possible solution. Finally, we would like to combine PLTs with BERT, similarly to ATTENTION-XML, but the computational cost of fine-tuning multiple BERT encoders, one for each PLT node, would be massive, surpassing the training cost of very large Transformer-based models, like T5-3B (Raffel et al., 2019) and MEGATRON-LM (Shoeybi et al., 2019) with billions of parameters (30-100x the size of BERT-BASE). + +# References + +Emily Alsentzer, John Murphy, William Boag, WeiHung Weng, Di Jin, Tristan Naumann, and Matthew McDermott. 2019. Publicly available clinical BERT embeddings. In Proceedings of the 2nd Clinical Natural Language Processing Workshop, pages 72-78, Minneapolis, Minnesota, USA. +Iz Beltagy, Kyle Lo, and Arman Cohan. 2019. Scibert: A pretrained language model for scientific text. In EMNLP. Association for Computational Linguistics. +Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The Long-Document Transformer. arXiv:2004.05150. +Ilias Chalkidis, Ion Androutsopoulos, and Nikolaos Aletras. 2019a. Neural legal judgment prediction in + +English. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4317-4323, Florence, Italy. Association for Computational Linguistics. +Ilias Chalkidis, Emmanouil Fergadiotis, Prodromos Malakasiotis, and Ion Androutsopoulos. 2019b. Large-Scale Multi-Label Text Classification on EU Legislation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6314–6322, Florence, Italy. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, abs/1810.04805. +Philip Gage. 1994. A new algorithm for data compression. C Users J., 12(2):23-38. +Aditya Grover and Jure Leskovec. 2016. node2vec: Scalable Feature Learning for Networks. In Proceedings of the 22Nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '16, pages 855-864, New York, NY, USA. ACM. +Kalina Jasinska, Krzysztof Dembczynski, Robert BusaFekete, Karlson Pfannschmidt, Timo Klerx, and Eyke Hullermeier. 2016. Extreme F-measure Maximization Using Sparse Probability Estimates. In Proceedings of the 33rd International Conference on International Conference on Machine Learning - Volume 48, ICML'16, pages 1435-1444. JMLR.org. +Alistair EW Johnson, David J. Stone, Leo A. Celi, and Tom J. Pollard. 2017. MIMIC-III, a freely accessible critical care database. Nature. +Sujay Khandagale, Han Xiao, and Rohit Babbar. 2019. Bonsai - Diverse and Shallow Trees for Extreme Multi-label Classification. CoRR, abs/1904.08249. +Diederik P. Kingma and Jim Ba. 2015. Adam: A method for stochastic optimization. In Proceedings of the 5th International Conference on Learning Representations. +Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. 2020. Reformer: The efficient transformer. In International Conference on Learning Representations. +Sotiris Kotitsas, Dimitris Pappas, Ion Androutsopoulos, Ryan McDonald, and Marianna Apidianaki. 2019. Embedding Biomedical Ontologies by Jointly Encoding Network Structure and Textual Node Descriptors. In Proceedings of the 18th BioNLP Workshop and Shared Task, pages 298-308, Florence, Italy. +David D. Lewis, Yiming Yang, Tony G. Rose, and Fan Li. 2004. RCV1: A New Benchmark Collection for Text Categorization Research. J. Mach. Learn. Res., 5:361-397. + +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. +Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schütze. 2009. Introduction to Information Retrieval. Cambridge University Press. +Julian McAuley and Jure Leskovec. 2013. Hidden Factors and Hidden Topics: Understanding Rating Dimensions with Review Text. In Proceedings of the 7th ACM Conference on Recommender Systems, RecSys '13, pages 165-172, New York, NY, USA. ACM. +Ryan McDonald, George Brokos, and Ion Androutsopoulos. 2018. Deep Relevance Ranking Using Enhanced Document-Query Interactions. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP). +Enaldo Loza Mencia and Johannes FURNKranzand. 2007. An Evaluation of Efficient Multilabel Classification Algorithms for Large-Scale Problems in the Legal Domain. In Proceedings of the LWA 2007, pages 126-132, Halle, Germany. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Distributed Representations of Words and Phrases and their Compositionality. In 26th Int. Conf. on Neural Information Processing Systems, Stateline, NV. +James Mullenbach, Sarah Wiegreffe, Jon Duke, Jimeng Sun, and Jacob Eisenstein. 2018. Explainable Prediction of Medical Codes from Clinical Text. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1101-1111. Association for Computational Linguistics. +Ioannis Partalas, Aris Kosmopoulos, Nicolas Baskiotis, Thierry Artières, Georgios Paliouras, Éric Gaussier, Ion Androutsopoulos, Massih-Reza Amini, and Patrick Gallinari. 2015. LSHTC: A Benchmark for Large-Scale Text Classification. CoRR, abs/1503.08581. +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 (EMNLP), pages 1532-1543. +Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In Conf. of NA Chapter of the Association for Computational Linguistics, New Orleans, Louisiana, USA. + +Yashoteja Prabhu, Anil Kag, Shrutendra Harsola, Rahul Agrawal, and Manik Varma. 2018. Parabel: Partitioned Label Trees for Extreme Classification with Application to Dynamic Search Advertising. In Proceedings of the 2018 World Wide Web Conference, WWW '18, pages 993-1002, Republic and Canton of Geneva, Switzerland. +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. +Anthony Rios and Ramakanth Kavuluru. 2018. Few-Shot and Zero-Shot Multi-Label Learning for Structured Label Spaces. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3132-3142. Association for Computational Linguistics. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2020. A Primer in BERTology: What we know about how BERT works. ArXiv, abs/2002.12327. +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. +Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. 2019. Megatron-lm: Training multi-billion parameter language models using model parallelism. arXiv e-prints. +Grigorios Tsoumakas and Ioannis Katakis. 2009. Multi-Label Classification: An Overview. International Journal of Data Warehousing and Mining, 3:1-13. +Zichao Yang, Diyi Yang, Chris Dyer, Xiaodong He, Alex Smola, and Eduard Hovy. 2016. Hierarchical Attention Networks for Document Classification. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1480-1489. Association for Computational Linguistics. +Ronghui You, Suyang Dai, Zihan Zhang, Hiroshi Mamitsuka, and Shanfeng Zhu. 2018. AttentionXML: Extreme Multi-Label Text Classification with Multi-Label Attention Based Recurrent Neural Networks. CoRR, abs/1811.01727. +Ronghui You, Zihan Zhang, Ziye Wang, Suyang Dai, Hiroshi Mamitsuka, and Shanfeng Zhu. 2019. AttentionXML: Label Tree-based Attention-Aware Deep Model for High-Performance Extreme Multi-Label Text Classification. In Advances in Neural Information Processing Systems 32, pages 5812-5822. Curran Associates, Inc. + +# A Additional Implementation Details + +All experiments were run in NVIDIA GT1080TI GPU cards, in a single GPU fashion. In Table 6, we report the size of the models and the elapsed training time. Hyper-parameters were tuned using HYPEROPT, $^{14}$ selecting values with the best loss on development data. Table 4 shows the hyperparameters search space and the selected values. We use 200-D pretrained GLOVE embeddings (Pennington et al., 2014) for EURLEX57K and Amazon13K, and 200-D WORD2VEC embeddings pretrained on PUBMED $^{15}$ (McDonald et al., 2018) for MIMIC-III. For BERT-based methods we tuned only the learning rate, considering the values $\{2e - 5$ , $3e - 5$ , $5e - 5\}$ , selecting $2e - 5$ for EURLEX57K and Amazon13K, and $5e - 5$ for MIMIC-III. Finally, for PARABEL and BONSAI we tuned the $n$ -gram order in the range $\{1, 2, 3, 4, 5\}$ , and the number of $n$ -gram features in the range $\{100k, 200k, 300k, 400k\}$ . When $n > 1$ we use $n$ -grams up to order $n$ , e.g. for $n = 3$ we use 1-grams, 2-grams and 3-grams. In all datasets the optimal values were 200k features for $n = 5$ . + +# B BIGRUs vs. CNNs + +Chalkidis et al. (2019b) showed that BIGRUs are better encoders than CNNs in EURLEX57K. We confirm these findings across all datasets (Table 5). BIGRU-LWAN, C-BIGRU-LWAN and GC-BIGRU-LWAN outperform CNN-LWAN, C-CNN-LWAN and GC-CNN-LWAN by 3.5 to 16.5 percentage points. + +# C Additional Results + +Table 7 shows $RP@K$ results of the zero-shot capable methods. As with $nDCG@K$ , we conclude that the GCN label hierarchy encoder of Rios and Kavuluru (2018) does not always improve LWANs in zero-shot learning, compared to equally deep LWANs, and that depending on the proximity of label assignments, it may be preferable to use additional or no encodings of the hierarchy for zero-shot learning. Also, the zero-shot capable methods outperform BIGRU-LWAN in all, frequent, and few labels, but no method is consistently the best. + +
EURLEX57K
Search spaceLayersUnitsDropoutWord DropoutBatch Size
BASELINES[1, 2][100, 200, 300, 400][0.1, 0.2, 0.3][0, 0.01, 0.02][8, 16]
BIGRU-LWAN (Chalkidis et al., 2019b)13000.4016
ZERO-SHOT[1, 2][100, 200, 300, 400][0.1, 0.2, 0.3][0, 0.01, 0.02][8, 16]
C-BIGRU-LWAN (Rios and Kavuluru, 2018)11000.10.0216
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)11000.1016
DC-BIGRU-LWAN (new)11000.1016
DN-BIGRU-LWAN (new)11000.1016
DNC-BIGRU-LWAN (new)11000.1016
GNC-BIGRU-LWAN (new)11000.10.0216
TRANSFER LEARNING[12][768][0.1, 0.2, 0.3]-[8, 16]
BERT-BASE (Devlin et al., 2019)127680.1-8
ROBERTA-BASE (Liu et al., 2019)127680.1-8
BERT-LWAN (new)127680.1-8
MIMIC-III
Search spaceLayersUnitsDropoutWord DropoutBatch Size
BASELINES[1, 2][100, 200, 300, 400][0.1, 0.2, 0.3][0, 0.01, 0.02][8, 16]
BIGRU-LWAN (Chalkidis et al., 2019b)23000.308
ZERO-SHOT[1, 2][100, 200, 300, 400][0.1, 0.2, 0.3][0, 0.01, 0.02][8, 16]
C-BIGRU-LWAN (Rios and Kavuluru, 2018 )21000.108
GC-BIGRU-LWAN (Rios and Kavuluru, 2018 )11000.108
DC-BIGRU-LWAN (new)11000.108
DN-BIGRU-LWAN (new)11000.108
DNC-BIGRU-LWAN (new)11000.108
GNC-BIGRU-LWAN (new)11000.108
TRANSFER LEARNING[12][768][0.1, 0.2, 0.3]-[8, 16]
BERT-BASE (Devlin et al., 2019)127680.1-8
ROBERTA-BASE (Liu et al., 2019)12
BERT-LWAN (new)127680.1-8
AMAZON
Search spaceLayersUnitsDropoutWord DropoutBatch Size
BASELINES[1, 2][100, 200, 300, 400][0.1, 0.2, 0.3][0, 0.01, 0.02][8, 16]
BIGRU-LWAN (Chalkidis et al., 2019b)23000.1032
ZERO-SHOT[1, 2][100, 200, 300, 400][0.1, 0.2, 0.3][0, 0.01, 0.02][8, 16]
C-BIGRU-LWAN (Rios and Kavuluru, 2018)21000.1032
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)11000.1032
DC-BIGRU-LWAN (new)21000.1032
DN-BIGRU-LWAN (new)11000.1032
DNC-BIGRU-LWAN (new)21000.1032
GNC-BIGRU-LWAN (new)11000.1032
TRANSFER LEARNING[12][768][0.1, 0.2, 0.3]-[8, 16]
BERT-BASE (Devlin et al., 2019)127680.1-8
ROBERTA-BASE (Liu et al., 2019)12
BERT-LWAN (ours)127680.1-8
+ +Table 4: Hyper-parameter search space and best values chosen for all neural methods except BERT-based ones. + +
ALL LABELSFREQUENTFEWZERO
RP@KnDCG@KRP@KnDCG@KRP@KnDCG@KRP@KnDCG@K
EURLEX57K (LAVG = 5.07, K = 5)
BIGRU-LWAN77.180.181.082.465.661.7--
CNN-LWAN71.774.676.177.361.155.1--
C-BIGRU-LWAN72.075.676.978.755.751.046.133.5
C-CNN-LWAN68.571.773.274.549.745.736.129.9
GC-BIGRU-LWAN76.880.080.682.366.261.848.942.6
GC-CNN-LWAN70.974.475.477.252.348.437.129.6
MIMIC-III (LAVG = 15.45, K = 15)
BIGRU-LWAN66.270.166.870.621.714.3--
CNN-LWAN60.564.361.164.716.310.2--
C-BIGRU-LWAN60.264.960.965.326.915.052.631.5
C-CNN-LWAN54.959.555.559.921.211.737.319.5
GC-BIGRU-LWAN64.969.165.669.635.921.156.635.2
GC-CNN-LWAN56.660.957.261.323.713.038.222.2
AMAZON13K (LAVG = 5.04, K = 5)
BIGRU-LWAN83.985.484.986.180.073.6--
CNN-LWAN77.179.178.279.770.463.6--
C-BIGRU-LWAN64.668.267.270.313.89.929.920.8
C-CNN-LWAN56.259.258.661.28.66.319.514.5
GC-BIGRU-LWAN77.479.879.181.053.745.856.146.1
GC-CNN-LWAN72.675.374.376.441.334.045.634.5
+ +Table 5: Results (\%) of experiments performed to compare GRU vs. CNN encoders. Best results in each zone shown in bold. We show results for $K$ close to the average number of labels $L_{AVG}$ . + +
MethodsParametersTrainable ParameterTrain Time
BASELINES
BIGRU-LWAN (Chalkidis et al., 2019b)86614h
ZERO-SHOT
C-BIGRU-LWAN (Rios and Kavuluru, 2018)80.20.29.3h
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)80.50.518.5h
DC-BIGRU-LWAN (new)81.31.311.2h
DN-BIGRU-LWAN (new)80.20.29.5h
DNC-BIGRU-LWAN (new)81.61.610.1h
GNC-BIGRU-LWAN (new)80.50.520.2h
TRANSFER LEARNING
BERT-BASE (Devlin et al., 2019)1101109.5h
ROBERTA-BASE (Liu et al., 2019)1101109.5h
BERT-LWAN (new)11911911h
+ +Table 6: Number of parameters (trainable or not) in millions and training time for a single run reported for all examined methods. + +
EURLEX57K (K = 5)MIMIC-III (K = 15)AMAZON13K (K = 5)
FEW (n < 50)ZEROFEW (n < 5)ZEROFEW (n < 100)ZERO
BIGRU-LWAN (Chalkidis et al., 2019b)65.6-21.7-80.0-
C-BIGRU-LWAN (Rios and Kavuluru, 2018)55.746.126.952.613.829.9
DC-BIGRU-LWAN (new)66.853.933.663.947.057.1
DN-BIGRU-LWAN (new)56.934.319.543.927.136.9
DNC-BIGRU-LWAN (new)66.951.741.359.450.259.6
GC-BIGRU-LWAN (Rios and Kavuluru, 2018)66.248.935.956.653.756.1
GNC-BIGRU-LWAN (new)67.749.431.657.553.863.4
+ +Table 7: Results (\%) of experiments performed with zero-shot capable extensions of BIGRU-LWAN. All scores are $RP@K$ , with the same $K$ values as in Table 1 of the main paper. Best results of zero-shot capable methods (excluding BIGRU-LWAN) shown in bold. Best results in each zone shown underlined. $n$ is the number of training documents assigned with a label. \ No newline at end of file diff --git a/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/images.zip b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..59d9afba9f1d6173390b5410fc0d98f353bf5184 --- /dev/null +++ b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bf6d1b548c515e1ea16c182d22a839fd241c3bc6102e18de50f2a01e7d3ccfa +size 882390 diff --git a/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/layout.json b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..363a82ecfeec2c62205d12c7d6e35f7bbfeed695 --- /dev/null +++ b/anempiricalstudyonlargescalemultilabeltextclassificationincludingfewandzeroshotlabels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90d64d1ed8f94ab893f935bafa1b36ba773dd61a16862ec63f7c56c3061503fe +size 446630 diff --git a/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_content_list.json b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f64502a4a0a7aa5cc6528c66e34578b141b0b11c --- /dev/null +++ b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec23ad7159bffbed5124cb383862639c51392ffd1a7233c6978a5c2a67789441 +size 104633 diff --git a/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_model.json b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e3076719953efce14217b0d091ec54f2a5d18dd8 --- /dev/null +++ b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bcaff0d44bad70eac6646127ef4db884fa52669055d536635b1d43adc928d7f +size 124938 diff --git a/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_origin.pdf b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ba8494582aff74b97db410d35c9355e8df544d35 --- /dev/null +++ b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/48bfc80e-acd1-4a3c-a569-16fb4f3c989a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9edae12de8de73d5e1ed7b5f7d86c4d8e33892ab56be9a157a87eb52c6744fc4 +size 527637 diff --git a/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/full.md b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..80db99f4645cd2477cb72cf336181e15dbe6284e --- /dev/null +++ b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/full.md @@ -0,0 +1,428 @@ +# An Exploration of Arbitrary-Order Sequence Labeling via Energy-Based Inference Networks + +Lifu $\mathbf{T}\mathbf{u}^{1*}$ Tianyu Liu $^{2*}$ Kevin Gimpel + +1 Toyota Technological Institute at Chicago, IL, USA + +$^{2}$ Institute of Computational Linguistics, Peking University, China {lifu, kgimpel}@ttic.edu, tianyu0421@pku.edu.cn + +# Abstract + +Many tasks in natural language processing involve predicting structured outputs, e.g., sequence labeling, semantic role labeling, parsing, and machine translation. Researchers are increasingly applying deep representation learning to these problems, but the structured component of these approaches is usually quite simplistic. In this work, we propose several high-order energy terms to capture complex dependencies among labels in sequence labeling, including several that consider the entire label sequence. We use neural parameterizations for these energy terms, drawing from convolutional, recurrent, and self-attention networks. We use the framework of learning energy-based inference networks (Tu and Gimpel, 2018) for dealing with the difficulties of training and inference with such models. We empirically demonstrate that this approach achieves substantial improvement using a variety of high-order energy terms on four sequence labeling tasks, while having the same decoding speed as simple, local classifiers. We also find high-order energies to help in noisy data conditions. $^{1}$ + +# 1 Introduction + +Conditional random fields (CRFs; Lafferty et al., 2001) have been shown to perform well in various sequence labeling tasks. Recent work uses rich neural network architectures to define the "unary" potentials, i.e., terms that only consider a single position's label at a time (Collobert et al., 2011; Lample et al., 2016; Ma and Hovy, 2016; Strubell et al., 2018). However, "binary" potentials, which consider pairs of adjacent labels, are usually quite simple and may consist solely of a parameter or parameter vector for each unique label transition. + +Models with unary and binary potentials are generally referred to as "first order" models. + +A major challenge with CRFs is the complexity of training and inference, which are quadratic in the number of output labels for first order models and grow exponentially when higher order dependencies are considered. This explains why the most common type of CRF used in practice is a first order model, also referred to as a "linear chain" CRF. + +One promising alternative to CRFs is structured prediction energy networks (SPENs; Belanger and McCallum, 2016), which use deep neural networks to parameterize arbitrary potential functions for structured prediction. While SPENs also pose challenges for learning and inference, Tu and Gimpel (2018) proposed a way to train SPENs jointly with "inference networks", neural networks trained to approximate structured arg max inference. + +In this paper, we leverage the frameworks of SPENs and inference networks to explore high-order energy functions for sequence labeling. Naively instantiating high-order energy terms can lead to a very large number of parameters to learn, so we instead develop concise neural parameterizations for high-order terms. In particular, we draw from vectorized Kronecker products, convolutional networks, recurrent networks, and self-attention. We also consider "skip-chain" connections (Sutton and McCallum, 2004) with various skip distances and ways of reducing their total parameter count for increased learnability. + +Our experimental results on four sequence labeling tasks show that a range of high-order energy functions can yield performance improvements. While the optimal energy function varies by task, we find strong performance from skip-chain terms with short skip distances, convolutional networks with filters that consider label trigrams, and recurrent networks and self-attention networks that consider large subsequences of labels. + +We also demonstrate that modeling high-order dependencies can lead to significant performance improvements in the setting of noisy training and test sets. Visualizations of the high-order energies show various methods capture intuitive structured dependencies among output labels. + +Throughout, we use inference networks that share the same architecture as unstructured classifiers for sequence labeling, so test time inference speeds are unchanged between local models and our method. Enlarging the inference network architecture by adding one layer leads consistently to better results, rivaling or improving over a BiLSTM-CRF baseline, suggesting that training efficient inference networks with high-order energy terms can make up for errors arising from approximate inference. While we focus on sequence labeling in this paper, our results show the potential of developing high-order structured models for other NLP tasks in the future. + +# 2 Background + +# 2.1 Structured Energy-Based Learning + +We denote the input space by $\mathcal{X}$ . For an input $\pmb{x} \in \mathcal{X}$ , we denote the structured output space by $\mathcal{Y}(\pmb{x})$ . The entire space of structured outputs is denoted $\mathcal{Y} = \cup_{\pmb{x} \in \mathcal{X}} \mathcal{Y}(\pmb{x})$ . We define an energy function (LeCun et al., 2006; Belanger and McCallum, 2016) $E_{\Theta}$ parameterized by $\Theta$ that computes a scalar energy for an input/output pair: $E_{\Theta}: \mathcal{X} \times \mathcal{Y} \to \mathbb{R}$ . At test time, for a given input $\pmb{x}$ , prediction is done by choosing the output with lowest energy: + +$$ +\hat {\boldsymbol {y}} = \arg \min _ {\boldsymbol {y} \in \mathcal {Y} (\boldsymbol {x})} E _ {\Theta} (\boldsymbol {x}, \boldsymbol {y}) \tag {1} +$$ + +# 2.2 Inference Networks + +Inference. Solving equation (1) requires combinatorial algorithms because $\mathcal{V}$ is a structured, discrete space. This becomes intractable when $E_{\Theta}$ does not decompose into a sum over small "parts" of $\pmb{y}$ . Belanger and McCallum (2016) relax this problem by allowing the discrete vector $\pmb{y}$ to be continuous. Let $\mathcal{V}_R$ denote the relaxed output space. They solve the relaxed problem by using gradient descent to iteratively minimize the energy with respect to $\pmb{y}$ . + +Tu and Gimpel (2018) propose an alternative that replaces gradient descent with a neural network trained to do inference, i.e., to mimic the function performed in equation (1). This "inference network" + +$\mathbf{A}_{\Psi}:\mathcal{X}\to \mathcal{Y}_R$ is parameterized by $\Psi$ and trained with the goal that + +$$ +\mathbf {A} _ {\Psi} (\boldsymbol {x}) \approx \underset {\boldsymbol {y} \in \mathcal {Y} _ {R} (\boldsymbol {x})} {\arg \min } E _ {\Theta} (\boldsymbol {x}, \boldsymbol {y}) \tag {2} +$$ + +Tu and Gimpel (2019) show that inference networks achieve a better speed/accuracy/search error trade-off than gradient descent given pretrained energy functions. + +Joint training of energy functions and inference networks. Belanger and McCallum (2016) proposed a structured hinge loss for learning the energy function parameters $\Theta$ , using gradient descent for the "cost-augmented" inference step required during learning. Tu and Gimpel (2018) replaced the cost-augmented inference step in the structured hinge loss with training of a "cost-augmented inference network" $\mathbf{F}_{\Phi}(\mathbf{x})$ trained with the following goal: + +$$ +\mathbf{F}_{\Phi}(\boldsymbol {x})\approx \operatorname *{arg min}_{\boldsymbol {y}\in \mathcal{Y}_{R}(\boldsymbol {x})}(E_{\Theta}(\boldsymbol {x},\boldsymbol {y}) - \triangle (\boldsymbol {y},\boldsymbol{y}^{*})) +$$ + +where $\triangle$ is a structured cost function that computes the distance between its two arguments. The new optimization objective becomes: + +$$ +\begin{array}{l} \min _ {\Theta} \max _ {\Phi} \sum_ {\langle \boldsymbol {x}, \boldsymbol {y} \rangle \in \mathcal {D}} [ \triangle (\mathbf {F} _ {\Phi} (\boldsymbol {x}), \boldsymbol {y}) \\ \left. - E _ {\Theta} (\boldsymbol {x}, \mathbf {F} _ {\Phi} (\boldsymbol {x})) + E _ {\Theta} (\boldsymbol {x}, \boldsymbol {y}) \right] _ {+} \\ \end{array} +$$ + +where $\mathcal{D}$ is the set of training pairs and $[h]_{+} = \max (0,h)$ . Tu and Gimpel (2018) alternatively optimized $\Theta$ and $\Phi$ , which is similar to training in generative adversarial networks (Goodfellow et al., 2014). + +# 2.3 An Objective for Joint Learning of Inference Networks + +One challenge with the optimization problem above is that it still requires training an inference network $\mathbf{A}_{\Psi}$ for test-time prediction. Tu et al. (2020a) proposed a "compound" objective that avoids this by training two inference networks jointly (with shared parameters), $\mathbf{F}_{\Phi}$ for cost-augmented inference and $\mathbf{A}_{\Psi}$ for test-time inference: + +$$ +\begin{array}{l} \min_{\Theta}\max_{\Phi ,\Psi}\sum_{\langle \boldsymbol {x},\boldsymbol {y}\rangle \in \mathcal{D}} \\ \underbrace {\left[ \triangle \left(\mathbf {F} _ {\Phi} (\boldsymbol {x}) , \boldsymbol {y}\right) - E _ {\Theta} \left(\boldsymbol {x} , \mathbf {F} _ {\Phi} (\boldsymbol {x})\right) + E _ {\Theta} \left(\boldsymbol {x} , \boldsymbol {y}\right) \right] _ {+}} _ {\text {m a r g i n - r e s c a l e d h i n g e l o s s}} \\ + \lambda \underbrace {\left[ - E _ {\Theta} (\boldsymbol {x} , \mathbf {A} _ {\Psi} (\boldsymbol {x})) + E _ {\Theta} (\boldsymbol {x} , \boldsymbol {y}) \right] _ {+}} _ {\text {p e r c e p t r o n l o s s}} \\ \end{array} +$$ + +As indicated, this loss can be viewed as the sum of the margin-rescaled and perceptron losses. $\Theta$ , $\Phi$ , and $\Psi$ are alternatively optimized. The objective for the energy function parameters $\Theta$ is: + +$$ +\begin{array}{l} \hat {\Theta} \leftarrow \underset {\Theta} {\arg \min } \\ \left[ \triangle (\mathbf {F} _ {\Phi} (\boldsymbol {x}), \boldsymbol {y}) - E _ {\Theta} (\boldsymbol {x}, \mathbf {F} _ {\Phi} (\boldsymbol {x})) + E _ {\Theta} (\boldsymbol {x}, \boldsymbol {y}) \right] _ {+} \\ + \lambda \left[ - E _ {\Theta} (\boldsymbol {x}, \mathbf {A} _ {\Psi} (\boldsymbol {x})) + E _ {\Theta} (\boldsymbol {x}, \boldsymbol {y}) \right] _ {+} \\ \end{array} +$$ + +The objective for the other parameters is: + +$$ +\begin{array}{l} \hat {\Psi}, \hat {\Phi} \leftarrow \underset {\Psi , \Phi} {\arg \max } \triangle (\mathbf {F} _ {\Phi} (\boldsymbol {x}), \boldsymbol {y}) - E _ {\Theta} (\boldsymbol {x}, \mathbf {F} _ {\Phi} (\boldsymbol {x})) \\ - \lambda E _ {\Theta} (\pmb {x}, \mathbf {A} _ {\Psi} (\pmb {x})) - \tau \ell_ {\mathrm {t o k e n}} (\pmb {y}, \mathbf {A} _ {\Psi} (\pmb {x})) \\ \end{array} +$$ + +where $\ell_{\mathrm{token}}$ is a supervised token-level loss which is added to aid in training inference networks. In this paper, we use the standard cross entropy summed over all positions. Like Tu et al. (2020a), we drop the zero truncation $(\max(0, .))$ when updating the inference network parameters to improve stability during training, which also lets us remove the terms that do not have inference networks. We use two independent networks but with the same architecture for the two inference networks. + +# 3 Energy Functions + +Our experiments in this paper consider sequence labeling tasks, so the input $\pmb{x}$ is a length- $T$ sequence of tokens where $x_{t}$ denotes the token at position $t$ . The output $\pmb{y}$ is a sequence of labels also of length $T$ . We use $\pmb{y}_{t}$ to denote the output label at position $t$ , where $\pmb{y}_{t}$ is a vector of length $L$ (the number of labels in the label set) and where $y_{t,j}$ is the $j$ th entry of the vector $\pmb{y}_{t}$ . In the original output space $\mathcal{V}(\pmb{x})$ , $y_{t,j}$ is 1 for a single $j$ and 0 for all others. In the relaxed output space $\mathcal{V}_R(\pmb{x})$ , $y_{t,j}$ can be interpreted as the probability of the $t$ th position being labeled with label $j$ . We use the following energy: $E_{\Theta}(\pmb{x},\pmb{y}) =$ + +$$ +- \left(\sum_ {t = 1} ^ {T} \sum_ {j = 1} ^ {L} y _ {t, j} \left(U _ {j} ^ {\top} b (\boldsymbol {x}, t)\right) + E _ {W} (\boldsymbol {y})\right) \tag {3} +$$ + +where $U_{j}\in \mathbb{R}^{d}$ is a parameter vector for label $j$ and $E_W(\pmb {y})$ is a structured energy term parameterized by parameters $W$ . In a linear chain CRF, $W$ is a transition matrix for scoring two adjacent labels. Different instantiations of $E_{W}$ will be detailed in the sections below. Also, $b(\pmb {x},t)\in \mathbb{R}^d$ denotes the "input feature vector" for position $t$ . We define it + +to be the $d$ -dimensional BiLSTM (Hochreiter and Schmidhuber, 1997) hidden vector at $t$ . The full set of energy parameters $\Theta$ includes the $U_{j}$ vectors, $W$ , and the parameters of the BiLSTM. + +The above energy functions are trained with the objective in Section 2.3. Table 1 shows the training and test-time inference requirements of our method compared to previous methods. For different formulations of the energy function, the inference network architecture is the same (e.g., BiLSTM). So the inference complexity is the same as the standard neural approaches that do not use structured prediction, which is linear in the label set size. However, even for the first order model (linear-chain CRF), the time complexity is quadratic in the label set size. The time complexity of higher-order CRFs grows exponentially with the order. + +# 3.1 Linear Chain Energies + +Our first choice for a structured energy term is relaxed linear chain energy defined for sequence labeling by Tu and Gimpel (2018): + +$$ +E _ {W} (\boldsymbol {y}) = \sum_ {t = 1} ^ {T} \boldsymbol {y} _ {t - 1} ^ {\top} W \boldsymbol {y} _ {t} +$$ + +Where $W_{i} \in \mathbb{R}^{L \times L}$ is the transition matrix, which is used to score the pair of adjacent labels. If this linear chain energy is the only structured energy term in use, exact inference can be performed efficiently using the Viterbi algorithm. + +# 3.2 Skip-Chain Energies + +We also consider an energy inspired by "skip-chain" conditional random fields (Sutton and McCallum, 2004). In addition to consecutive labels, this energy also considers pairs of labels appearing in a given window size $M + 1$ : + +$$ +E _ {W} (\boldsymbol {y}) = \sum_ {t = 1} ^ {T} \sum_ {i = 1} ^ {M} \boldsymbol {y} _ {t - i} ^ {\top} W _ {i} \boldsymbol {y} _ {t} +$$ + +where each $W_{i}\in \mathbb{R}^{L\times L}$ and the max window size $M$ is a hyperparameter. While linear chain energies allow efficient exact inference, using skip-chain energies causes exact inference to require time exponential in the size of $M$ . + +# 3.3 High-Order Energies + +We also consider $M$ th-order energy terms. We use the function $F$ to score the $M + 1$ consecutive + +
TimeTraining Number of ParametersTimeInference Number of Parameters
BiLSTMO(T * L)O(|Ψ|)O(T * L)O(|Ψ|)
CRFO(T * L2)O(|Θ|)O(T * L2)O(|Θ|)
Energy-Based Inference NetworksO(T * L)O(|Ψ| + |Φ| + |Θ|)O(T * L)O(|Ψ|)
+ +Table 1: Time complexity and number of parameters of different methods during training and inference, where $T$ is the sequence length, $L$ is the label set size, $\Theta$ are the parameters of energy function, and $\Phi, \Psi$ are the parameters of two energy-based inference networks. For arbitrary-order energy functions or different parameterizations, the size of $\Theta$ can be different. + +labels $\pmb{y}_{t - M},\dots ,\pmb{y}_t$ , then sum over positions: + +$$ +E _ {W} (\boldsymbol {y}) = \sum_ {t = M} ^ {T} F \left(\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}\right) \tag {4} +$$ + +We consider several different ways to define the function $F$ , detailed below. + +Vectorized Kronecker Product (VKP): A naive way to parameterize a high-order energy term would involve using a parameter tensor $W \in \mathbb{R}^{L^M + 1}$ with an entry for each possible label sequence of length $M + 1$ . To avoid this exponentially-large number of parameters, we define a more efficient parameterization as follows. We first define a label embedding lookup table $\in \mathbb{R}^{L \times n_l}$ and denote the embedding for label $j$ by $e_j$ . We consider $M = 2$ as an example. Then, for a tensor $W \in \mathbb{R}^{L \times L \times L}$ , its value $W_{i,j,k}$ at indices $(i,j,k)$ is calculated as + +$$ +\mathbf {v} ^ {\top} \mathrm {L a y e r N o r m} ([ e _ {i}; e _ {j}; e _ {k} ] + \mathrm {M L P} ([ e _ {i}; e _ {j}; e _ {k} ])) +$$ + +where $\mathbf{v} \in \mathbb{R}^{(M + 1)n_l}$ is a parameter vector and; denotes vector concatenation. MLP expects and returns vectors of dimension $(M + 1) \times n_l$ and is parameterized as a multilayer perceptron. Then, the energy is computed: + +$$ +F (\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}) = \operatorname {V K P} (\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t - 1}) W \boldsymbol {y} _ {t} +$$ + +where $W$ is reshaped as $\in \mathbb{R}^{LM\times L}$ . The operator VKP is somewhat similar to the Kronecker product of the $k$ vectors $\pmb{v}_1,\dots ,\pmb{v}_k^2$ . However it will return a vector, not a tensor: + +$$ +\begin{array}{l} \operatorname {V K P} \left(\boldsymbol {v} _ {1}, \dots , \boldsymbol {v} _ {k}\right) = \\ \left\{ \begin{array}{l l} \boldsymbol {v} _ {1} & k = 1 \\ \mathbf {v e c} (\boldsymbol {v} _ {1} \boldsymbol {v} _ {2} ^ {\top}) & k = 2 \\ \mathbf {v e c} (\mathrm {V K P} (\boldsymbol {v} _ {1}, \ldots , \boldsymbol {v} _ {k - 1}) \boldsymbol {v} _ {k} ^ {\top}) & k > 2 \end{array} \right. \\ \end{array} +$$ + +Where vec is the operation that vectorizes a tensor into a (column) vector. + +CNN: Convolutional neural networks (CNN) are frequently used in NLP to extract features based on words or characters (Collobert et al., 2011; Kim, 2014). We apply CNN filters over the sequence of $M + 1$ consecutive labels. The $F$ function is computed as follows: + +$$ +F (\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}) = \sum_ {n} f _ {n} (\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}) +$$ + +$$ +f _ {n} \left(\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}\right) = g \left(W _ {n} \left[ \boldsymbol {y} _ {t - M}; \dots ; \boldsymbol {y} _ {t} \right] + \mathbf {b} _ {n}\right) +$$ + +where $g$ is a ReLU nonlinearity and the vector $W_{n} \in \mathbb{R}^{L(M + 1)}$ and scalar $b_{n} \in \mathbb{R}$ are the parameters for filter $n$ . The filter size of all filters is the same as the window size, namely, $M + 1$ . The $F$ function sums over all CNN filters. When viewing this high-order energy as a CNN, we can think of the summation in Eq. 4 as corresponding to sum pooling over time of the feature map outputs. + +Tag Language Model (TLM): Tu and Gimpel (2018) defined an energy term based on a pretrained "tag language model", which computes the probability of an entire sequence of labels. We also use a TLM, scoring a sequence of $M + 1$ consecutive labels in a way similar to Tu and Gimpel (2018); however, the parameters of the TLM are trained in our setting: + +$$ +\begin{array}{l} F (\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}) = \\ - \sum_ {t ^ {\prime} = t - M + 1} ^ {t} \boldsymbol {y} _ {t ^ {\prime}} ^ {\top} \log (\mathrm {T L M} (\langle \boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t ^ {\prime} - 1} \rangle)) \\ \end{array} +$$ + +where $\mathrm{TLM}(\langle \pmb{y}_{t - M},\dots ,\pmb{y}_{t^{\prime} - 1}\rangle)$ returns the softmax distribution over tags at position $t^\prime$ (under the tag language model) given the preceding tag vectors. When each $y_{t^{\prime}}$ is a one-hot vector, this energy reduces to the negative log-likelihood of the tag sequence specified by $\pmb{y}_{t - M},\dots ,\pmb{y}_t$ + +Self-Attention (S-Att): We adopt the multi-head self-attention formulation from Vaswani et al. (2017). Given a matrix of the $M + 1$ consecutive labels $Q = K = V = [\pmb{y}_{t - M};\dots ;\pmb{y}_t]\in \mathbb{R}^{(M + 1)\times L}$ .. + +$$ +H = \mathrm {a t t e n t i o n} (Q, K, V) +$$ + +$$ +F \left(\boldsymbol {y} _ {t - M}, \dots , \boldsymbol {y} _ {t}\right) = \sum H +$$ + +where attention is the general attention mechanism: the weighted sum of the value vectors $V$ using query vectors $Q$ and key vectors $K$ (Vaswani et al., 2017). The energy on the $M + 1$ consecutive labels is defined as the sum of entries in the feature map $H \in \mathbb{R}^{L \times (M + 1)}$ after the self-attention transformation. + +# 3.4 Fully-Connected Energies + +We can simulate a "fully-connected" energy function by setting a very large value for $M$ in the skip-chain energy (Section 3.2). For efficiency and learnability, we use a low-rank parameterization for the many translation matrices $W_{i}$ that will result from increasing $M$ . We first define a matrix $S \in \mathbb{R}^{L \times d}$ that all $W_{i}$ will use. Each $i$ has a learned parameter matrix $D_{i} \in \mathbb{R}^{L \times d}$ and together $S$ and $D_{i}$ are used to compute $W_{i}$ : + +$$ +W _ {i} = S D _ {i} ^ {\top} +$$ + +where $d$ is a tunable hyperparameter that affects the number of learnable parameters. + +# 4 Related Work + +Linear chain CRFs (Lafferty et al., 2001), which consider dependencies between at most two adjacent labels or segments, are commonly used in practice (Sarawagi and Cohen, 2005; Lample et al., 2016; Ma and Hovy, 2016). + +There have been several efforts in developing efficient algorithms for handling higher-order CRFs. Qian et al. (2009) developed an efficient decoding algorithm under the assumption that all high-order features have non-negative weights. Some work has shown that high-order CRFs can be handled relatively efficiently if particular patterns of sparsity are assumed (Ye et al., 2009; Cuong et al., 2014). Mueller et al. (2013) proposed an approximate CRF using coarse-to-fine decoding and early updating. Loopy belief propagation (Murphy et al., 1999) has been used for approximate inference in high-order + +CRFs, such as skip-chain CRFs (Sutton and McCallum, 2004), which form the inspiration for one category of energy function in this paper. + +CRFs are typically trained by maximizing conditional log-likelihood. Even assuming that the graph structure underlying the CRF admits tractable inference, it is still time-consuming to compute the partition function. Margin-based methods have been proposed (Taskar et al., 2004; Tsochantaridis et al., 2004) to avoid the summation over all possible outputs. Similar losses are used when training SPENs (Belanger and McCallum, 2016; Belanger et al., 2017), including in this paper. The energy-based inference network learning framework has been used for multi-label classification (Tu and Gimpel, 2018), non-autoregressive machine translation (Tu et al., 2020b), and previously for sequence labeling (Tu and Gimpel, 2019). + +Moving beyond CRFs and sequence labeling, there has been a great deal of work in the NLP community in designing non-local features, often combined with the development of approximate algorithms to incorporate them during inference. These include $n$ -best reranking (Och et al., 2004), beam search (Lowerre, 1976), loopy belief propagation (Sutton and McCallum, 2004; Smith and Eisner, 2008), Gibbs sampling (Finkel et al., 2005), stacked learning (Cohen and de Carvalho, 2005; Krishnan and Manning, 2006), sequential Monte Carlo algorithms (Yang and Eisenstein, 2013), dynamic programming approximations like cube pruning (Chiang, 2007; Huang and Chiang, 2007), dual decomposition (Rush et al., 2010; Martins et al., 2011), and methods based on black-box optimization like integer linear programming (Roth and Yih, 2004). These methods are often developed or applied with particular types of non-local energy terms in mind. By contrast, here we find that the framework of SPEN learning with inference networks can support a wide range of high-order energies for sequence labeling. + +# 5 Experimental Setup + +We perform experiments on four tasks: Twitter part-of-speech tagging (POS), named entity recognition (NER), CCG supertagging (CCG), and semantic role labeling (SRL). + +# 5.1 Datasets + +POS. We use the annotated data from Gimpel et al. (2011) and Owoputi et al. (2013) which con + +tains 25 POS tags. We use the 100-dimensional skip-gram embeddings from Tu et al. (2017) which were trained on a dataset of 56 million English tweets using word2vec (Mikolov et al., 2013). The evaluation metric is tagging accuracy. + +NER. We use the CoNLL 2003 English data (Tjong Kim Sang and De Meulder, 2003). We use the BIOES tagging scheme, so there are 17 labels. We use 100-dimensional pretrained GloVe (Pennington et al., 2014) embeddings. The task is evaluated with micro-averaged F1 score. + +CCG. We use the standard splits from CCGbank (Hockenmaier and Steedman, 2002). We only keep sentences with length less than 50 in the original training data during training. We use only the 400 most frequent labels. The training data contains 1,284 unique labels, but because the label distribution has a long tail, we use only the 400 most frequent labels, replacing the others by a special tag \*. The percentages of $*$ in train/development/test are $0.25 / 0.23 / 0.23\%$ . When the gold standard tag is $*$ , the prediction is always evaluated as incorrect. We use the same GloVe embeddings as in NER. The task is evaluated with per-token accuracy. + +SRL. We use the standard split from CoNLL 2005 (Carreras and Márquez, 2005). The gold predicates are provided as part of the input. We use the official evaluation script from the CoNLL 2005 shared task for evaluation. We again use the same GloVe embeddings as in NER. To form the inputs to our models, an embedding of a binary feature indicating whether the word is the given predicate is concatenated to the word embedding.3 + +# 5.2 Training + +Local Classifiers. We consider local baselines that use a BiLSTM trained with the local loss $\ell_{\mathrm{token}}$ . For POS, NER and CCG, we use a 1-layer BiLSTM with hidden size 100, and the word embeddings are fixed during training. For SRL, we use a 4-layer BiLSTM with hidden size 300 and the word embeddings are fine-tuned. + +BiLSTM-CRF. We also train BiLSTM-CRF models with the standard conditional log-likelihood objective. A 1-layer BiLSTM with hidden size 100 is used for extracting input features. The CRF + +part uses a linear chain energy with a single tag transition parameter matrix. We do early stopping based on development sets. The usual dynamic programming algorithms are used for training and inference, e.g., the Viterbi algorithm is used for inference. The same pretrained word embeddings as for the local classifiers are used. + +Inference Networks. When defining architectures for the inference networks, we use the same architectures as the local classifiers. However, the objective of the inference networks is different, which is shown in Section 2.3. $\lambda = 1$ and $\tau = 1$ are used for training. We do early stopping based on the development set. + +Energy Terms. The unary terms are parameterized using a one-layer BiLSTM with hidden size 100. For the structured energy terms, the VKP operation uses $n_l = 20$ , the number of CNN filters is 50, and the tag language model is a 1-layer LSTM with hidden size 100. For the fully-connected energy, $d = 20$ for the approximation of the transition matrix and $M = 20$ for the approximation of the fully-connected energies. + +Hyperparameters. For the inference network training, the batch size is 100. We update the energy function parameters using the Adam optimizer (Kingma and Ba, 2014) with learning rate 0.001. For POS, NER, and CCG, we train the inference networks parameter with stochastic gradient descent with momentum as the optimizer. The learning rate is 0.005 and the momentum is 0.9. For SRL, we train the inference networks using Adam with learning rate 0.001. + +# 6 Results + +Parameterizations for High-Order Energies. We first compare several choices for energy functions within our inference network learning framework. In Section 3.3, we considered several ways to define the high-order energy function $F$ . We compare performance of the parameterizations on three tasks: POS, NER, and CCG. The results are shown in Table 2. + +For VKP high-order energies, there are small differences between 2nd and 3rd order models, however, 4th order models are consistently worse. The CNN high-order energy is best when $M = 2$ for the three tasks. Increasing $M$ does not consistently help. The tag language model (TLM) works best when scoring the entire label sequence. In + +
POSNERCCG
Linear Chain89.590.692.8
VKPM=289.991.193.1
M=389.891.292.9
M=489.590.892.8
CNNM=189.791.193.0
M=290.091.393.0
M=389.991.292.9
M=489.791.093.0
TLMM=289.790.892.4
M=389.891.092.7
M=489.891.392.7
all90.091.492.9
S-AttM=289.790.792.6
M=489.890.892.8
M=689.990.992.8
M=889.991.093.0
all89.790.893.1
+ +the following experiment with TLM energies, we always use it with this "all" setting. Self-attention (S-Att) also shows better performance with larger $M$ . However, the results for NER are not as high overall as for other energy terms. + +Overall, there is no clear winner among the four types of parameterizations, indicating that a variety of high-order energy terms can work well on these tasks, once appropriate window sizes are chosen. We do note differences among tasks: NER benefits more from larger window sizes than POS. + +Comparing Structured Energy Terms. Above we compared parameterizations of the high-order energy terms. In Table 3, we compare instantiations of the structured energy term $E_W(\pmb{y})$ : linear-chain energies, skip-chain energies, high-order energies, and fully-connected energies. We also compare to local classifiers (BiLSTM). The models with structured energies typically improve over the local classifiers, even with just the linear chain energy. + +The richer energy terms tend to perform better than linear chain, at least for most tasks and energies. The skip-chain energies benefit from relatively large $M$ values, i.e., 3 or 4 depending on the + +Table 2: Development results for different parameterizations of high-order energies when increasing the window size $M$ of consecutive labels, where "all" denotes the whole relaxed label sequence. The inference network architecture is a one-layer BiLSTM. We ran $t$ -tests for the mean performance (over five runs) of our proposed energies (the settings in bold) and the linear-chain energy. All differences are significant at $p < 0.001$ for NER and $p < 0.005$ for other tasks. + +
POSNERCCGSRL
WSJBrown
BiLSTM88.785.392.881.871.8
Linear Chain89.785.993.081.772.0
Skip-Chain90.086.793.382.172.4
VKP90.186.793.381.872.0
High-CNN90.186.593.281.972.2
Order TLM90.086.693.081.872.1
S-Att90.186.593.382.272.2
Fully-Connected89.886.392.981.471.4
+ +Table 3: Test results on all tasks for local classifiers (BiLSTM) and different structured energy functions. POS/CCG use accuracy while NER/SRL use F1. The architecture of inference networks is one-layer BiLSTM. More results are shown in the appendix. + +
POSNERCCG
2-layer BiLSTM88.886.093.4
BiLSTM-CRF89.287.393.1
Linear Chain90.086.693.7
Skip-Chain90.287.593.8
VKP90.287.293.8
High- CNN90.287.393.6
OrderTLM90.187.193.6
S-Att90.087.393.7
Fully-Connected90.087.293.3
+ +Table 4: Test results when inference networks have 2 layers (so the local classifier baseline also has 2 layers). + +task. These tend to be larger than the optimal VKP $M$ values. We note that S-Att high-order energies work well on SRL. This points to the benefits of self-attention on SRL, which has been found in recent work (Tan et al., 2018; Strubell et al., 2018). + +Both the skip-chain and high-order energy models achieve substantial improvements over the linear chain CRF, notably a gain of 0.8 F1 for NER. The fully-connected energy is not as strong as the others, possibly due to the energies from label pairs spanning a long range. These long-range energies do not appear helpful for these tasks. + +Comparison using Deeper Inference Networks. Table 4 compares methods when using 2-layer BiLSTMs as inference networks. $^{5}$ The deeper inference networks reach higher performance across all tasks compared to 1-layer inference networks. + +We observe that inference networks trained with skip-chain energies and high-order energies achieve better results than BiLSTM-CRF on the three datasets (the Viterbi algorithm is used for + +
α=0.1α=0.2α=0.3
BiLSTM75.067.258.8
Linear Chain75.267.459.1
Skip-Chain (M=4)75.567.959.5
VKP (M=3)75.367.759.3
CNN (M=0)75.767.959.4
CNN (M=2)76.368.660.2
CNN (M=4)76.769.860.4
TLM76.067.859.9
S-Att (M=8)75.667.659.7
+ +Table 5: UnkTest setting for NER: words in the test set are replaced by the unknown word symbol with probability $\alpha$ . For CNN energies (the settings in bold) and linear-chain energy, they differ significantly with $p < 0.001$ . + +
α=0.1α=0.2α=0.3
BiLSTM80.176.070.6
Linear Chain80.476.370.9
Skip-Chain (M=4)81.276.771.2
VKP (M=3)81.476.871.4
CNN (M=0)81.176.771.5
CNN (M=2)81.877.071.8
CNN (M=4)82.077.171.7
TLM80.976.371.1
S-Att (M=8)81.476.971.4
+ +Table 6: UnkTrain setting for NER: training on noisy text, evaluating on noisy test sets. Words are replaced by the unknown word symbol with probability $\alpha$ . For CNN energies (the settings in bold) and linear-chain energy, they differ significantly with $p < 0.001$ . + +exact inference for BiLSTM-CRF). This indicates that adding richer energy terms can make up for approximate inference during training and inference. Moreover, a 2-layer BiLSTM is much cheaper computationally than Viterbi, especially for tasks with large label sets. + +# 6.1 Results on Noisy Datasets + +We now consider the impact of our structured energy terms in noisy data settings. Our motivation for these experiments stems from the assumption that structured energies will be more helpful when there is a weaker relationship between the observations and the labels. One way to achieve this is by introducing noise into the observations. + +So, we create new datasets: for any given sentence, we randomly replace a token $x$ with an unknown word symbol "UNK" with probability $\alpha$ . From previous results, we see that NER shows more benefit from structured energies, so we focus on NER and consider two settings: UnkTest: train on clean text, evaluate on noisy text; and UnkTrain: train on noisy text, evaluate on noisy text. + +Baselines: + +
BERT (local loss)92.13
BERT-CRF92.34
+ +Energy-based inference networks: + +
Linear Chain92.14
Skip-Chain (M=3)92.46
+ +Table 7: Test results for NER when using BERT. When using energy-based inference networks (our framework), BERT is used in both the energy function and as the inference network architecture. + +Table 5 shows results for UnkTest. CNN energies are best among all structured energy terms, including the different parameterizations. Increasing $M$ improves F1, showing that high-order information helps the model recover from the high degree of noise. Table 6 shows results for UnkTrain. The CNN high-order energies again yield large gains: roughly 2 points compared to the local classifier and 1.8 compared to the linear chain energy. + +# 7 Incorporating BERT + +Researchers have recently been applying large-scale pretrained transformers like BERT (Devlin et al., 2019) to many tasks, including sequence labeling. To explore the impact of high-order energies on BERT-like models, we now consider experiments that use $\mathrm{BERT}_{\mathrm{BASE}}$ in various ways. We use two baselines: (1) BERT finetuned for NER using a local loss, and (2) a CRF using BERT features ("BERT-CRF"). Within our framework, we also experiment with using BERT in both the energy function and inference network architecture. That is, the "input feature vector" in Equation 3 is replaced by the features from BERT. The energy and inference networks are trained with the objective in Section 2.3. For the training of energy function and inference networks, we use Adam with learning rate $5\mathrm{e} - 5$ , a batch size of 32, and L2 weight decay of $1\mathrm{e} - 5$ . The results are shown in Table 7.6 + +There is a slight improvement when moving from BERT trained with the local loss to using BERT within the CRF (92.13 to 92.34). There is little difference (92.13 vs. 92.14) between the locally-trained BERT model and when using the linear-chain energy function within our framework. However, when using the higher-order energies, the difference is larger (92.13 to 92.46). + +![](images/0050831a392e0af9ad93621baabcfdb9fc31d21c1398f280b7287e5234dd5709.jpg) +(a) Skip-chain energy matrix $W_{1}$ . + +![](images/12ebe4458b2929cbd54a9c50bdb587807f286d9edef3ad9904f975e1ac5ca2a2.jpg) +(b) Skip-chain energy matrix $W_{3}$ . +Figure 1: Learned pairwise potential matrices $W_{1}$ and $W_{3}$ for NER with skip-chain energy. The rows correspond to earlier labels and the columns correspond to subsequent labels. + +# 8 Analysis of Learned Energies + +In this section, we visualize our learned energy functions for NER to see what structural dependencies among labels have been captured. + +Figure 1 visualizes two matrices in the skipchain energy with $M = 3$ . We can see strong associations among labels in neighborhoods from $W_{1}$ . For example, B-ORG and I-ORG are more likely to be followed by E-ORG. The $W_{3}$ matrix shows a strong association between I-ORG and E-ORG, which implies that the length of organization names is often long in the dataset. + +For the VKP energy with $M = 3$ , Figure 2 shows the learned matrix when the first label is B-PER, showing that B-PER is likely to be followed by "I-PER E-PER", "E-PER O", or "I-PER I-PER". + +In order to visualize the learned CNN filters, + +![](images/6659c094edbb43c5d0f90b3b5bb8c9b3c4a219903c21ede68560b78fbedac47a.jpg) +Figure 2: Learned 2nd-order VKP energy matrix beginning with B-PER in NER dataset. + +
filter 26B-MISCI-MISCE-MISC
filter 12B-LOCI-LOCE-LOC
filter 15B-PERI-PERI-PER
filter 5B-MISCE-MISCO
filter 6OB-LOCI-LOC
filter 16S-LOCB-ORGI-ORG
filter 44B-PERI-PERI-PER
filter 3B-MISCI-MISCE-MISC
filter 2I-LOCE-LOCO
filter 45OB-LOCE-LOC
+ +Table 8: Top 10 CNN filters with high inner product with 3 consecutive labels for NER. + +we calculate the inner product between the filter weights and consecutive labels. For each filter, we select the sequence of consecutive labels with the highest inner product. Table 8 shows the 10 filters with the highest inner product and the corresponding label trigram. All filters give high scores for structured label sequences with a strong local dependency, such as "B-MISC I-MISC E-MISC" and "B-LOC I-LOC E-LOC", etc. Figure 3 in the appendix shows these inner product scores of 50 CNN filters on a sampled NER label sequence. We can observe that filters learn the sparse set of label trigrams with strong local dependency. + +# 9 Conclusion + +We explore arbitrary-order models with different neural parameterizations on sequence labeling tasks via energy-based inference networks. This approach achieve substantial improvement using high-order energy terms, especially in noisy data conditions, while having same decoding speed as simple local classifiers. + +# Acknowledgments + +We would like to thank Sam Wiseman for help regarding high-order CRFs and the reviewers for insightful comments. This research was supported in part by an Amazon Research Award to K. Gimpel. + +# References + +David Belanger and Andrew McCallum. 2016. Structured prediction energy networks. In Proceedings of the 33rd International Conference on Machine Learning. +David Belanger, Bishan Yang, and Andrew McCallum. 2017. End-to-end learning for structured prediction energy networks. In Proceedings of the 34th International Conference on Machine Learning. +Xavier Carreras and Lluis Márquez. 2005. Introduction to the CoNLL-2005 shared task: Semantic role labeling. In Proceedings of the Ninth Conference on Computational Natural Language Learning (CoNLL-2005), pages 152-164, Ann Arbor, Michigan. Association for Computational Linguistics. +David Chiang. 2007. Hierarchical phrase-based translation. Computational Linguistics, 33(2):201-228. +William W. Cohen and Vitor Rocha de Carvalho. 2005. Stacked sequential learning. In *IJCAI-05, Proceedings of the Nineteenth International Joint Conference on Artificial Intelligence*, Edinburgh, Scotland, UK, July 30 - August 5, 2005, pages 671-676. +Ronan Collobert, Jason Weston, Léon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel Kuksa. 2011. Natural language processing (almost) from scratch. JMLR. +Nguyen Viet Cuong, Nan Ye, Wee Sun Lee, and Hai Leong Chieu. 2014. Conditional random field with high-order dependencies for sequence labeling and segmentation. Journal of Machine Learning Research, 15(28):981-1009. +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. +Jenny Rose Finkel, Trond Grenager, and Christopher Manning. 2005. Incorporating non-local information into information extraction systems by Gibbs sampling. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL'05), pages 363-370, Ann Arbor, Michigan. Association for Computational Linguistics. + +Kevin Gimpel, Nathan Schneider, Brendan O'Connor, Dipanjan Das, Daniel Mills, Jacob Eisenstein, Michael Heilman, Dani Yogatama, Jeffrey Flanigan, and Noah A. Smith. 2011. Part-of-speech tagging for twitter: Annotation, features, and experiments. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 42-47. +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. 2014. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 27, pages 2672-2680. Curran Associates, Inc. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural Computation. +Julia Hockenmaier and Mark Steedman. 2002. Acquiring compact lexicalized grammars from a cleaner treebank. In Proceedings of the Third International Conference on Language Resources and Evaluation (LREC'02), Las Palmas, Canary Islands - Spain. European Language Resources Association (ELRA). +Liang Huang and David Chiang. 2007. Forest rescoring: Faster decoding with integrated language models. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pages 144-151, Prague, Czech Republic. Association for Computational Linguistics. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1746-1751, Doha, Qatar. Association for Computational Linguistics. +Diederik P. Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Vijay Krishnan and Christopher D. Manning. 2006. An effective two-stage model for exploiting non-local dependencies in named entity recognition. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pages 1121-1128, Sydney, Australia. Association for Computational Linguistics. +John D. Lafferty, Andrew McCallum, and Fernando C. N. Pereira. 2001. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In Proc. of ICML. +Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. 2016. Neural architectures for named entity recognition. In Proceedings of the 2016 Conference of the North + +American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 260-270. +Yann LeCun, Sumit Chopra, Raia Hadsell, Marc'Aurelio Ranzato, and Fu-Jie Huang. 2006. A tutorial on energy-based learning. In Predicting Structured Data. MIT Press. +Tao Lei, Yu Xin, Yuan Zhang, Regina Barzilay, and Tommi Jaakkola. 2014. Low-rank tensors for scoring dependency structures. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1381-1391, Baltimore, Maryland. Association for Computational Linguistics. +Bruce T. Lowerre. 1976. The HARPY Speech Recognition System. Ph.D. thesis, Pittsburgh, PA, USA. +Xuezhe Ma and Eduard 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 (Volume 1: Long Papers), pages 1064-1074. +André Martins, Noah Smith, Mário Figueiredo, and Pedro Aguiar. 2011. Dual decomposition with many overlapping components. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pages 238-249, Edinburgh, Scotland, UK. Association for Computational Linguistics. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 26, pages 3111-3119. Curran Associates, Inc. +Thomas Mueller, Helmut Schmid, and Hinrich Schütze. 2013. Efficient higher-order CRFs for morphological tagging. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 322-332, Seattle, Washington, USA. Association for Computational Linguistics. +Kevin P. Murphy, Yair Weiss, and Michael I. Jordan. 1999. Loopy belief propagation for approximate inference: An empirical study. In UAI. +Franz Josef Och, Daniel Gildea, Sanjeev Khudanpur, Anoop Sarkar, Kenji Yamada, Alex Fraser, Shankar Kumar, Libin Shen, David Smith, Katherine Eng, Viren Jain, Zhen Jin, and Dragomir Radev. 2004. A smorgasbord of features for statistical machine translation. In Proceedings of the Human Language Technology Conference of the North American Chapter of the Association for Computational Linguistics: HLT-NAACL 2004, pages 161-168, Boston, Massachusetts, USA. Association for Computational Linguistics. + +Olutobi Owoputi, Brendan O'Connor, Chris Dyer, Kevin Gimpel, Nathan Schneider, and Noah A. Smith. 2013. Improved part-of-speech tagging for online conversational text with word clusters. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 380-390. +Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. GloVe: Global vectors for word representation. In Proc. of EMNLP. +Xian Qian, Xiaogian Jiang, Qi Zhang, Xuanjing Huang, and Lide Wu. 2009. Sparse higher order conditional random fields for improved sequence labeling. In ICML. +Dan Roth and Wen-tau Yih. 2004. A linear programming formulation for global inference in natural language tasks. In Proceedings of the Eighth Conference on Computational Natural Language Learning (CoNLL-2004) at HLT-NAACL 2004, pages 1-8, Boston, Massachusetts, USA. Association for Computational Linguistics. +Alexander M. Rush, David Sontag, Michael Collins, and Tommi Jaakkola. 2010. On dual decomposition and linear programming relaxations for natural language processing. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 1-11, Cambridge, MA. Association for Computational Linguistics. +Sunita Sarawagi and William W Cohen. 2005. Semi-Markov conditional random fields for information extraction. In L. K. Saul, Y. Weiss, and L. Bottou, editors, Advances in Neural Information Processing Systems 17, pages 1185-1192. MIT Press. +David Smith and Jason Eisner. 2008. Dependency parsing by belief propagation. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pages 145-156, Honolulu, Hawaii. Association for Computational Linguistics. +Vivek Srikumar and Christopher D Manning. 2014. Learning distributed representations for structured output prediction. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 27, pages 3266-3274. Curran Associates, Inc. +Emma Strubell, Patrick Verga, Daniel Andor, David Weiss, and Andrew McCallum. 2018. Linguistically-informed self-attention for semantic role labeling. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 5027-5038, Brussels, Belgium. Association for Computational Linguistics. +Charles Sutton and Andrew McCallum. 2004. Collective segmentation and labeling of distant entities in + +information extraction. In ICML Workshop on Statistical Relational Learning and Its Connections to Other Fields. +Zhixing Tan, Mingxuan Wang, Jun Xie, Yidong Chen, and Xiaodong Shi. 2018. Deep semantic role labeling with self-attention. In Proceedings of AAAI. +Ben Taskar, Carlos Guestrin, and Daphne Koller. 2004. Max-margin Markov networks. In S. Thrun, L. K. Saul, and B. Schölkopf, editors, Advances in Neural Information Processing Systems 16, pages 25-32. +Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 142-147. +Ioannis Tsochantaridis, Thomas Hofmann, Thorsten Joachims, and Yasemin Altun. 2004. Support vector machine learning for interdependent and structured output spaces. In Proceedings of the Twenty-first International Conference on Machine Learning. +Lifu Tu and Kevin Gimpel. 2018. Learning approximate inference networks for structured prediction. In Proceedings of International Conference on Learning Representations (ICLR). +Lifu Tu and Kevin Gimpel. 2019. Benchmarking approximate inference methods for neural structured prediction. 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 3313-3324, Minneapolis, Minnesota. Association for Computational Linguistics. +Lifu Tu, Kevin Gimpel, and Karen Livescu. 2017. Learning to embed words in context for syntactic tasks. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pages 265-275. +Lifu Tu, Richard Yuanzhe Pang, and Kevin Gimpel. 2020a. Improving joint training of inference networks and structured prediction energy networks. Proceedings of the 4th Workshop on Structured Prediction for NLP. +Lifu Tu, Richard Yuanzhe Pang, Sam Wiseman, and Kevin Gimpel. 2020b. ENGINE: Energy-based inference networks for non-autoregressive machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. 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. + +Yi Yang and Jacob Eisenstein. 2013. A log-linear model for unsupervised text normalization. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 61-72, Seattle, Washington, USA. Association for Computational Linguistics. +Nan Ye, Wee S. Lee, Hai L. Chieu, and Dan Wu. 2009. Conditional random fields with high-order features for sequence labeling. In Y. Bengio, D. Schuurmans, J. D. Lafferty, C. K. I. Williams, and A. Culotta, editors, Advances in Neural Information Processing Systems 22, pages 2196-2204. Curran Associates, Inc. +Mo Yu, Mark Dredze, Raman Arora, and Matthew R. Gormley. 2016. Embedding lexical features via low-rank tensors. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1019-1029, San Diego, California. Association for Computational Linguistics. +Jie Zhou and Wei Xu. 2015. End-to-end learning of semantic role labeling using recurrent neural networks. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1127-1137, Beijing, China. Association for Computational Linguistics. + +# A Appendices + +
POSNERCCGSRL
DevTestDevTestDevTestDevWSJBrown
BiLSTM88.688.790.485.392.692.880.281.871.8
BiLSTM + CRF89.189.291.687.393.093.1---
Linear Chain89.589.790.685.992.893.080.381.772.0
VKP (M=2)89.990.191.186.593.193.380.381.872.0
VKP (M=3)89.789.891.286.792.993.080.181.671.6
VKP (M=4)89.489.590.886.392.893.079.981.271.3
VKP (M=[2,3,4])89.889.991.086.593.093.380.381.971.8
Skip Chain (M=2)89.789.890.886.292.893.180.381.871.8
Skip Chain (M=3)89.990.091.286.593.093.380.482.172.4
Skip Chain (M=4)89.889.991.386.792.792.880.281.671.7
Skip-Chain (M=5)89.589.691.086.292.592.780.281.771.7
Fully Connect (M=20)89.789.891.186.392.892.980.081.471.4
CNN (M=0)89.689.890.986.292.692.880.081.771.8
CNN (M=1)89.789.891.186.492.893.080.181.872.0
CNN (M=2)90.090.191.386.593.093.280.381.972.2
CNN (M=3)89.989.991.286.492.993.080.081.771.9
CNN (M=4)89.789.891.086.293.093.180.281.772.2
CNN (M=1,2,3)90.090.091.386.693.193.380.382.072.2
TLM (M=1)89.689.790.986.392.492.679.881.371.3
TLM (M=2)89.789.890.886.392.492.780.081.671.7
TLM (M=3)89.889.891.086.492.792.980.181.771.9
TLM (M=4)89.890.091.386.592.792.880.081.671.8
TLM90.090.091.486.692.993.080.281.872.1
S-Att(M=2)89.789.890.786.392.692.880.081.671.8
S-Att(M=4)89.889.990.886.492.893.080.081.771.8
S-Att(M=6)89.990.090.986.492.893.180.281.972.0
S-Att(M=8)89.990.191.086.593.093.380.482.272.2
S-Att89.789.990.886.493.193.380.382.072.2
+ +Table 9: Results on all tasks for local classifiers and different structured energy functions: linear-chain energy, Kronecker Product high-order energies, skip-chain energy and fully-connected energies. The metrics of the four tasks POS, NER, CCG, SRL are accuracy, F1, accuracy and F1. The architecture of inference networks is one-layer BiLSTM. + +
POSNERCCG
DevTestDevTestDevTest
2-layer BiLSTM88.788.890.986.093.293.4
Linear Chain89.990.091.286.693.393.7
Skip-Chain90.090.291.787.593.593.8
VKP89.990.291.587.293.693.8
CNN90.090.291.587.393.593.6
TLM89.990.191.487.193.393.6
S-Att (M=8)89.990.091.687.393.593.7
Fully Connected89.890.091.487.293.293.3
+ +Table 10: Results when inference networks use 2-layer BiLSTMs (so the local classifier baseline also has 2 layers). + +
α=0.1α=0.2α=0.3
DevTestDevTestDevTest
BiLSTM80.075.070.167.262.458.8
Linear Chain80.275.270.367.462.759.1
Skip-Chain (M=4)80.675.570.967.963.259.5
VKP (M=3)80.575.370.567.762.859.3
CNN (M=0)80.875.771.367.963.359.4
CNN (M=2)81.476.372.468.664.060.2
CNN (M=4)81.976.773.069.864.560.4
TLM81.076.071.367.863.859.9
S-Att (M=8)80.675.671.567.663.259.7
+ +Table 11: UnkTest setting for NER: Words in the test set are randomly replaced by the unknown word symbol with probability $\alpha$ . + +
α=0.1α=0.2α=0.3
DevTestDevTestDevTest
BiLSTM85.080.180.076.075.070.6
Linear Chain85.480.480.576.375.270.9
Skip-Chain (M=4)85.781.280.776.775.471.2
VKP (M=3)85.981.481.076.875.571.4
CNN (M=0)85.681.180.876.775.671.5
CNN (M=2)86.081.881.277.076.171.8
CNN (M=4)86.182.081.277.175.971.7
TLM85.680.980.676.375.371.1
S-Att (M=8)85.881.481.076.975.671.4
+ +Table 12: UnkTrain setting for NER: training on noisy text, evaluating on noisy test sets. Words are randomly replaced by the unknown word symbol with probability $\alpha$ . + +![](images/4bc98bd9a02ad56c75b3e02e92b476f326d2d7ed782adbfc40a7b0652ce436f8.jpg) +Figure 3: Visualization of the scores of 50 CNN filters on a sampled label sequence. We can observe that filters learn the sparse set of label trigrams with strong local dependency. \ No newline at end of file diff --git a/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/images.zip b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2ac263c6a7a9423f25004f8e344a74cfa49bac5f --- /dev/null +++ b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71e9679ad9dc41c77990db551c85d047a785ebf30196f91564a9c96fad187c0e +size 893283 diff --git a/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/layout.json b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..963265cf38bc7e6c9d6a93e07fcc5a734428a666 --- /dev/null +++ b/anexplorationofarbitraryordersequencelabelingviaenergybasedinferencenetworks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e09f5d088c4b2a47770c781f7c0ae5fc861e472fc356ae5e558dc915a9ea100 +size 537763 diff --git a/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_content_list.json b/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..967cb07eae6a89ca51221ad40999ea642354c6d7 --- /dev/null +++ b/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec66ecc8f06d0894759eed08f3c83142a302f90990980c8f21ba1b5b1b712894 +size 147952 diff --git a/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_model.json b/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_model.json new file mode 100644 index 0000000000000000000000000000000000000000..337483c0c917dd1499a00c52cca430c2c0f6feba --- /dev/null +++ b/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17355a1a3ae664753e2aed504817d0ba5808f9ae5c7972a13b0573cc7e8e9156 +size 179913 diff --git a/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_origin.pdf b/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7b36c4e3a5388b8581b598d70f1dd5213ca9b66d --- /dev/null +++ b/animitationgameforlearningsemanticparsersfromuserinteraction/5875247a-95fa-471f-923f-81c7c7b60eda_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f1adc9300db9294edd61fc5250bf4da5ee11c1109a80dc8e22a22410d989913 +size 1258503 diff --git a/animitationgameforlearningsemanticparsersfromuserinteraction/full.md b/animitationgameforlearningsemanticparsersfromuserinteraction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..60778746ff421cca9a877533a9936ebbd75bce59 --- /dev/null +++ b/animitationgameforlearningsemanticparsersfromuserinteraction/full.md @@ -0,0 +1,628 @@ +# An Imitation Game for Learning Semantic Parsers from User Interaction + +Ziyu Yao $^{1}$ , Yiqi Tang $^{1}$ , Wen-tau Yih $^{2}$ , Huan Sun $^{1}$ , Yu Su $^{1}$ +{yao.470, tang.1466, sun.397, su.809}@osu.edu +scottyih@fb.com + $^{1}$ The Ohio State University + $^{2}$ Facebook AI Research, Seattle + +# Abstract + +Despite the widely successful applications, building a semantic parser is still a tedious process in practice with challenges from costly data annotation and privacy risks. We suggest an alternative, human-in-the-loop methodology for learning semantic parsers directly from users. A semantic parser should be introspective of its uncertainties and prompt for user demonstrations when uncertain. In doing so it also gets to imitate the user behavior and continue improving itself autonomously with the hope that eventually it may become as good as the user in interpreting their questions. To combat the sparsity of demonstrations, we propose a novel annotation-efficient imitation learning algorithm, which iteratively collects new datasets by mixing demonstrated states and confident predictions and retransmits the semantic parser in a Dataset Aggregation fashion (Ross et al., 2011). We provide a theoretical analysis of its cost bound and also empirically demonstrate its promising performance on the text-to-SQL problem.1 + +# 1 Introduction + +Semantic parsing has found tremendous applications in building natural language interfaces that allow users to query data and invoke services without programming (Woods, 1973; Zettlemoyer and Collins, 2005; Berant et al., 2013; Yih et al., 2015; Su et al., 2017; Yu et al., 2018). The life cycle of a semantic parser typically consists of two stages: (1) bootstrapping, where we keep collecting labeled data via trained annotators and/or crowdsourcing for model training until it reaches commercial-grade performance (e.g., $95\%$ accuracy on a surrogate test set), and (2) fine-tuning, where we deploy the system, analyze the usage, and collect and + +![](images/5705e5c42edeafeed33db582005ae2477cbbf1d31fc4e8c8d16b7c3478b9b9d1.jpg) +Figure 1: A semantic parser proactively interacts with the user in a friendly way to resolve its uncertainties. In doing so it also gets to imitate the user behavior and continue improving itself autonomously with the hope that eventually it may become as good as the user in interpreting their questions. + +Analyze the data to identify the most likely causes of new data. Anonymize new data to address the identified problems or emerging needs. However, it poses several challenges for scaling up or building semantic parsers for new domains: (1) high bootstrapping cost because mainstream neural parsing models are data-hungry and the annotation cost of semantic parsing data is relatively high, (2) high fine-tuning cost from continuously analyzing usage and annotating new data, and (3) privacy risks arising from exposing private user data to annotators and developers (Lomas, 2019). + +In this paper, we suggest an alternative methodology for building semantic parsers that could potentially address all the aforementioned problems. The key is to involve human users in the learning loop. A semantic parser should be introspective of its uncertainties (Dong et al., 2018) and proac + +tively prompt for demonstrations from the user, who knows the question best, to resolve them. In doing so, the semantic parser can accumulate targeted training data and continue improving itself autonomously without involving any annotators or developers, hence also minimizing privacy risks. The bootstrapping cost could also be significantly reduced because an interactive system needs not to be almost perfectly accurate to be deployed. On the other hand, such interaction opens up the black box and allows users to know more about the reasoning underneath the system and better interpret the final results (Su et al., 2018). A human-in-the-loop methodology like this also opens the door for domain adaptation and personalization. + +This work builds on the recent line of research on interactive semantic parsing (Li and Jagadish, 2014; Chaurasia and Mooney, 2017; Gur et al., 2018; Yao et al., 2019b). Specifically, Yao et al. (2019b) provide a general framework, MISP (Model-based Interactive Semantic Parsing), which handles uncertainty modeling and natural language generation. We will leverage MISP for user interaction to prove the feasibility of the envisioned methodology. However, existing studies only focus on interacting with users to resolve uncertainties. None of them has fully addressed the crucial problem of how to continually learn from user interaction, which is the technical focus of this study. + +One form of user interaction explored for learning semantic parsers is asking users to validate the execution results (Clarke et al., 2010; Artzi and Zettlemoyer, 2013; Iyer et al., 2017). While appealing, in practice it may be a difficult task for real users because they would not need to ask the question if they knew the answer in the first place. We instead aim to learn semantic parsers from fine-grained interaction where users only need to answer simple questions covered by their background knowledge (Figure 1). However, learning signals from such fine-grained interactions are bound to be sparse because the system needs to avoid asking too many questions and overwhelming the user, which poses a challenge for learning. + +To tackle the problem, we propose NEIL, a novel aNnotation-Efficient Imitation Learning algorithm for learning semantic parsers from such sparse, fine-grained demonstrations: The agent (semantic parser) only requests for demonstrations when it is uncertain about a state (parsing step). For certain/confident states, actions chosen by the current + +policy are deemed correct and are executed to continue parsing. The policy is updated iteratively in a Dataset Aggregation fashion (Ross et al., 2011). In each iteration, all the state-action pairs, demonstrated or confident, are included to form a new training set and train a new policy in a supervised way. Intuitively, using confident state-action pairs for training mitigates the sparsity issue, but it may also introduce training bias. We provide a theoretical analysis and show that, under mild assumptions, the impact of the bias and the quality of the NEIL policy can be controlled by tuning the policy initialization and confidence estimation accuracy. + +We also empirically compare NEIL with a number of baselines on the text-to-SQL parsing task. On the WikiSQL (Zhong et al., 2017) dataset, we show that, when bootstrapped using only $10\%$ of the training data, NEIL can achieve almost the same test accuracy ( $2\%$ absolute loss) as the full expert annotation baseline, while requiring less than $10\%$ of the annotations that the latter needs, without even taking into account the different unit cost of annotations from users vs. domain experts. We also show that the quality of the final policy is largely determined by the quality of the initial policy, which provides empirical support for the theoretical analysis. Finally, we demonstrate that NEIL can generalize to more complex semantic parsing tasks such as Spider (Yu et al., 2018). + +# 2 Related Work + +Interactive Semantic Parsing. Our work extends the recent idea of leveraging system-user interaction to improve semantic parsing on the fly (Li and Jagadish, 2014; He et al., 2016; Chaurasia and Mooney, 2017; Su et al., 2018; Gur et al., 2018; Yao et al., 2019a,b; Elgohary et al., 2020; Zeng et al., 2020; Semantic Machines et al., 2020). Gur et al. (2018) built a neural model to identify and correct error spans in generated queries via dialogues. Yao et al. (2019b) formalized a model-based intelligent agent MISP, which enables user interaction via a policy probability-based uncertainty estimator, a grammar-based natural language generator, and a multi-choice question-answer interaction design. More recently, Elgohary et al. (2020) crowdsourced a dataset for fixing incorrect SQL queries using free-form natural language feedback. Semantic Machines et al. (2020) constructed a contextual semantic parsing dataset where agents could trigger conversations to handle exceptions such as ambigu + +ous or incomplete user commands. In this work, we seek to continually improve semantic parsers from such user interaction, a topic that is not carefully studied by the aforementioned work. + +Interactive Learning from Feedback. Learning interactively from user feedback has been studied in many NLP tasks (Sokolov et al., 2016; Wang et al., 2016, 2017; Nguyen et al., 2017; Gao et al., 2018; Abujabal et al., 2018; Hancock et al., 2019; Kreutzer and Riezler, 2019). Most relevant to us, Hancock et al. (2019) constructed a self-feeding chatbot that improves itself from user satisfied responses and their feedback on unsatisfied ones. + +In the field of semantic parsing, Clarke et al. (2010); Artzi and Zettlemoyer (2013); Iyer et al. (2017) learned semantic parsers from binary user feedback on whether executing the generated query yields correct results. However, often times (especially in information-seeking scenarios) it may not be very practical to expect end users able to validate the denotation correctness (e.g., consider validating an execution result "103" for the question "how many students have a GPA higher than 3.5" from a massive table). Active learning is also leveraged to save human annotations (Duong et al., 2018; Ni et al., 2020). Our work is complementary to this line of research as we focus on learning interactively from end users (not "teachers"). + +Imitation Learning. Traditional imitation learning algorithms (Daumé et al., 2009; Ross and Bagnell, 2010; Ross et al., 2011; Ross and Bagnell, 2014) iteratively execute and train a policy by collecting expert demonstrations for every policy decision. Despite its efficacy, the learning demands costly annotations from experts. In contrast, we save expert effort by selectively requesting demonstrations. This idea is related to active imitation learning (Chernova and Veloso, 2009; Kim and Pineau, 2013; Judah et al., 2014; Zhang and Cho, 2017). For example, Judah et al. (2014) assumed a "teacher" and actively requested demonstrations for most informative trajectories in the unlabeled data pool. Similar to us, Chernova and Veloso (2009) solicited demonstrations only for uncertain states. However, their algorithm simply abandons policy actions that are confident, leading to sparse training data. Instead, our algorithm utilizes confident policy actions to combat the sparsity issue and is additionally provided with a theoretical analysis. + +Concurrent with our work, Brantley et al. (2020) studied active imitation learning for structured pre + +diction tasks such as named entity recognition. Our work instead focuses on semantic parsing, which presents a unique challenge of integrality, i.e., the output sequence (a semantic parse) could only be correct as a whole (as opposed to partially correct) in order to yield the correct denotation. We therefore propose a new cost function (Section 5) to theoretically analyze the factors that affect the efficacy of learning semantic parsers via imitation. + +# 3 Preliminaries + +Formally, we assume the semantic parsing model generates a semantic parse by executing a sequence of actions $a_{t}$ (parsing decisions) at each time step $t$ . In practice, the definition of an action depends on the specific semantic parsing model, as we will illustrate shortly. A state $s_t$ is then defined as a tuple of $(q,a_{1:t - 1})$ , where $q$ is the initial natural language question and $a_{1:t - 1} = (a_1,\dots,a_{t - 1})$ is the current partial parse. In particular, the initial state $s_1 = (q,\phi)$ contains only the question. Denote a semantic parser as $\hat{\pi}$ , which is a policy function (Sutton and Barto, 2018) that takes a state $s_t$ as input and outputs a probability distribution over the action space. The semantic parsing process can be formulated as sampling a trajectory $\tau$ by alternately observing a state and sampling an action from the policy, i.e., $\tau = (s_1,a_1\sim \hat{\pi} (s_1),\ldots ,s_T,a_T\sim \hat{\pi} (s_T))$ , assuming a trajectory length $T$ . The probability of the generated semantic parse becomes: $p_{\hat{\pi}}(a_{1:T}|s_1) = \prod_{t = 1}^{T}p_{\hat{\pi}}(a_t|s_t)$ . + +An interactive semantic parser typically follows the aforementioned definition and requests the user's validation of a specific action $a_{t}$ . Based on the feedback, a correct action $a_{t}^{*}$ can be inferred to replace the original $a_{t}$ . The parsing process continues with $a_{t}^{*}$ afterwards. + +In this work, we adopt MISP (Yao et al., 2019b) as the back-end interactive semantic parsing framework, given that it is a principled framework for this purpose and can generalize to various kinds of semantic parsers and logical forms. However, we note that our proposed algorithm is not limited to MISP; it instead depicts a general algorithm for learning semantic parsers from user interaction. We illustrate the application of MISP to a sketch-based parser, SQLova (Hwang et al., 2019), as follows. More details and another example of how it applies to a non-sketch-based parser EditSQL (Zhang et al., 2019) can be found in Appendix B.1. + +Example. Consider the SQLova parser, which + +generates a query by filling "slots" in a predefined SQL sketch "SELECT Agg SCol WHERE WCol OP VAL". To complete the SQL query in Figure 1, it first takes three steps: $\text{SCol} =$ "School/Club Team" ( $a_1$ ), $\text{Agg} =$ "COUNT" ( $a_2$ ) and $\text{WCol} =$ "School/Club Team" ( $a_3$ ). MISP detects that $a_3$ is uncertain because its probability is lower than a pre-specified threshold. It validates $a_3$ with the user and corrects it with WCol="Player" ( $a_3^*$ ). The parsing continues with $\text{OP} =$ "=" ( $a_4$ ) and $\text{VAL} =$ "jalen rose" ( $a_5$ ). Here, the trajectory length $T = 5$ . + +# 4 Learning Semantic Parsing from User Interaction + +In this section, we present NEIL, an aNnotation- Efficient Imitation Learning algorithm that trains a parser from user interaction, without requiring a large amount of user feedback (or "annotations"). This property is particularly important for end user-facing systems in practical use. Note that while we apply NEIL to semantic parsing in this work, in principle it can also be applied to other structured prediction tasks (e.g., machine translation). + +# 4.1 An Imitation Learning Formulation + +Under the interactive semantic parsing framework, a learning algorithm intuitively can aggregate $(s_t, a_t^*)$ pairs collected from user interactions and trains the parser to enforce $a_t^*$ under the state $s_t = (q, a_{1:t-1})$ . However, this is not achievable by conventional supervised learning since the training needs to be conducted in an interactive environment, where the partial parse $a_{1:t-1}$ is generated by the parser itself. + +Instead, we formulate it as an imitation learning problem (Daumé et al., 2009; Ross and Bagnell, 2010). Consider the user as a demonstrator, then the derived action $a_{t}^{*}$ can be viewed as an expert demonstration which is interactively sampled from the demonstrator's policy (or expert policy) $\pi^{*}$ , i.e., $a_{t}^{*} \sim \pi^{*}(s_{t})$ . The goal of our algorithm is thus to train policy $\hat{\pi}$ to imitate the expert policy $\pi^{*}$ . A general procedure is described in Algorithm 1 (Line 1-9), where $\hat{\pi}$ is learned iteratively for every $m$ user questions. In each iteration, the policy is retrained on an aggregated training data over the past iterations, following the Dataset Aggregation fashion in (Ross et al., 2011). + +Algorithm 1 The NEIL Algorithm + +Input: Initial training data $D_0$ , policy confidence threshold $\mu$ . + +Output: A trained policy $\hat{\pi}$ . + +1: Initialize $D \gets D_0$ . +2: Initialize $\hat{\pi}_1$ by training it on $D_0$ . +3: for $i = 1$ to $N$ do +4: Observe $m$ user questions $q_{j}, j \in [1, m]$ ; +5: $D_{i}\gets \bigcup_{j = 1}^{m}\mathsf{PARSE\& COLLECT}(\mu ,q_{j},\hat{\pi}_{i},\pi^{*});$ +6: Aggregate dataset $D \gets D \cup D_i$ ; +7: Train policy $\hat{\pi}_{i+1}$ on $D$ using Eq. (1). +8: end for +9: return best $\hat{\pi}_i$ on validation. + +10: function PARSE&COLLECT $(\mu ,q,\hat{\pi}_i,\pi^*)$ + +11: Initialize $D_{j}^{\prime}\gets \emptyset ,s_{1} = (q,\phi)$ +12: for $t = 1$ to $T$ do +13: Preview action $a_{t} = \arg \max_{a}\hat{\pi}_{i}(s_{t})$ +14: if $p_{\bar{\pi}_i}(a_t|s_t)\geq \mu$ then +15: $w_{t}\gets 1;$ +16: Collect $D_i^\prime \gets D_i^\prime \bigcup \{(s_t,a_t,w_t)\}$ +17: Execute $a_{t}$ + +18: else + +19: Trigger user interaction and derive expert demonstration $a_{t}^{*} \sim \pi^{*}(s_{t})$ ; + +20: $w_{t}\gets 1$ if $a_{t}^{*}$ is valid; 0 otherwise; +21: Collect $D_i^\prime \gets D_i^\prime \bigcup \{(s_t,a_t^*,w_t)\}$ +22: Execute $a_{t}^{*}$ +23: end if +24: end for +25: return $D_{i}^{\prime}$ +26: end function + +# 4.2 Annotation-efficient Imitation Learning + +Consider parsing a user question and collecting training data using the parser $\hat{\pi}_i$ in the $i$ -th iteration (Line 5). A standard imitation learning algorithm such as DAGGER (Ross et al., 2011) usually requests expert demonstration $a_t^*$ for every state $s_t$ in the sampled trajectory. However, it requires a considerable amount of user annotations, which may not be practical when interacting with end users. + +Instead, we propose to adopt an annotation-efficient learning strategy in NEIL, which saves user annotations by selectively requesting user interactions, as indicated in function PARSE&COLLECT. In each parsing step, the system first previews whether it is confident about its own decision $a_{t}$ (Line 13-14), which is determined when its probability is no less than a threshold, i.e., $p_{\hat{\pi}_i}(a_t|s_t)\geq$ + +$\mu$ .3 In this case, the algorithm executes and collects its own action $a_{t}$ (Line 15-17); otherwise, a system-user interaction will be triggered and the derived demonstration $a_{t}^{*} \sim \pi^{*}(s_{t})$ will be collected and executed to continue parsing (Line 19-22). + +Denote a collected state-action pair as $(s_t, \tilde{a}_t)$ , where $\tilde{a}_t$ could be $a_t$ or $a_t^*$ depending on whether an interaction is requested. To train $\hat{\pi}_{i+1}$ (Line 7), our algorithm adopts a reduction-based approach similar to DAGGER and reduces imitation learning to iterative supervised learning. Formally, we define our training loss function as a weighted negative log-likelihood: + +$$ +\mathcal {L} \left(\hat {\pi} _ {i + 1}\right) = - \frac {1}{| D |} \sum_ {\left(s _ {t}, \tilde {a} _ {t}, w _ {t}\right) \in D} w _ {t} \log p _ {\tilde {\pi} _ {i}} \left(\tilde {a} _ {t} \mid s _ {t}\right), \tag {1} +$$ + +where $D$ is the aggregated training data over $i$ iterations and $w_{t}$ denotes the weight of $(s_t,\tilde{a}_t)$ . + +We consider assigning weight $w_{t}$ in three cases: (1) For confident actions $a_{t}$ , we set $w_{t} = 1$ . This essentially treats the system's own confident actions as gold decisions, which resembles self-training (Scudder, 1965; Nigam and Ghani, 2000; McClosky et al., 2006). (2) For user-confirmed decisions (valid demonstrations $a_{t}^{*}$ ), such as enforcing a WHERE condition on "Player" in Figure 1, $w_{t}$ is also set to 1 to encourage the parser to imitate the correct decisions from users. (3) For uncertain actions that cannot be addressed via human interactions (invalid demonstrations $a_{t}^{*}$ , which are identified when the user selects "None of the above options" in Figure 1), we assign $w_{t} = 0$ . This could happen when some of the incorrect precedent actions are not fixed. For example, in Figure 1, if the system missed correcting the WHERE condition on "School/Club Team", then whatever value it generates after "WHERE School/Club Team=" is wrong, and thus any action $a_{t}^{*}$ derived from human feedback would be invalid. In this case, the system selects the next available option without further validation and continues parsing. + +A possible training strategy to handle case (3) may set $w_{t}$ to be negative, similar to Welleck et al. (2020). However, empirically we find this strategy fails to train the parser to correct its mistake in generating "School/Club Team" but rather disturbs the model training. By setting $w_{t} = 0$ , the impact of unaddressed actions is removed from training. A similar solution is also adopted in + +Petrushkov et al. (2018); Kreutzer and Riezler (2019). As shown in Section 6, this way of training weight assignment enables stable improvement in iterative model learning while requiring fewer user annotations. + +# 5 Theoretical Analysis + +While Neil enjoys the benefit of learning from a small amount of user feedback, one crucial question is whether it can still achieve the same level of performance as the traditional supervised approach (which trains a policy on full expert annotations, if one could afford that and manage the privacy risk). In this section, we prove that the performance gap between the two approaches is mainly determined by the learning policy's probability of trusting a confident action that turns out to be wrong, which can be controlled in practice. + +Our analysis follows prior work (Ross and Bagnell, 2010; Ross et al., 2011) to assume a unified trajectory length $T$ and an infinite number of training samples in each iteration (i.e., $m = \infty$ in Algorithm 1), such that the state space can be full explored by the learning policy. An analysis under the "finite sample" case can be found in Appendix A.5. + +# 5.1 Cost Function for Analysis + +Unlike typical imitation learning tasks (e.g., Super Tux Kart (Ross et al., 2011)), in semantic parsing, there exists only one gold trajectory semantically identical to the question. Whenever a policy action is different from the gold one, the whole trajectory will not yield the correct semantic meaning and the parsing is deemed failed. In other words, a well-performing semantic parser should be able to keep staying in the correct trajectory during the parsing. Therefore, for theoretical analysis, we only analyze a policy's performance when it is conditioned on a gold partial parse, i.e., $s_t \in d_{\pi^*}^t$ , where $d_{\pi^*}^t$ is the state distribution in step $t$ when executing the expert policy $\pi^*$ for first $t-1$ steps. Let $\ell(s, \hat{\pi}) = 1 - p_{\hat{\pi}}(a = a^* | s)$ be the loss of $\hat{\pi}$ making a mistake at state $s$ . We define the cost (i.e., the inverse test-time quality) of a policy as: + +$$ +J (\hat {\pi}) = T \mathbb {E} _ {s \sim d _ {\pi^ {*}}} \left[ \ell (s, \hat {\pi}) \right], \tag {2} +$$ + +where $d_{\pi^*} = \frac{1}{T}\sum_{t=1}^{T}d_{\pi^*}^t$ denotes the average expert state distribution (assuming time step $t$ is a + +random variable uniformly sampled from $1\sim T$ A detailed derivation is shown in Appendix A.1. + +The better a policy $\hat{\pi}$ is, the smaller this cost becomes. Note that, by defining Eq. (2), we simplify the analysis from evaluating the whole trajectory sampled from $\hat{\pi}$ (as we do in experiments) to evaluating the expected single-step loss of $\hat{\pi}$ conditioned on a gold partial parse. This cost function makes the analysis easier and meanwhile reflects a consistent relative performance among algorithms for comparison. Next, we compare our NEIL algorithm with the supervised approach by analyzing the upper bounds of their costs. + +# 5.2 Cost Bound of Supervised Approach + +A fully supervised system trains a parser on expert-annotated $(q, a_{1:T}^{*})$ pairs, where the gold semantic parse $a_{1:T}^{*}$ can be viewed as generated by executing the expert policy $\pi^{*}$ . This gives the policy $\hat{\pi}_{sup}$ : + +$$ +\hat{\pi}_{sup} = \operatorname *{arg min}_{\pi \in \Pi}\mathbb{E}_{s\sim d_{\pi^{*}}}[l(s,\pi)], +$$ + +where $\Pi$ is the policy space induced by the model architecture. A detailed derivation in Appendix A.2 shows the cost bound of the supervised approach: + +Theorem 5.1. For supervised approach, let $\epsilon_N = \min_{\pi \in \Pi} \mathbb{E}_{s \sim d_{\pi^*}}[l(s, \pi)]$ , then $J(\hat{\pi}_{sup}) = T\epsilon_N$ . + +The theorem gives an exact bound (as shown by the equality) since the supervised approach, given the "infinite sample" assumption, trains a policy under the same state distribution $d_{\pi^*}$ as the one being evaluated in the cost function (Eq. (2)). + +# 5.3 Cost Bound of NEIL Algorithm + +Recall that, in each training iteration, NEIL samples trajectories by executing actions from both the previously learned policy $\hat{\pi}_i$ and the expert policy $\pi^*$ (when an interaction is requested). Let $\pi_i$ denote such a "mixture" policy. We derive the following cost bound of a NEIL policy $\hat{\pi}$ : + +$$ +J (\hat {\pi}) \leq \frac {T}{N} \sum_ {i = 1} ^ {N} \left[ \mathbb {E} _ {s \sim d _ {\pi_ {i}}} [ \ell (s, \hat {\pi} _ {i}) ] + \ell_ {m a x} | | d _ {\pi_ {i}} - d _ {\pi^ {*}} | | _ {1} \right] +$$ + +The bound is determined by two terms. The first term $\mathbb{E}_{s\sim d_{\pi_i}}[\ell (s,\hat{\pi}_i)]$ calculates the expected training loss of $\hat{\pi}_i$ . Notice that, while the policy is trained on states induced by the mixture policy $(s\sim d_{\pi_i})$ , what matters to its test-time quality is the policy's performance conditioned on a gold partial parse $(s\sim d_{\pi^*}$ in Eq. (2)). This state discrepancy, which does not exist in the supervised approach, explains the performance loss of NEIL, and + +is bounded by the second term $\ell_{\text{max}} || d_{\pi_i} - d_{\pi^*} ||_1$ , the weighted $L_1$ distance between $d_{\pi_i}$ and $d_{\pi^*}$ . To bound the two terms, we employ a "no-regret" assumption (Kakade and Tewari, 2009; Ross et al., 2011, see Appendix A.3-A.4 for details), which gives the theorem: + +Theorem 5.2. For the proposed NEIL algorithm, if $N$ is $\tilde{O}(T)$ , there exists a policy $\hat{\pi} \in \hat{\pi}_{1:N}$ s.t. $J(\hat{\pi}) \leq T\left[\epsilon_N + \frac{2T\ell_{max}}{N}\sum_{i=1}^{N}e_i\right] + O(1)$ . + +Here, $\epsilon_N = \min_{\pi \in \Pi} \frac{1}{N} \sum_{i=1}^{N} \mathbb{E}_{s \sim d_{\pi_i}}[\ell(s, \pi)]$ denotes the best expected policy loss in hindsight, and $e_i$ denotes the probability that $\hat{\pi}_i$ does not query the expert policy (i.e., being confident) but its own action is wrong under $d_{\pi^*}$ . + +We note that a no-regret algorithm requires convexity of the loss function (Hazan et al., 2007; Kakade and Tewari, 2009), which is not satisfied by neural network-based semantic parsers. In general, proving theorems under a non-convex case is not trivial. Therefore, we follow the common practice (e.g., Kingma and Ba (2015); Reddi et al. (2018)) to theoretically analyze the convex case while empirically demonstrating the performance of our NEIL algorithm with non-convex loss functions (i.e., when it applies to neural semantic parsers). More accurate regret bound for non-convex cases will be studied in the future. + +Remarks. Compared with the supervised approach (Theorem 5.1), NEIL's cost bound additionally contains a term of $\frac{1}{N} \sum_{i=1}^{N} e_i$ , which, as we expect, comes from the aforementioned state discrepancy. Intuitively, if a learning policy frequently executes its own but wrong actions in training, the resulting training states $d_{\pi_i}$ will greatly deviate from the gold ones $d_{\pi^*}$ . + +This finding inspires us to restrict the performance gap by reducing the learning policy's error rate when it does not query the expert. Empirically this can be achieved by: (1) Accurate confidence estimation, so that actions deemed confident are generally correct, and (2) Moderate policy initialization, such that in general the policy is less likely to make wrong actions throughout the iterative training. For (1), we set a high confidence threshold $\mu = 0.95$ , which is demonstrated reliable for MISP (Yao et al., 2019b). We then empirically validate (2) in experiments. + +# 6 Experiments + +In this section, we conduct experiments to demonstrate the annotation efficiency of our NEIL algo + +rithm and that it can train semantic parsers for high performance when the parsers are reasonably initialized, which verifies our theoretical analysis. + +# 6.1 Experimental Setup + +We compare various systems on the WikiSQL dataset (Zhong et al., 2017). The dataset contains large-scale annotated question-SQL pairs (56,355 pairs for training) and thus serves as a good resource for experimenting iterative learning. For the base semantic parser, we choose SQLova (Hwang et al., 2019), one of the top-performing models on WikiSQL, to ensure a reasonable model capacity in terms of data utility along iterative training. + +We experiment each system with three parser initialization settings, using $10\%$ , $5\%$ and $1\%$ of the total training data. During iterative learning, questions from the remaining training data arrive in a random order to simulate user questions and we simulate user feedback by directly comparing the synthesized query with the gold one. In each iteration, all systems access exactly the same user questions. Depending on how they solicit feedback, each system collects a different number of annotations. At the end of each iteration, we update each system by retraining its parser on its accumulated annotations and the initial training data, and report its (exact) query match accuracy on the test set. We also report the accumulated number of annotations that each system has requested after each training iteration, in order to compare their annotation efficiency. + +In experiments, we consider every 1,000 user questions as one training iteration (i.e., $m = 1,000$ in Algorithm 1). We repeat the whole iterative training for three runs and report average results. Reproducible details are included in Appendix B. + +# 6.2 System Comparison + +We denote our system as MISP-NEIL since it leverages MISP in the back end of NEIL. We compare it with the traditional supervised approach (denoted as Full Expert). To investigate the skyline capability of our system, we also present a variant called MISP-NEIL*, which is assumed with perfect confidence measurement and interaction design, so that it can precisely identify and correct its mistakes during parsing. This is implemented by allowing the system to compare its synthesized query with the gold one. Note that this is not a realized automatic system; we show its performance as an upper bound of MISP-NEIL. + +On the other hand, although execution feedback-based learning systems (Clarke et al., 2010; Artzi and Zettlemoyer, 2013; Iyer et al., 2017) may not be very practical for end users, we include them nonetheless in the interest of a comprehensive comparison. This leads to two baselines. The Binary User system requests binary user feedback on whether executing the generated SQL query returns correct database results and collects only queries with correct results to further improve the parser. The Binary User+Expert system additionally collects full expert SQL annotations when the generated SQL queries do not yield correct answers. + +Given the completely different nature of annotations from Binary User (which validate the denotation) and those from Full Expert and MISP-NEIL (which validate a semantic parse's constituents), there may not exist a universally fair way to convert one's annotation consumption into the other's. Therefore, in the following sections, we only present and discuss Binary User(+Expert) in terms of their parsing accuracy under different training iterations. To give an estimation of their annotation efficiency for reference, we design a compromised annotation calculation metric for Binary User(+Expert) and include their results on WikisSQL validation set in Appendix C. + +Finally, while our MISP-NEIL and the aforementioned baselines all leverage feedback from users or domain experts, an interesting question is how much gain they could obtain compared with using no annotation or feedback at all. To this end, we compare the systems with a Self Train baseline (Scudder, 1965; Nigam and Ghani, 2000; McClosky et al., 2006). In each iteration, this baseline collects SQL queries generated by itself as the new gold annotations for further training. We additionally apply a confidence threshold to improve the collection quality, i.e., only SQL queries with probability $p_{\hat{\pi}}(a_{1:T}|s_1)$ greater than 0.5 are included. This strategy empirically leads to better performance. Intuitively, we expect Self Train to perform no better than any other systems in our experiments, since no human feedback is provided to correct mistakes in its collection. + +# 6.3 Experimental Results + +We evaluate each system by answering two research questions (RQs): + +- RQ1: Can the system improve a parser without requiring a large amount of annotations? + +![](images/656095f93de81f73ee1dd4f50a3c0b32864019f48e672187a51b213fd69086ea.jpg) + +![](images/f061a553a91b4f81fbdafa334db8a1298607ac7894171b4f159050633b8c5bab.jpg) + +![](images/c9e28a5e7c1d4a44f19b0f5f925e6e1ee6580a1e3b1f54e019af82ef55b7df8d.jpg) + +Figure 2: Parsing accuracy on WikiSQL test set when systems are trained with various numbers of user/expert annotations (top) and for different iterations (bottom). We experiment with three initialization settings, using $10\%$ , $5\%$ and $1\%$ of the training data respectively. Results on validation set can be found in Appendix C. +![](images/6674e5301bed3c6256f37fb8d148229434cc7ae06f7ccc3b8a53ebed201e4431.jpg) +Full Expert Binary User Binary User+Expert MISP-NEIL MISP-NEIL\* Self Train + +![](images/75ab89ede81e5df7c5b64996c97e9b3c2339759db35a3ab7eea4bf89ab0a8cc6.jpg) + +![](images/8b1e6dba509acb43e67780dbbedb00f061918f8ab2fef21358b4bb8c6d67cfa2.jpg) + +- RQ2: For interactive systems, while requiring weaker supervision, can they train the parser to reach a performance comparable to the traditional supervised system? + +For $RQ1$ , we measure the number of user/expert annotations that a system requires to train a parser. For Full Expert, this number equals the trajectory length of the gold query (e.g., 5 for the query in Figure 1); for MISP-NEIL and MISP-NEIL*, it is the number of user interactions during training. Note that while we do not differentiate the actual (e.g., time/financial) cost of users from that of experts in this aspect, we emphasize that our system enjoys an additional benefit of collecting training examples from a much cheaper and more abundant source. For Self Train, the number of annotations is always zero since it does not request any human feedback for the online user questions. + +Our results in Figure 2 (top) demonstrate that MISP-NEIL consistently consumes a comparable or smaller amount of annotations to train the parser to reach the same parsing accuracy. Figure 5 in Appendix further shows that, on average, it requires no more than one interaction for each user question along the training. Particularly in the $10\%$ initialization setting, MISP-NEIL uses less than $10\%$ of + +the total annotations that Full Expert needs in the end. Given the limited size of WikiSQL training set, the simulation experiments currently can only show MISP-NEIL's performance under a small number of annotations. However, we expect this gain to continue as it receives more user questions in the long-term deployment. + +To answer $RQ2$ , Figure 2 (bottom) compares each system's accuracy after they have been trained for the same number of iterations. The results demonstrate that when a semantic parser is moderately initialized ( $10\% / 5\%$ initialization setting), MISP-NEIL can further improve it to reach a comparable accuracy as Full Expert (0.776/0.761 vs. 0.794 in the last iteration). In the extremely weak $1\%$ initialization setting (using only around 500 initial training examples), all interactive learning systems suffer from a huge performance loss. This is consistent with our finding in theoretical analysis (Section 5). In Appendix C.2, we plot the value of $e_i$ , the probability that $\hat{\pi}_i$ makes a confident but wrong decision given a gold partial parse, showing that a better initialized policy generally obtains a smaller $e_i$ throughout the training and thus a tighter cost bound. + +Our system also surpasses Binary User. We find + +that the inferior performance of Binary User is mainly due to the "spurious program" issue (Guu et al., 2017), i.e., a SQL query having correct execution results can still be incorrect in terms of semantics. MISP-NEIL circumvents this issue by directly validating the semantic meaning of intermediate parsing decisions. The performance of Binary User+Expert is close to Full Expert as it has additionally involved expert annotations on a considerable number of user questions, which on the other hand also leads to extra annotation overhead. + +When it is assumed with perfect interaction design and confidence estimator, MISP-NEIL* shows striking superiority in both aspects. Since it always corrects wrong decisions immediately, MISP-NEIL* can collect and derive the same training examples as Full Expert, and thus trains the parser to Full Expert's performance level in Figure 2 (bottom). However, it requires only $6\%$ of the annotations that Full Expert needs (Figure 2, top). These observations imply large room for MISP-NEIL to be improved in the future. + +Finally, we observe that all feedback-based learning systems outperform Self Train dramatically (Figure 2, bottom). This verifies the benefit of learning from human feedback. + +# 6.4 Generalize to Complex SQL Queries + +We next investigate whether MISP-NEIL can generalize to the complex SQL queries in the Spider dataset (Yu et al., 2018), which can contain complicated keywords like GROUP BY. For the base semantic parser, we choose EditSQL (Zhang et al., 2019), one of the open-sourced top models on Spider. Given the small size of Spider (7,377 question-SQL pairs for training after data cleaning; see Appendix B.3 for details), we only experiment with one initialization setting, using $10\%$ of the training set. Since EditSQL does not predict the specific values in a SQL query (e.g., "jalen rose" in Figure 1), we cannot execute the generated query to simulate the binary execution feedback. Therefore, we only compare our system with Full Expert and Self Train. Parsers are evaluated on Spider Dev set since its test set is not publicly available. + +Figure 3 (top) shows that MISP-NEIL and MISP-NEIL* consistently achieve comparable or better annotation efficiency while enjoying the advantage of learning from end user interaction. We expect this superiority to continue as the systems receive more user questions beyond Spider. Meanwhile, + +![](images/5ccb578f56390d9a75a9f45744878485330b1ddb0228ac6ee6322802f23c4572.jpg) +Figure 3: Parsing accuracy on Spider Dev set when systems are trained with various numbers of user/expert annotations and for different iterations. + +we also notice that the gain is smaller and MISP-NEIL suffers from a large performance loss compared with Full Expert (Figure 3, bottom), due to the poor parser initialization and the SQL query complexity. This can be addressed via adopting better interaction designs and more accurate confidence estimation, as shown by MISP-NEIL*. Similarly as in WikiSQL experiments, Self Train performs worse than human-in-the-loop learning systems, as there is no means to correct wrong predictions in its collected annotations. + +# 7 Conclusion and Future Work + +Our work shows the possibility of continually learning semantic parsers from fine-grained end user interaction. As a pilot study, we experiment systems with simulated user interaction. One important future work is thus to conduct large-scale user studies and train parsers from real user interaction. This is not trivial and has to account for uncertainties such as noisy user feedback. We also plan to derive a more realistic formulation of user/expert annotation costs by analyzing real user statistics (e.g., average time spent on each question). + +In experiments, we observe that neural semantic parsers tend to be overconfident and training them with more data does not mitigate this issue. In the future, we will look into more accurate confidence measure via neural network calibration (Guo et al., 2017) or using machine learning components (e.g., answer triggering (Zhao et al., 2017) or a reinforced active selector (Fang et al., 2017)). + +Finally, we believe our algorithm can be applied to save annotation effort for other NLP tasks, especially the low-resource ones (Mayhew et al., 2019). + +# Acknowledgments + +We would like to thank the anonymous reviewers for their helpful comments. This research was sponsored in part by the Army Research Office under cooperative agreements W911NF-17-1-0412, NSF Grant IIS1815674, NSF CAREER #1942980, Fujitsu gift grant, and Ohio Supercomputer Center (Center, 1987). The views and conclusions contained herein are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Army Research Office or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notice herein. + +# References + +Abdalghani Abujabal, Rishiraj Saha Roy, Mohamed Yahya, and Gerhard Weikum. 2018. Never-ending learning for open-domain question answering over knowledge bases. In Proceedings of the 2018 World Wide Web Conference, pages 1053-1062. +Yoav Artzi and Luke Zettlemoyer. 2013. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association for Computational Linguistics, 1:49-62. +Kazuoki Azuma. 1967. Weighted sums of certain dependent random variables. Tohoku Mathematical Journal, Second Series, 19(3):357-367. +Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on freebase from question-answer pairs. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1533-1544. +Kianté Brantley, Amr Sharaf, and Hal Daumé, III. 2020. Active imitation learning with noisy guidance. In Proceedings of the Conference of the Association for Computational Linguistics (ACL). +Ohio Supercomputer Center. 1987. Ohio supercomputer center. http://osc.edu/ark:/19495/f5slph73. +Shobhit Chaurasia and Raymond J Mooney. 2017. Dialog for language to code. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 175-180. +Sonia Chernova and Manuela Veloso. 2009. Interactive policy learning through confidence-based autonomy. Journal of Artificial Intelligence Research, 34:1-25. +James Clarke, Dan Goldwasser, Ming-Wei Chang, and Dan Roth. 2010. Driving semantic parsing from + +the world's response. In Proceedings of the fourteenth conference on computational natural language learning, pages 18-27. Association for Computational Linguistics. +Hal Daumé, John Langford, and Daniel Marcu. 2009. Search-based structured prediction. *Machine learning*, 75(3):297-325. +Li Dong, Chris Quirk, and Mirella Lapata. 2018. Confidence modeling for neural semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 743-753. +Long Duong, Hadi Afshar, Dominique Estival, Glen Pink, Philip R Cohen, and Mark Johnson. 2018. Active learning for deep semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 43-48. +Ahmed Elgohary, Saghar Hosseini, and Ahmed Hassan Awadallah. 2020. Speak to your parser: Interactive text-to-SQL with natural language feedback. In Annual Conference of the Association for Computational Linguistics (ACL 2020). +Meng Fang, Yuan Li, and Trevor Cohn. 2017. Learning how to active learn: A deep reinforcement learning approach. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 595-605. +Yang Gao, Christian M Meyer, and Iryna Gurevych. 2018. APRIL: Interactively learning to summarise by combining active preference learning and reinforcement learning. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4120-4130. +Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. 2017. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 1321-1330. JMLR.org. +Izzeddin Gur, Semih Yavuz, Yu Su, and Xifeng Yan. 2018. DialSQL: Dialogue based structured query generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1339-1349. +Kelvin Guu, Panupong Pasupat, Evan Liu, and Percy Liang. 2017. From language to programs: Bridging reinforcement learning and maximum marginal likelihood. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1051-1062. +Braden Hancock, Antoine Bordes, Pierre-Emmanuel Mazare, and Jason Weston. 2019. Learning from dialogue after deployment: Feed yourself, chatbot! In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3667-3684. + +Elad Hazan, Amit Agarwal, and Satyen Kale. 2007. Logarithmic regret algorithms for online convex optimization. Machine Learning, 69(2-3):169-192. +Luheng He, Julian Michael, Mike Lewis, and Luke Zettlemoyer. 2016. Human-in-the-loop parsing. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2337-2342. +Wassily Hoeffding. 1994. Probability inequalities for sums of bounded random variables. In The Collected Works of Wassily Hoeffding, pages 409-426. Springer. +Wonseok Hwang, Jinyeung Yim, Seunghyun Park, and Minjoon Seo. 2019. A comprehensive exploration on WikiSQL with table-aware word contextualization. arXiv preprint arXiv:1902.01069. +Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, Jayant Krishnamurthy, and Luke Zettlemoyer. 2017. Learning a neural semantic parser from user feedback. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 963-973. +Kshitij Judah, Alan P Fern, Thomas G Dietterich, and Prasad Tadepalli. 2014. Active imitation learning: Formal and practical reductions to iid learning. Journal of Machine Learning Research, 15:4105-4143. +Sham M Kakade and Ambuj Tewari. 2009. On the generalization ability of online strongly convex programming algorithms. In Advances in Neural Information Processing Systems, pages 801-808. +Beomjoon Kim and Joelle Pineau. 2013. Maximum mean discrepancy imitation learning. Robotics: Science and systems. +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. +Julia Kreutzer and Stefan Riezler. 2019. Self-regulated interactive sequence-to-sequence learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 303-315. +Fei Li and HV Jagadish. 2014. Constructing an interactive natural language interface for relational databases. Proceedings of the VLDB Endowment, 8(1):73-84. +Natasha Lomas. 2019. Google ordered to halt human review of voice AI recordings over privacy risks. https://techcrunch.com/2019/08/02/google-ordered-to-halt-human-review-of-voice-ai-recordings-over-privacy-risks/. Accessed: 2020-04-28. + +Stephen Mayhew, Snigdha Chaturvedi, Chen-Tse Tsai, and Dan Roth. 2019. Named entity recognition with partially annotated training data. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 645-655. +David McClosky, Eugene Charniak, and Mark Johnson. 2006. Effective self-training for parsing. In Proceedings of the Human Language Technology Conference of the NAACL, Main Conference, pages 152-159. +Khanh Nguyen, Hal Daumé III, and Jordan Boyd-Graber. 2017. Reinforcement learning for bandit neural machine translation with simulated human feedback. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1464-1474. +Ansong Ni, Pengcheng Yin, and Graham Neubig. 2020. Merging weak and active supervision for semantic parsing. In Thirty-Fourth AAAI Conference on Artificial Intelligence (AAAI), New York, USA. +Kamal Nigam and Rayid Ghani. 2000. Analyzing the effectiveness and applicability of co-training. In Proceedings of the ninth international conference on Information and knowledge management, pages 86-93. +Pavel Petrushkov, Shahram Khadivi, and Evgeny Matusov. 2018. Learning from chunk-based feedback in neural machine translation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 326-331. +Sashank J. Reddi, Satyen Kale, and Sanjiv Kumar. 2018. On the convergence of adam and beyond. In International Conference on Learning Representations. +Stéphane Ross and Drew Bagnell. 2010. Efficient reductions for imitation learning. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 661-668. +Stéphane Ross and J. Andrew Bagnell. 2014. Reinforcement and imitation learning via interactive no-regret learning. *ArXiv*, abs/1406.5979. +Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. 2011. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 627-635. +H Scudder. 1965. Probability of error of some adaptive pattern-recognition machines. IEEE Transactions on Information Theory, 11(3):363-371. +Semantic Machines, Jacob Andreas, John Bufe, David Burkett, Charles Chen, Josh Clausman, Jean Crawford, Kate Crim, Jordan DeLoach, Leah Dorner, Jason Eisner, Hao Fang, Alan Guo, David Hall, Kristin + +Hayes, Kellie Hill, Diana Ho, Wendy Iwaszuk, Smriti Jha, Dan Klein, Jayant Krishnamurthy, Theo Lanman, Percy Liang, Christopher H. Lin, Ilya Lintsbakh, Andy McGovern, Aleksandr Nisnevich, Adam Pauls, Dmitrij Peeters, Brent Read, Dan Roth, Subhro Roy, Jesse Rusak, Beth Short, Div Slomin, Ben Snyder, Stephon Striplin, Yu Su, Zachary Tellman, Sam Thomson, Andrei Vorobev, Izabela Witoszko, Jason Wolfe, Abby Wray, Yuchen Zhang, and Alexander Zotov. 2020. Task-oriented dialogue as dataflow synthesis. Transactions of the Association for Computational Linguistics, 8:556-571. +Artem Sokolov, Julia Kreutzer, Christopher Lo, and Stefan Riezler. 2016. Learning structured predictors from bandit feedback for interactive nlp. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1610-1620. +Yu Su, Ahmed Hassan Awadallah, Madian Khabsa, Patrick Pantel, Michael Gamon, and Mark Encarnacion. 2017. Building natural language interfaces to web apis. In Proceedings of the International Conference on Information and Knowledge Management. +Yu Su, Ahmed Hassan Awadallah, Miaosen Wang, and Ryen W White. 2018. Natural language interfaces with fine-grained user interaction: A case study on web APIs. In Proceedings of the International ACM SIGIR Conference on Research and Development in Information Retrieval. +Richard S Sutton and Andrew G Barto. 2018. Reinforcement learning: An introduction. MIT press. +Sida I Wang, Samuel Ginn, Percy Liang, and Christopher D Manning. 2017. Naturalizing a programming language via interactive learning. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 929-938. +Sida I Wang, Percy Liang, and Christopher D Manning. 2016. Learning language games through interaction. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2368-2378. +Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. 2020. Neural text generation with unlikelihood training. In International Conference on Learning Representations. +William A Woods. 1973. Progress in natural language understanding: an application to lunar geology. In Proceedings of the American Federation of Information Processing Societies Conference. +Ziyu Yao, Xiujun Li, Jianfeng Gao, Brian Sadler, and Huan Sun. 2019a. Interactive semantic parsing for if-then recipes via hierarchical reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 2547-2554. + +Ziyu Yao, Yu Su, Huan Sun, and Wen-tau Yih. 2019b. Model-based interactive semantic parsing: A unified framework and a text-to-SQL case study. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5450-5461. +Wen-tau Yih, Ming-Wei Chang, Xiaodong He, and Jianfeng Gao. 2015. Semantic parsing via staged query graph generation: Question answering with knowledge base. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1321-1331. +Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, et al. 2018. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-SQL task. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3911-3921. +Jichuan Zeng, Xi Victoria Lin, Steven CH Hoi, Richard Socher, Caiming Xiong, Michael Lyu, and Irwin King. 2020. Photon: A robust cross-domain text-to-SQL system. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 204-214. +Luke S Zettlemoyer and Michael Collins. 2005. Learning to map sentences to logical form: structured classification with probabilistic categorical grammars. In Proceedings of the Twenty-First Conference on Uncertainty in Artificial Intelligence, pages 658-666. +Jiakai Zhang and Kyunghyun Cho. 2017. Query-efficient imitation learning for end-to-end simulated driving. In Thirty-First AAAI Conference on Artificial Intelligence. +Rui Zhang, Tao Yu, Heyang Er, Sungrok Shim, Eric Xue, Xi Victoria Lin, Tianze Shi, Caiming Xiong, Richard Socher, and Dragomir Radev. 2019. Editing-based SQL query generation for cross-domain context-dependent questions. 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 5341-5352. +Jie Zhao, Yu Su, Ziyu Guan, and Huan Sun. 2017. An end-to-end deep framework for answer triggering with a novel group-level objective. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1276-1282. +Victor Zhong, Caiming Xiong, and Richard Socher. 2017. Seq2SQL: Generating structured queries from natural language using reinforcement learning. arXiv preprint arXiv:1709.00103. + +# A Theoretical Analysis in Infinite Sample Case + +In this section, we give a detailed theoretical analysis to derive the cost bounds of the supervised approach and our proposed NEIL algorithm (Section 4). Following Ross et al. (2011), we first focus the proof on an infinite sample case, which assumes an infinite number of samples to train a policy in each iteration (i.e., $m = \infty$ in Algorithm 1), such that the state space in training can be full explored by the learning policy. + +As an overview, we start the analysis by introducing the "cost function" we use to analyze each policy in Appendix A.1, which represents an inverse quality of a policy. In Appendix A.2, we derive the bound of the cost of the supervised approach. Appendix A.3 and Appendix A.4 then discuss the cost bound of our proposed NEIL algorithm. Finally, in Appendix A.5, we show the cost bound of NEIL in finite sample case. + +# A.1 Cost Function for Analysis + +In a semantic parsing task, whenever a policy action is different from the gold one, the whole trajectory cannot yield the correct semantic meaning and the parsing is deemed failed. Therefore, we analyze a policy's performance only when it is conditioned on a gold partial parse. Intuitively, a policy with better quality should have a higher parsing accuracy under a gold partial parse, so that it is more likely to sample a completely correct trajectory in inference time. + +Given a question $q$ and denoting $a_{1:t}^{*}$ as the gold partial trajectory sampled by the expert policy $\pi^{*}$ , we first define the cost of sampling a partial trajectory $a_{1:t} = (a_1, \dots, a_t)$ as: + +$$ +C (q, a _ {1: t}) = \left\{ \begin{array}{l l} 0 & \text {i f} a _ {1: t} = a _ {1: t} ^ {*} \\ 1 & \text {o t h e r w i s e} \end{array} \right.. +$$ + +In other words, a sampled partial trajectory is correct if and only if it is the same as the gold partial parse. Based on this definition, we further define the expected cost of policy $\hat{\pi}$ in a single time step $t$ (given the question $q$ ) as: + +$$ +\begin{array}{l} C _ {\hat {\pi}} ^ {t} (q) = \mathbb {E} _ {a _ {1: t - 1} \sim \pi^ {*}} \mathbb {E} _ {a _ {t} \sim \hat {\pi}} [ C (q, a _ {1: t}) ] \\ = \mathbb {E} _ {a _ {1: t - 1} \sim \pi^ {*}} [ 1 - p _ {\hat {\pi}} (a _ {t} = a _ {t} ^ {*} | q, a _ {1: t - 1}) ]. \\ \end{array} +$$ + +Here, $a_{1:t-1} \sim \pi^*$ denotes a gold partial parse till the $(t-1)$ -th step, which is obtained by executing the expert policy $\pi^*$ for the first $t-1$ steps (given $q$ ), + +and $p_{\hat{\pi}}(a_t = a_t^* |q,a_{1:t - 1})$ denotes the probability that $\hat{\pi}$ samples action $a_{t}^{*}$ given a question $q$ and a partial parse $a_{1:t - 1}$ . By taking an expectation over all questions $q\in \mathcal{Q}$ , we have the following derivations: + +$$ +\begin{array}{l} \mathbb {E} _ {q \in \mathcal {Q}} \left[ C _ {\hat {\pi}} ^ {t} (q) \right] = \mathbb {E} _ {q \in \mathcal {Q}, a _ {1: t - 1} \sim \pi^ {*}} \left[ 1 - p _ {\hat {\pi}} \left(a _ {t} = a _ {t} ^ {*} \mid q, a _ {1: t - 1}\right) \right] \\ = \mathbb {E} _ {s _ {t} \sim d _ {\pi^ {*}}} [ 1 - p _ {\hat {\pi}} (a _ {t} = a _ {t} ^ {*} | s _ {t}) ]. \\ \end{array} +$$ + +The second equality holds by the definition $s_t = (q, a_{1:t-1})$ , and $d_{\pi^*}^t$ is the "expert state distribution" in step $t$ when executing the expert policy $\pi^*$ for first $t-1$ steps. In this analysis, we follow Ross and Bagnell (2010); Ross et al. (2011) to assume a unified decision length $T$ . By summing up the above expected cost over the $T$ steps, we define the cost (i.e., the inverse test-time quality) of policy $\hat{\pi}$ : + +$$ +\begin{array}{l} J (\hat {\pi}) = \sum_ {t = 1} ^ {T} \mathbb {E} _ {q \in \mathcal {Q}} [ C _ {\hat {\pi}} ^ {t} (q) ] \\ = \sum_ {t = 1} ^ {T} \mathbb {E} _ {s _ {t} \sim d _ {\pi^ {*}} ^ {t}} [ 1 - p _ {\hat {\pi}} (a _ {t} = a _ {t} ^ {*} | s _ {t}) ]. \\ \end{array} +$$ + +Denote $\ell(s, \hat{\pi}) = 1 - p_{\hat{\pi}}(a = a^* | s), a \sim \hat{\pi}(s), a^* \sim \pi^*(s)$ as the "single-step loss function", which is bounded within $[0, 1]$ , then the cost of policy $\hat{\pi}$ can be simplified as: + +$$ +\begin{array}{l} J (\hat {\pi}) = \sum_ {t = 1} ^ {T} \mathbb {E} _ {s _ {t} \sim d _ {\pi^ {*}} ^ {t}} \left[ \ell (s _ {t}, \hat {\pi}) \right] \\ = T \mathbb {E} _ {t \sim \mathcal {U} (1, T)} \mathbb {E} _ {s _ {t} \sim d _ {\pi^ {*}} ^ {t}} \left[ \ell (s _ {t}, \hat {\pi}) \right] \\ = T \mathbb {E} _ {s \sim d _ {\pi} *} \left[ \ell (s, \hat {\pi}) \right], \tag {3} \\ \end{array} +$$ + +where $d_{\pi^*} = \frac{1}{T}\sum_{t=1}^{T}d_{\pi^*}^t$ is the average expert state distribution, when we assume the time step $t$ to be a random variable under the uniform distribution $\mathcal{U}(1,T)$ (the second equality). + +# A.2 Cost Bound of Supervised Approach + +In this section, we analyze the cost bound of the supervised approach. Recall that the supervised approach trains a policy $\hat{\pi}$ using the standard supervised learning algorithm with supervision from $\pi^{*}$ at every decision step. Therefore, it finds the best policy $\hat{\pi}_{sup}$ on infinite samples as: + +$$ +\hat {\pi} _ {s u p} = \underset {\pi \in \Pi} {\arg \min } \mathbb {E} _ {s \sim d _ {\pi^ {*}}} [ \ell (s, \pi) ], \tag {4} +$$ + +where $\Pi$ denotes the policy space induced by the model architecture, and the expectation over $s$ is + +sampled from the whole $d_{\pi^*}$ state space because of the "infinite sample" assumption. The supervised approach thus obtains the following cost bound: + +$$ +\begin{array}{l} J \left(\hat {\pi} _ {s u p}\right) = T \mathbb {E} _ {s \sim d _ {\pi *}} \left[ \ell (s, \hat {\pi} _ {s u p}) \right] \\ = T \min _ {\pi \in \Pi} \mathbb {E} _ {s \sim d _ {\pi *}} [ \ell (s, \pi) ]. \\ \end{array} +$$ + +This gives the following theorem: + +Theorem A.1. For supervised approach, let $\epsilon_N = \min_{\pi \in \Pi} \mathbb{E}_{s \sim d_{\pi^*}}[\ell(s, \pi)]$ , then $J(\hat{\pi}_{sup}) = T\epsilon_N$ . + +The cost bound of the supervised approach represents its exact performance as implied by the equality. This is because the approach trains a policy (Eq. (4)) under the same state distribution $d_{\pi^*}$ (given the "infinite sample" assumption) as in evaluation (Eq. (3)). As we will show next, the proposed NEIL algorithm breaks this consistency while enjoying the benefit of high annotation efficiency, which explains the performance gap. + +# A.3 No-regret Assumption + +Before showing the cost bound of our NEIL algorithm, we introduce a "no-regret" assumption (Kakade and Tewari, 2009; Ross et al., 2011) that is leveraged in the derivation. + +Assumption A.1. No-regret assumption. Define $\ell_i(\pi) = \mathbb{E}_{s\sim d_{\pi_i}}[l(s,\pi)]$ and $\epsilon_N = \min_{\pi \in \Pi}\frac{1}{N}\sum_{i = 1}^{N}\ell_i(\pi)$ , then + +$$ +\frac {1}{N} \sum_ {i = 1} ^ {N} \ell_ {i} (\hat {\pi} _ {i}) - \epsilon_ {N} \leq \gamma_ {N} +$$ + +for $\lim_{N\to \infty}\gamma_N = 0$ (usually $\gamma_N\in \tilde{O} (\frac{1}{N})$ ). + +This assumption characterizes an important policy learning pattern: As a policy is trained for an infinite number of iterations, on average, its expected training loss $\left(\frac{1}{N}\sum_{i=1}^{N}\ell_i(\hat{\pi}_i)\right)$ will converge to the loss of the best policy in hindsight $(\epsilon_N)$ . In our scenario, this assumption implies that, while our policy is trained on online labels from both the expert policy $\pi^*$ (when it is queried) and the previously learned policy $\hat{\pi}_i$ (when the agent is confident), it still gradually fits to the best policy over the same state space in training $(d_{\pi_i})$ . In other words, the likely noisy labels from $\hat{\pi}_i$ do not harm the model fitting to the expert policy in general. + +Many no-regret algorithms (Hazan et al., 2007; Kakade and Tewari, 2009) that guarantee $\gamma_N \in \tilde{O}\left(\frac{1}{N}\right)$ require convexity or strong-convexity of the loss function. However, the loss function used + +in our application, which is built on the top of a deep neural network model, does not satisfy this requirement. In general, proving theorems under a non-convex case is not trivial. In this analysis, we follow the common practice (see Kingma and Ba (2015); Reddi et al. (2018) for example) to theoretically analyze the convex case while empirically demonstrating the non-convex case. A more accurate regret bound for non-convex neural networks (which may result in a slower $\gamma_N$ convergence speed with respect to $N$ ) can be studied in the future. + +# A.4 Cost Bound of NEIL Algorithm + +As shown in Algorithm 1, NEIL produces a sequence of policies $\hat{\pi}_{1:N} = (\hat{\pi}_1,\hat{\pi}_2,\dots,\hat{\pi}_N)$ , where $N$ is the number of training iterations, and returns the one with the best test-time performance on validation set as $\hat{\pi}$ . In training, the algorithm executes actions from both the learning policy $\hat{\pi}_i$ (when the model is confident) and the expert policy $\pi^*$ . We denote this "mixture" policy as $\pi_i$ . Then for the first $N$ iterations, we have the cost bound of NEIL as: + +$$ +\begin{array}{l} J (\hat {\pi}) = \min _ {\hat {\pi} ^ {\prime} \in \hat {\pi} _ {1: N}} T \mathbb {E} _ {s \sim d _ {\pi^ {*}}} \left[ \ell (s, \hat {\pi} ^ {\prime}) \right] \\ \leq \frac {T}{N} \sum_ {i = 1} ^ {N} \mathbb {E} _ {s \sim d _ {\pi^ {*}}} \left[ \ell (s, \hat {\pi} _ {i}) \right] \\ \leq \frac {T}{N} \sum_ {i = 1} ^ {N} \left[ \mathbb {E} _ {s \sim d _ {\pi_ {i}}} [ \ell (s, \hat {\pi} _ {i}) ] + \ell_ {\max } | | d _ {\pi_ {i}} - d _ {\pi^ {*}} | | _ {1} \right]. \tag {5} \\ \end{array} +$$ + +From the last inequality, we can see that the cost bound of NEIL is restricted by two terms. The first term $\mathbb{E}_{s\sim d_{\pi_i}}[\ell (s,\hat{\pi}_i)]$ denotes the expected loss of $\hat{\pi}_i$ under the states induced by $\pi_{i}$ during training (under the "infinite sample" assumption, as mentioned in the beginning of the analysis). By applying the no-regret assumption (Assumption A.1), this term can be bound by $\frac{1}{N}\sum_{i = 1}^{N}\mathbb{E}_{s\sim d_{\pi_i}}[\ell (s,\hat{\pi}_i)]\leq \epsilon_N + \gamma_N$ . Here, $\epsilon_N = \min_{\pi \in \Pi}\frac{1}{N}\sum_{i = 1}^{N}\ell_i(\pi)$ denotes the best expected training loss in hindsight. + +The second term denotes the $L_{1}$ distance between state distributions induced by $\pi_{i}$ and $\pi_{i}^{*}$ , weighted by the maximum loss value $l_{max}$ that $\hat{\pi}_{i}$ encounters over the training. As we notice, unlike the supervised approach, NEIL trains a policy under $d_{\pi_i}$ , while what matters to its test-time quality is its performance on the state distribution $d_{\pi^*}$ (Eq. (3)). This discrepancy explains the performance loss of our algorithm compared to the supervised approach and is bounded by the aforementioned $L_{1}$ distance. To further bound this term, + +we define $e_i$ as the probability that $\hat{\pi}_i$ makes a confident (i.e., without querying the expert policy) but wrong action under $d_{\pi^*}$ , and introduce the following lemma: + +Lemma A.1. $||d_{\pi_i} - d_{\pi^*}||_1 \leq 2Te_i$ + +Proof. Let $\beta_{it}$ be the probability of querying the expert policy under $d_{\pi^*}^t$ , $\tilde{\epsilon}_{it}$ the error rate of $\hat{\pi}_i$ under $d_{\pi^*}^t$ (w.r.t. $\pi^*$ ), and $d$ any state distribution besides $d_{\pi^*}$ . We can then express $d_{\pi_i}$ by: + +$$ +\begin{array}{l} d _ {\pi_ {i}} = \prod_ {t = 1} ^ {T} \left(\beta_ {i t} + (1 - \beta_ {i t}) (1 - \tilde {\epsilon} _ {i t})\right) d _ {\pi^ {*}} \\ + (1 - \prod_ {t = 1} ^ {T} (\beta_ {i t} + (1 - \beta_ {i t}) (1 - \tilde {\epsilon} _ {i t}))) d. \\ \end{array} +$$ + +The distance between $d_{\pi_i}$ and $d_{\pi^*}$ thus becomes + +$$ +\begin{array}{l} \left| \left| d _ {\pi_ {i}} - d _ {\pi^ {*}} \right| \right| _ {1} \\ = (1 - \prod_ {t = 1} ^ {T} (\beta_ {i t} + (1 - \beta_ {i t}) (1 - \tilde {\epsilon} _ {i t}))) | | d - d _ {\pi^ {*}} | | _ {1} \\ \leq 2 (1 - \prod_ {t = 1} ^ {T} (\beta_ {i t} + (1 - \beta_ {i t}) (1 - \tilde {\epsilon} _ {i t}))) \\ \leq 2 \sum_ {t = 1} ^ {T} \left[ 1 - \left(\beta_ {i t} + (1 - \beta_ {i t}) \left(1 - \tilde {\epsilon} _ {i t}\right)\right) \right] \\ \leq 2 \sum_ {t = 1} ^ {T} \left[ \tilde {\epsilon} _ {i t} \left(1 - \beta_ {i t}\right) \right] \\ \leq 2 \sum_ {t = 1} ^ {T} e _ {i t} \\ = 2 T e _ {i}. \\ \end{array} +$$ + +The second inequality uses $1 - \prod_{t=1}^{T} x_{t} \leq \sum_{t=1}^{T} (1 - x_{t})$ , which holds when $x_{t} \in [0,1]$ . + +By applying Assumption A.1 and Lemma A.1 to Eq. (3), we derive the following inequality: + +$$ +J (\hat {\pi}) \leq T \left[ \gamma_ {N} + \epsilon_ {N} + \frac {2 T \ell_ {m a x}}{N} \sum_ {i = 1} ^ {N} e _ {i} \right]. +$$ + +Given a large enough $N$ ( $N \in \tilde{O}(T)$ ), by the no-regret assumption, we can further simplify the above as: + +$$ +J (\hat {\pi}) \leq T \left[ \epsilon_ {N} + \frac {2 T \ell_ {m a x}}{N} \sum_ {i = 1} ^ {N} e _ {i} \right] + O (1), +$$ + +which leads to our theorem: + +Theorem A.2. For the proposed NEIL algorithm, if $N$ is $\tilde{O}(T)$ , there exists a policy $\hat{\pi} \in \hat{\pi}_{1:N}$ s.t. $J(\hat{\pi}) \leq T\left[\epsilon_{N} + \frac{2T\ell_{max}}{N}\sum_{i=1}^{N}e_{i}\right] + O(1)$ . + +By comparing Theorem A.1 and Theorem A.2, it is obvious that the performance gap between NEIL and the supervised approach is bounded by the term around $\frac{1}{N}\sum_{i = 1}^{N}e_i$ . We discuss its implications in Section 5 and show that, in practice, this performance gap can be controlled by carefully initializing the policy and choosing a more accurate confidence estimator. + +Discussion about MISP-NEIL*. In experiments, we consider a skyline instantiation of NEIL, called MISP-NEIL*. This instantiation is assumed with perfect confidence estimation and interaction design, such that it can precisely detect and correct its intermediate mistakes during parsing. Therefore, MISP-NEIL* presents an upper bound performance (i.e., the tightest cost bound) of NEIL. This can be interpreted theoretically. In fact, for MISP-NEIL*, $e_i$ is always zero since the system has ensured that its policy action is correct when it does not query the expert policy. In this case, $d_{\pi_i} = d_{\pi^*}$ , so $\epsilon_N = \min_{\pi \in \Pi} \frac{1}{N} \sum_{i=1}^{N} \mathbb{E}_{s \sim d_{\pi^*}}[l(s, \pi)] = \min_{\pi \in \Pi} \mathbb{E}_{s \sim d_{\pi^*}}[l(s, \pi)]$ . Therefore, according to Theorem A.2, MISP-NEIL* has a cost bound of: + +$$ +J (\hat {\pi}) \leq T \epsilon_ {N} + O (1), +$$ + +where $\epsilon_N = \min_{\pi \in \Pi} \mathbb{E}_{s \sim d_{\pi^*}}[l(s, \pi)]$ . + +By comparing this bound with the cost bound in Theorem A.1, it is observed that MISP-NEIL* shares the same cost bound as the supervised approach (except for the inequality relation and the constant). This is explainable since MISP-NEIL* indeed collects exactly the same training labels as the supervised approach. + +# A.5 Cost Bound of NEIL Algorithm in Finite Sample Case + +The theorem in the previous section holds when the algorithm observes infinite trajectories in training. However, in practice, NEIL observes the training loss from only a finite set of $m$ trajectories in each iteration. For this consideration, in the following discussion, we provide a proof of the cost bound of NEIL under the finite sample case. + +Denote $D_{i}$ as the $m$ trajectories collected in the $i$ -th iteration and $\ell_i(\hat{\pi}_i) = \mathbb{E}_{s\sim D_i}[\ell (s,\hat{\pi}_i)]$ . Applying the no-regret assumption (Assumption A.1) allows us to bound the average expected policy training loss: $\frac{1}{N}\sum_{i = 1}^{N}\mathbb{E}_{s\sim D_i}\bigl [\ell (s,\pi_i)\bigr ] - \tilde{\epsilon}_N\leq \tilde{\gamma}_N$ + +where $\tilde{\epsilon}_N = \min_{\pi \in \Pi}\frac{1}{N}\sum_{i = 1}^N\mathbb{E}_{s\sim D_i}\left[\ell (s,\pi)\right]$ denotes the loss of the best policy in hindsight on the finite samples. + +Following Eq. (5), we need to switch the derivation from the expected loss of $\hat{\pi}_i$ over $d_{\pi_i}$ (i.e., $\mathbb{E}_{s\sim d_{\pi_i}}[\ell (s,\hat{\pi}_i)])$ to that over $D_{i}$ (i.e., $\mathbb{E}_{s\sim D_i}[\ell (s,\hat{\pi}_i)]$ ), the actual state distribution that $\hat{\pi}_i$ is trained on. To fill this gap, we introduce $Y_{ij}$ to denote the difference between the expected loss of $\hat{\pi}_i$ under $d_{\pi_i}$ and the average loss of $\hat{\pi}_i$ under the $j$ -th sample trajectory with $\pi$ at iteration $i$ . The random variables $Y_{ij}$ over all $i\in \{1,2,\dots,N\}$ and $j\in \{1,2,\dots,m\}$ are all zero mean, bounded in $[- \ell_{max},\ell_{max}]$ and form a martingale in the order of $Y_{11},Y_{12},\ldots ,Y_{1m},Y_{21},\ldots ,Y_{Nm}$ . By Azuma-Hoeffding's inequality (Azuma, 1967; Hoeffding, + +1994), $\frac{1}{mN}\sum_{i = 1}^{N}\sum_{j = 1}^{m}Y_{ij}\leq \ell_{max}\sqrt{\frac{2\log(1 / \delta)}{mN}}$ with probability $1 - \delta$ . Following the derivations in Eq. (5) and by introducing $Y_{ij}$ , with probability of $1 - \delta$ , we obtain the following inequalities by definition: + +$$ +\begin{array}{l} J (\hat {\pi}) \\ \leq \frac {T}{N} \sum_ {i = 1} ^ {N} \left[ \mathbb {E} _ {s \sim d _ {\pi_ {i}}} [ \ell (s, \hat {\pi} _ {i}) ] + \ell_ {m a x} | | d _ {\pi_ {i}} - d _ {\pi^ {*}} | | _ {1} \right] \\ \leq \frac {T}{N} \sum_ {i = 1} ^ {N} \left[ \mathbb {E} _ {s \sim D _ {i}} [ \ell (s, \hat {\pi} _ {i}) ] + \ell_ {m a x} | | d _ {\pi_ {i}} - d _ {\pi^ {*}} | | _ {1} \right] \\ + \frac {T}{m N} \sum_ {i = 1} ^ {N} \sum_ {j = 1} ^ {m} Y _ {i j} \\ \leq \frac {T}{N} \sum_ {i = 1} ^ {N} \left[ \mathbb {E} _ {s \sim D _ {i}} [ \ell (s, \hat {\pi} _ {i}) ] + \ell_ {m a x} | | d _ {\pi_ {i}} - d _ {\pi^ {*}} | | _ {1} \right] \\ + \ell_ {m a x} T \sqrt {\frac {2 \log (1 / \delta)}{m N}} \\ \leq T \left[ \tilde {\gamma} _ {N} + \tilde {\epsilon} _ {N} + \ell_ {m a x} \sqrt {\frac {2 \log (1 / \delta)}{m N}} \right. \\ \left. + \frac {2 \ell_ {m a x} T}{N} \sum_ {i = 1} ^ {N} e _ {i} \right]. \\ \end{array} +$$ + +Notice that we need $mN$ to be at least $\tilde{O}(T^2\log(1/\delta))$ , so that $\gamma_N$ and $l_{max}\sqrt{\frac{2\log(1/\delta)}{mN}}$ are negligible. This leads to the following theorem: + +Theorem A.3. For the proposed NEIL algorithm, with probability at least $1 - \delta$ , when $mN$ is $\hat{O}(T^2 \log(1/\delta))$ , there exists a policy $\hat{\pi} \in \hat{\pi}_{1:N}$ s.t. $J(\hat{\pi}) \leq T[\tilde{\epsilon}_N + \frac{2l_{max}T}{N} \sum_{i=1}^{N} e_i] + O(1)$ . + +The theorem shows that the cost of Neil can still be bounded in the finite sample setting. Com + +paring this bound with the bound under the infinite sample setting, we can observe that the bound is still related to $e_i$ , the probability that $\hat{\pi}_i$ takes a confident but incorrect action under $d_{\pi^*}$ . + +# B Implementation Details + +# B.1 Interactive Semantic Parsing Framework + +Our system assumes an interactive semantic parsing framework to collect user feedback. In experiments, this is implemented by adapting MISP (Yao et al., 2019b), an open-sourced framework that has demonstrated a strong ability to improve test-time parsing accuracy. In this framework, an agent is comprised of three components: a world model that wraps the base semantic parser and a feedback incorporation module to interpret user feeds and update the semantic parse, an error detector that decides whether to request for user intervention, and an actuator that delivers the agent's request by asking a natural language question, such that users without domain expertise can understand. + +We follow MISP's instantiation for text-to-SQL tasks to adopt a probability-based uncertainty estimator as the error detector, which triggers user interactions when the probability of the current decision is lower than a threshold. The actuator is instantiated by a grammar-based natural language generator. We use the latest version of MISP that allows multi-choice interactions to improve the system efficiency, i.e., when the parser's current decision is validated as wrong, the system presents multiple alternative options for user selection. An additional "None of the above options" option is included in case all top options from the system are wrong. Figure 1 shows an example of the user interaction. From there, the system can derive a correct decision to address its uncertainty (e.g., taking "Player" as a WHERE column). + +As a general interactive semantic parsing framework, MISP has its advantage of being generalizable to different kinds of semantic parsers (as long as their parsing process can be formulated as taking a sequence of actions in their respective action space) and various logical forms (e.g., lambda expressions). Although it could be non-trivial to instantiate such an interactive system, we note that it is a one-time effort for all datasets of the same logical form. + +Example of Non-sketch-based Parsers. In addi- + +tion to the example of the SQLova parser (Hwang et al., 2019) that we provide in Section 3, here we show how the EditSQL parser (Zhang et al., 2019) is formulated under MISP. Unlike SQLova, EditSQL does not assume any SQL sketch; it instead generates a SQL query "token by token".6 Consider the SQL query in Figure 1. EditSQL takes actions: $a_1 = "\text{SELECT}"$ , $a_2 = "\text{COUNT}"$ , $a_3 = "$ ", $a_4 = "\text{School/Club Team}"$ , $a_5 = "$ ", etc. Therefore, the action space of EditSQL consists of all SQL keywords, grammatical constituents (e.g., "(") and available table columns. In this case, MISP only validates semantically meaningful actions (including aggregators, operators, column names, etc.) while skipping others (including trivial symbols like " (" and most SQL keywords). + +User Simulator. Our experiments train each system with simulated user feedback. To this end, we build a user simulator similar to the one used by Yao et al. (2019b) in MISP, which can access the ground-truth SQL queries. It gives yes/no answer or selects a choice by directly comparing the sampled policy action with the true one in the gold query. When the true option is not presented within the system provided choices, the user is simulated to select "None of the above options". + +# B.2 WikiSQL Experiment Details + +Dataset&Model. Our main experiments consider the WikiSQL benchmark dataset (Zhong et al., 2017), which contains 56,355/8,421/15,878 question-SQL query pairs in the training/validation/test set. We use exactly the same data split as Zhong et al. (2017). + +We choose SQLova (Hwang et al., 2019), one of the open-sourced9 top-performing semantic parser on WikiSQL, as the base parser, which ensures reasonable model capability to study continual learning. Hyper-parameters are set the same as the ones recommended by the SQLova authors on their GitHub repository,10 except that we use a learning rate of 1e-5 for fine-tuning the BERT model. Empirically we found out this relatively larger learning + +rate can greatly accelerate the model learning without affecting the model performance significantly. The total number of model parameters is around 118M, with 110M from BERT-Base (Uncased)11 and 8M from the SQLova parser side. + +Early stop is used to accelerate model training in each training iteration. Specifically, we stop model training if it does not show improvement on the validation set for a consecutive number of epochs. We set this number to 10 before the 30-th training iteration when the total training data is in a relatively small size, and decay it to 5 after the 30-th iteration. We follow SQLova when preprocessing the WikiSQL data. + +Experimental Setup. We study a "continual learning" problem and experiment various systems with three initialization settings, as suggested by our theoretical analysis (Section 5). Specifically, we use $10\%$ (5,636 pairs), $5\%$ (2,818 pairs), and $1\%$ (564 pairs) of the total training data for parser initialization, respectively. + +In each initialization setting, the remaining training data is used to simulate user questions that a system receives after deployment. The user questions come in a random order. We repeat three random runs (i.e., three random orders of user questions) and report the average system performance. Notice that, we ensure each system receive the same user question (but may have different user feedback depending on their interaction designs) during iterative training, for a fair comparison. Systems update (retrain) their base semantic parsers periodically for every 1,000 user questions. + +Metrics. In the end of each iteration, we evaluate the system's performance, including: + +- Parsing accuracy. We measure the query match accuracy (i.e., logical form accuracy) using the script from SQLova implementation. +- An accumulated number of user/expert annotations (introduced in Section 6.3). Different systems request different kinds of user/expert annotations. Therefore, even when serving the user on the same user question, different systems require different numbers of annotations. This metric sums up the total number of annotations that each system has requested after each training iteration. + +Calculating the aforementioned metrics allow us to plot Figure 2 and Figure 4. + +Compute. We complete experiments on Nvidia GeForce RTX 2080Ti (11GB). Models are all implemented using PyTorch. $^{12}$ The run time for each training iteration varies depending on the accumulated training data size. To finish the $50+$ iterations of (re-)training, each system takes around 15 days. In the weak $1\%$ initialization case, the Binary User baseline takes less time (around 10 days), since most of its predicted queries are wrong and thus are not included into its training data. + +# B.3 EditSQL Experiment Details + +Data&Model. The Spider dataset (Yu et al., 2018) contains 8,421 question-SQL pairs for training and 1,034 pairs for validation. $^{13}$ The test set is not publicly available and is thus not used in our experiments. + +We choose EditSQL (Zhang et al., 2019) as the base semantic parser, since it is one of the open-sourced state-of-the-art models on Spider. All hyper-parameters are set following (Zhang et al., 2019). Pre-trained BERT model is also used. Totally there are around 120M parameters in the model, with 110M from the BERT-Base (Uncased) and 10M from the EditSQL parser side. Early stop is additionally used to accelerate model training. Specifically, we stop model training when it does not show improvement on validation for 5 consecutive epochs. + +In the data preprocessing step, EditSQL transforms each gold SQL query into a sequence of tokens, where the From clause is removed and each column Col is prepended by its paired table name, i.e., Tab.Col. However, we observe that sometimes this transformation is not convertible. For example, consider the question "what are the first name and last name of all candidates?" and its gold SQL query: "SELECT T2.first_name, T2.last_name FROM candidates AS T1 JOIN people AS T2 ON T1.candidate_id = T2.person_id". EditSQL transforms this query into: "select people.first_name, people.last_name". The transformed sequence accidentally removes the information about table candidates in the original SQL + +query, leading to semantic meaning inconsistent with the question. When using such erroneous sequences as the gold targets in model training, we cannot simulate consistent user feedback, e.g., when the user is asked whether her query is relevant to the table candidates, the simulated user cannot give an affirmative answer based on the transformed sequence. To avoid inconsistent user feedback, we remove question-SQL pairs whose transformed sequence is inconsistent with the original gold SQL query, from the training data. This can be easily done by using EditSQL's post-processing script to convert a preprocessed sequence back to the SQL format. Only when the converted query is the same as the original one, the transformation is consistent. This reduces the size of the training set from 8,421 to 7,377. The validation set is kept untouched for fair evaluation. + +The implementation of interactive semantic parsing for EditSQL is the same as Section B.1, except that, in order to cope with the complicated structure of Spider SQL queries, for columns in WHERE, GROUP BY, ORDER BY and HAVING clauses, we additionally provide an option for the user to "remove" the clause, e.g., removing a WHERE clause by picking the "The system does not need to consider any conditions." option. We also adjust the "semantic unit" definition in MISP16 to deal with the autoregressive decoding of EditSQL. For example, instead of asking first about a SELECT column and then about its aggregator, we define one semantic unit to inquire about both the column and its aggregator. + +To instantiate NEIL, the confidence threshold $\mu$ is 0.995 as we observe that EditSQL tends to be overconfident. + +Experimental Setup. We experiment with one initialization setting, using $10\%$ of the total training data (i.e., 737 question-SQL pairs), and systems update (retrain) their base semantic parsers periodically for every 1,000 user questions as in WikiSQL experiments. We report system performance averaged over three random runs (i.e., three random orders of user questions). + +We also tried using more training data for initialization. However, since the total training data in Spider is very limited in size, more initialization data means fewer data for simulating online + +user questions and conducting continual learning. This leads to less clear experimental observations (e.g., even the Full Expert system shows fluctuation, probably due to data redundancy or an issue with model architecture capability). Therefore, we only focus on the $10\%$ initialization setting. + +Metrics. We measure each system similarly as in WikiSQL experiments. For parsing performance, we calculate the exact match accuracy using scripts from the EditSQL implementation. + +Compute. We complete experiments on Nvidia GeForce RTX 2080Ti (11GB). Models are implemented using PyTorch. The run time for each training iteration varies depending on the accumulated training data size. Finishing the whole iterative learning takes around 5 days for all systems. + +# C Additional Experimental Results + +# C.1 Additional SQLova Results + +Figure 4 shows different systems' performance on WikiSQL validation set. For Binary User(+Expert), it is hard to quantify "one annotation", which varies according to the actual database size and the query difficulty. As a compromise, we approximate this number by calculating it in the same way as Full Expert, with the assumption that in general validating execution results is as hard as validating the SQL query itself. + +We also show in Figure 5 the average number of annotations (i.e., user interactions) that MISP-NEIL requires per question during the iterative training. Overall, as the base parser is further trained, our system tends to request fewer user interactions. In most cases throughout the training, the system requests no more than one user interaction, demonstrating the annotation efficiency of our NEIL algorithm. + +# C.2 Connection to Theoretical Analysis + +As we proved in Section 5, the performance gap between our proposed NEIL algorithm and the supervised approach is mainly decided by $\frac{1}{N}\sum_{i = 1}^{N}e_{i}$ , an average probability that $\hat{\pi}_i$ makes a confident but wrong decision under $d_{\pi^*}$ (i.e., given a gold partial parse) over $N$ training iterations. More specifically, from our proof of Lemma A.1, $e_i$ can be expressed as: + +$$ +e _ {i} = \frac {1}{T} \sum_ {t = 1} ^ {T} e _ {i t} = \frac {1}{T} \sum_ {t = 1} ^ {T} \tilde {\epsilon} _ {i t} (1 - \beta_ {i t}), +$$ + +where $\tilde{\epsilon}_{it}$ denotes policy $\hat{\pi}_i$ 's conditional error rate under $d_{\pi^*}^t$ when it does not query the expert (i.e., being confident about its own action) at step $t$ , and $1 - \beta_{it}$ denotes the probability that $\hat{\pi}_i$ does not query the expert under $d_{\pi^*}^t$ . $\tilde{\epsilon}_{it}(1 - \beta_{it})$ thus represents a joint probability that $\hat{\pi}_i$ makes confident but wrong action under $d_{\pi^*}^t$ at step $t$ . + +To show a reflection of our theoretical analysis on the experiments, we present the values of the following three variables during training: (1) $\tilde{\epsilon}_i = \frac{1}{T}\sum_{t=1}^T\tilde{\epsilon}_{it}$ , the average value of $\tilde{\epsilon}_{it}$ over $T$ time steps. A smaller $\tilde{\epsilon}_i$ implies a lower conditional error rate and thus a smaller $e_i$ and a smaller performance gap. (2) $\beta_i = \frac{1}{T}\sum_{t=1}^T\beta_{it}$ , the average value of $\beta_{it}$ over $T$ time steps. A smaller $\beta_i$ (i.e., a larger $1 - \beta_i$ ) means a smaller probability that $\hat{\pi}_i$ queries the expert (i.e., being more confident). This could lead to a larger $e_i$ and thus a larger performance gap. (3) $e_i$ as defined previously. A smaller $e_i$ indicates a smaller performance gap between our algorithm and the supervised approach. + +We plot the results of our MISP-NEIL system (based on SQLova) in Figure 6. For all initialization settings, we observe that the base parser tends to make more confident actions under a gold partial parse (i.e., decreasing $\beta_{i}$ ) when it is trained for more iterations. Meanwhile, the error rate of its confident actions under a gold partial parse is also reduced (i.e., decreasing $\tilde{\epsilon}_i$ ). When combining the two factors, $e_i$ is shown to keep decreasing, implying that with more iterations that the parser is trained, it gets a tighter cost bound and better performance. + +Finally, we notice that a differently initialized parser can end up with different performance. This is reasonable since a better initialized parser presumably should have a better overall error rate. This is also consistent with our observation in the main experimental results (Section 6.3). + +![](images/9238b85d4bbe45c082c3680118874c99ad73bd55b91c354127b9208766fda689.jpg) + +![](images/9b38676f37daa7e167424584b554743404c55bf7f471705c24d552c6ef74d247.jpg) + +![](images/3668994ad0007738224a7aa2e07910bb400a1f409bd2e84854c840e5c3e57b67.jpg) + +Figure 4: Parsing accuracy on WikiSQL validation set when systems are trained with various numbers of user/expert annotations (top) and for different iterations (bottom). We experiment systems with three initialization settings, using $10\%$ , $5\%$ and $1\%$ of the training data respectively. +![](images/3a0299534b52d134180af1622a41a42aa549be0347036dbd98906d8d6d61de7e.jpg) +Full Expert Binary User Binary User+Expert MISP-NEIL MISP-NEIL\* Self Train + +![](images/81b19ed0a2e8c78c52393d1bdd1245d589c8459a87650b9b89e358c511404a94.jpg) + +![](images/bede67f81e54c237d549a4395143262d3179bdca20fc7d30581991d154d67708.jpg) + +![](images/490b19ef1b97191fd203bda745d946c48985c51f36b390f25fe3810a61839c9f.jpg) +Figure 5: Average number of user annotations/interactions that MISP-NEIL requests for each user question during iterative training (on WikiSQL), when the parser is initialized using $10\%$ , $5\%$ and $1\%$ of training data. + +![](images/3dff0a4eab71f19d4d5697ab8bec61e5501a101b324548ff45fc47df8ad4f3a5.jpg) + +![](images/f4f5740d87c09d3109908187c21d185526396b8a13ff9d5f14ce2acf90013c78.jpg) + +![](images/50384e1d284d71d5b6da3e47127a35226611617683606b522938bd32bde31cd2.jpg) +(a) + +![](images/fd95f12b843d4d0e0a823c527dc6a334659845163fc9d31ad350a0acb9ad1fe6.jpg) +(b) + +![](images/90b976a40381f62956eb29e7d6b00ad2a9b14643a8e9c8f43649e1b13b61ca08.jpg) +(c) +Figure 6: The values of $\tilde{\epsilon}_i$ (a), $\beta_{i}$ (b) and $e_i$ (c) in MISP-NEIL throughout the training (on WikiSQL validation set), under different initialization settings. \ No newline at end of file diff --git a/animitationgameforlearningsemanticparsersfromuserinteraction/images.zip b/animitationgameforlearningsemanticparsersfromuserinteraction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..4ab9dc37311a2c353a9e825687541f279bd98614 --- /dev/null +++ b/animitationgameforlearningsemanticparsersfromuserinteraction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:251f162e22a545ceeeb2d68e5330e4ef0db35e51e14be4f9f680459bfa460bf4 +size 641502 diff --git a/animitationgameforlearningsemanticparsersfromuserinteraction/layout.json b/animitationgameforlearningsemanticparsersfromuserinteraction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c2d3c2c1f239d5283ce466259b97fb2103c56846 --- /dev/null +++ b/animitationgameforlearningsemanticparsersfromuserinteraction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:916a98e34745f3b15cfdc3d955e971c02754d295314ecf2d05f357e84c8dde05 +size 897672 diff --git a/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_content_list.json b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..dbc58fde53167f9abeef9fff7ecf9bda4b7b6364 --- /dev/null +++ b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:934b432fb39e183d225257fb040efe837e71d99a77e92b3251b21236681257bd +size 109955 diff --git a/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_model.json b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..322ff6b92a9f37bdaeaf986203e8c1cedf3dddb8 --- /dev/null +++ b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e33c838e7883df1a65cbe6af025339e784c16bfead5be85dc5b9def48331391 +size 128341 diff --git a/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_origin.pdf b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e26106d9031a6631470325895cc7ba7dc3010c58 --- /dev/null +++ b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/3b064f60-9711-4517-bf74-c110f433132b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9126c81f76f4f4404da2cf8d60519aa4044b43e909e481f2814ee20f1c09ee81 +size 712426 diff --git a/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/full.md b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/full.md new file mode 100644 index 0000000000000000000000000000000000000000..77a4ae6be7b07b88b90359a5535263a8108d67e1 --- /dev/null +++ b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/full.md @@ -0,0 +1,492 @@ +# An Information Bottleneck Approach for Controlling Conciseness in Rationale Extraction + +Bhargavi Paranjape† Mandar Joshi† John Thickstun† Hannaneh Hajishirzi† $\epsilon$ Luke Zettlemoyer† + +† Allen School of Computer Science & Engineering, University of Washington, Seattle, WA +Allen Institute of Artificial Intelligence, Seattle + +{bparan,mandar90,thickstn,hannaneh,1sz}@cs.washington.edu + +# Abstract + +Decisions of complex models for language understanding can be explained by limiting the inputs they are provided to a relevant subsequence of the original text — a rationale. Models that condition predictions on a concise rationale, while being more interpretable, tend to be less accurate than models that are able to use the entire context. In this paper, we show that it is possible to better manage the trade-off between concise explanations and high task accuracy by optimizing a bound on the Information Bottleneck (IB) objective. Our approach jointly learns an explainer that predicts sparse binary masks over input sentences without explicit supervision, and an end-task predictor that considers only the residual sentences. Using IB, we derive a learning objective that allows direct control of mask sparsity levels through a tunable sparse prior. Experiments on the ERASER benchmark demonstrate significant gains over previous work for both task performance and agreement with human rationales. Furthermore, we find that in the semi-supervised setting, a modest amount of gold rationales (25% of training examples with gold masks) can close the performance gap with a model that uses the full input.1 + +# 1 Introduction + +A rationale is a short yet sufficient part of the input text that can explain model decisions for a range of language understanding tasks (Lei et al., 2016). Models can be faithful to a rationale by only using the selected text as input for end-task prediction (DeYoung et al., 2019). However, there is almost always a trade-off between interpretable models that learn to extract sparse rationales and more accurate models that are able to use the full + +![](images/7751256c824300cc6a98bfdd587e61eabe99f2c95a27a8e725416b6f0d6e972d.jpg) +Figure 1: Our Information Bottleneck-based approach extracts concise rationales that are minimally informative about the original input, and maximally informative about the label through fine-grained control of sparsity in the bottleneck (0.4 in this fact verification example). End-task prediction is conditioned only on the bottlenecked input. + +context but provide little explanation for their predictions (Lei et al., 2016; Weld and Bansal, 2019). In this paper, we show that it is possible to better manage this trade-off by optimizing a novel bound on the Information Bottleneck (Tishby et al., 1999) objective (Figure 1). + +We follow recent work in representing rationales as binary masks over the input text (Lei et al., 2016; Bastings et al., 2019). During learning, it is common to encourage sparsity by minimizing a norm on the rationale masks (e.g. $L_{0}$ or $L_{1}$ ) (Lei et al., 2016; Bastings et al., 2019). It is often challenging to control the sparsity-accuracy trade-off in norm-minimization methods; we show that these methods seem to push too directly for sparsity at the expense of accuracy (Section 5.2). Our approach, in contrast, allows more control through a prior that specifies task-specific target sparsity levels that should be met in expectation across the training set. + +More specifically, we formalize the problem of + +inducing controlled sparsity in the mask using the Information Bottleneck (IB) principle. Our approach seeks to extract a rationale as an optimal compressed intermediate representation (the bottleneck) that is both (1) minimally informative about the original input, and (2) maximally informative about the output class. We derive a novel variational bound on the IB objective for our case where we constrain the intermediate representation to be a concise subsequence of the input, thus ensuring its interpretability. + +Our model consists of an explainer that extracts a rationale from the input, and an end-task predictor that predicts the output based only on the extracted rationale. Our IB-based training objective guarantees sparsity by minimizing the Kullback-Leibler (KL) divergence between the explainer mask probability distribution and a prior distribution with controllable sparsity levels. This prior probability affords us tunable fine-grained control over sparsity, and allows us to bias the proportion of the input to be used as rationale. We show that, unlike norm-minimization methods, our KL-divergence objective is able to consistently extract rationales with the specified sparsity levels. + +Across five tasks from the ERASER interpretability benchmark (DeYoung et al., 2019) and the BeerAdvocate dataset (McAuley et al., 2012), our IB-based sparse prior objective has significant gains over previous norm-minimization techniques — up to $5\%$ relative improvement in task performance metrics and $6\%$ to $80\%$ relative improvement in agreement with human rationale annotations. Our interpretable model achieves task performance within $10\%$ of a model of comparable size that uses the entire input. Furthermore, we find that in the semi-supervised setting, adding a small proportion of gold rationale annotations (approximately $25\%$ of the training examples) bridges this gap — we are able to build an interpretable model without compromising performance. + +# 2 Method + +# 2.1 Task and Method Overview + +We assume supervised text classification or regression data that contains tuples of the form $(x,y)$ . The input document $x$ can be decomposed into a sequence of sentences $x = (x_{1},x_{2},\ldots ,x_{n})$ and $y$ is the category, answer choice, or target value to predict. Our goal is to learn a model that not only predicts $y$ , but also extracts a rationale or explana + +tion $z$ a latent subsequence of sentences in $x$ with the following properties: + +1. Model prediction $y$ should rely entirely on $z$ and not on its complement $x \backslash z$ — faithfulness (DeYoung et al., 2019). +2. $z$ must be concise, i.e., it should contain as few sentences as possible without sacrificing the ability to correctly predict $y$ . + +Following Lei et al. (2016), our interpretable model learns a boolean mask $m = (m_1, m_2, \ldots, m_n)$ over the sentences in $x$ , where $m_j \in \{0, 1\}$ is a discrete binary variable. To enforce (1), the masked input $z = m \odot x = (m_1 \cdot x_1, m_2 \cdot x_2, \ldots, m_n \cdot x_n)$ is used to predict $y$ . Conciseness is attained using an information bottleneck. + +# 2.2 Formalizing Interpretability Using Information Bottleneck + +Background The Information Bottleneck (IB) method is used to learn an optimal compression model that transmits information from a random variable $X$ to another random variable $Y$ through a compressed representation $Z$ . The IB objective is to minimize the following: + +$$ +L _ {I B} = I (X, Z) - \beta I (Z, Y), \tag {1} +$$ + +where $I(\cdot, \cdot)$ is mutual information. This objective encourages $Z$ to only retain as much information about $X$ as is needed to predict $Y$ . The hyperparameter $\beta$ controls the trade-off between retaining information about either $X$ or $Y$ in $Z$ . Alemi et al. (2016) derive the following variational bound on Equation 1: + +$$ +\begin{array}{l} L _ {V I B} = \underbrace {\mathbb {E} _ {z \sim p _ {\theta} (z | x)} [ - \log q _ {\phi} (y | z) ]} _ {\text {T a s k L o s s}} + \\ \underbrace {\beta K L [ p _ {\theta} (z \mid x) , r (z) ]} _ {\text {I n f o r m a t i o n L o s s}}, \tag {2} \\ \end{array} +$$ + +where $q_{\phi}(y|z)$ is a parametric approximation to the true likelihood $p(y|z); r(z)$ , the prior probability of $z$ , approximates the marginal $p(z)$ ; and $p_{\theta}(z|x)$ is the parametric posterior distribution over $z$ . + +The information loss term in Equation 2 reduces $I(X,Z)$ by decreasing the KL divergence3 be + +tween the posterior distribution $p_{\theta}(z|x)$ that depends on $x$ and a prior distribution $r(z)$ that is independent of $x$ . The task loss encourages predicting the correct label $y$ from $z$ to increase $I(Z,Y)$ . + +Our Variational Bound for Interpretability The learned bottleneck representation $z$ , found via Equation 2, is not human-interpretable as $z$ is typically a compressed continuous vector representation of input $x$ . To ensure interpretability of $z$ , we define the interpretable latent representation as $z := m \odot x$ , where $m$ is a boolean mask on the input sentences in $x$ . We assume that the mask variables $m_j$ over individual sentences are conditionally independent given the input $x$ , i.e. the posterior $p_{\theta}(m|x) = \prod_j p_{\theta}(m_j|x)$ , where $p_{\theta}(m_j|x) = \text{Bernoulli}(\theta_j(x))$ and $j$ indexes sentences in the input text. Because $z := m \odot x$ , the posterior distribution over $z$ is a mixture of dirac-delta distributions: + +$$ +p _ {\theta} (z _ {j} | x) = (1 - \theta_ {j} (x)) \delta (z _ {j}) + \theta_ {j} (x) \delta (z _ {j} - x _ {j}), +$$ + +where $\delta (x - c)$ is the dirac-delta probability distribution that is zero everywhere except at $c$ . + +For the prior, we assume a fixed Bernoulli distribution over mask variables. For instance, $r(m_j) = \operatorname{Bernoulli}(\pi)$ for some constant $\pi \in (0,1)$ . This also induces a fixed distribution on $z$ via the definition $z := m \odot x$ . Instead of using an expressive $r(z)$ to approximate $p(z)$ , we use a non-parametric prior $r(z)$ to force the marginal $p(z)$ of the learned distribution over $z$ to approximately equal $\pi$ . Our characterization of the prior and the posterior achieves compression of the input via sparsity in the latent representation, in contrast to compression via dimensionality reduction (Alemi et al., 2016). + +For the intermediate representation $z\coloneqq m\odot x$ we can decompose $\mathrm{KL}(p_{\theta}(z_j|x),r(z_j))$ as: + +$$ +\operatorname {K L} \left(p _ {\theta} \left(m _ {j} \mid x\right), r \left(m _ {j}\right)\right) + \pi H (x) +$$ + +Since the entropy of the input, $\pi H(x)$ , is a constant with respect to $\theta$ , it can be dropped. Hence, we obtain the following variational bound on IB with interpretability constraints over $z$ , derived in more detail in Appendix A.2: + +$$ +\begin{array}{l} L _ {I V I B} = \mathbf {E} _ {m \sim p _ {\theta} (m | x)} [ - \log q _ {\phi} (y | m \odot x) ] + \\ \beta \sum_ {j} K L [ p _ {\theta} (m _ {j} | x) | | r (m _ {j}) ] \tag {3} \\ \end{array} +$$ + +![](images/48ceb6d7f678324a76fba61b9ea7251d7f751029afbae1928add3304f7e502be.jpg) +Figure 2: Architecture: The explainer extracts a rationale from the input using a binary mask, and an end-task predictor predicts the output based only on the extracted rationale. + +The first term is the expected cross-entropy term for the task which can be computed by drawing samples $m \sim p_{\theta}(m|x)$ . The second information-loss term encourages the mask $m$ to be independent of $x$ by reducing the KL divergence of its posterior $p_{\theta}(m|x)$ from a prior $r(m)$ that is independent of $x$ . However, this does not necessarily remove information about $x$ in $z = x \odot m$ . For instance, a mask consisting of all ones is independent of $x$ , but in this case $z = x$ and the rationale is no longer concise. In the following section, we present a simple way to avoid this degenerate case in practice by appropriately fixing the value of $\pi$ . + +# 2.3 The Sparse Prior Objective + +The key to ensuring that $z = m \odot x$ is strictly a subsequence of $x$ lies in the fact that $r(m_j) = \pi$ is our prior belief about the probability of a sentence being important for prediction. For instance, if humans annotate $10\%$ of the input text as a rationale, we can fix our prior belief that a sentence should be a part of the mask as $r(m_j) = \pi = 0.1 \forall j$ . IB allows us to control the amount of sparsity in the mask that is eventually sampled from the learned distribution $p_{\theta}(m|x)$ in several ways. $\pi$ can be estimated as the expected sparsity of the mask from expert rationale annotations. If such a statistic is not available, it can be explicitly tuned for the desired trade-off between end task performance and rationale length. In this work, we assume $\pi \in (0,0.5)$ so that the sampled mask is sparse. We refer to this training objective with tunable $r(m) = \pi$ as the sparse prior (Sparse IB) method in our experiments. In Appendix C, we also discuss explicitly learning the value of $\pi$ . + +# 3 Model + +To optimize for objective 3, the posterior distribution estimator $p_{\theta}()$ and label likelihood estimator + +$q_{\phi}()$ are instantiated as the explainer and end-task predictor neural models respectively. Two different pre-trained transformers (Devlin et al., 2019) are used to initialize both models. + +# 3.1 Architecture + +Explainer $p_{\theta}(z|x)$ : Given an input $x = x_1, x_2, \ldots, x_n$ consisting of $n$ sentences, the explainer produces a binary mask $m \in \{0, 1\}^n$ over the input sentences which is used to derive a rationale $z = m \odot x$ . It maps every sentence $x_j$ to its probability, $p_{\theta}(m_j|x)$ of being selected as part of $z$ where $p(\cdot)$ is a binary distribution. The explainer contextualizes the input sequence $x$ at the token level, and produces sentence representations $\mathbf{x} = (\mathbf{x}_1, \mathbf{x}_2, \ldots, \mathbf{x}_n)$ where $\mathbf{x}_j$ is obtained by concatenating the contextualized representations of the first and last tokens in sentence $x_j$ . A linear layer is used to transform these representations into logits (log probabilities) of a Bernoulli distribution. We choose the Bernoulli distribution since its sample can be reparameterized as described in Section 3.2, and we can analytically compute the KL-divergence term between two Bernoulli distributions. In Appendix C, we also experiment with the Kumaraswamy distribution (Fletcher and Ponnambalam, 1996) used in (Bastings et al., 2019). The mask $m \in \{0, 1\}^n$ is constructed by independently sampling each $m_j$ from $p(m_j|x)$ . + +End-task Predictor $q_{\phi}(y|z)$ : We define $z$ as the rationale representation $z = m \odot \mathbf{x}$ , an element-wise dot product between $m_j$ and the corresponding sentence representation $\mathbf{x}_j$ . The end-task predictor uses $z$ to predict the output variable $y$ . The same hard attention mask $m$ is applied to all end-task transformer layers at every head to ensure prediction relies only on $m \odot x$ . The predictor further consists of a log-linear classifier layer over the [CLS] token, similar to Devlin et al. (2019). When an optional query sequence is available for datasets like BoolQ, we do not mask it as it is assumed to be essential to predict $y$ (see Appendix B.2 for implementation details). + +# 3.2 Training and Inference + +The sampling operation of the discrete binary variable $m_j \in \{0,1\}$ in Section 3.1 is not differentiable. Lei et al. (2016) use a simple Bernoulli distribution with REINFORCE (Williams, 1992) to overcome non-differentiability. We found REINFORCE to be quite unstable with high variance + +in results. Instead, we employ reparameterization (Kingma et al., 2015) to facilitate end-to-end differentiability of our approach. We use the Gumbel-Softmax reparameterization (Jang et al., 2017) for categorical (here, binary) distributions to reparameterize the Bernoulli variables $m_j$ . The reparameterized binary variable $m_j^*$ is generated as follows: + +$$ +m _ {j} ^ {*} = \sigma \left(\frac {\log p (m _ {j} | x) + g _ {j}}{\tau}\right), +$$ + +where $\sigma$ is the Sigmoid function, $\tau$ is a hyperparameter for the temperature of the Gumbel-Softmax function, and $g_{j}$ is a random sample from the Gumbel(0,1) distribution (Gumbel, 1948). $m_j^* \in (0,1)$ is a continuous and differentiable approximation to $m_j$ with low variance. + +During inference, we extract the top $\pi \%$ sentences with largest $p_{\theta}(m_j|x)$ values, where $\pi$ corresponds to the threshold hyperparameter described in Section 2.3. Previous work (Lei et al., 2016; Bastings et al., 2019) samples from $p(m|x)$ during inference. Such an inference strategy is non-deterministic, making comparison of different masking strategies difficult. Moreover, it is possible to appropriately scale $p(m_j|x)$ values to obtain better inference results, thereby not reflecting if $p(m_j|x) \forall j$ are correctly ordered. By allowing a fixed budget of $\pi \%$ per example, we are able to fairly compare approaches in Section 4.3. + +# 3.3 Semi-Supervised Setting + +As we will show in Section 5, despite better control over the sparsity-accuracy trade-off, there is still a gap in task performance between our unsupervised approach and a model that uses full context. To bridge this gap and better manage the trade-off at minimal annotation cost, we experiment with a semi-supervised setting where we have annotated rationales for part of the training data. + +For input example $x = (x_{1}, x_{2}, \ldots, x_{n})$ and a gold mask $\hat{m} = (\hat{m}_{1}, \hat{m}_{2}, \ldots, \hat{m}_{n})$ over sentences, we use the following semi-supervised objective: + +$$ +\begin{array}{l} L _ {s e m i} = \mathbf {E} _ {m \sim p _ {\theta} (m | x)} [ - \log q (y | m \odot x) ] + \\ \gamma \sum_ {j} - \hat {m} _ {j} \log p (m _ {j} | x) \tag {4} \\ \end{array} +$$ + +While we still sample from $p(m|x)$ and train end-to-end using reparameterization, the information loss over $p(m|x)$ is replaced with the supervised rationale loss. + +# 4 Experimental Setup + +# 4.1 End Tasks + +We evaluate our Sparse IB approach on five text classification tasks from the ERASER benchmark (DeYoung et al., 2019) and the BeerAdvocate regression task (McAuley et al., 2012) used in Lei et al. (2016). + +ERASER: The ERASER tasks we evaluate on include the Movies sentiment analysis task (Pang and Lee, 2004), the FEVER fact extraction and verification task (Thorne et al., 2018), the MultiRC (Khashabi et al., 2018) and BoolQ (Clark et al., 2019) reading comprehension tasks, and the Evidence Inference classification task (Lehman et al., 2019) over scientific articles for results of medical interventions. + +BeerAdvocate (McAuley et al., 2012): The BeerAdvocate regression task for predicting 0-5 star ratings for multiple aspects like appearance, smell, and taste based on reviews. + +All these datasets have sentence-level rationale annotations for validation and test sets. We do not consider e-SNLI (Camburu et al., 2018) and CoS-E (Rajani et al., 2019) in ERASER as they have only 1-2 input sentences, rationales annotations at word level, and often require common sense/world knowledge. The ERASER tasks contain rationale annotations for the training set, which we only use for our semi-supervised experiments. We closely follow dataset processing in the ERASER benchmark setup and Bastings et al. (2019) (for Beer-Advocate). Additionally, for BoolQ and Evidence Inference which contain longer documents, we use a sliding window to select a single document span that has the maximum TF-IDF score against the question (further details in Appendix B.1). + +# 4.2 Setup + +Evaluation Metrics We adopt the metrics proposed for the ERASER benchmark to evaluate both agreement with comprehensive human rationales as well as end task performance. To evaluate quality of rationales, we report the token-level Intersection-Over-Union F1 (IOU F1), which is a relaxed measure for comparing two sets of text spans. We also report token-level F1 scores. For task accuracy, we report weighted F1 for classification tasks, and the mean square error for the BeerAdvocate regression task. + +Implementation Details We use BERT-base with a maximum context-length of 512 to instantiate the combined explainer and end-task predictor. Models are tuned on the development set using the rationale IOU F1. Appendix B.3 contains details about hyperparameters. + +# 4.3 Baselines + +We first consider two bounding scenarios where no rationales are predicted. In the Full Context (Full) setting, the entire context is used to make predictions; this allows us to estimate the loss in performance as a result of interpretable hard attention models that only use $\pi \%$ of the input. In the Gold Rationale (Gold) setting, we train a model to only use human rationale annotations during training and inference to estimate an upper-bound on task and rationale performance metrics. We compare our Sparse IB approach with the following baselines. For fair comparison, all baselines are modified to use BERT-based representations. + +Norm Minimization (Sparse Norm) Existing approaches (Lei et al., 2016; Bastings et al., 2019) learn sparse masks over the inputs by minimizing the $L_{0}$ norm of the mask $m$ as follows: + +$$ +L _ {S L 0} = \mathbf {E} _ {m \sim p (m | x)} [ - \log q (y | z) ] + \lambda | | m | | \tag {5} +$$ + +Here, $\lambda$ is the weight on the norm. + +Controlled Norm Minimization (Sparse Norm-C) For fair comparison against our approach for controlled sparsity, we modify Equation 5 to ensure that the norm of $m$ is not penalized when it drops below the threshold $\pi$ . + +$$ +\begin{array}{l} L _ {S L 0 - C} = \mathbf {E} _ {m \sim p (m | x)} [ - \log q (y | z) ] + \\ \lambda \max (0, | | m | | - \pi) (6) \\ \end{array} +$$ + +This modification has also been adopted in recent work (Jain et al., 2020). Explicit control over sparsity in the mask $m$ through the tunable prior probability $\pi$ naturally emerges from IB theory, as opposed to the modification adopted in norm-based regularization (Equation 6). + +No Sparsity This method only optimizes for the end-task performance without any sparsity-inducing loss term, to evaluate the effect of sparsity inducing objectives in Sparse IB, Sparse Norm, and Sparse Norm-C. + +
ApproachFEVERMultiRCMovies
TaskToken F1IOUTaskToken F1IOUTaskToken F1IOU
1. Full89.533.736.266.829.129.291.035.147.3
2. Gold91.8--76.6--97.0--
Unsupervised
3. No Sparsity82.835.738.160.120.819.878.224.637.9
4. Sparse Norm83.140.944.059.719.920.478.623.534.7
5. Sparse Norm-C83.341.644.961.721.721.881.822.834.4
6. Sparse IB (Us)84.742.745.562.124.924.384.027.539.6
Supervised
7. Bert-To-Bert (Reported)87.781.283.562.439.940.982.414.57.5
8. Bert-To-Bert (Ours\(^{\epsilon}\))85.078.181.763.341.241.686.016.215.7
9. 25% data (Us)88.863.966.666.454.054.485.428.243.4
TaskBoolQEvidence InferenceBeerAdvocate
Token F1IOUTaskToken F1IOUTaskToken F1IOU
1. Full65.611.815.052.16.49.7.01538.437.8
2. Gold85.9--71.7-----
Unsupervised
3. No Sparsity62.58.110.743.06.109.0.01848.247.3
4. Sparse Norm62.58.512.838.93.46.3.01728.635.5
5. Sparse Norm-C63.710.714.344.75.18.0.01849.349.0
6. Sparse IB (Us)65.212.816.546.36.910.0.01653.152.3
Supervised
8. Bert-To-Bert (Reported)54.413.45.270.846.845.5
7. Bert-To-Bert (Ours\(^{\epsilon}\))62.318.431.570.854.853.9
9. 25% data (Us)63.419.232.346.710.813.3
+ +Table 1: Task, Rationale IOU F1 (threshold set to 0.1) and Token F1 for our hard-attention Sparse IB approach and baselines on test sets, averaged over 5 random seeds. We report MSE for BeerAdvocate, hence lower is better. Gold IOU and token F1 are 100.0. We use $25\%$ training data in our semi-supervised setting (Section 3.3). Validation set results can be found in Table 6 in the Appendix. $\epsilon$ We could not reproduce numbers for the Bert-to-Bert supervised method reported in DeYoung et al. (2019). $\dagger$ No rationale supervision available for BeerAdvocate. + +Supervised Approach (Pipeline) Lehman et al. (2019) learn an explainer and a task predictor independently in sequence using supervision for rationales and task labels, using the output of the explainer in the predictor during inference. We compare our semi-supervised model (Section 3.3) with this pipeline approach. + +# 5 Results + +# 5.1 Quantitative Evaluation + +Table 1 compares our Sparse IB approach against baselines (Section 4.3). Sparse IB outperforms norm-minimization approaches (rows 4-6) in both agreement with human rationales and task performance across all tasks. We perform particularly well on rationale extraction with 5 to $80\%$ relative improvements over the better performing norm-minimization variant Sparse Norm-C. Sparse IB also attains task performance within 0.5 to $10\%$ + +of the full-context model (row 1), despite using $< 50\%$ of the input sentences. All unsupervised approaches still obtain a lower IOU F1 compared to the full context model for Movies and MultiRC, primarily due to their considerably lower precision on these benchmarks. + +Our results also highlight the importance of explicit controlled sparsity inducing terms as effective inductive biases for improved task performance and rationale agreement. Specifically, sparsity-inducing methods consistently outperform the No Sparsity-baseline (row 3). One way to interpret this result is that sparsity objectives add input-dimension regularization during training, which results in better generalization during inference. Moreover, Sparse Norm-C, which adds the element of control to norm-minimization, performs considerably better than Sparse Norm. Finally, we see a positive correlation between task performance and + +![](images/cff12eb8d7893d607142439edd43abb6b95ebbd3f5bd314f58be071ee850cd77.jpg) +Figure 3: Semi-supervised experiments showing the task performance for varying proportions of rationale annotation supervision on the MultiRC, FEVER, and Movies datasets. + +![](images/e4bb642720ce328c7135a1342d40cea045b71894c71702ba096f4a773cc26b86.jpg) + +![](images/225fa217d55d71e5d191b1ceb2cff69ca8485fed2b1e918cb25a8b44762615a6.jpg) + +![](images/ad23e43258bddb889a610040817c3304b8dd822d08c79aea52609a98e5796515.jpg) +Figure 4: Effect of varying the sparsity hyperparameter $\pi$ to control the trade-off between compactness of rationales and accuracy for the FEVER dataset (right). SIB is Sparse IB and SN-C is Sparse Norm-C. + +agreement with human rationales. This is important since accurate models that also better emulate human rationalization likely engender more trust. + +Semi-supervised Setting In order to close the performance gap with the full-context model, we also experiment with a setup where we minimize the task and the rationale prediction loss using rationale annotations available for a part of the training data (Section 3.3). Figure 4 (left, center) shows the effect of incorporating an increasing proportion of rationale annotation supervision for the FEVER and MultiRC datasets. Our semi-supervised model is even able to match the performance of the full-context models for both FEVER and MultiRC with only $25\%$ of rationale annotation supervision. Furthermore, Figure 4 also shows that these gains can be achieved with relatively modest annotation costs since adding more rationale supervision to the training data seems to have diminishing returns. + +Table 1 compares our interpretable model (row 9), which uses rationale supervision for $25\%$ of + +
DatasetπSparse Norm-CSparse IB
MeanVarMeanVar
FEVER0.200.170.940.211.24
MultiRC0.250.111.140.261.67
Movies0.400.382.900.423.02
BoolQ0.200.040.840.221.91
Evidence0.200.101.170.201.61
+ +Table 2: Average mask length (sparsity) attained by Sparse IB and the Sparse Norm-C baseline for a given prior $\pi$ for different tasks, averaged over 100 runs. Mean is reported as the average proportion of sentences to compare with expected sparsity $(\pi)$ and variance is reported in the number of sentences. + +the training data, with the full-context model and the Pipeline approach (row 8). On three (FEVER, MultiRC, and BoolQ) out of five datasets for which rationale supervision is available, our interpretable models match the task performance of the full-context models while recording large gains in IOU (17-30 F1 absolute). Our approach outperforms the pipeline-based approach in task performance (for FEVER, MultiRC, Movies, and BoolQ) and IOU (for MultiRC and Movies). These gains may result from better exploration due to sampling and inference based on a fixed budget of $\pi\%$ sentences. Our weakest results are on Evidence Inference where the TF-IDF preprocessing often fails to select relevant rationale spans and the pipeline approach uses SciBERT (Beltagy et al., 2019). Our overall results suggest that a small proportion of direct supervision can help build interpretable models without compromising task performance. + +# 5.2 Analysis + +Accurate Sparsity Control Table 2 compares average sparsity rates in rationales extracted by Sparse IB with those extracted by norm-minimization methods. We measure the spar + +# Examples from Error Analysis + +Prediction:Positive + +Ground Truth:Negative + +The original Bab gets my vote as the best family film since the princess bride, and it's sequel has been getting rave reviews from most internet critics, both Sikel and Ebert sighting it more than a month ago as one of the year's finest films. So, naturally, when I entered the screening room that was to be showing the movie and there was nary another viewer to be found, this notion left me puzzled. It is a rare thing for a children's movie to be praised this highly ... Looking back, I should have taken the hint and left right when I entered the theater. Believe me; I wanted to like Bab: Pig in the City. The plot seemed interesting enough; ... It is here that we meet an array of eccentric characters, the most memorable being the family of chimps led by Steven Wright. Here is where the film took a wrong turn ... unfortunately, the story wears thin as we are introduced to a new set of animals that ... the main topic of discussion ... it just didn't feel right and was more painful to watch than it was funny or entertaining, and the same goes for the rest of the movie. + +Statement : Unforced labor is a reason for human trafficking. + +Prediction: SUPPORTS + +Ground Truth: REFUTES + +DOC: Human trafficking is the trade of humans, most commonly for the purpose of forced labour, sexual slavery, or comm--ercial sexual exploitation for the trafficker or others. This may encompass providing a spouse in the context of forced marriage, or the extraction of organs or tissues, including for surrogacy and ova removal. Human trafficking can occur within a country or transnationally. coercion and because of their commercial exploitation ... In 2012, the I.L.O. estimated that 21 million victims are trapped in modern-day slavery ... + +Statement: Atlanta metropolitan area is located in south Georgia. + +Prediction: SUPPORTS + +Ground Truth:REFUTES + +DOC: Metro Atlanta, designated by the United States Office of Management and Budget as the Atlanta-Sandy Springs-Roswell, GA Metropolitan Statistical Area, is the most populous metro area in the US state of Georgia and the ninth-largest metropolitan statistical area (MSA) in the United States. Its economic, cultural and demographic center is Atlanta, and it had a 2015 estimated population of 5.7 million people according to the U.S. Census Bureau. The metro area forms the core of a broader trading area, the Atlanta - Athens-Clarke - Sandy Springs Combined Statistical Area. The Combined Statistical Area spans up to 39 counties in north Georgia and had an estimated 2015 population of 6.3 million people. Atlanta is considered an “alpha world city”. It is the third largest metropolitan region in the Census Bureau’s Southeast region behind Greater Washington and South Florida. + +Table 3: Misclassified examples from the Movies and FEVER datasets show: (a) limitations in considering more complex linguistic phenomena like sarcasm; (b) overreliance on shallow lexical matching—unforced vs. forced; (c) limited world knowledge—south Georgia, Southeast region, South Florida. Legend: Model evidence, Gold evidence, Model and Gold Evidence + +sity achieved by the explainer during inference by computing the average number of one entries in the input mask $m$ over sentences (the hamming weight) for 100 runs. Sparse IB consistently achieves the sparsity level $\pi$ used in the prior while the norm-minimization approach (Sparse Norm-C) converges to a lower average sparsity for the mask. + +Sparsity-Accuracy Trade-off Figure 4 (right) shows the variation in task and rationale agreement performance as a function of the sparsity rate $\pi$ for Sparse IB and Sparse Norm-C on the FEVER dataset. Both methods extract longer rationales with increasing $\pi$ that results in a decrease in agreement with sparse human rationales, while accuracy improves. However, Sparse IB consistently outperforms Sparse Norm-C in task performance. + +In summary, our analysis indicates that unlike norm-minimization methods, our IB objective is able to consistently extract rationales with the specified sparsity rates, and achieves a better trade-off with accuracy. We hypothesize that optimizing + +the KL-divergence of the posterior $p(m|x)$ may be able to model input salience better than an implicit regularization (through $||m||_0$ ). The sparse prior term can learn $p(m|x)$ adaptive to different examples, while $||m||$ encourages uniform sparsity across examples. This can be seen explicitly in Table 2, where the variance in sampled mask across examples is higher for our objective. + +Model Agnostic Behavior Our approach is ag- nostic to choice of model architecture and word vs. sentence level rationales. We experimented with the word-level model in (DeYoung et al., 2019), where masks are learned over words instead of sentences. More details of the model architecture can be found in (DeYoung et al., 2019). The results for which are shown in Table 4 + +Error Analysis A qualitative analysis of the rationales extracted by the Sparse IB approach indi + +
ApproachMoviesMultiRC
TaskIOUTaskIOU
Sparse Norm-C91.9648.964.2525.7
Sparse IB (Us)93.4652.165.6327.0
+ +Table 4: Task and IOU F1 for our Sparse IB approach and best performing baseline on word-level rationales and BERT+LSTM model. + +cates that such methods struggle when the context offers spurious—or in some cases even genuine but limited—evidence for both output labels (Figure 3). For instance, the model makes an incorrect positive prediction for the first example from the Movies sentiment dataset based on sentences that praise the prequel of the movie or acknowledge some critical acclaim. We also observed incorrect predictions based on shallow lexical matching (likely equating forced and unforced in the second example) and world knowledge (likely equating south Georgia, southeastern United States, and South Florida in the third). Overall, there is scope for improvement through better incorporation of exact lexical match, coreference propagation, and representation of pragmatics in our sentence representations. + +# 6 Related Work + +Extractive Rationalization Methods that condition predictions on their explanations are more trustworthy than post-hoc explanation techniques (Ribeiro et al., 2016; Krause et al., 2017; Alvarez-Melis and Jaakkola, 2017) and analyses of self-attention (Serrano and Smith, 2019; Jain et al., 2020). Extractive rationalization (Lei et al., 2016) is one of the most well-studied of such methods and has received increased attention with the recently released ERASER benchmark (DeYoung et al., 2019). Chang et al. (2019) and Yu et al. (2019); Chang et al. (2019) have complementary work on class-wise explanation extraction. Bastings et al. (2019) employ a reparameterizable version of the bi-modal beta distribution (instead of Bernoulli) for the binary mask. While our method has focused on unsupervised settings due to the considerable cost of obtaining reliable rationale annotations, recent work (Lehman et al., 2019) has also attempted to use direct supervision from rationale annotations for critical medical domain tasks. Finally, Latcinnik and Berant (2020) and Rajani et al. (2019) focus on generating explanations (rather than extracting them from the input). The extractive paradigm can be unfavourable for + +certain ERASER tasks like commonsense question answering, where the given input provides limited context for the task. + +Information Bottleneck Information Bottleneck (IB) (Tishby et al., 1999) has recently been adapted in a number of downstream applications like parsing (Li and Eisner, 2019), extractive summarization (West et al., 2019), and image classification (Alemi et al., 2016; Zhmoginov et al., 2019). Alemi et al. (2016) and Li and Eisner (2019) use IB for optimal compression of hidden representations of images and words respectively. We are interested in compressing the number of cognitive units (like sentences) to ensure interpretability of the bottleneck representation, similar to West et al. (2019). However, while West et al. (2019) use brute-force search to optimize IB for summarization, we directly optimize a parametric variational bound on IB for rationales. IB has also been previously used for interpretability—Zhmoginov et al. (2019) use a VAE to estimate the prior distribution over $z$ for image classification. Bang et al. (2019) use IB for post-hoc explanation of sentiment classification. They do not enforce a sparse prior, and as a result, cannot guarantee that the rationale is strictly smaller than the input. Controlling sparsity to manage the accuracy-conciseness trade-off is also not possible in their model. + +# 7 Conclusion + +We introduce a novel sparsity-inducing objective derived from the Information Bottleneck principle to extract rationales of desired conciseness. Our approach outperforms existing norm-minimization techniques in task performance and agreement with human rationales for tasks in the ERASER benchmark. Our objective obtains a better trade off of accuracy vs. sparsity. We are also able to close the gap with models that use the full input with $< 25\%$ rationale annotations for a majority of the tasks. In future work, we would like to apply our approach on document-level and multi-document NLU tasks. + +# Acknowledgments + +This research was supported by ONR N00014-18-1-2826, DARPA N66001-19-2-403, ARO W911NF-16-1-0121 and NSF IIS-1252835, IIS-1562364, an Allen Distinguished Investigator Award, and the Sloan Fellowship. We thank Prof. Sreeram Kannan, Andrey Zhmoginov, and the UW NLP group for helpful conversations and comments on the work. + +# References + +Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. 2016. Deep variational information bottleneck. arXiv preprint arXiv:1612.00410. +David Alvarez-Melis and Tommi Jaakkola. 2017. A causal framework for explaining the predictions of black-box sequence-to-sequence models. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 412-421. +Seojin Bang, Pengtao Xie, Heewook Lee, Wei Wu, and Eric Xing. 2019. Explaining a black-box using deep variational information bottleneck approach. arXiv preprint arXiv:1902.06918. +Joost Bastings, Wilker Aziz, and Ivan Titov. 2019. Interpretable neural predictions with differentiable binary variables. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2963-2977. +Iz Beltagy, Kyle Lo, and Arman Cohan. 2019. Scibert: A pretrained language model for scientific text. arXiv preprint arXiv:1903.10676. +Oana-Maria Camburu, Tim Roktäschel, Thomas Lukasiewicz, and Phil Blunsom. 2018. e-snli: Natural language inference with natural language explanations. In Advances in Neural Information Processing Systems, pages 9539-9549. +Shiyu Chang, Yang Zhang, Mo Yu, and Tommi Jaakkola. 2019. A game theoretic approach to class-wise selective rationalization. In Advances in Neural Information Processing Systems, pages 10055-10065. +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. arXiv preprint arXiv:1905.10044. +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. +Jay DeYoung, Sarthak Jain, Nazneen Fatema Rajani, Eric Lehman, Caiming Xiong, Richard Socher, and Byron C Wallace. 2019. Eraser: A benchmark to evaluate rationalized nlp models. arXiv preprint arXiv:1911.03429. +SG Fletcher and K Ponnambalam. 1996. Estimation of reservoir yield and storage distribution using moments analysis. Journal of Hydrology (Amsterdam), 182(1):259-275. + +Emil Julius Gumbel. 1948. Statistical theory of extreme values and some practical applications: a series of lectures, volume 33. US Government Printing Office. +Sarthak Jain, Sarah Wiegreffe, Yuval Pinter, and Byron C Wallace. 2020. Learning to faithfully rationalize by construction. arXiv preprint arXiv:2005.00115. +Eric Jang, Shixiang Gu, and Ben Poole. 2017. Categorical reparametrization with gumble-softmax. In International Conference on Learning Representations (ICLR 2017). OpenReview.net. +Daniel Khashabi, Snigdha Chaturvedi, Michael Roth, Shyam Upadhyay, and Dan Roth. 2018. Looking beyond the surface: A challenge set for reading comprehension over multiple sentences. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 252-262. +Durk P Kingma, Tim Salimans, and Max Welling. 2015. Variational dropout and the local reparameterization trick. In Advances in neural information processing systems, pages 2575-2583. +Josua Krause, Aritra Dasgupta, Jordan Swartz, Yindalon Aphinyanaphongs, and Enrico Bertini. 2017. A workflow for visual diagnostics of binary classifiers using instance-level explanations. In 2017 IEEE Conference on Visual Analytics Science and Technology (VAST), pages 162-172. IEEE. +Veronica Latcinnik and Jonathan Berant. 2020. Explaining question answering models through text generation. arXiv preprint arXiv:2004.05569. +Eric Lehman, Jay DeYoung, Regina Barzilay, and Byron C Wallace. 2019. Inferring which medical treatments work from reports of clinical trials. 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 3705-3717. +Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2016. Rationalizing neural predictions. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 107-117. +Xiang Lisa Li and Jason Eisner. 2019. Specializing word embeddings (for parsing) by information bottleneck. 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 2744-2754. +Julian McAuley, Jure Leskovec, and Dan Jurafsky. 2012. Learning attitudes and attributes from multi-aspect reviews. In 2012 IEEE 12th International Conference on Data Mining, pages 1020-1025. IEEE. + +Eric Nalisnick and Padhraic Smyth. 2017. Stick-breaking variational autoencoders. In International Conference on Learning Representations (ICLR). +Bo Pang and Lillian Lee. 2004. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. In Proceedings of the 42nd annual meeting on Association for Computational Linguistics, page 271. Association for Computational Linguistics. +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. +Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2016. "why should i trust you?" explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pages 1135-1144. +Sofia Serrano and Noah A Smith. 2019. Is attention interpretable? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2931-2951. +James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018. Fever: a large-scale dataset for fact extraction and verification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 809-819. +Naftali Tishby, Fernando C. Pereira, and William Bialek. 1999. The information bottleneck method. In Proc. of the 37-th Annual Allerton Conference on Communication, Control and Computing, pages 368-377. +Daniel S Weld and Gagan Bansal. 2019. The challenge of crafting intelligible intelligence. Communications of the ACM, 62(6):70-79. +Peter West, Ari Holtzman, Jan Buys, and Yejin Choi. 2019. Bottlesum: Unsupervised and self-supervised sentence summarization using the information bottleneck principle. 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 3743-3752. +Ronald J Williams. 1992. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229-256. +Mo Yu, Shiyu Chang, Yang Zhang, and Tommi Jaakkola. 2019. Rethinking cooperative rationalization: Introspective extraction and complement control. 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 4085-4094. +Andrey Zhmoginov, Ian Fischer, and Mark Sandler. 2019. Information-bottleneck approach to salient region discovery. arXiv preprint arXiv:1907.09578. + +# A Information Bottleneck Theory + +We first present an overview of the variational bound on IB introduced by (Alemi et al., 2016) and then derive a modified version amenable to interpretability. + +# A.1 Variational Information Bottleneck (Alemi et al. (2016)) + +The objective is to parameterize the information bottleneck objective $L_{IB} = I(X,Z) - \beta I(Z,Y)$ using neural models and use SGD to optimize. Consider the joint distribution: $p(X,Y,Z) = p(Z|X,Y)p(Y|X)p(X) = p(Z|X)p(Y|X)p(X)$ under the Markov chain $Y\leftrightarrow X\leftrightarrow Z$ . As mutual information is hard to compute, the following bounds are derived on both MI terms: + +First Term: + +$$ +I (Z, X) := \mathbb {E} _ {x} \left[ \underset {z \sim p _ {\theta} (z | x)} {\mathbb {E}} \left[ \log \frac {p _ {\theta} (z | x)}{p (z)} \right] \right] +$$ + +where, + +$$ +p (z) := \int d x p _ {\theta} (z | x) p (x) +$$ + +This marginal is intractable. Let $r(z)$ be a variational approximation to this marginal. Since $\mathrm{KL}[p(z), r(z)] \geq 0$ , + +$$ +I (Z, X) \leq \mathbb {E} _ {x} \left[ \underset {z \sim p _ {\theta} (z | x)} {\mathbb {E}} \left[ \log \frac {p _ {\theta} (z | x)}{r (z)} \right] \right] +$$ + +If $p_{\theta}(z|x)$ and $r(z)$ are of a form that KL divergence can be analytically computed, we get: + +$$ +I (Z, X) \leq \mathbb {E} _ {x} \left[ \mathrm {K L} [ p _ {\theta} (z | x), r (z) ] \right. +$$ + +Typically, the distributions $p_{\theta}(z|x)$ and $r(z)$ are instantiated as multivariate Normal distributions to analytically compute the KL-divergence term. + +$$ +r (z) = \mathcal {N} (z | 0, I), p (z | x) = \mathcal {N} (z | \mu (x), \Sigma (x)); +$$ + +where $\mu$ is a neural network which outputs the K-dimensional mean of $z$ and $\Sigma$ outputs the $K\times K$ covariance matrix $\Sigma$ . This also allows us to reparameterize samples drawn from $p_{\theta}(z|x)$ . + +Second Term: + +$$ +I (Z, Y) := \underset {y, z \sim p _ {\theta}} {\mathbb {E}} \left[ \log \frac {p (y | z)}{p (y)} \right] +$$ + +where, + +$$ +p (y | z) := \int d x \frac {p (y | x) p (z | x) p (x)}{p (z)} +$$ + +Again, as this is intractable, $q_{\phi}(y|z)$ is used as a variational approximation to $p(y|z)$ and is instantiated as a transformer model with its own set of parameters $\phi$ . As Kullback Leibler divergence is always positive: + +$$ +\operatorname {K L} [ p (y | z), q _ {\phi} (y | z) ] \geq 0 \rightarrow +$$ + +$$ +I (Z, Y) \geq \underset {y, z \sim p _ {\theta}} {\mathbb {E}} \left[ \log \frac {q _ {\phi} (y | z)}{p (y)} \right] +$$ + +The term $p(y)$ can be dropped as it is constant with respect to parameters $\phi$ . Thus, we minimize $\mathbb{E}_{y,z\sim p_{\theta}}[-\log q_{\phi}(y|z)]$ Thus the IB objective is bounded by the loss function: + +$$ +L _ {v i b} \geq \mathbb {E} _ {y, z \sim p _ {\theta}} [ - \log q _ {\phi} (y | z) ] + \beta \mathbf {K L} [ p _ {\theta} (z | x), r (z) ] +$$ + +# A.2 Deriving the Sparse Prior Objective + +The latent space learned in Appendix A.1 is not easy to interpret. Instead we consider a masked representation of the form $z = m \odot x$ , where $m_j \in \{0, 1\}$ is a binary mask sampled from a distribution $p_\theta(m_j|x) = \text{Bernoulli}(\theta_j(x))$ . This is an adaptive masking strategy, defined by data-driven relevance estimators $\theta_j(x)$ . The distributions over $x$ and $m$ induce a distribution on $z = m \odot x$ defined by the conditionals + +$$ +p _ {\theta} (z _ {j} | x) = (1 - \theta_ {j} (x)) \delta (z _ {j}) + \theta_ {j} (x) \delta (z _ {j} - x _ {j}). +$$ + +Our prior, based on human annotations, is that rationale needed for a prediction is sparse; we encode this prior as a distribution over masks $r(m_j) = \operatorname{Bernoulli}(\pi)$ . The prior also induces a distribution on $z = m \odot x$ given by + +$$ +r (z _ {j} | x) = (1 - \pi) \delta (z _ {j}) + \pi \delta (z _ {j} - x _ {j}). +$$ + +We want to enforce a constraint $p_{\theta}(z_j) = r(z_j)$ ; i.e. that the marginal distribution $p_{\theta}(z_j) = \int p_{\theta}(z_j|x)p(x)dx$ matches our prior $r(z_j)$ . This is difficult to do directly, but as in Appendix A.1, we can construct an upper bound the mutual information between $x$ and $z$ : + +$$ +I (Z, X) \leq \underset {x \sim p} {\mathbb {E}} \left[ \mathrm {K L} \left[ p _ {\theta} (z | x), r (z) \right] \right]. +$$ + +The inequality is tight if $r(z) = p_{\theta}(z)$ . By optimizing to minimize mutual information $I(Z,X)$ , we + +
HyperparameterMovieFEVERMultiRCBoolQEvidence InferenceBEER
NS361015252010
π (Sparsity threshold (%)).40.20.25.20.20.20
γ (weight on SR)0.50.051.00E-040.010.0010.01
+ +Table 5: Hyperparameters used to report results. + +
ApproachFEVERMultiRCMoviesBoolQEvidence
TaskIOUTaskIOUTaskIOUTaskIOUTaskIOU
Full90.54-68.18-88.0-63.16-47.51-
Gold92.52-78.20-1.0-71.65-85.39-
No Sparsity83.0135.5059.1722.4281.4620.6361.8210.3947.519.87
Sparse Norm84.3045.4458.4020.4179.3519.2359.0412.4044.529.4
Sparse Norm-C84.4244.9060.7723.2582.4318.9162.2409.7248.9709.40
Sparse IB85.6445.4661.1125.5586.5022.3363.0716.6349.0911.09
+ +Table 6: Final results of our unsupervised models on ERASER Dev Set + +will implicitly learn parameters $\theta$ that approximate the desired constraint on the marginal. + +In contrast to Alemi et al. (2016), our prior $r(z)$ has no parameters; rather than using an expressive model $r(z)$ to approximate the $p_{\theta}(z)$ , we instead use the fixed prior $r(z)$ to force the learned conditionals $p_{\theta}(z|x)$ to assume a form such that the marginal $p_{\theta}(z)$ approximately matches the marginal of the prior, $\pi$ . Average mask sparsity values in Table 2 corroborate this. + +By a limiting argument, we can compute the divergence between $p_{\theta}(z|x)$ and $r(z)$ : + +$$ +\begin{array}{l} \mathrm {K L} (p _ {\theta} (z _ {j} | x), r (z _ {j})) \\ = (1 - \theta_ {j} (x)) \int \delta (z _ {j}) \log \frac {p _ {\theta} (z _ {j} | x)}{r (z _ {j})} d z _ {j} \\ + \theta_ {j} (x) \int \delta (z _ {j} - x _ {j}) \log \frac {p _ {\theta} (z _ {j} | x)}{r (z _ {j})} d z _ {j} \\ = (1 - \theta_ {j} (x)) \log \frac {1 - \theta_ {j} (x)}{1 - \pi} + \theta_ {j} (x) \log \frac {\theta_ {j} (x)}{\pi p (x)} \\ = \operatorname {K L} \left(p _ {\theta} \left(m _ {j} \mid x\right), r \left(m _ {j}\right)\right) - \theta_ {j} (x) \log p (x). \\ \end{array} +$$ + +The term $\mathrm{KL}[p_{\theta}(m_j|x),r(m_j)]$ is a divergence between two Bernoulli distributions and has a simple closed form. If $\theta_{j}(x)$ and $\log p(x)$ are uncorrelated then + +$$ +\underset {x \sim q} {\mathbb {E}} \left[ - \theta_ {j} (x) \log p (x) \right] = \pi H (X). +$$ + +The term $\pi H(X)$ is constant with respect to the parameters $\theta$ and can be dropped. + +We use the same, standard cross-entropy bound discussed in Appendix A.1 to estimate $I(Z,Y)$ , + +leading us to our variational bound on IB with interpretability constraints + +$$ +\begin{array}{l} L _ {I V I B} = \mathbf {E} _ {m \sim p (m | x)} [ - \log q (y | m \odot x) ] \\ + \beta \sum_ {j} K L [ p _ {\theta} (m _ {j} | x) | | r (m _ {j}) ]. \\ \end{array} +$$ + +# B Experimental Details + +# B.1 Data Processing + +The train, test and validation splits are the same as used in the ERASER benchmark (DeYoung et al., 2019) and for the Beer Advocate dataset (Bastings et al., 2019). In order to batch operations, we process the data so that each example has at most NS sentences. NS is fixed based on the average number of sentences in the development set of the respective task (see Table 5). Some dataset specific processing details are highlighted below: + +FEVER: ERASER adapts the original fact verification task as a binary classification of whether the given evidence supports or refutes a given claim. + +MultiRC: The reading comprehension task with multiple correct answers is modified into a binary classification task for ERASER, where each (rationale, question, answer) triplet has a true/false label. + +BoolQ: A Boolean (yes/no) question answering dataset over Wikipedia articles. Since most documents are considerably longer than BERT's maximum context window length of 512 tokens (3.3K + +tokens on average), we use a sliding window to select a single document span that has the maximum TF-IDF score against the question. + +Evidence Inference: A three-way classification task over full-text scientific articles for inferring whether a given medical intervention is reported to either significantly increase, significantly decrease, or have no significant effect on a specified outcome compared to a comparator of interest. We again apply the TF-IDF heuristic as the average number of tokens is a document is 4.6K. + +BEER: The Beer Advocate regression task for predicting 0-5 star ratings for multiple aspects like appearance, smell, and taste based on reviews. We report on the appearance aspect. + +# B.2 Modeling + +For question answering tasks in ERASER. $s$ and $x$ are encoded together in the sequence $s[\mathrm{SEP}]x$ while assuming that $s$ is fully unmasked i.e. $p_{\theta}(m_s|x) = 1$ . Once again, the sequence $s[\mathrm{SEP}]m \odot x$ is used if query $s$ is available, i.e., we assume no masking over $s$ as it is assumed to be essential to predict $y$ . + +Semi-supervised: Whenever train loss is not available, only task loss is used. Evaluation is still done based on $\pi \%$ sentences, to fairly compare with unsupervised models. + +# B.3 Hyperparameters + +We use a sequence length of 512, batch size of 16 and Adam optimizer with a learning rate of 5e-5. We do not use warm-up or weight decay. We run all model for 20 epochs and set patience to 10 (over iterations). Hyper-parameter tuning is done on the validation set for the rationale performance metric (IOU F18) on the development sets for ERASER tasks and on the test set for BEER (only test set contains rationale annotations). We tune the value of $\pi \in \{0.05, 0.1, 0.15, \dots, 0.50\}$ . We found that Sparse IB approach is not as sensitive to the parameter $\beta$ and fix it to 1 to simplify experimental design. For baselines, we tune the values of the Lagrangian multipliers, $\lambda \in \{1e - 4, 5e - 4, 1e - 3, \dots, 1\}$ as norm-based techniques are more sensitive to $\lambda$ . The value + +of the $\gamma$ hyperparameter in the semi-supervised setup was set to 1.0 to simplify design. Instead of explicitly tuning or annealing the Gumbel softmax parameter, we fix it to 0.7 across all our experiments (including baselines). Hyperparameters for each dataset used for the final results are presented in Table 5. $^9$ + +# C Analysis + +Learning the Value of $\pi$ Instead of tuning the value of $\pi$ , we can alternately learn an appropriate value by allowing $\pi$ to be a learnable parameter in our implementation. In our experiments (see Table 7, we found that the norm-minimization completely degenerates and learns a very high value of $\pi$ , as the norm-loss in Equation 6 (Section 4.3) can still be minimized if both $||m||$ and $\pi$ are driven close to 1.0. In our case, since $pi$ is now a learnable parameter, we have to minimize the following objective. + +$$ +\begin{array}{l} L _ {I V I B} = \mathbf {E} _ {m \sim p _ {\theta} (m | x)} [ - \log q _ {\phi} (y | m \odot x) ] + \\ \beta \sum_ {j} K L [ p _ {\theta} (m _ {j} | x) | | r (m _ {j}) ] + \pi H (x) \tag {7} \\ \end{array} +$$ + +The caveat here is that it requires another hyperparameter, namely the constant $H(x) = \lambda^{10}$ . This is not unlike Sparse Normor Sparse Norm-Cwhere sparsity is controlled through the hyperparameter $\lambda$ . In Table 7, we compare the Sparse IBobjective with Equation 7 for Movies and FEVER. We find that optimizing Equation 7 actually allows us to control the trade-off because of the presence of the term $\pi H(x)$ that enforces a smaller value for $\pi$ . The learned value of $\pi$ is close the tuned value in Table 5, thus we choose to report our main results across all models on tuned $\pi$ . + +A More Expressive Distribution Bastings et al. (2019) compare against the best-known previous work on norm regularization Lei et al. (2016) by exploring the bi-modal Kumaraswamy distribution (Fletcher and Ponnambalam, 1996) to replace the Bernoulli distribution. This more expressive distribution may be able to complement our approach, as KL-divergence for it can be analytically computed (Nalisnick and Smyth, 2017) (Appendix C). + +
ApproachTasksFever
Task F1IOU F1SparsityTask F1IOU F1Sparsity
Sparse Norm-Cwith learned π89.8624.180.9989.036.20.98
Sparse IB91.024.180.9888.5036.20.96
Sparse IBwith learned π86.9725.630.4585.6445.710.14
+ +Table 7: Evaluation of learnable $\pi$ . Results on Dev set + +
Distribution/ApproachMoviesFever
TaskIOUTaskIOU
Bernoulli (Sparse Norm-C)79.418.383.344.9
Bernoulli Sparse IB81.521.884.745.5
Kuma Sparse Norm-C81.821.084.943.0
Kuma Sparse IB83.421.585.645.5
+ +Table 8: Results on the Kumaraswamy distribution from (Bastings et al., 2019) on Dev set + +The KL divergence between the Kumaraswamy and Beta distribution can be analytically computed, as done in this work (Nalisnick and Smyth, 2017). In Table 8, we show results on Movies and FEVER datasets for this distribution, comparing Sparse IBa-gaint the Sparse Norm-Cbaseline. We find that the superior performance of the KL-divergence loss term persists. \ No newline at end of file diff --git a/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/images.zip b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..def4a76824ca72d5e8f81ff0a88d7cfb7ae78c85 --- /dev/null +++ b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a893008ceb04556b507cb6cc5f671ecfbf56cc65e7db732a6737315412dadadb +size 644756 diff --git a/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/layout.json b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cad55810a0c580b3e9c9a98b65dd592efa2d4b9e --- /dev/null +++ b/aninformationbottleneckapproachforcontrollingconcisenessinrationaleextraction/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bb977647ff32c907780ce93ab6d24a17f61b5f6d1b1b0c88f2372208c4e0841 +size 627050 diff --git a/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_content_list.json b/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..deaf9148de1b5470e003e8a69814534b7d1adc77 --- /dev/null +++ b/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca21b0d2be937ddbd6ceff67765416202f004ee6b94918064331dc34e3e90a86 +size 66103 diff --git a/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_model.json b/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2e72c19936ed5e248d1c03ce6c90f2c88e715c67 --- /dev/null +++ b/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5e4828cc41f2f8c8e768101f6d2e4eeee727e6997bf8faf723a00906690f702 +size 77715 diff --git a/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_origin.pdf b/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..dd6bb4d726dcc3dab3817431be249836801a6902 --- /dev/null +++ b/aninformationtheoreticviewonselectinglinguisticprobes/68a39bd2-79f5-46ea-a580-f1885076e363_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2ac46b9c6039def92feda9edc0f305fbe872773f5865c5d1f6422279990cd50 +size 6920513 diff --git a/aninformationtheoreticviewonselectinglinguisticprobes/full.md b/aninformationtheoreticviewonselectinglinguisticprobes/full.md new file mode 100644 index 0000000000000000000000000000000000000000..32368387660279a241d112f7da01310d7b7fe4c8 --- /dev/null +++ b/aninformationtheoreticviewonselectinglinguisticprobes/full.md @@ -0,0 +1,370 @@ +# An information theoretic view on selecting linguistic probes + +Zining Zhu $^{1,2}$ , Frank Rudzicz $^{3,4,1,2}$ + +1 University of Toronto, 2 Vector Institute, 3 Surgical Safety Technologies + +$^{4}$ Li Ka Shing Knowledge Institute, St Michael's Hospital + +{zining, frank}@cs.toronto.edu + +# Abstract + +There is increasing interest in assessing the linguistic knowledge encoded in neural representations. A popular approach is to attach a diagnostic classifier – or “probe” – to perform supervised classification from internal representations. However, how to select a good probe is in debate. Hewitt and Liang (2019) showed that a high performance on diagnostic classification itself is insufficient, because it can be attributed to either “the representation being rich in knowledge”, or “the probe learning the task”, which Pimentel et al. (2020) challenged. We show this dichotomy is valid information-theoretically. In addition, we find that the methods to construct and select good probes proposed by the two papers, control task (Hewitt and Liang, 2019) and control function (Pimentel et al., 2020), are equivalent – the errors of their approaches are identical (modulo irrelevant terms). Empirically, these two selection criteria lead to results that highly agree with each other. + +# 1 Introduction + +Recently, neural networks have shown substantial progress in NLP tasks (Devlin et al., 2019; Radford et al., 2019). To understand and explain their behavior, a natural question emerge: how much linguistic knowledge is encoded in these neural network systems? + +An efficient approach to reveal information encoded in internal representations uses diagnostic classifiers (Alain and Bengio, 2017). Referred to as "probes", diagnostic classifiers are trained on pre-computed intermediate representations of neural NLP systems. The performance on tasks they are trained to predict are used to evaluate the richness of the linguistic representation in encoding the probed tasks. Such tasks include probing syntax (Hewitt and Manning, 2019; Lin et al., 2019; Tenney et al., 2019a), semantics (Yaghoobzadeh + +et al., 2019), discourse features (Chen et al., 2019; Liu et al., 2019; Tenney et al., 2019b), and commonsense knowledge (Petroni et al., 2019; Poerner et al., 2019). + +However, appropriate criteria for selecting a good probe is under debate. The traditional view that high-accuracy probes are better is challenged by Hewitt and Liang (2019), who proposed that the high accuracy could be attributed to either (1) that the representation contains rich linguistic knowledge, or (2) that the probe learns the task. To circumvent this ambiguity, they proposed to use the improvement of probing task performance against a control task (predicting random labels from the same representations), i.e., the "selectivity" criterion. Recently, Pimentel et al. (2020), challenged this dichotomy from an information theoretic viewpoint. They proposed to use an "information gain" criterion, which empirically is the reduction in cross entropy from a "control function task" probing from randomized representation. + +In this paper, we show the "non-exclusive-or" dichotomy raised by Hewitt and Liang (2019) is valid information-theoretically. There is a difference between the original NLP model learning the task and the probe learning the task. + +In addition, we show that the "selectivity" criterion and the "control function" criterion are comparably accurate. Pimentel et al. (2020) formulated their errors with the difference in a pair of KL divergences. We show that the error of the "selectivity" criterion (Hewitt and Liang, 2019), if measured from cross entropy loss, can be formulated in the difference in a pair of KL divergences as well. When randomizations are perfect, these two criteria differ by only constant terms. + +Empirically, on a POS tag probing task on English, French and Spanish translations, we show that the "selectivity" and the "control function" criteria highly agree with each other. We rank experi + +ments with over 10,000 different hyperparameter settings using these criteria. The Spearman correlation of the Hewitt and Liang (2019) vs. Pimentel et al. (2020) criteria are on par with the correlations of "accuracy vs. cross entropy loss" – two very strong baselines. + +Overall, we recommend using control mechanisms to select probes, instead of relying on merely the probing task performance. When randomization is done well, controlling the target or representations are equivalent. + +# 2 Related work + +Diagnostic probes were originally intended to explain information encoded in intermediate representations (Adi et al., 2017; Alain and Bengio, 2017; Belinkov et al., 2017). Recently, various probing tasks have queried the representations of, e.g., contextualized word embeddings (Tenney et al., 2019a,b) and sentence embeddings (Linzen et al., 2016; Chen et al., 2019; Alt et al., 2020; Kassner and Schütze, 2020; Maudslay et al., 2020; Chi et al., 2020). + +The task of probing is usually formulated as a classifier problem, with the representations as input, and the features indicating information as output. A straightforward method to train a classifier is by minimizing cross entropy, which is the approach we follow. Note that Voita and Titov (2020) derived training objectives from minimum description lengths, resulting in cross entropy loss and some variants. + +# 3 Information theoretic probes + +# 3.1 Formulation + +We adopt the information theoretic formulation of linguistic probes of (Pimentel et al., 2020), and briefly summarize as follows. + +We want to probe true labels $T$ from representations $R$ . An ideal probe should accurately report the code-target mutual information $I(T;R)$ , which is unfortunately intractable. We will write $I(T;R)$ in an alternative form. + +Let $p(T\mid R)$ be the unknown true conditional distribution, and a diagnostic probe, according to the setting in literature (Alain and Bengio, 2017; Hewitt and Manning, 2019; Maudslay et al., 2020), is an approximation $q_{\theta}(T\mid R)$ parameterized by $\theta$ then: + +$$ +\begin{array}{l} I (T; R) = H (T) - H (T \mid R) \\ H (T \mid R) = - \mathbb {E} _ {p (T \mid R)} \log p (T \mid R) \\ = - \mathbb {E} _ {p (T \mid R)} \log \frac {p (T \mid R) q _ {\theta} (T \mid R)}{q _ {\theta} (T \mid R)} \\ = - \mathbb {E} _ {p} \log q _ {\theta} - \mathbb {E} _ {p} \log \frac {p}{q _ {\theta}} \\ = H (p, q _ {\theta}) - \operatorname {K L} (p \| q _ {\theta}), \\ \end{array} +$$ + +where $p$ and $q_{\theta}$ stand for $p(T \mid R)$ and $q_{\theta}(T \mid R)$ respectively. We also use $H(p, q_{\theta}) = -\mathbb{E}_p \log q_{\theta}$ to represent the cross entropy for simplicity. + +# 3.2 The source of probing error + +A valid dichotomy Traditionally, people use the cross entropy loss of the diagnostic probe $H(p,q_{\theta})$ to approximate $I(T;R)$ . We can derive a source of error by rewinding the above formulations: + +$$ +H (p, q _ {\theta}) = H (T) - I (T; R) + \mathrm {K L} (p \| q _ {\theta}) +$$ + +The first term on RHS, $H(T)$ , is independent of either $R$ or $\theta$ . Therefore, a low cross entropy loss $H(p,q_{\theta})$ can be caused by either of the two scenarios: + +- High code-target mutual information $I(T;R)$ , indicating the representation $R$ contains rich information about the target $T$ . +- Low KL-divergence between $p(T \mid R)$ and $q_{\theta}(T \mid R)$ , indicating the probe learns the task. + +The two scenarios exactly correspond to the dichotomy of Hewitt and Liang (2019). + +A good probe To get a good probe, we want $H_{q_{\theta}}(T|R)$ to approximate $I(T;R)$ as much as possible. This means a good probe should minimize $\mathrm{KL}(p\parallel q_\theta)$ , as proposed by Pimentel et al. (2020). + +However, empirically Pimentel et al. (2020) (as well as many previous articles) used the cross entropy loss $H_{q_{\phi}}(T \mid R)$ to select good probes, which is insufficient, as described above. Alternatively, Hewitt and Liang (2019) and Pimentel et al. (2020) proposed control tasks and control functions, respectively. + +# 3.3 The control task + +The control task (Hewitt and Liang, 2019) sets random targets for the probing task. Let us use $c(T)$ to indicate a "control function" applied on a token + +$v$ that originally has label $T$ . The control function could nullify the information of the input, if necessary. + +If we measure the difference between cross entropy in the control task and probing task $H(p(c(T) \mid R), q_{\theta_c}(c(T) \mid R)) - H(p(T \mid R), q_\theta(T \mid R))$ , we can derive a form of error margin in their measurements1. Let us use a short-hand notations $H(p_c, q_{\theta_c}) - H(p, q_\theta)$ for clarity. Now, what does the diff between cross entropy on control task and probing task actually contain? + +$$ +\begin{array}{l} H \left(p _ {c}, q _ {\theta_ {c}}\right) - H (p, q _ {\theta}) \\ = (H (c (T)) - I (c (T); R) + \mathrm {K L} \left(p _ {c} \| q _ {\theta_ {c}}\right)) \\ - (H (T) - I (T; R) + \mathrm {K L} (p \| q _ {\theta})) \\ = (H (c (T)) - H (T)) \\ - I (c (T); R) + I (T; R) \\ + \left(\mathrm {K L} \left(p _ {c} \| q _ {\theta_ {c}}\right) - \mathrm {K L} \left(p \| q _ {\theta}\right)\right) \\ \end{array} +$$ + +We already knew that $H(T) = \mathrm{Const}$ . According to the definition of control function, the output $c(T)$ would be independent of $R$ . Then: + +$$ +H (c (T)) = \text {C o n s t} +$$ + +$$ +p (c (T), R) = p (c (T)) p (R) +$$ + +$$ +I (c (T); R) = \mathbb {E} \frac {p (c (T) , R)}{p (c (T)) p (R)} = \text {C o n s t} +$$ + +Therefore: + +$$ +H \left(p _ {c}, q _ {\theta_ {c}}\right) - H (p, q _ {\theta}) = I (T; R) - \Delta_ {h} +$$ + +where $\Delta_h$ is a short-hand notation for the measurement error in the control task criteria: + +$$ +\Delta_ {h} = \mathrm {K L} \left(p \| q _ {\theta}\right) - \mathrm {K L} \left(p _ {c} \| q _ {\theta_ {c}}\right) + \text {C o n s t} \tag {1} +$$ + +When the probe fits the true distribution to a similar extent on both the control task and probing task, the error $\Delta_h$ would be small. Unfortunately, both KL terms are intractable. + +# 3.4 The control function + +Control function (Pimentel et al., 2020) introduces a random processor $\mathbf{c}(\cdot)$ on the representation $R$ . To measure the information gain, they used an "information gain" criterion: + +$$ +\mathcal {G} (T, R, \mathbf {c}) = I (T; R) - I (T; \mathbf {c} (R)) +$$ + +Noticing that mutual information terms are intractable, they approximated the objective with the difference between cross entropy in the control function task (we refer to as "control function" henceforth) and the probing task: + +$$ +\tilde {\mathcal {G}} (T, R, \mathbf {c}) = H (p _ {c}, q _ {\phi_ {c}}) - H (p, q _ {\phi}) +$$ + +To compute the error of this approximation, they reformulated the terms as following: + +$$ +\begin{array}{l} \mathcal {G} (T, R, \mathbf {c}) \\ = H (T) - H (T \mid R) - H (T) + H (T \mid \mathbf {c} (R)) \\ \end{array} +$$ + +The two $H(T)$ terms cancel out, then: + +$$ +\begin{array}{l} H (T \mid R) = H (p (T \mid R), q _ {\phi} (T \mid R)) \\ - \operatorname {K L} (p (T \mid R) \| q _ {\phi} (T \mid R)) \\ = H (p, q _ {\phi}) - \operatorname {K L} (p, q _ {\phi}) \\ \end{array} +$$ + +$$ +\begin{array}{l} H (T | \mathbf {c} (R)) = H (p (T | \mathbf {c} (R)), q _ {\phi_ {c}} (T | \mathbf {c} (R))) \\ - \operatorname {K L} (p (T | \mathbf {c} (R)) \| q _ {\phi_ {c}} (T | \mathbf {c} (R))) \\ = H \left(p _ {c}, q _ {\phi_ {c}}\right) - \mathrm {K L} \left(p _ {c} \| q _ {\phi_ {c}}\right) \\ \end{array} +$$ + +Where we abbreviate similarly as we did for the control task. Specifically, we write $\phi$ for the probe parameters of control function to tell apart from $\theta$ in the control task. + +Pimentel et al. (2020) showed that the error of their approximation, $\Delta_p = \mathcal{G}(T,R,\mathbf{c}) - \tilde{\mathcal{G}}(T,R,\mathbf{c})$ , can be expressed as: + +$$ +\Delta_ {p} = \mathrm {K L} (p \| q _ {\phi}) - \mathrm {K L} (p _ {c} \| q _ {\phi_ {c}}) \tag {2} +$$ + +Again, when the probe fits the true distribution to a similar extent on both the target labels distribution and the probing task, the $\Delta_p$ will be small. Unfortunately, both KL terms are intractable too. + +# 3.5 Control task vs control function + +From Equations 1 and 2, we showed that the selectivity criterion of Hewitt and Liang (2019) and the information gain criterion of Pimentel et al. (2020), if both measured in cross entropy loss, have very similar errors in approximating information gains. + +These errors, $\Delta_h$ and $\Delta_p$ respectively, appear in very similar forms. The probes selected from these two criteria should be highly correlated to each other, and our experiments will confirm. + +
Language# POS# TokensCorrelations
train / dev / test(t_acc, f_ent)(t_acc, t_ent)(f_acc, f_ent)
English17177k / 22k / 22k0.16150.13340.1763
French15303k / 31k / 8k0.09060.06060.1295
Spanish16341k / 33k / 11k0.13600.05600.1254
+ +Table 1: Spearman correlations between t_acc (the "selectivity" criterion (Hewitt and Liang, 2019)) and f ent (the "gain" criterion (Pimentel et al., 2020)) are on par with two "accuracy vs. cross entropy" correlations. + +# 4 Experiments + +# 4.1 Setup + +We use the same family of probes as Hewitt and Liang (2019) and Pimentel et al. (2020), multiple layers perceptrons with ReLU activations, to show the correlations of their "good probe" criteria (control task and control function, respectively). + +Overall, we sweep the probe model hyperparameters with a unified training scheme on three tasks (probe, control task, control function). The control task (function) setting includes labels (embeddings) drawn from a uniform random sample once before all experiments. In each training, we follow the setting of (Hewitt and Liang, 2019). We save the model with the best dev loss, report the test set loss and accuracy, and average across 4 different random seeds. + +Data We use the Universal Dependency (Zeman et al., 2019) dataset loaded with the Flair toolkit (Akbik et al., 2018). We examine three languages: English, French, and Spanish. For the probing task, we use POS with labels provided by $\mathrm{SpaCy}^3$ . We use the embedding of multilingual BERT (mBERT) implemented by huggingface (Wolf et al., 2019). If a word is split into multiple word pieces, we average its representations. + +# 4.2 The "good probes" are good for both + +When measuring the qualities of probes using the "selectivity" (Hewitt and Liang, 2019) or "information gain" (Pimentel et al., 2020) criterion, we show that the rules-of-thumb for training good probes largely agree. + +- Early stopping before 24,000 gradient steps (approximately 4 epochs) could inhibit probe quality, but longer training procedures do not improve the probe qualities considerably. +- Smaller probes are better in general, but exceptions exist. For example, when weight decay + +is set to 0, probes with one hidden layer and 40 hidden neurons are better in both criteria. + +- A small weight decay is beneficial. + +We include more descriptions, including comprehensive experiment configurations and plots in the Supplementary Material. + +# 4.3 The high correlation between criteria + +In addition to the qualitative correlations shown above, we compute the correlations between the two criteria over a grid-search style hyperparameter sweep of over 10,000 configurations. For each "probe, control task, control function" experiment set, we record the following four criteria: + +- t_acc: Difference between probing task and control task accuracy. This is the "selectivity" criterion of Hewitt and Liang (2019). +- f_ent: Difference between control function and probing task cross entropy. This is the "gain" criterion of Pimentel et al. (2020). +- t_ent: Difference between the control task and the probing task cross entropy. +- f_acc: Difference between the probing task and control function accuracy. + +We collect all experiments of each language according to these criteria, and use Spearman correlation to test three pairs of correlations. As is reported in Table 1, the (t_acc, f ent) correlations are comparable to two strong baselines, (t_acc, t ent) and (f acc, f ent), the correlations between measurements in accuracy and cross entropy losses. + +# 5 Conclusion + +When selecting probes that better approximate $I(T;R)$ , we recommend measuring with a control mechanism instead of relying on the traditional cross entropy on probing task. We show both information-theoretically and empirically, that controlling the targets and representations are equivalent, as long as the control mechanism is randomized. + +# Acknowledgement + +We would like to thank Mohamed Abdalla for his insights and discussion. Rudzicz is supported by a CIFAR Chair in artificial intelligence. + +# References + +Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. 2017. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. In ICLR, Toulon, France. +Alan Akbik, Duncan Blythe, and Roland Vollgraf. 2018. Contextual String Embeddings for Sequence Labeling. In COLING, pages 1638-1649. +Guillaume Alain and Yoshua Bengio. 2017. Understanding intermediate layers using linear classifier probes. In *ICLR*, Toulon, France. +Christoph Alt, Aleksandra Gabryszak, and Leonhard Hennig. 2020. Probing Linguistic Features of Sentence-Level Representations in Neural Relation Extraction. In ACL. Association of Computational Linguistics. +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2017. What do Neural Machine Translation Models Learn about Morphology? In ACL, pages 861-872, Stroudsburg, PA, USA. Association for Computational Linguistics. +Mingda Chen, Zewei Chu, and Kevin Gimpel. 2019. Evaluation Benchmarks and Learning Criteria for Discourse-Aware Sentence Representations. In EMNLP, pages 649-662, Stroudsburg, PA, USA. Association for Computational Linguistics. +Ethan A Chi, John Hewitt, and Christopher D Manning. 2020. Finding Universal Grammatical Relations in Multilingual BERT. In ACL. 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 *NAACL*, pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics. +John Hewitt and Percy Liang. 2019. Designing and Interpreting Probes with Control Tasks. In EMNLP, pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +John Hewitt and Christopher D Manning. 2019. A Structural Probe for Finding Syntax in Word Representations. In *NAACL*, pages 4129-4138, Minneapolis, Minnesota. Association for Computational Linguistics. +Nora Kassner and Hinrich Schütze. 2020. Negated and Misprimed Probes for Pretrained Language Models: Birds Can Talk, But Cannot Fly. ACL. + +Yongjie Lin, Yi Chern Tan, and Robert Frank. 2019. Open Sesame: Getting Inside BERT's Linguistic Knowledge. ACL BlackBoxNLP Workshop. +Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. 2016. Assessing the Ability of LSTMs to Learn Syntax-Sensitive Dependencies. TACL, 4:521-535. +Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. 2019. Linguistic Knowledge and Transferability of Contextual Representations. pages 1073-1094, Minneapolis, Minnesota. Association for Computational Linguistics. +Rowan Hall Maudslay, Josef Valvoda, Tiago Pimentel, Adina Williams, and Ryan Cotterell. 2020. A Tale of a Probe and a Parser. In ACL. Association for Computational Linguistics. +Fabio Petroni, Tim Roktaschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language Models as Knowledge Bases? In EMNLP, pages 2463-2473, Hong Kong, China. Association for Computational Linguistics. +Tiago Pimentel, Josef Valvoda, Rowan Hall Maudslay, Ran Zmigrod, Adina Williams, and Ryan Cotterell. 2020. Information-Theoretic Probing for Linguistic Structure. In ACL. Association of Computational Linguistics. +Nina Poerner, Ulli Waltinger, and Hinrich Schütze. 2019. BERT is Not a Knowledge Base (Yet): Factual Knowledge vs. Name-Based Reasoning in Unsupervised QA. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. OpenAI Blog, 1(8):1-24. +Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019a. BERT Rediscovers the Classical NLP Pipeline. In ACL, pages 4593-4601, Florence, Italy. Association for Computational Linguistics. +Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R. Thomas McCoy, Najoung Kim, Benjamin Van Durme, Samuel R. Bowman, Dipanian Das, and Ellie Pavlick. 2019b. What do you learn from context? Probing for sentence structure in contextualized word representations. In ICLR. +Elena Voita and Ivan Titov. 2020. Information-Theoretic Probing with Minimum Description Length. arXiv preprint arXiv:2003.12298. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. HuggingFace's Transformers: State-of-the-art Natural Language Processing. ArXiv, abs/1910.0:1-11. + +Yadollah Yaghoobzadeh, Katharina Kann, T J Hazen, Eneko Agirre, and Hinrich Schütze. 2019. Probing for Semantic Classes: Diagnosing the Meaning Content of Word Embeddings. In ACL, pages 5740-5753, Florence, Italy. Association for Computational Linguistics. + +Daniel Zeman, Joakim Nivre, and Mitchell et al. Abrams. 2019. Universal dependencies 2.5. LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (UFAL), Faculty of Mathematics and Physics, Charles University. + +# A Difference between the two criteria + +In Section 3 we show that the error of the two criteria can both be written as difference between a pair of KL divergence (modulo a constant term). Here we further simplify the terms when we assume the control task and functions take perfectly random distributions (i.e., independent of the task and representations, respectively). + +$$ +\begin{array}{l} \Delta_ {h} - \Delta_ {p} = \text {C o n s t} + \\ \operatorname {K L} (p (c (T) | R) \| q _ {\theta_ {c}} (c (T) | R)) - \operatorname {K L} (p \| q _ {\theta}) \\ - \operatorname {K L} (p (T | c (R)) \| q _ {\phi_ {c}} (T | c (R))) + \operatorname {K L} (p \| q _ {\phi}) \\ \end{array} +$$ + +When we use the same hyperparameter setting, $q_{\theta}(T \mid R)$ and $q_{\phi}(T \mid R)$ should be able to approximate $p(T \mid R)$ to the same extent, so $\mathrm{KL}(p \parallel q_{\theta})$ and $\mathrm{KL}(p \parallel q_{\phi})$ cancel out. Additionally, following the definitions of the control function and control tasks, we can simplify as follows: + +$$ +\begin{array}{l} p (c (T) | R) = p (c (T)), q _ {\theta_ {c}} (c (T) | R) = q _ {\theta_ {c}} (c (T)) \\ p (T | c (R)) = p (T), q _ {\phi_ {c}} (T | c (R)) = q _ {\phi_ {c}} (T) \\ \end{array} +$$ + +$$ +\begin{array}{l} \operatorname {K L} (p (c (T) | R) \parallel q _ {\theta_ {c}} (c (T) | R)) = \mathbb {E} _ {p (c (T))} \frac {p (c (T))}{q _ {\theta_ {c}} (c (T))} \\ \operatorname {K L} (p (T | c (R)) \parallel q _ {\phi_ {c}} (T | c (R))) = \mathbb {E} _ {p (T)} \frac {p (T)}{q _ {\phi_ {c}} (T)} \\ \end{array} +$$ + +Therefore, the difference between errors of criteria of Hewitt and Liang (2019) and Pimentel et al. (2020) are: + +$$ +\begin{array}{l} \Delta_ {h} - \Delta_ {p} = \operatorname {C o n s t} - \mathrm {K L} (p (T) \| q _ {\phi_ {c}} (T)) \tag {3} \\ + \operatorname {K L} (p (c (T)) \| q _ {\theta_ {c}} (c (T))) \\ \end{array} +$$ + +In short, these two criteria differ by terms dependent only on the randomization functions and the inherent distributions of task labels, i.e., irrelevant terms. + +# B Experiments details + +Hewitt and Liang (2019) proposed some rules-of-thumb to select good probes, including a "simple probe" suggestion. We sweep the hyper parameters to test whether these rules also apply when measuring probe qualities using the control function (Pimentel et al., 2020). + +Hyper-parameter ranges We sweep hyper parameters from the following ranges: + +- Learning rate: $\{10^{-4}, 5 \times 10^{-5}, 3 \times 10^{-5}, 10^{-5}, 5 \times 10^{-6}, 3 \times 10^{-6}\}$ +- Maximum gradient steps: $\{1500, 3000, 6000, 12000, 24000, 96000, \infty\}$ . Their effects are shown in Figure 1. +- Weight decay: $\{0, 0.01, 0.1, 1.0\}$ . Their effects are shown in Figures 2, 3 and 4. When sweeping weight decay, max gradient step is set to 24000. + +In any configuration mentioned above, we run four experiments with random seeds 73, 421, 9973, 361091, and average the reported results (i.e., accuracy and loss). + +Early stopping could inhibit probe quality Early stopping, if stopped before 24,000 gradient steps (approximately 4 epochs) may inhibit the quality of probes. In addition, we Figure 1 shows high correlation between the "selectivity" (Hewitt and Liang, 2019) and "information gain" (Pimentel et al., 2020) criteria. + +Small weight decay is beneficial We find that smaller weight decays (e.g., 0.01) are more beneficial for probes than larger weight decays. While the two criteria rank the capacity of probes similarly, the most simple probes tend to stand out more distinctively with the "selectivity" criterion (Pimentel et al., 2020), as are shown on Figures 2, 3, and 4. + +Smaller probes are not necessarily better We find that while smaller probes have higher "selectivity" and "information gain" for mBERT representations, probes with one hidden layer and 40-80 hidden neurons are better than more simplistic probes, as shown in Figures 5, 6 and 7. The plots show consistency between the two criteria. For example, larger models and more layers do not necessary lead to better results. Neither are the smallest probes with 0 hidden layers. + +Note that we also swept hyperparameters for FastText, where probes with less parameters do not always outperform more complex probes in either accuracy, loss, selectivity, or information gain. Figures 8 and 9 illustrate these observations. + +# C Reproducibility + +On a T4 GPU card, training one epoch takes around 20 seconds. Without setting maximum gradient steps, $98.6\%$ of experiments finish within + +400 epochs. We open source our codes at https://github.com/SPOClab-ca/InfoProbe. + +![](images/377cd879661cb848eb67b8171285961a7a4b5b93c4a55e0e33d400d68be80b2e.jpg) + +![](images/413fcd29c20285e5d4c3366f7a265d9650ab4d838afb17294855f3febdf5f497.jpg) + +![](images/809e2bab3ff556f1444e8317f5ce6899fbd56bb71bf1e12809979ab7d33841a0.jpg) + +![](images/80c8727c3b707e51ef7c79990599587e0d8f7b43805b7d66da7a96795927e339.jpg) + +![](images/65968a7b968a782e4e1f1a4405a59e54278f52469924c02bec7c68e628f73b65.jpg) + +![](images/c24ef895b9730bc7b99a4442c2657c267e81683fe7caf9fabe741903adab6a25.jpg) + +![](images/39269e1e924a57d3a01fc8df760cb75084c6bbab8035c5fe6040a535442551ca.jpg) + +![](images/3ea13da747647ef6ac0daaec95017fbf6508117805bb2e0c45b0a4ac09e909ad.jpg) + +![](images/51883cf72d1428fa98178ca8bae1fe3823fc7ff1b967e63c822344d0a831f433.jpg) + +![](images/399a01217b19e62f8d79f5312288e8d77329ce12b154257f5fb906c9a7e77d74.jpg) + +![](images/5f870017836d1ae867ed7c57797819ef3cdad3c1315989eb5ac89a6b9db31086.jpg) + +![](images/e9de0aa1eb3747afda98b161d490e1cddd18910755dee472a99b714d2cd341e7.jpg) + +![](images/0a19e3177737c7cdfdc5d87c91f96bc52c05b097b79a9ba16fff2b0644a63716.jpg) + +![](images/074f2a73cb5d04f29ac83f621108f99745164a744cce45b8913d8495149710f7.jpg) + +![](images/4f293b7674a9d4850d1886326f9ecd0fe8e26724a392e94cab20d393ab4c9048.jpg) + +![](images/2a0ae99e35ef537aa5e8c98bf71c67d879e2a90e62e8884a3f240f69df35cdc2.jpg) +Figure 1: Max gradient step vs accuracy, t_acc, f_acc (blue) and loss, t ent, f ent (green) on English. The "t" refers to control task (Hewitt and Liang, 2019), and "h" refers to control function (Pimentel et al., 2020). In these set of experiments, we look for the best learning rate and zero weight decay in each configuration. + +![](images/b0086d582e6c7bf76fa6ffb5bef275fa280da9a82f9319aeccea3ed456b067d2.jpg) + +![](images/19e4e1e2be5d10d5b5d78a16b790679fb0136562a236bf3e85711cbb2d5dbd22.jpg) + +![](images/b363edb80579e43d2f01579c2df94adf97eecb8b6917c40990c08991e4929b8e.jpg) + +![](images/e5a8cf292c5db0e9297b90f843eea6966554fd28c3079d590afa46857e13aa68.jpg) + +![](images/a9c7ee3f230f305f9170ba9fcc92e3d9060647f1c368c19039364040e83d772b.jpg) +Figure 2: The "difference of accuracy" (Hewitt and Liang, 2019) and the "difference of loss" (Pimentel et al., 2020) criteria against weight decay on model configurations, on UD English. For each configuration, the learning rate leading to the highest accuracy is selected. + +![](images/0ce7e7c50bd9349a06c45ce381e55dd64ec6297b2ec20354b2a178373307cd32.jpg) + +![](images/6752194c1d4f48925946babff6e18f0ccddb028a5a24faa2893065ebbeaff8bb.jpg) +Figure 3: The "difference of accuracy" (Hewitt and Liang, 2019) and the "difference of loss" (Pimentel et al., 2020) criteria against weight decay on model configurations, on UD French. For each configuration, the learning rate leading to the highest accuracy is selected. + +![](images/25cf9846bf41733aecf1111c506f1e32f8d3fce5691b1781b558feffb14b4354.jpg) + +![](images/482764d52f03e8488e3a5f98195e1c3b93ec5c4f9f8ca9182677ed8bbfc006e8.jpg) +Figure 4: The "difference of accuracy" (Hewitt and Liang, 2019) and the "difference of loss" (Pimentel et al., 2020) criteria against weight decay on model configurations, on UD Spanish. For each configuration, the learning rate leading to the highest accuracy is selected. + +![](images/9b364f187933fa5c116b9125085a3fef190713104093674ef6d97327cff919e7.jpg) + +![](images/769954bcb07cf84af38e66a35518086ac1ef3e6fa78065e1784f6c0bc8cc30ea.jpg) +Figure 5: The "difference of accuracy" (Hewitt and Liang, 2019) and the "difference of loss" (Pimentel et al., 2020) criteria with different learning rates on model configurations, on UD English. The weight decay is set to 0. + +![](images/7f8a3d712560094a73a8a455e3f1f7dc36dc356d1b6257aea43262eda2bdcb57.jpg) + +![](images/27c745fe3bd2b289c30f7bbb0278ddccb5b41ca236254a87c63b90154871cc20.jpg) +Figure 6: The "difference of accuracy" (Hewitt and Liang, 2019) and the "difference of loss" (Pimentel et al., 2020) criteria with different learning rates on model configurations, on UD French. The weight decay is set to 0. + +![](images/6cc58bf54a9882c228daf5f38b61dddca249845e39745ecfe07b959c0f950563.jpg) + +![](images/e89935264f546556ba5e5d51788a465dcb6f9eb4173d1d96cab9ed5f3d01bd9c.jpg) +Figure 7: The "difference of accuracy" (Hewitt and Liang, 2019) and the "difference of loss" (Pimentel et al., 2020) criteria with different learning rates on model configurations, on UD Spanish. The weight decay is set to 0. + +![](images/73c6abd013aaa09a33e657cec0ab95e175d94ad19610f282d601816180d66839.jpg) + +![](images/11c23c410a3b69825284a823e0941a4428f001183afdd4d9ffd01d5676c742b8.jpg) +Figure 8: The accuracy and cross entropy loss of probes on FastText. These performances are much worse than those on mBERT, indicating the richness of information encoded in contextuality of mBERT. + +![](images/f13139cad0aabb8c0d28615362799ba0e8471e0314a00b19ed3f475ab793b4a9.jpg) + +![](images/7f383f6e20189f3bf03c582fc2866010ee69ba90a124d63ac3c19c5e4dbf393e.jpg) +Figure 9: The selectivity (Hewitt and Liang, 2019) and information gain (Pimentel et al., 2020) of probes on FastText. Probes with different capacities are ranked similarly using these two criteria. + +![](images/f80d296cdb4ad4e10f61c94ffc5eada373eaf1b7ecee72248db6ae42706e4956.jpg) \ No newline at end of file diff --git a/aninformationtheoreticviewonselectinglinguisticprobes/images.zip b/aninformationtheoreticviewonselectinglinguisticprobes/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b2d17a0f5fe0c068d7cedd1e59eea5fd39672599 --- /dev/null +++ b/aninformationtheoreticviewonselectinglinguisticprobes/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:426c727ca4562ed23a6a8e9b192cdd761dd70d099fb2579ef4f5ba66717b0077 +size 994006 diff --git a/aninformationtheoreticviewonselectinglinguisticprobes/layout.json b/aninformationtheoreticviewonselectinglinguisticprobes/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b16365fe595a7fc0be42ee0751425292286a3220 --- /dev/null +++ b/aninformationtheoreticviewonselectinglinguisticprobes/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2510fec5ee9a913f2ed53afdb4a291ed4516e5df4a285af976652b912d914b29 +size 356320 diff --git a/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_content_list.json b/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..28814226549375dbe9ec762086970b5419fa50ea --- /dev/null +++ b/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf8c035b6dac1038d3f4b49e125f63b52a036beb9803cc373b9bf8e683f83a12 +size 85555 diff --git a/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_model.json b/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_model.json new file mode 100644 index 0000000000000000000000000000000000000000..98f2a8d667b4a029c344ec09344d5b535a8a481f --- /dev/null +++ b/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68789871dbb0984e7074646eaf39651f3a163b07a19fb2b2671ffb20ac9aa510 +size 105785 diff --git a/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_origin.pdf b/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..bcd468923999015aa432d324298213155f93b776 --- /dev/null +++ b/annotatingtemporaldependencygraphsviacrowdsourcing/f2ccc85e-5250-44a0-b560-cc5e6b12d31e_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0a02c0c9929e7684586f70f7b556b6c19aa534d77bcfaec51d273e51f7ce3f5 +size 717512 diff --git a/annotatingtemporaldependencygraphsviacrowdsourcing/full.md b/annotatingtemporaldependencygraphsviacrowdsourcing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8afb110108b3e8315e152e9329d6425e13183ceb --- /dev/null +++ b/annotatingtemporaldependencygraphsviacrowdsourcing/full.md @@ -0,0 +1,364 @@ +# Annotating Temporal Dependency Graphs via Crowdsourcing + +Jiarui Yao $^{1}$ , Haoling Qiu $^{2}$ , Bonan Min $^{2}$ , and Nianwen Xue $^{1}$ + +$^{1}$ Brandeis University {jryao, xuen}@brandeis.edu $^{2}$ Raytheon BBN Technologies ing.qiu, bonan.min}@raythe + +# Abstract + +We present the construction of a corpus of 500 Wikinews articles annotated with temporal dependency graphs (TDGs) that can be used to train systems to understand temporal relations in text. We argue that temporal dependency graphs, built on previous research on narrative times and temporal anaphora, provide a representation scheme that achieves a good balance between completeness and practicality in temporal annotation. We also provide a crowdsourcing strategy to annotate TDGs, and demonstrate the feasibility of this approach with an evaluation of the quality of the annotation, and the utility of the resulting data set by training a machine learning model on this data set. This data set is publicly available1. + +# 1 Introduction + +Understanding temporal relations between events in a text is an important part of understanding the "meaning" of text. With the wide adoption of machine learning methods in natural language processing, the ability to achieve a large-scale high-quality temporally annotated data set has been the bottleneck in advancing the state of the art in this area. Even though the first temporal annotation scheme, TimeML (Pustejovsky et al., 2003a; Sauri et al., 2006), was proposed over a decade ago, temporally annotated data is still relatively scarce. The largest data set that we are aware of is the data set used in TempEval-3 (UzZaman et al., 2013), and it consists of 276 articles from the TimeBank Corpus (Pustejovsky et al., 2003b) and the AQUAINT Corpus. This data set was later re-annotated by (Ning et al., 2018) to improve its annotation consistency using a crowdsourcing approach. + +There are many challenges that have contributed to this state of affairs. Temporal relations are often + +confounded with modalities (How do you order an event that actually happened with one that might happen?). Some events are ambiguous between an instantaneous and stative reading (Does "marriage" refer to the start of the marriage or does it refer to the state when marriage is in effect?) and this complicates its temporal relation with other events. While these have all contributed to the difficulty in temporal annotation, the main challenge is a practical one. The general assumption in temporal annotation has been that the temporal relation between every pair of events in a text has to be specified in order to fully understand the temporal relations in a text. This amounts to constructing a fully connected graph in which every event is connected to another event. With this pair-wise approach, a text of $n$ events has $\binom{n}{2}$ event pairs that need to be considered. As the value of $n$ increases, the number of event pairs quickly becomes very large. In practice, attempts to achieve complete annotation often fell far short and had to settle with covering all event pairs within a short text window (e.g., within adjacent sentences). Even with this restriction, it is still difficult to produce a large data set. For example, there are only 36 articles in TimeBank-Dense (Cassidy et al., 2014). On the other end of the spectrum, approaches that allow the annotators to select a subset of the event pairs to annotate often end up with sparse and inconsistent annotation, as different annotators often select different event pairs to annotate. For example, while the TimeBank corpus has relatively more articles, but only annotates a relatively small number of temporal relations (6,418 in total). There are also efforts that report improved annotation consistency by focusing on specific syntactic constructions (Bethard et al., 2007) or one aspect of temporal annotation (Reimers et al., 2016), but this comes at the cost of incomplete annotation. + +One promising recent approach to get out of this + +dilemma is to focus on dependencies between time expressions, between time expressions and events, and between events (Zhang and Xue, 2018b), based on the observation that time expressions and events are often expressed in relative terms and their temporal location needs to be understood with a reference time in mind. Consider the examples in (1): + +(1) a. He left on Friday. He left home at $\underline{9:00\mathrm{am}}$ . +b. The Pentagon said today that it would reexamine the question. +c. The Pentagon said today that it will reexamine the question. +d. Ricky New entered the store carrying a large stick, demanded money, assaulted the clerk with the stick, and left with an undisclosed amount of money. + +In (1a), the interpretation of the time expression 9:00am depends on another time expression Friday, which in turn depends on when the time this sentence is written, generally known as the document creation time (DCT). In (1b), the temporal location of re-examine can only be understood in relation to said (it happens after the saying event). Note that it does not depend on today, as it may or may not happen on that day. In contrast, in (1c), the temporal location of re-examine can only be understood with respect to the DCT, not said. Another example of one event depends on another event for its temporal interpretation is (1d), where the temporal interpretation of demanded depends on entered (it happened after entered), the temporal interpretation of assaulted depends on demanded, and the temporal interpretation of left depends on assaulted. This is a linguistic phenomenon known as temporal anaphora (Reichenbach, 1949; Partee, 1973, 1984; Hinrichs, 1986; Webber, 1988; Bohnemeyer, 2009) that has been extensively studied in computational linguistics. The working hypothesis of this dependency-based approach is that by annotating the dependencies, additional temporal relations can be inferred, via transitivity, or via common sense reasoning. This hypothesis seems to have been born out in (1d): Based on the dependencies, one can additionally infer that assaulted happened after entered, for example. + +Zhang and Xue (2018b) made the assumption that there is exactly one reference time for each event or time expression. With this assumption, the temporal relations between time expressions and events in a text will form a temporal dependency tree (TDT). This means that each event or + +time expression only relates to one other event or time expression, making TDT a much scalable annotation problem in practice. However, there are reasons to believe that this assumption is too stringent, and in some cases, multiple reference times may be needed to properly interpret the temporal location of an event. In this paper, we extend the temporal dependency tree to temporal dependency graph (TDG), allowing each event to have a reference time expression, a reference event, or both. Compared with TDT, TDG does not substantially increase the number of temporal relations in a text that need to be annotated while improving its expressiveness. + +We also investigate the feasibility of annotating TDGs from scratch via crowdsourcing, meaning we start with identifying events and time expressions, and then annotate the temporal relations between them. Previous work on crowdsourcing temporal annotations relies on the events and time expressions already identified in the TimeBank (Ning et al., 2018; Zhang and Xue, 2019), and this limits the possibility of expanding temporally annotated datasets beyond what already exist. We show that with a carefully designed annotation strategy, annotating TDGs via crowdsourcing is feasible. We annotated a corpus of 500 Wikinews articles with this approach, and created the largest corpus in terms of the number of articles and the number of event or time expression pairs. + +The remainder of the paper is organized as follows. We provide a brief overview of the TDT representation and propose our extension in Section 2. We present our crowdsourcing strategy in Section 3. We present a quantitative analysis of our corpus in Section 4, and then evaluate the quality of our annotation in Section 5. In Section 6, we retrain a neural ranking parser (Zhang and Xue, 2018a) on this data set to demonstrate its utility and establish a baseline for fellow researchers. We discuss related work in Section 7, and conclude in Section 8. + +# 2 From Temporal Dependency Tree to Temporal Dependency Graph + +# 2.1 Temporal Dependency Tree + +Zhang and Xue (2018b) defines a temporal dependency tree as a rooted directed edge-labeled tree in which nodes are events and time expressions as well as a few pre-defined meta nodes (e.g. DCT). The parent of each node is its reference time. The + +
RelationsDefinitions
BeforeA before B
AfterA after B
OverlapThe temporal interval of A over-laps that of B. Applies only to events
IncludesTime expression A includes B
+ +Table 1: Temporal relations used in TDT + +temporal dependency tree obeys the following constraint: the reference time of a time expression can only be a time expression or a meta node and it cannot be an event. The reference time of an event, on the other hand, can be a time expression, a meta node or another event. For example, in (2), the reference time for the time expression yesterday is $DCT$ , and the reference time for went and had is yesterday. The edges in the temporal dependency tree are labeled with temporal relations, which are simplified version of what is used in TimeML. The full set of temporal relations are presented in Table 1. The relation between time expressions and meta nodes is represented as "Depend-on". + +(2) Yesterday, I went to the museum, then had dinner with my friends. + +# 2.2 Temporal Dependency Graph + +In a temporal dependency tree, each child node can only have one parent or one reference time. However, there are reasons to believe that this assumption is too stringent. In (2), for example, the reference time of the had event can be went, or the time expression yesterday. To precisely determine the temporal location of had, we need to say it happened yesterday and after went. To account for linguistic phenomena like this, we extend the temporal dependency tree to temporal dependency graph, where each event always has a reference time that is a time expression or a meta node. We call this the reference timex. Optionally it can also have another event as its reference time, and we call this the reference event. The reference event is optional because not all events have an reference event. For example, in (2), went does not have another event as its reference time and only has a reference timex. In TDG, the reference timex of an event is the most specific (i.e., the smallest) narrative time (Pustejovsky and Stubbs, 2011) that the event can be placed into. If such a narrative time is not available, this event should be anchored to DCT. + +The reference event of an event is the event that gives this event the most specific temporal location. + +Figure 1 provides a contrast between the TDT and TDG for the example in (2). The solid lines indicate edges for TDT, and the dotted line indicates the additional edge in its TDG. + +![](images/cdf11c16d14671eed845e880836f5a4533134b4681a0fc9d5b5b46bd131195d1.jpg) +Figure 1: Temporal Dependency Structure for (2). + +# 3 Crowdsourcing Strategy + +Crowdsourcing is generally accepted as a cost-effective alternative to the traditional annotation approach where annotators are provided detailed guidelines and carefully trained to meet certain consistency threshold before productive annotation can start. In a crowdsourcing setting, we oftentimes hire a much larger set of annotators that are not professionally trained and may be only working on the task sporadically. Therefore, it is infeasible to ask them to follow detailed guidelines. As a result, successful crowdsourcing tasks tend to be simple and intuitive. To make crowdsourcing practical for TDGs, we adopt a divide-and-conquer strategy that decomposes the annotation of a TDG into five steps. A top-level flowchart of our annotation process is in Figure 2. After all annotation steps are completed, we assemble the TDG for each text, and an example that illustrates the step-by-step construction of the TDG of a text is provided in Figure 3. + +In all steps, each annotation is completed by three crowd workers using the Amazon Mechanic Turk platform. Unless otherwise specified, the majority-voted answer is designated as the gold annotation. We explain each annotation step in greater detail in the rest of the section. + +# 3.1 Step 1: Time Expression Identification + +In the spirit of simplifying the task as much as possible, we present crowd workers a candidate time expression and ask them to decide if it is indeed a time expression instead of asking crowd workers to select time expressions from raw text directly. This makes this task a binary decision rather than an open-ended text selection. This means we + +S1: Time Expression (TE) Identification + +![](images/bfda33d438c0f3efbf1828bce4241171c06104570129bf68b9622b8408a3ce71.jpg) + +S2: Identifying Reference Time for TE + +![](images/591df023dbc9f7a545704f00b7c9b03d6d7dc9e9f77a5ce0098102746e8c95d1.jpg) + +S3: Event Identification + +![](images/65b6bf316e46ac0fb5db07c27b994262972a0f51062b13f63cdc2187adfcc790.jpg) + +S4: Identifying Reference Timex for Events + +![](images/760e23eb6dfcce6bd46bb33109aa98a5cfc3c8506c84a9fee4329c1d196ad05e.jpg) +Figure 2: A top-level flow chart for the annotation tasks. S1, S2, ..., S5 refer to the steps 1-5. + +S5: Identifying Reference Event for Events + +need a reliable way to generate candidate time expressions without excluding true time expressions. To achieve this, we supplement candidate time expressions extracted with HeidelTime (Strötgen and Gertz, 2013) with numeric expressions extracted with regular expression patterns. + +# 3.2 Step 2: Identifying Reference Time for Time Expressions + +With the assumption that the reference time for a time expression can only be another time expression, the search space for the reference time of a time expression is greatly reduced. Following the practice of (Zhang and Xue, 2018b), we classify time expressions into different types: locatable time expressions that can be placed on a timeline and unlocatable time expressions. Locatable time expressions include concrete absolute time expressions (e.g., "2020"), concrete relative time expressions (e.g., "this year") and vague time expressions (e.g., "nowadays"). Unlocatable time expressions include durations (e.g., "two months"), set (e.g., "every month"). Concrete absolute time expressions do not need a reference time to be resolved, and they are directly attached to the root of the dependency graph without going through an annotation process. Vague time expressions belong to a closed set and they can be anchored to pre-defined meta nodes (Present/Past/Future-reference) in a deterministic manner. Unlocatable time expressions cannot be resolved with reference times and are ignored. The focus is on identifying the reference time for concrete relative time expressions, which can be another concrete time expression (absolute or relative) or the DCT. To classify the time expressions, we use regular expression patterns in the case of absolute time expressions and dictionaries when there is a closed set of expressions for that + +particular type. + +As many concrete relative time expressions can be resolved to DCT, we further split this step into two subtasks. In the first subtask, we ask crowd workers if a time expression can be resolved to DCT. If the answer is "No", in the second subtask, crowd workers will be asked to find the reference time for this time expression. However, it turned out that in most cases the reference time is the DCT. After the first subtask was completed, we found that only for fewer than 200 time expressions (less than $10\%$ of all time expressions), their reference time is not DCT. We decide that it is not worth setting up another crowdsourcing task and to have experts annotate the second subtask. + +# 3.3 Step 3: Event Identification + +Following the same approach with time expression identification, we give crowd workers an event candidate and ask them if that is an event. To collect event candidates, we first construct a list of common event trigger words2. Then, we parse the raw text with Stanford CoreNLP dependency parser (Chen and Manning, 2014; Manning et al., 2014) and add the verbs of each sentence as well as the root of its dependency parse as event candidates. We exclude modal events, negative events and stative events in this work. In total, we collected 27,487 event candidates. + +# 3.3.1 Quality Control for Step 3 + +We set up a qualification test for this pass. Crowd workers have to achieve at least $70\%$ accuracy in order to be eligible to work on this task. In addition, 5 questions with gold answers are inserted into each HIT. If a crowd worker's accuracy on the 5 test questions drops below $60\%$ , he or she will be blocked from the task and his/her annotation will be discarded. + +# 3.3.2 Post-processing + +We performed post-processing procedures to filter out some trivial mistakes in the crowdsourced annotation. For event annotation, we excluded negative events in this project since negative events do not have temporal locations. However, even though we made this clear in our instructions to the workers, some crowd workers still annotated negative events as events. We take advantage of the Stanford CoreNLP dependency parser (Chen and Manning, 2014) to filter out some of these unwanted events. + +![](images/b99290544b10e0366ba4ba68dd4ceb1de973ca6f40dbb75a28d73129f60ae2b2.jpg) +Figure 3: Constructing a TDG in 5 steps. + +![](images/4f7b7fd0fadff7ec9fd254dd09bbfffb5bbdf37246ee5a5acd51b5b2d35c2960.jpg) + +# 3.4 Step 4: Identifying Reference Timex for Events + +In this step, the crowdworkers are asked to select a reference timex for a given event from a list of candidate time expressions. In theory, all the time expressions in a text can be considered as candidate reference times. However, in practice, we observe that in the vast majority of cases the reference timex of an event is in the same paragraph as the event itself. We also observe that in news reports, key events and time expressions are usually described in the first paragraph. To reduce the number of candidate time expressions and simplify this task, for each event, we present crowd workers with time expressions in the same paragraph as well as time expressions in the first paragraph as its candidate reference timexes. + +To participate in this task, crowd workers need to achieve $70\%$ accuracy on the qualifying test. Four questions with gold answers are added to each HIT. + +# 3.4.1 Answer Aggregation + +Additionally, after computing each worker's average accuracy on all the tasks they submitted, we found that some workers were able to maintain a higher average accuracy that was between 0.7 to 0.8. This discovery inspires us to come up with a tiered-approach with weighted answer aggregation. Specifically, we compute the average accuracy of each worker and create a "best workers" group which consists of the crowd workers whose average accuracy is above 0.7. Then, for each question, if the three crowd workers give the same answer, that answer becomes the gold answer. Otherwise, + +if one crowd worker is in the "best workers" group, his/her answer becomes the gold answer; else, the majority answer is the gold answer. + +# 3.5 Step 5: Identifying Reference Event for Events + +In addition to reference timexes, some events also have a reference event, which gives it the most specific temporal location. In a crowdsourcing setting, given an event, the crowd worker is provided with a list of candidate events that are potential reference times for the event. This is a challenging problem as the list of candidates can be very long in a typical text, and there are now no obvious heuristics that can be used to shrink down the list. We rely on linguistic insights from research on temporal anaphora to identify where potential reference events are (Hinrichs, 1986; Webber, 1988), and split this task into subtasks that reflect different scenarios of how an event is related to its reference time. + +We split this task into two subtasks: a within-sentence reference event identification task and a cross-sentence reference event identification task. In the first subtask, given a non-sentence-initial event, crowdworkers are asked to identify its reference event in the same sentence. In the second subtask, given a sentence-initial event, crowdworkers are asked to identify its reference event from previous sentences. + +Within-sentence annotation When the reference time of an event is from the same sentence, we can take advantage of syntactic patterns to identify candidate reference events. For example, for events + +in complement clauses their reference events are typically the matrix events. The event in the subject of a sentence depends on the main verb for temporal interpretation (3a). In (3b), the event in a purpose clause depends on the main verb. When there is a temporal conjunction (3c), it provides clue for the temporal dependency between the event in the temporal modifier and the event in the main clause. Based on this discovery, we extract event pairs in the following structures with Stanford dependency parser (Chen and Manning, 2014): complement clauses, relative clauses, temporal conjunctions, arguments and predicates, and purpose expressions. + +(3) a. The landslide hit the village. +b. I got up at 6am to take the train. +c. Right before I got to the station, the train left. + +Cross-sentence annotation In wikinews articles, each paragraph is usually a self-contained discourse segment. We assume that the first event of a discourse segment starts a new temporal chain and does not have a reference event. In addition, to make the annotation problem practical, we limit the maximum number of reference event candidates to be 4 when proposing reference event candidates from previous sentences for crowd-workers to choose from. + +In Step 5, 11K events are given to crowd workers for reference event resolution. Crowd workers need to achieve 0.6 accuracy on the qualification test. We use the same answer aggregation approach as Step 4. + +# 4 Corpus Statistics + +The news articles that we use for our annotation are sampled from English Wikinews3 and extracted with the publicly available WikiExtractor.py script to remove hypertext markings.4 + +Table 2 presents a comparison of this corpus and some other temporally annotated corpora. TDT-Crd (Zhang and Xue, 2019) is a crowdsourced TDT corpus annotated on top of TimeBank (Pustejovsky et al., 2003b), while TB-Dense (Cassidy et al., 2014) is annotated on a subset of TimeBank. MATRES (Ning et al., 2018) was first annotated on TB-Dense, then extended to the TempEval-3 + +(UzZaman et al., 2012) data set. TDT-Crd includes events that are matrix verbs. MATRES annotates verb events on the main axis and orthogonal axes (see Ning et al., 2018 for their axis types), and does not annotate the relations between events and time expressions. Compared to the four TimeBank-based corpora, our corpus is much larger on every count, with 500 news articles, 14,974 events, 2,485 time expressions, and 28,350 temporal relations. + +
DocsTimexEventsRefs
TimeBank1831,4147,9356,418
TB-Dense362891,72912,715
MATRES275-1,79013,577
TDT-Crd1831,4142,6914,105
This work5002,48514,97428,350
+ +A more detailed analysis of temporal relations in our corpus shows that for reference timex identification, $19\%$ of the events have a reference timex that is in the same sentence, while $17\%$ of the events have a reference timex that is in different sentences. Around $64\%$ of the events have DCT as the reference timex. This indicates that in the majority of cases, the reference timex of an event cannot be found in the same sentence, and our TDG annotation is able to capture these relations as a document-level annotation framework. Our analysis also shows that for reference event identification, $27\%$ of the events do not have an reference event, and these are usually the first event of a paragraph. Table 3 shows the distribution of temporal relations in reference event identification. + +Table 2: Events, time expressions and temporal relations in various corpora. + +
No REBeforeAfterOverlap
27%24%25%24%
+ +Table 3: Distribution of temporal relations between events and events. RE refers to reference event. + +# 5 Annotation Evaluation + +We evaluate the annotation quality of our data set with two evaluation metrics. The first metric measures the agreement between crowd workers and experts, and the second metric, Worker Agreement With Aggregate (WAWA) (Ning et al., 2018), measures the agreement among the crowd-workers. Both metrics have their advantages and disadvantages but in conjunction, they provide a fuller picture of the annotation consistency of our data set. + +To measure the agreement between the expert and crowd-workers, ten percent of the articles are double annotated by experts and crowd workers. As shown in Table 4, high agreements are achieved in the first two steps. The post-processing effort in Step 3 brings the agreement from 0.79 to 0.83. Table 5 presents the agreement scores of the reference time identification for events. In Step 4 and 5, annotations are conducted both on crowdsourced events and time expressions and gold events and time expressions. Agreement scores are calculated for both labeled (L) and unlabeled (U) annotation. Unlabeled agreement evaluates reference time identification, while labeled agreement evaluates both reference time identification and relation annotation between a given event and its reference time. We achieve a labeled (unlabeled) F1-score of 0.77 (0.85) on gold events and time expressions in the reference timex identification, and a labeled (unlabeled) F1-score of 0.75 (0.83) on gold events in the reference event identification. There is an error propagation effect when crowdsourced events and time expressions are used, and the agreement scores are lower. + +We also evaluate our annotation with the WAWA metric, which measures the average agreement between crowd workers' annotation and the aggregate answer. The WAWA score measures the agreement among crowd workers, and as such it is sensitive to the number of crowd workers and whether there are outliers. Nevertheless, it is a useful metric, assuming that when an annotation task is well-defined, there should be less variation among the annotators. When computing WAWA, we used the majority aggregation instead of the weighted majority aggregation, and we only computed the labeled agreement. The WAWA scores for the subtasks are also reported in Tables 4 and 5. + +
TaskAgreementWAWA
S1: Timex ID0.960.97
S2: Timex RT0.890.95
S3: Event ID0.790.84
+ +Relation only annotation evaluation is also performed for Step 4 and Step 5 on gold events and time expressions. Specifically, we compute the portion of correct relation when the reference time + +Table 4: Agreement F1 and WAWA for time expression identification (ID), time expression reference time (RT) identification and event identification. + +
TaskNodeLUWAWA
S4: RT IDGold0.770.850.81
Crowd0.610.670.78
S5: RE IDGold0.750.830.75
Crowd0.520.590.70
+ +is correctly annotated. As we can see in Table 6, our relation-only annotation agreements between crowd workers and experts for S4 and S5 are 0.91 and 0.85. This shows that finding the appropriate reference timex and reference event is the more challenging aspect of the annotation. The relation-only agreement is in the ballpark of annotation frameworks such as Ning et al. (2018) that do not require the identification of reference events or timexes, although a strict comparison is impossible given different data sets are used. + +Table 5: Agreement F1 for reference timex (RT) and reference event (RE) identification for events. The third column evaluates the labeled (L) annotation, the fourth column evaluates the unlabeled (U) annotation. + +
S4S5
Agreement0.910.85
+ +Table 6: Relation only annotation agreement. + +# 5.1 Error Analysis for Reference Event Identification + +The most challenging aspect of this project is identifying the reference event for a given event and determining their temporal relations. To gain a better understanding of the quality of the crowdsourced data set, we did a manual error analysis of this pass. We randomly sampled 100 instances where the crowdsourced reference events are different from that identified by the expert. We then decide if the crowdsourced annotation is simply wrong or is different from the expert annotation but is still reasonable. For example, in (4), the reference event identified by crowdworkers for event discovered is pursued. However, the pursued event happened before the incident event, and the incident event happened before the discovered event, so we get the most specific temporal location for event discovered when incident is used as the reference event. The crowdsourced annotation in this case is simply wrong. Example (5) is an edge case where it is reasonable to say the fight event happened before event lose, but it's also reasonable to say that the lose event is a part of the fight process, so the fight event overlaps the lose event. + +(4) The incident took place after three youngsters on bicycles pursued two youths who sought cover inside the store. Investigators have discovered that Kamaleswaran's mother was also inside the store during the shooting. + +(5) Terror organisations and their pawns are targeting our innocent citizens in the most immoral and heartless way as they lose the fight against our security forces. + +In the 100 instances, 36 of them are wrong, while the other 64 are different from that of the expert but reasonable. As we can see in Table 7, in the 36 wrong annotations, 21 (58%) of them are caused by the crowd worker identifying the incorrect referent event while the other 15 (42%) of them are annotated with incorrect temporal relations. This shows that identifying the correct reference time is more challenging than determining the temporal relation. + +
StructureRelationTotal
21 (58%)15 (42%)36
+ +# 6 Experiments + +We test our data with an attention-based neural ranking temporal dependency parser $^6$ that Zhang and Xue (2018a) developed for TDT, which parses the temporal dependency tree by ranking the candidate parents for each node. To apply the tree parser to the graph data, we first add a meta node as reference event for events that only have a reference timex. Then, we rank all the time expressions for events and pick the one with the highest score as its reference timex, and rank all the events and select its reference event. To help the model learn the relations between DCT and events, a POS tag feature is added which only distinguishes present tense verb events with other events. This feature is represented as a one hot vector. We use the same hyperparameter values as Zhang and Xue (2018a). In the 500 documents, 400 are used as training data, 50 as validation data, and 50 as test data. The test data is annotated by experts, and the validation data is generated from crowdsourced annotation as follows: if there is no agreement for one question, i.e. + +three crowd workers chose three different answers, then experts annotate that question. + +We also develop a heuristic baseline system as follows. First, each time expression is attached to DCT. For each event, if there is a time expression in the same sentence, we attach the event to that time expression, and designate the relation as "Include". Otherwise that event is attached to DCT, and the relation is "Before". For the reference events, we attach each event to the immediately previous event in the text, and designate the relation as "Overlap", which is the most common relation between events in experts' annotation. As shown in Table 8, the neural ranking system achieves 0.66 labeled F1-score on the test data, compared with a baseline of 0.51. Table 8 also includes a breakdown of accuracy for different subtasks. The neural ranking model outperforms the baseline by a large margin for all subtasks. Overall, these results show that temporal dependency parsing is a very challenging task, and by making this data set available, it will aid in the development of more sophisticated machine learning models to advance the state of the art in this area. + +Table 7: Distribution of the cause of the wrong annotations in the 100 sampled instances. + +
Unlabeled FLabeled F
devtestdevtest
Baselinete,te0.800.820.800.82
e,te0.540.700.460.58
e,e0.640.610.260.34
full0.620.680.410.51
Neuralte,te0.880.930.880.93
e,te0.620.770.530.66
e,e0.70.770.50.58
full0.690.790.550.66
+ +Table 8: Experiment results of the baseline system and the neural ranking model. + +# 7 Related Work + +# 7.1 Temporal Dependency Structure + +Kolomiyets et al. (2012) are the first work that use the term temporal dependencies, and they extract timelines from narrative stories as temporal dependency trees. However, in their work, only events are included as nodes in the dependency tree, and the parent of each node is not explicitly defined as the reference event of the child event. Zhang and Xue (2018b) first defined a temporal dependency tree structure that have both events and time expressions as nodes in the tree, and attempted + +to explicitly define the parent of each event or time expression as the reference event or time expression of the child node. This temporal dependency tree has been applied to both Chinese (Zhang and Xue, 2018b) and English (Zhang and Xue, 2019) data, and to both news reports and narrative stories, indicating this framework can be applied across languages and genres. The present work extends temporal dependency trees to the temporal dependency graphs, and crowd-sourced temporal dependency graphs on English news articles. + +# 7.2 Crowdsourcing Temporal Relations + +Early studies on crowdsourcing temporal relations usually focus on some subtask of this problem. Snow et al. (2008) crowdsources the relations of a subset of verb event pairs from TimeBank (Pustejovsky et al., 2003b) whose relations are either "strictly before" or "strictly after". Ng and Kan (2012) only focuses on the relation between events and time expressions from news data. Caselli et al. (2016) conducts crowdsourcing experiments on both temporal relation annotation and event / time expression extraction. In the time expression extraction experiments, they ask crowd workers to select time expressions directly from the raw text. In contrast, we give crowd workers time expression candidates and ask them binary questions. Our approach prevents crowd workers from selecting wrong textual spans. Ning et al. (2018) comes up with a multi-axis approach for event temporal relation annotation (see Ning et al., 2018 Section 2 and Appendix A for more details about their multi-axis model). The multi-axis approach is a way of factoring out modalities in event annotation, and combined with the decision to only consider the start point of events, they are able to achieve high accuracy in annotating temporal relations assuming gold events are provided. Our annotation is more challenging in that crowdworkers also need to identify time expressions and events, in addition to annotating temporal relations. + +Zhang and Xue (2019) crowdsourced a temporal dependency tree (TDT) corpus, and is the work that is the most related to ours. The differences between their work and this work are as follows. First, our work extends the temporal dependency tree to temporal dependency graph, where events always have a reference timex and optionally also have a reference event. In TDT, events only have one reference time, either a reference timex or a reference event, but not both. The second differ + +ence is that the TDT corpus is constructed on top of TimeBank (Pustejovsky et al., 2003b), without having to annotate events and time expressions. In contrast, we construct the TDG corpus from scratch in that we first extract events and time expressions, then annotate the relations between them as part of the graph structure. + +# 8 Conclusion + +In this paper, we proposed a temporal annotation scheme called temporal dependency graphs which extend previous research on temporal dependency trees. The temporal dependency graphs, like temporal dependency trees, draw inspiration from previous research on narrative times and temporal anaphora, allow a good trade-off between completeness and practicality in temporal annotation. We proposed a crowdsourcing strategy and demonstrated its feasibility with a comparative analysis of the quality of the annotation. We also demonstrated the utility of the data set by training a neural ranking model on this data set, and the data set is publicly available. + +# Acknowledgments + +We thank the anonymous reviewers for their helpful comments, Jayeol Chun and Yi Zhang for discussing the project with us. This work is supported in part by a grant from the IIS Division of National Science Foundation (Award No. 1763926) entitled "Building a Uniform Meaning Representation for Natural Language Processing" awarded to the fourth author. All views expressed in this paper are those of the authors and do not necessarily represent the view of the National Science Foundation. + +This work was supported in part by DARPA/I2O and U.S. Army Research Office Contract No. W911NF-18-C-0003 under the World Modelers program, and the Office of the Director of National Intelligence (ODNI) and Intelligence Advanced Research Projects Activity (IARPA) via IARPA Contract No. 2019-19051600006 under the BETTER program. The views, opinions, and/or findings expressed are those of the author(s) and should not be interpreted as representing the official views or policies, either expressed or implied, of ODNl, IARPA, the Department of Defense or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein. + +# References + +Steven Bethard, James H Martin, and Sara Klingenstein. 2007. Timelines from text: Identification of syntactic temporal relations. In International Conference on Semantic Computing (ICSC 2007), pages 11-18. IEEE. +Jürgen Bohnemeyer. 2009. Temporal anaphora in a tenseless language. The expression of time in language, pages 83-128. +Tommaso Caselli, Rachele Sprugnoli, and Oana Inel. 2016. Temporal information annotation: Crowd vs. experts. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 3502-3509, Porto Roz, Slovenia. European Language Resources Association (ELRA). +Taylor Cassidy, Bill McDowell, Nathanael Chambers, and Steven Bethard. 2014. An annotation framework for dense event ordering. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 501-506, Baltimore, Maryland. Association for Computational Linguistics. +Danqi Chen and Christopher Manning. 2014. A fast and accurate dependency parser using neural networks. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 740-750, Doha, Qatar. Association for Computational Linguistics. +Erhard Hinrichs. 1986. Temporal anaphora in discourses of english. Linguistics and philosophy, pages 63-82. +Oleksandr Kolomiyets, Steven Bethard, and Marie-Francine Moens. 2012. Extracting narrative timelines as temporal dependency structures. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 88-97, Jeju Island, Korea. Association for Computational Linguistics. +Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. 2014. The Stanford CoreNLP natural language processing toolkit. In Association for Computational Linguistics (ACL) System Demonstrations, pages 55-60. +Jun-Ping Ng and Min-Yen Kan. 2012. Improved temporal relation classification using dependency parses and selective crowdsourced annotations. In Proceedings of COLING 2012, pages 2109-2124, Mumbai, India. The COLING 2012 Organizing Committee. +Qiang Ning, Hao Wu, and Dan Roth. 2018. A multi-axis annotation scheme for event temporal relations. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1318-1328, Melbourne, Australia. Association for Computational Linguistics. + +Barbara H Partee. 1984. Nominal and temporal anaphora. Linguistics and philosophy, pages 243-286. +Barbara Hall Partee. 1973. Some structural analogies between tenses and pronouns in english. The Journal of Philosophy, 70(18):601-609. +James Pustejovsky, José M Castano, Robert Ingria, Roser Sauri, Robert J Gaizauskas, Andrea Setzer, Graham Katz, and Dragomir R Radev. 2003a. Timeml: Robust specification of event and temporal expressions in text. New directions in question answering, 3:28-34. +James Pustejovsky, Patrick Hanks, Roser Sauri, Andrew See, Robert Gaizauskas, Andrea Setzer, Dragomir Radev, Beth Sundheim, David Day, Lisa Ferro, et al. 2003b. The timebank corpus. In Corpus linguistics, volume 2003, page 40. Lancaster, UK. +James Pustejovsky and Amber Stubbs. 2011. Increasing informativeness in temporal annotation. In Proceedings of the 5th Linguistic Annotation Workshop, pages 152-160. Association for Computational Linguistics. +Hans Reichenbach. 1949. Elements of symbolic logic. +Nils Reimers, Nazanin Dehghani, and Iryna Gurevych. 2016. Temporal anchoring of events for the time-bank corpus. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2195-2204. +Roser Saurí, Jessica Littman, Bob Knippen, Robert Gaizauskas, Andrea Setzer, and James Pustejovsky. 2006. Timeml annotation guidelines. Version, 1(1):31. +Rion Snow, Brendan O'Connor, Daniel Jurafsky, and Andrew Ng. 2008. Cheap and fast – but is it good? evaluating non-expert annotations for natural language tasks. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pages 254–263, Honolulu, Hawaii. Association for Computational Linguistics. +Jannik Strötgen and Michael Gertz. 2013. Multilingual and cross-domain temporal tagging. *Language Resources and Evaluation*, 47(2):269-298. +Naushad UzZaman, Hector Llorens, James F. Allen, Leon Derczynski, Marc Verhagen, and James Pustejovsky. 2012. Tempeval-3: Evaluating events, time expressions, and temporal relations. CoRR, abs/1206.5333. +Naushad UzZaman, Hector Llorens, Leon Derczynski, James Allen, Marc Verhagen, and James Pustejovsky. 2013. Semeval-2013 task 1: Tempeval-3: Evaluating time expressions, events, and temporal relations. In Second Joint Conference on Lexical and Computational Semantics (*SEM), Volume 2: Proceedings of the Seventh International Workshop on Semantic Evaluation (SemEval 2013), pages 1-9. + +Bonnie Lynn Webber. 1988. Tense as discourse anaphor. Computational Linguistics, 14(2):61-73. +Yuchen Zhang and Nianwen Xue. 2018a. Neural ranking models for temporal dependency structure parsing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3339-3349, Brussels, Belgium. Association for Computational Linguistics. +Yuchen Zhang and Nianwen Xue. 2018b. Structured interpretation of temporal relations. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Miyazaki, Japan. European Language Resources Association (ELRA). +Yuchen Zhang and Nianwen Xue. 2019. Acquiring structured temporal representation via crowdsourcing: A feasibility study. In Proceedings of the Eighth Joint Conference on Lexical and Computational Semantics (*SEM* 2019), pages 178-185, Minneapolis, Minnesota. Association for Computational Linguistics. + +# A Appendix + +In this section, we give examples of the annotation interface of each step. In step 4 and 5, the number of options we gave to crowd workers is varied. The template we have here for step 5 has the maximum number of options. The options are also ranked by likelihood: the first event is usually the most likely choice. + +1. Sentence: Mozilla Firefox 1.0, a free open-source web browser, has been released on November 9, 2004 by the Mozilla Foundation. + +Is "November 9, 2004" a time expression? + +Yes +No +Not sure + +Figure 4: Annotation interface for time expression identification. + +# 1. Article: October 7, 2006 + +In the $2006_{[10]}$ World Cup final, Fabien Barthez's mistake allowed Materazzi to score a decisive goal. + +The keeper, who'll be remembered for being top-head kissed at the start of each international match by teammate Laurent Blanc, was desperately hoping for revenge against Italy last September in the Stade de France but Grégory Coupet became the #1 rated French football goalkeeper therefore pushing Fabien in retirement announced officially yesterday[t2]. + +Which of the following statements about last September is true? + +This time expression doesn't need a reference time because it is an absolute time expression. +This time expression doesn't need a reference time because it is a duration. +This time expression doesn't need a reference time because it describes a frequency. +The publication time of this news, October 7, 2006 is the reference time of the time expression last September. +The publication time of this news, October 7, 2006 is NOT the reference time of the time expression last September. + +Figure 5: Annotation interface for reference time resolution for time expressions. + +1. Sentence: The bill states the National Assembly seats are to be reduced from 342 to 336; the Senate is to be reduced from 104 to 96 seats. + +Is "reduced" an event? + +Yes +No +Not sure + +Figure 6: Annotation interface for event identification. + +# 0. August 26, 2007 + +Investigators have discovered a hole in the fuel tank of the China Airlines jet that caught fire and exploded on August 20[10] on the island of Okinawa, Japan. + +Investigators from Japan, Taiwan and the United States have all been examining the wreckage of China Airlines Flight 120 since the accident. Now[1], Japanese investigators say that they have found that a structural bolt had pierced the fuel tank of the Boeing 737-800 series aircraft. + +"We spotted a hole in a fuel tank," said a brief statement by the transport ministry's investigative division. "We suspect that oil leaked from this hole and spilled from the right wing to the outside." + +It is understood that, prior to the discovery of the hole, the investigation had been focusing on the tubing connecting the fuel tank to the engine, rather than the tank itself. + +Taiwan-based China Airlines's only comment was to repeat earlier comments that the plane had been inspected last month, at which point the airline had been unable to find any problem with it. However, prior to this news, the chief executive flew to Okinawa to console worried tourists, while chairman Philip Wei offered to resign "...in a bid to shoulder his responsibility," according to an airline official. The airline is also offering compensation to passengers on the flight. + +Boeing refused to comment on the incident, citing the fact that the investigation remains open. However, the "Jiji Press" has reported that Boeing had warned airlines in 2006 about the possibility of bolts piercing the fuel tanks, after a number of incidents in which tank piercing was found to have occurred. + +The event found happens (ed) + +$\mathrm{O}$ Now[t1] +on August 20 [t0] +$\bigcirc$ before August 26, 2007, which is when the news was published +around August 26, 2007, which is when the news was published +$\bigcirc$ after August 26, 2007, which is when the news was published + +Figure 7: Annotation interface for resolving reference timex for events. + +# 7. May 14, 2008 + +According to police sources, a series of seven coordinated bombs detonated in Jaipur, the capital of the state Rajasthan, in India on Tuesday, May 13. At least eighty people were killed and over two hundred injured in the attacks. + +The bombs went off over a period of twenty minutes and tore through the city's crowded bazaars, beginning at 7:20 p.m. IST (UTC+5:30). An eighth bomb, which did not go off, was recovered. Ten of the dead were children. + +In the wake of the bombing, a daytime curfew has been in place. "The curfew is a precaution to ensure peace," said Vasundhara Raje, the Chief Minister of Rajasthan. + +On Wednesday, two arrests were announced[e10]. "We have arrested[e11] two people and have detained[e12] several more for questioning," said[e13] Vasundhara Raje. "This seems to have been done by some international group," she added, in a comment that was intrepreted by "The Daily Telegraph" to suggest Pakistan-based Islamic militants. + +# Which of the following best describes added + +Undecidable. +added happens (ed) before said[e13] +$\bigcirc$ added happens (ed) after said[13] +added happens (ed) at the same time with said[c13] +added happens (ed) before detaineded[e12] +added happens (ed) after detaineded[e12] +added happens (ed) at the same time with detainedid[ec12] +added happens (ed) before arrested[e11] +added happens (ed) after arrested[e11] +$\bigcirc$ added happens (ed) at the same time with arrested[111] +added happens (ed) before announced[e10] +added happens (ed) after announced[e10] +added happens (ed) at the same time with announced[e10] + +Figure 8: Annotation interface for resolving reference events for events. \ No newline at end of file diff --git a/annotatingtemporaldependencygraphsviacrowdsourcing/images.zip b/annotatingtemporaldependencygraphsviacrowdsourcing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3aca9378d3a4ba62b3b7e9159905380ad80756d3 --- /dev/null +++ b/annotatingtemporaldependencygraphsviacrowdsourcing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77c49c4ef49dc3223b8cb52272e1e0a90a442a499c17ce73497dc9e15b48bff3 +size 216394 diff --git a/annotatingtemporaldependencygraphsviacrowdsourcing/layout.json b/annotatingtemporaldependencygraphsviacrowdsourcing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1724381632acdf6864a7bfba9b847fc0b9ffbcef --- /dev/null +++ b/annotatingtemporaldependencygraphsviacrowdsourcing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18f7b8ae057dc7ef16502e2a0aacaa1debcd78f6968b8cfe7bfdafec068c6bcb +size 366677 diff --git a/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_content_list.json b/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f8fb64f39259f862cc1e52ea690ad322c559e063 --- /dev/null +++ b/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e361b201aa8c6f3b259aa3629f3b17301a31de4d377142d15614ed18e6df787a +size 78108 diff --git a/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_model.json b/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_model.json new file mode 100644 index 0000000000000000000000000000000000000000..395da052b7d2131d3413471fc31c2c5055974169 --- /dev/null +++ b/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd08eb0a8c4a9b09dd0ee1293ac3c6f752e4f426830a3011f4efdcb7bccf8ef0 +size 94133 diff --git a/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_origin.pdf b/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e644f2c932c3ce54b7fba53c4fbef3df647162af --- /dev/null +++ b/answerfactfactcheckinginproductquestionanswering/2135c6ad-1bd9-44f9-a65e-43cb5276bb79_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c11be86ccbdf92d3cfabe6667314bc0420d20e55e6e1e3d03fb7d73d370ca39 +size 1184549 diff --git a/answerfactfactcheckinginproductquestionanswering/full.md b/answerfactfactcheckinginproductquestionanswering/full.md new file mode 100644 index 0000000000000000000000000000000000000000..4c150a35890c070fac8fc46ebfea73e980dd5a6b --- /dev/null +++ b/answerfactfactcheckinginproductquestionanswering/full.md @@ -0,0 +1,346 @@ +# AnswerFact: Fact Checking in Product Question Answering* + +Wenxuan Zhang†, Yang Deng†, Jing Ma‡ and Wai Lam† + +†The Chinese University of Hong Kong + +$^{\ddagger}$ Hong Kong Baptist University + +{wxzhang, ydeng, wlam}@se.cuhk.edu.hk + +majing@comp.hkbu.edu.hk + +# Abstract + +Product-related question answering platforms nowadays are widely employed in many E-commerce sites, providing a convenient way for potential customers to address their concerns during online shopping. However, the misinformation in the answers on those platforms poses unprecedented challenges for users to obtain reliable and truthful product information, which may even cause a commercial loss in E-commerce business. To tackle this issue, we investigate to predict the veracity of answers in this paper and introduce AnswerFact, a large scale fact checking dataset from product question answering forums. Each answer is accompanied by its veracity label and associated evidence sentences, providing a valuable testbed for evidence-based fact checking tasks in QA settings. We further propose a novel neural model with tailored evidence ranking components to handle the concerned answer veracity prediction problem. Extensive experiments are conducted with our proposed model and various existing fact checking methods, showing that our method outperforms all baselines on this task. + +# 1 Introduction + +The ability to ask questions during online shopping is found to be a key factor for customers to make purchase decisions (Smith and Anderson, 2016). To this end, product-related community question answering (PQA) platforms have emerged in many E-commerce sites such as Amazon and Taobao, allowing users to pose their concerns as questions and receive answers from fellow users to obtain useful product information. However, similar to other community question answering (CQA) platforms, + +Question: Is this egg coker automatic shut off? + +Answer (Claim): Yes there's an automatic shut-off when the cooking cycle is finished. (Verdict: FALSE) + +# Evidence: + +$s_1$ : A buzzer sounds to let you know the eggs are done, I wish it would just shut off instead. + +$s_2$ : When the alarm sounds you need to turn it off and open it. + +$s_3$ : I would have liked the cooker to turn off automatically but instead a bell rings until you turn if off. + +$s_4$ : Also, by the time the timer goes off, the hot pan has a burning smell. + +$s_5$ : And it turns off itself after the bell rings. + +·· + +Table 1: An example instance in AnswerFact, where the answer is the claim to be verified. The relevant product information are provided as evidence sentences. + +the user-provided answers on PQA platforms vary significantly on their qualities (Zhang et al., 2020b), and more seriously, their veracity due to the lack of systematic quality control (Mihaylova et al., 2018). Those untruthful answers may attribute to multiple factors such as misunderstandings of the question, improper expressions during writing, and even intentionally malicious attacks from the competitors (Carmel et al., 2018). Therefore, automatically verifying the answer veracity is becoming a demanding need, which can offer a more reliable online shopping environment, for example, by triggering a double-check on the detected doubtful answers. + +Fact checking aiming at verifying the truthfulness of a given claim (Thorne and Vlachos, 2018; Sharma et al., 2019) can be a promising direction to tackle the concerned problem. However, the claim on which existing fact checking methods mainly focus is usually a standalone text snippet such as news (Wang, 2017; Popat et al., 2018; Ma et al., 2019) or twitter posts (Derczynski et al., 2017; Wei et al., 2019). To predict the veracity of an answer in the QA settings, one can notice that it is insufficient to consider the answer alone since the question text + +also carries important semantic information for the prediction. Thus, we need to appropriately leverage the question text into the verification process. + +In the context of CQA problems, most existing studies focus on measuring the semantic relevance of a candidate answer to the given question (Tay et al., 2017; Yang et al., 2019b) or ranking available answers for a given question (Zhang et al., 2020a). However, the notion of veracity poses a more rigorous requirement of an answer where it needs to be factually correct. For example, the given answer in Table 1 will be labeled as positive from the perspective of the typical CQA task (Nakov et al., 2017) since it is topically relevant to the question. But its verdict is indeed false which can be verified from the product description. Recently, a new shared task, namely SemEval-2019 Task 8 (Mihaylova et al., 2019) investigates the fact checking problem in question answering scenario, requiring a system to classify the veracity of answers in a web forum. However, only QA pairs are given in this task, making it less practical since most of the predictions require extra knowledge from external sources. Moreover, with only hundreds of QA pairs provided, such limited number of samples precludes its use to develop powerful machine learning based fact checking models. + +To tackle the aforementioned issues, we introduce a large scale fact checking dataset called AnswerFact for investigating the answer veracity in product question answering forums. An instance of the dataset is shown in Table 1. It consists of 60,864 answer claims, each with its veracity label derived from the community votes. Moreover, the relevant product information from product descriptions and user reviews are retrieved as evidence sentences providing the external knowledge for judging the answer veracity. Compared with existing works (Thorne et al., 2018a; Mihaylova et al., 2018), AnswerFact exhibits some unique characteristics: Firstly, different from a typical single text claim, a sentence pair (i.e., QA pair) is given in AnswerFact, indicating that the rich interaction information between the question and answer text needs to be explored and utilized. Secondly, since part of the evidence sentences come from user reviews written by ordinary users, the potential unreliability of some evidence sentences needs to be investigated and the consistency among evidence needs to be verified to uncover the common judgement towards the answer for the prediction. + +We further propose AVER, an Answer Veracity prediction model with tailored Evidence Ranking modules to predict the answer veracity in PQA forums. AVER first utilizes the information from both the question and answer text to rank the evidence sentences with different gating mechanisms. An agreement-matching strategy is then employed to model the self-coherence of the evidence sentences for obtaining reliable combined evidence embeddings to verify the answer verdict. To summarize, our main contributions are as follows: + +- We study the fact checking problem in product question answering. To our best knowledge, this is the first work to investigate the truthfulness of answers in E-commerce QA platforms. +- We introduce AnswerFact, a large dataset consisting of 60,864 answer claims across five product domains. Each claim comes with its veracity label and associated evidence sentences. +- We propose a novel neural model with tailored evidence ranking module to tackle the answer veracity prediction problem, which shows to outperforms all established baselines. + +# 2 Related Work + +# 2.1 Community Question Answering + +Existing methods in community question answering (CQA) mainly focus on the answer selection task (Nakov et al., 2017; Tay et al., 2017; Yang et al., 2019b; Deng et al., 2020), where an answer is considered to be positive if it is semantically relevant to the question regardless of its veracity. Some studies further measure the quality of answers, trying to predict the answer helpfulness in PQA platforms (Zhang et al., 2020b) or ranking all available answers for a given question (Zhang et al., 2020a). One closely related work in the CQA context is a recent attempt of investigating the fact checking task in QA settings (Mihaylova et al., 2018), which was later adopted as the SemEval-2019 Task 8 (Mihaylova et al., 2019). Its goal is to classify an answer in the Qatar forum1 into true, false or non-factual. However, only QA pairs are given in this shared task to predict the answer veracity, making it less practical due to the lack of evidence sources. Moreover, the small number of training data consisting only 495 QA pairs restricts the possibility of trying some powerful machine learning models such as deep neural networks. + +As pointed out in Mihaylova et al. (2019), verifying the verdict of answers in CQA requires using rich world knowledge. However, gathering relevant information as evidence can be difficult due to the open-domain nature of those questions. Compared with general CQA forums, PQA provides product-specific forums, making the evidence collection process more realistic and controllable. Also, as will be described in Section 3, the high proportion of factual type QA pairs also makes it suitable for studying the fact checking problem on PQA. + +# 2.2 Fact Checking Datasets & Methods + +Automatically predicting the veracity of claims has been extensively studied in recent years and various fact checking datasets have been released (Thorne et al., 2018a; Sharma et al., 2019; Augenstein et al., 2019). Typically, the data are collected from news checking websites such as Politifact and Snopes, where the evidence is either not given (Rashkin et al., 2017; Pérez-Rosas et al., 2018) or provided as an external URL link containing machine unreadable format ranging from statistical tables to PDF reports (Wang, 2017). One recent trend is that evidence-based fact checking has gained more attention where datasets with well-formatted claims and evidence are adopted (Thorne et al., 2018a; Popat et al., 2018; Chen et al., 2020). + +Fact checking methods are mostly tailored to specific types of datasets. Methods involving small datasets often use hand-crafted features to represent the claim (Mihaylova et al., 2018). These features are then fed into a SVM or MLP classifier to make the prediction (Baly et al., 2018). Deep learning based methods are also proposed given the existence of large datasets. The claim and evidence representations can be learned with neural networks such as recurrent neural networks (RNNs) (Rashkin et al., 2017) or convolutional neural networks (CNNs) (Wang, 2017). + +However, none of these work conducts fact checking problem in QA settings with associated well-formatted evidence sentences. + +# 3 AnswerFact Dataset Construction + +We build our dataset upon a large QA collection (Wan and McAuley, 2016) crawled from Amazon. Five product domains with the largest number of QA pairs are selected, namely, Electronics, Home and Kitchen, Sports and Outdoors, Health and Personal Care, and Cell Phones and Accessories, con + +
LabelsCommunity Votes
TRUEnup = total
PARTTRUEndown < nup < total
UNSUREndown = nup
PARTFALSEnup < ndown < total
FALSEndown = total
+ +Table 2: Veracity labels from community votes. $n_{up}$ , $n_{down}$ , $n_{total}$ refers to the number of upvotes, downvotes and total votes of the answer respectively. + +stituting around 2.7 million QA pairs in total. + +# 3.1 Factual QA Pairs Filtering + +The raw data collection contains various questions spanning from questions asking for product details to personal user experience. Since it can be difficult to verify the truthfulness of answers to subjective questions given the diversity of user experience, we focus on factual QA pairs to investigate the answer veracity. We begin by manually labeling the factual types of two thousand randomly sampled questions, judging whether the answer will vary from user to user. For example, questions asking for product attributes are judged as FACTUAL since the answers are objective facts. Questions looking for personal experience are treated as NONFACTUAL since their answers depend on users' own experience and vary from person to person. Each question is labeled by two annotators and the disagreements are settled by discussions. From the annotation, we found that factual questions are actually the dominant type in PQA forums where around $71\%$ of the annotated questions are factual ones. + +Following the strategy in Syed et al. (2019) which ranked first for predicting the question type in SemEval-2019 Task 8, we applied the Universal Sentence representation (Cer et al., 2018) to encode question texts. While we found that the SVM classifier performs slightly better than the XGBoost (Chen and Guestrin, 2016) used in their work, achieving average 0.85 accuracy and 0.90 F1 score under the 5-fold cross validation. We then trained the SVM classifier on the whole $2\mathrm{k}$ annotated questions for predicting the type of all questions. Note that since we can sacrifice some recall for the sake of precision to ensure that the questions we want are all factual ones, we discarded questions whose predicted scores are close to decision boundary. Finally, to measure the performance of such auto-filtering, we randomly sample 150 ques + +
ElectronicsHomeSportsHealthPhonesTotal
# Answers per Label
TRUE13,05410,5924,5396,8792,46737,531
PARTTRUE1,7371,2975811,0353364,986
UNSURE3,1162,2281,1341,7827388,998
PARTFALSE8226833085641512,528
FALSE2,4911,79789712114156,821
# Answers21,22016,5977,45911,4814,10760,864
# Questions11,5548,2103,9185,8162,24531,743
+ +Table 3: Summary statistics of the AnswerFact dataset + +tions with their predicted types and annotate their question types again. The results showed that the precision score reached 0.99 on this set. + +# 3.2 Veracity Labels from Community Votes + +To obtain the veracity label of each answer, an intuitive way is to manually digest relevant product information to make the annotation. However, since the annotators may not be familiar with the concerned product, their annotations might be influenced by the surface level of the answer such as its writing style instead of its actual correctness. Such labeling process can also be time-consuming and difficult to collect large amounts of data. On the other hand, we observe that the community votes of each answer can be a valuable numerical indicator reflecting its veracity. Specifically, in PQA forums, each answer can receive upvotes and downvotes from the former buyers. For factual type QA pairs, such community votes reflect users' stance towards the statement claimed in the answer, indicating the overall veracity judgement given by the entire community. It is not surprising that some answers may not have any vote in practice. But those answers with votes can provide precious labeled data for our investigation in PQA forums. + +To ensure the quality of labels, we first filter out answers with total votes (including upvotes and downvotes) less than 2. Then following typical settings in fact checking datasets (Vlachos and Riedel, 2014; Wang, 2017; Augenstein et al., 2019), we consider the problem as a multi-class classification task and divide answers into five types according to their community votes as shown in Table 2. The rationality is that fully objective truth is often elusive and ill-defined as pointed out in Popat et al. (2018). For example, an answer may contain partially true information for the question. Thus, such veracity label partition can also be interpreted as measuring the answer credibility or reliability in + +multiple scales. + +# 3.3 Evidence Retrieval + +We then use the question text to retrieve relevant product information as evidence for providing external information when predicting the answer veracity. In E-commerce scenario, product descriptions from the manufacture and user reviews from the former buyers contain rich product information, which can be treated as the candidate information pool for the retrieval process. Similar with Thorne et al. (2018a), we rank the evidence sentences by TF-IDF similarity to the question text. To further improve the accuracy of the retrieved evidence, we only use the TF-IDF similarity as an initial filtering step, then the pre-trained BERT (Devlin et al., 2019) is utilized as the sentence encoder to encode the filtered evidence sentences and question text. The $k$ nearest evidence sentences using cosine similarity with the encoded question are kept as the evidence for veracity verification. The statistics of the entire dataset is reported in Table 3. + +# 4 Answer Veracity Prediction + +Problem Definition. Given an answer $\pmb{a}$ to its corresponding question $\pmb{q}$ , our aim is to predict the answer veracity which falls into one of the predefined veracity type, with the help of $k$ relevant evidence sentences $s_1, s_2, \ldots, s_k$ . + +In this section, we describe our proposed model AVER for the Answer Veracity prediction task with tailored Evidence Ranking module. An overview of AVER is shown in Figure 1. + +# 4.1 Attention-based Input Encoding + +For each word in the given text sequences, which is either a question, an answer or an evidence sentence, we use an embedding matrix to map it into a vector representation. To capture the temporal + +![](images/22249c2b094891526f5bc60cd1cd5cba1c7c8383ae4b157f88d81512fb6d5aa1.jpg) +Figure 1: The architecture of our proposed AVER model + +interactions between words, we employ a bidirectional GRU to transform the word embedding $w_{t}$ to the context-aware representation $h_t$ : + +$$ +h _ {t} ^ {*} = \operatorname {B i - G R U} \left(h _ {t - 1} ^ {*}, w _ {t}\right), \quad * \in [ q, a, s _ {i} ] \tag {1} +$$ + +where $h_t^* \in \mathbb{R}^{d_h}$ is the hidden state at the $t$ -th time step for the corresponding text sequence, $d_h$ is the dimension of the hidden state. We denote the whole sequence as $H_* = [h_1^*, h_2^*, \ldots, h_l^*] \in \mathbb{R}^{l_* \times d_h}$ where $l$ is the corresponding sequence length. + +For predicting the answer veracity, one can note that rich semantic information is implicitly contained in the question text, indicating the importance of capturing the interrelations between the QA pair when encoding them. We thus employ a dual attention mechanism to encode the question and answer text with attention from each other: + +$$ +S = H _ {q} \cdot H _ {a} ^ {T} \in \mathbb {R} ^ {l _ {q} \times l _ {a}} \tag {2} +$$ + +where each item $S_{ij}$ in the alignment matrix $S$ denotes the alignment score between the $i$ -th word in $H_{q}$ and the $j$ -th word in $H_{a}$ . Next we can compute the dual attention weight for the question and answer respectively as follows: + +$$ +\alpha_ {q a} = \operatorname {s o f t m a x} \left(\max _ {\text {r o w}} (S)\right) \tag {3} +$$ + +$$ +\alpha_ {a q} = \operatorname {s o f t m a x} \left(\max _ {\text {r o w}} \left(S ^ {T}\right)\right) \tag {4} +$$ + +$$ +v _ {q} = H _ {q} ^ {T} \cdot \alpha_ {q a}, v _ {a} = H _ {a} ^ {T} \cdot \alpha_ {a q} \tag {5} +$$ + +where $\max_{\mathrm{row}}()$ denotes row-wise max-pooling operation. We can then obtain the encoded question embedding $v_{q}$ and answer embedding $v_{a}$ as the + +weighted sum of the context-aware representations of each word in the corresponding sequence. + +Since the evidence sentences, either reviews or product descriptions are not written specifically for answering the question, we utilize the question text to highlight the important units in the evidence sentences during their encoding process. Therefore, we can obtain the encoded vector representation $v_{s_i}$ for the $i$ -th evidence sentence as follows: + +$$ +T = H _ {s _ {i}} W _ {1} H _ {q} ^ {T} \in \mathbb {R} ^ {l _ {s _ {i}} \times l _ {q}} \tag {6} +$$ + +$$ +v _ {s _ {i}} = H _ {s _ {i}} ^ {T} \cdot \operatorname {s o f t m a x} \left(\max _ {\text {r o w}} (T)\right) \tag {7} +$$ + +where $W_{1}\in \mathbb{R}^{d_{h}\times d_{h}}$ is a trainable weight matrix of the bilinear attention module to incorporate the different writing styles between $q$ and $s_i$ . We denote the encoded representations for all evidence sentences as $v_{s} = [v_{s_{1}},v_{s_{2}},\ldots ,v_{s_{k}}]\in \mathbb{R}^{k\times d_{h}}$ . + +# 4.2 Evidence Sentence Ranking + +One characteristic of our problem setting is that not all evidence sentences are equally useful and reliable. For example, some user reviews can be misleading and even conflicting with other evidences, requiring the model to take such imperfectness of the evidence sentences into consideration. To this end, we design an evidence sentence ranking module to capture the importance of each sentence. + +# 4.2.1 QA-guided Evidence Ranking + +We first use the question and answer to measure the usefulness of each evidence sentence: + +$$ +\beta = f \left(v _ {s} W _ {2} v _ {q} + v _ {s} W _ {3} v _ {a}\right) \tag {8} +$$ + +where $\beta \in \mathbb{R}^k$ denotes the weights for each evidence sentence, $W_{2}$ and $W_{3}$ are trainable parameters. The function $f()$ acts as a gate, which can be sigmoid() or softmax() function, corresponding to two different gating strategies: + +Hard Gate. When the sigmoid() function is applied element-wise for each sentence, the network will tend to assign weights closing to 0 or 1 to each evidence sentence. Thus such process will be similar as an evidence selection process, where only the useful evidence sentences will be "activated" to play the role in verifying the claim. + +Soft Gate. The softmax() function on the other hand will normalize the score for each evidence sentence. Thus, more important evidence can have larger weight and attach more importance in the subsequent prediction process. + +After obtaining a score for each sentence, we then apply an element-wise product to obtain a new representation for each evidence sentence $s_i$ : + +$$ +\bar {v} _ {s} = \beta \otimes v _ {s} \in \mathbb {R} ^ {k \times d _ {h}} \tag {9} +$$ + +# 4.2.2 Evidence Agreement Matching + +One remaining issue is that not all evidence sentences are always reliable. For example, $s_5$ in Table 1 contains opposite opinions with other evidence sentences and can mislead the veracity prediction process. To tackle this issue, we conduct an agreement matching process among the evidences to cross-check their internal coherence: + +$$ +\gamma = \operatorname {s o f t m a x} \left(w _ {4} ^ {T} \tanh \left(W _ {5} \cdot \bar {v} _ {s} ^ {T}\right)\right) \tag {10} +$$ + +where $w_{4} \in \mathbb{R}^{d_{a}}$ and $W_{5} \in \mathbb{R}^{d_{a} \times d_{h}}$ are trainable parameters, $\gamma \in \mathbb{R}^{k}$ denotes the coherence weight for each evidence sentence. As discussed in Lin et al. (2017), such vector representation usually focuses on one specific aspect among the sentences. To capture multiple factual aspects involved in the verification process, we extend Equation 10 to a multi-view agreement matching as follows: + +$$ +\Gamma = W _ {4} \cdot \tanh \left(W _ {5} \cdot \bar {v} _ {s} ^ {T}\right) \tag {11} +$$ + +$$ +\gamma^ {\prime} = \operatorname {s o f t m a x} \left(\max _ {\operatorname {c o l}} (\Gamma)\right) \in \mathbb {R} ^ {k} \tag {12} +$$ + +where $W_{4}\in \mathbb{R}^{n_{a}\times d_{a}}$ and $W_{5}\in \mathbb{R}^{d_{a}\times d_{h}}$ are trainable parameters, $\Gamma$ is the multi-view agreement matching matrix. We then conduct a max-pooling on such matrix and take the softmax operation on the resulting vector to obtain the weight vector $\gamma^{\prime}$ + +Then a combined evidence embedding denoting the most related evidence information from all evidence sentences can be calculated as follows: + +$$ +\tilde {v} _ {s} = \sum_ {i = 1} ^ {k} \bar {v} _ {s _ {i}} \cdot \gamma_ {i} ^ {\prime} \tag {13} +$$ + +Note that the evidence embedding $\bar{v}_s$ is obtained by scaling with the importance weights of each evidence sentence if the soft gate is utilized. Thus we will substitute $\bar{v}_s$ by $v_{s}$ in Equation 13 if the soft gate is utilized, which is also empirically better on our held-out validation set. + +# 4.3 Answer Veracity Prediction + +After obtaining the combined evidence embedding $\tilde{v}_s$ , we utilize it to verify the answer claim. Following (Mou et al., 2016; Yang et al., 2019a) for strengthening the inference relations between the evidence and answer claim, we integrate the answer claim embedding $v_a$ , evidence embedding $\tilde{v}_s$ , their absolute difference $|v_a - \tilde{v}_s|$ , and the element-wise product $v_a \otimes \tilde{v}_s$ into a prediction vector. Moreover, since the question text also implicitly contains useful semantic information, we also concatenate the question embedding $v_q$ to the prediction vector. It is then fed to a MLP layer to make the prediction: + +$$ +\hat {y} = \operatorname {M L P} \left(\left[ v _ {q}, v _ {a}, \tilde {v} _ {s}, \left| v _ {a} - \tilde {v} _ {s} \right|; v _ {a} \otimes \tilde {v} _ {s} \right]\right) \tag {14} +$$ + +The entire model can then be trained end-to-end by computing the cross-entropy loss between the prediction $\hat{y}$ and the ground-truth label $y$ . + +# 5 Experiments + +# 5.1 Experimental Setup + +Dataset As introduced in Section 3, AnswerFact has 60,864 QA pairs in total ${}^{2}$ . We randomly split them into a training set and a test set with the ratio being 90:10. In addition, we set aside 10% data from the training set as the validation set to tune hyper-parameters during training. + +Following previous work (Rashkin et al., 2017; Ma et al., 2019), we conduct experiments in two label settings, one considering all five classes introduced in Table 2, another merging the middle three classes, i.e., PARTTRUE, UNSURE and PARTFALSE as the class MIXED similarly with Ma et al. (2019). Such different label granularities can provide us a more practical and comprehensive understanding of our concerned task. + +
Model3-CLASS5-CLASS
Mac-F1Mic-F1FTRUEFIMIXEDFFALSEMac-F1Mic-F1
CNN-claim0.4420.6480.7910.1440.3900.2490.649
LSTM-claim0.4920.6490.7850.3020.3900.2530.653
DeClarE0.4500.6350.7850.1530.4130.2430.635
NSMN0.5040.6630.7990.2840.4290.2790.651
MultiFC0.5130.6550.7870.3000.4530.2990.655
AVER-w/o gate0.5160.6610.7980.2960.4530.3050.657
AVER-hard gate0.5260.6740.8040.3060.4670.3260.662
AVER-soft gate0.5340.6730.8020.3140.4860.3300.665
+ +Table 4: Performance of various methods for answer veracity predictions on AnswerFact dataset. $\mathbf{F}_{\mathrm{TRUE}}$ , $\mathbf{F}_{\mathrm{MIXED}}$ and $\mathbf{F}_{\mathrm{FALSE}}$ denotes the F1 scores for TRUE, MIXED and FALSE class respectively. + +Experimental Details We utilize the pre-trained 300D GloVe word vectors (Pennington et al., 2014) to initialize the embedding matrix and fine-tune it during training. $k$ in Section 3 is set to 5. The hidden dimension of the Bi-GRU is set to be 256 with dropout of 0.4. For the evidence agreement matching module, we perform a grid search over $n_a$ and $d_a$ with the following hyperparameters where the final setting is underlined: $n_a = [2, \underline{3}, 4]$ and $d_a = [64, \underline{128}, 256]$ . ReLU is used as the activation function in the MLP layer. We assemble batches of answers with similar length together with the batch size being 64. We use the Adam optimiser with learning rate of 0.0005 and train all models on two Tesla K80 GPUs. To avoid overfitting, we conduct early stopping on the validation set with a patience being 5 and add a L2 regularization with the weight of 0.002. + +Evaluation Metrics We use macro and micro averaged F1 score, as well as class-specific F1 score as the evaluation metrics. + +# 5.2 Baseline Models + +We compare our proposed model with the following baseline and state-of-the-art models: 1) CNN-claim and 2) LSTM-claim: Two claim-focused fact checking models based on CNN (Rashkin et al., 2017) and LSTM (Rashkin et al., 2017) for obtaining claim representations respectively. Both of them exploit the claim text solely without considering any external evidence. 3) DeClarE (Popat et al., 2018): An evidence-aware neural fact checking model of textual claims. It utilizes a word-level attention for highlighting important units in evidence sentences. 4) NSMN (Nie et al., 2019): A + +pipeline-based system which ranked first in the FEVER shared task (Thorne et al., 2018b). We use its claim verification module for our task. 5) MultiFC (Augenstein et al., 2019): An evidence-based fact checking model which jointly rank evidence pages and conduct veracity predictions. Since the answer itself often does not contain enough information for the veracity prediction as discussed before, we concatenate the question and answer text as the "claim" for these fact checking models facilitating a more fair comparison. + +For our proposed model, we report its performance with no gate mechanism involved ("AVER-w/o gate"), with hard gate ("AVER-hard gate") and soft gate ("AVER-soft gate") respectively as introduced in Section 4.2.1. + +# 5.3 Veracity Prediction Results + +Table 4 shows the results of different methods for predicting the answer veracity on the AnswerFact dataset with two label settings. It can be observed that models considering evidence information (e.g., MultiFC and AVER model) consistently achieve better results than those relying on claim text only (e.g., CNN-claim model). An exception is the DeClarE model which only obtains similar performance with the CNN-claim method. We conjecture that DeClarE treats each claim-evidence pair as one training instance without considering the relations between evidence sentences. Thus the model can be misled by conflicting evidence sentences and makes random predictions. This further indicates the necessity of selecting and ranking the evidence sentences by their importance for the prediction. + +For our proposed model, we can find that AVER without any gate can already achieve better results + +
3-CLASS5-CLASS
QA (claim) only0.5070.253
+ avg evidence embed0.5140.313
+ fc evidence ranking0.5110.264
+ hard evidence ranking0.5260.326
+ soft evidence ranking0.5340.330
+ +than most baseline models, showing the effectiveness of the agreement matching mechanism among evidence sentences for cross-checking their coherence. With the guide from question and answer information, the model with either soft or hard gate mechanism consistently outperforms all baseline methods on two label settings. This result suggests that the attention information from the QA pair is very important for ranking the evidence sentences and highlighting those more helpful sentences for assisting the prediction. Moreover, we can notice that the model with soft gate obtains better results than the model with hard gate in general, suggesting that measuring the importance of each evidence sentence with a soft weight is better than aggressively determining whether to "select" an evidence sentence or not in the hard gate mechanism for our concerned problem. + +# 5.4 Analysis and Discussion + +In this section, we conduct detailed analysis on our proposed evidence ranking module, which plays an important role for finding out more helpful and reliable evidence sentences for the subsequent veracity prediction. + +# Impact of Evidence Ranking Strategies + +To investigate the effectiveness of our proposed evidence ranking strategy, we substitute it with two possible alternatives and present the results in Table 5. Specifically, we first report the results with QA pair only ("QA only") as a base model. Then we use the average sentence embedding $\frac{1}{k}\sum_{i=1}^{k}v_{s_i}$ to replace $\tilde{v}_s$ in Eq.13 to examine what if we do not consider the relations among the evidence sentences ("avg evidence embed"). We also create another model by utilizing a fully-connected layer to capture the relation of each evidence sentence with the answer and then concatenate these predictions to make the final judgement ("fc evidence ranking") as proposed in Augenstein et al. (2019). + +Table 5: Comparison of different evidence ranking strategies, Macro-F1 scores are reported. + +
3-CLASS5-CLASS
MacMicMacMic
AVER-soft gate0.5340.6730.3300.665
- w/o QA-guided0.5160.6610.3050.657
- w/o agree-match0.5140.6590.2980.656
- w/o multi-view0.5220.6690.3150.656
+ +Table 6: Ablation studies on AVER. Mac/Mic refer to Macro/Micro F1 scores respectively. + +We can see that our proposed model is superior than both alternatives since it carefully ranks the evidence sentences with both information from QA pair and agreement matching. It can be noticed that the model with fully connected evidence ranking performs even worse than averaging the evidence embeddings. This is likely due to the fact that it would be difficult for the model to implicitly learn the relations for each claim-evidence pair given only the veracity label. We alleviate this issue by conducting an agreement matching among the sentences first and then calculating a combined evidence embeddings to assist the prediction. + +# Ablation Study + +We perform ablation studies by discarding some important components of AVER to investigate their effectiveness. For two evidence ranking modules, we discard QA-guided evidence ranking by directly replacing $\bar{v}_s$ in Eq.11 with $v_{s}$ so as to neglect the QA information ("w/o QA-guided"). Then we create another variant by using the weight vector $\beta$ in Eq.8 for calculating the combined evidence embedding in Eq.13 resulting in leaving out the evidence agreement matching component ("w/o agree-match"). As shown in Table 6, both modules contribute to the final veracity prediction performance in either label setting, indicating the importance of treating each evidence sentence differently for predicting the answer veracity. Moreover, we also replace the multi-view agreement matching with the single-view matching operation in Eq.10 ("w/o multi-view"), which leads to an inferior performance. This result indicates that cross-checking the coherence among the evidence from multiple perspectives can better measure the importance of each sentence, thus helping the final prediction. + +# Case Study + +We present a sample case in Table 7 which is correctly predicted as false by AVER. The evidence + +Question: Does this case fit the S4 with the inductive charging back? It is slightly thicker than the original back. + +Answer: No, it will not is only for the S2. + +Verdict: FALSE + +$s_1$ : Love these cases...they fit the Galaxy S4 so well, they even accommodate the wireless charger back plate. +$s_2$ : It fits the s4 perfect, the cut outs are perfect and its not bulky. +$s_3$ : I had a very similar case for my Galaxy S2, so I bought this one hoping it would hold up as well as the first. +$s_4$ : I wish it was available in more colors for the Galaxy S4. +$s_5$ : The case didn't work with extended battery and cover. + +Table 7: A sample case of the prediction where the evidence sentences are ranked by their attention weights. + +sentences are also shown, ranked by their weight $\gamma_i^\prime$ in Eq.12. We can observe that the top ranked evidences are highly topically relevant to the QA pair and coherent to other evidence sentences. Moreover, they contain essential information that can be directly used to infer the verdict of the answer. In contrast, the lower ranked sentences contain less relevant information which should play less important role during the prediction. This example indicates that different importance and usefulness of each evidence sentence need to be taken into consideration when predicting the answer verdict. + +# 6 Conclusions + +In this paper, we investigate the fact checking problem in product question answering forums, aiming to predict the answer veracity so as to provide more reliable online shopping environment. To this end, we introduce AnswerFact, an evidence-based fact checking datasets in QA settings. Further, we propose AVER model to predict answer veracity via tailored evidence ranking module. Extensive experiments show that our proposed method outperforms various established baselines. + +# References + +Isabelle Augenstein, Christina Lioma, Dongsheng Wang, Lucas Chaves Lima, Casper Hansen, Christian Hansen, and Jakob Grue Simonsen. 2019. Multifc: A real-world multi-domain dataset for evidence-based fact checking of claims. 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 4684-4696. +Ramy Baly, Mitra Mohtarami, James R. Glass, Lluís Márquez, Alessandro Moschitti, and Preslav Nakov. + +2018. Integrating stance detection and fact checking in a unified corpus. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT, pages 21-27. +David Carmel, Liane Lewin-Eytan, and Yoelle Maarek. 2018. Product question answering using customer generated content-research challenges. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pages 1349-1350. +Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, Brian Strope, and Ray Kurzweil. 2018. Universal sentence encoder for english. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, EMNLP 2018: System Demonstrations, pages 169-174. +Tianqi Chen and Carlos Guestrin. 2016. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 785-794. +Wenhu Chen, Hongmin Wang, Jianshu Chen, Yunkai Zhang, Hong Wang, Shiyang Li, Xiyou Zhou, and William Yang Wang. 2020. Tabfact: A large-scale dataset for table-based fact verification. In International Conference on Learning Representations ICLR 2020. +Yang Deng, Wai Lam, Yuexiang Xie, Daoyuan Chen, Yaliang Li, Min Yang, and Ying Shen. 2020. Joint learning of answer selection and answer summary generation in community question answering. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, pages 7651-7658. +Leon Derczynski, Kalina Bontcheva, Maria Liakata, Rob Procter, Geraldine Wong Sak Hoi, and Arkaitz Zubiaga. 2017. Semeval-2017 task 8: Rumoureval: Determining rumour veracity and support for rumours. In Proceedings of the 11th International Workshop on Semantic Evaluation, SemEval@ACL 2017, pages 69-76. +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. +Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. 2017. A structured self-attentive sentence embedding. In 5th International Conference on Learning Representations, ICLR 2017. + +Jing Ma, Wei Gao, Shafiq R. Joty, and Kam-Fai Wong. 2019. Sentence-level evidence embedding for claim verification with hierarchical attention networks. In Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, pages 2561-2571. +Tsvetomila Mihaylova, Georgi Karadzhov, Pepa Atanasova, Remy Baly, Mitra Mohtarami, and Preslav Nakov. 2019. Semeval-2019 task 8: Fact checking in community question answering forums. In Proceedings of the 13th International Workshop on Semantic Evaluation, SemEval@NAACL-HLT 2019, pages 860-869. +Tsvetomila Mihaylova, Preslav Nakov, Lluís Marquez, Alberto Barrón-Cedeño, Mitra Mohtarami, Georgi Karadzhov, and James R. Glass. 2018. Fact checking in community forums. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), pages 5309-5316. +Lili Mou, Rui Men, Ge Li, Yan Xu, Lu Zhang, Rui Yan, and Zhi Jin. 2016. Natural language inference by tree-based convolution and heuristic matching. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 130-136. +Preslav Nakov, Doris Hoogeveen, Lluis Márquez, Alessandro Moschitti, Hamdy Mubarak, Timothy Baldwin, and Karin Verspoor. 2017. Semeval-2017 task 3: Community question answering. In Proceedings of the 11th International Workshop on Semantic Evaluation, SemEval@ACL 2017, pages 27-48. +Yixin Nie, Haonan Chen, and Mohit Bansal. 2019. Combining fact extraction and verification with neural semantic matching networks. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, pages 6859–6866. +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, EMNLP 2014, pages 1532-1543. +Verónica Pérez-Rosas, Bennett Kleinberg, Alexandra Lefevre, and Rada Mihalcea. 2018. Automatic detection of fake news. In Proceedings of the 27th International Conference on Computational Linguistics, COLING 2018, pages 3391-3401. +Kashyap Popat, Subhabrata Mukherjee, Andrew Yates, and Gerhard Weikum. 2018. Declare: Debunking fake news and false claims using evidence-aware deep learning. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 22-32. +Hannah Rashkin, Eunsol Choi, Jin Yea Jang, Svitlana Volkova, and Yejin Choi. 2017. Truth of varying + +shades: Analyzing language in fake news and political fact-checking. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, EMNLP 2017, pages 2931-2937. +Karishma Sharma, Feng Qian, He Jiang, Natali Ruchansky, Ming Zhang, and Yan Liu. 2019. Combating fake news: A survey on identification and mitigation techniques. ACM TIST, 10(3):21:1-21:42. +Aaron Smith and Monica Anderson. 2016. Online shopping and e-commerce. +Bakhtiyar Syed, Vijayasaradhi Indurthi, Manish Shrivastava, Manish Gupta, and Vasudeva Varma. 2019. Fermi at semeval-2019 task 8: An elementary but effective approach to question discernment in community QA forums. In Proceedings of the 13th International Workshop on Semantic Evaluation, SemEval@NAACL-HLT 2019, pages 1160-1164. +Yi Tay, Minh C. Phan, Anh Tuan Luu, and Siu Cheung Hui. 2017. Learning to rank question answer pairs with holographic dual LSTM architecture. In Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 695-704. +James Thorne and Andreas Vlachos. 2018. Automated fact checking: Task formulations, methods and future directions. In Proceedings of the 27th International Conference on Computational Linguistics, COLING 2018, pages 3346-3359. +James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018a. FEVER: a large-scale dataset for fact extraction and verification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2018, pages 809-819. +James Thorne, Andreas Vlachos, Oana Cocarascu, Christos Christodoulopoulos, and Arpit Mittal. 2018b. The fact extraction and VERIFICATION (FEVER) shared task. In Proceedings of the First Workshop on Fact Extraction and VERIFICATION (FEVER), pages 1-9. +Andreas Vlachos and Sebastian Riedel. 2014. Fact checking: Task definition and dataset construction. In Proceedings of the Workshop on Language Technologies and Computational Social Science@ACL 2014, pages 18-22. +Mengting Wan and Julian J. McAuley. 2016. Modeling ambiguity, subjectivity, and diverging viewpoints in opinion question answering systems. In IEEE 16th International Conference on Data Mining, ICDM 2016, pages 489-498. +William Yang Wang. 2017. "liar, liar pants on fire": A new benchmark dataset for fake news detection. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, pages 422-426. + +Penghui Wei, Nan Xu, and Wenji Mao. 2019. Modeling conversation structure and temporal dynamics for jointly predicting rumor stance and veracity. 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 4787-4798. +Runqi Yang, Jianhai Zhang, Xing Gao, Feng Ji, and Haiqing Chen. 2019a. Simple and effective text matching with richer alignment features. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4699-4709. +Xiao Yang, Madian Khabsa, Miaosen Wang, Wei Wang, Ahmed Hassan Awadallah, Daniel Kifer, and C. Lee Giles. 2019b. Adversarial training for community question answer selection based on multiscale matching. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, pages 395-402. +Wenxuan Zhang, Yang Deng, and Wai Lam. 2020a. Answer ranking for product-related questions via multiple semantic relations modeling. In Proceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval, pages 569-578. +Wenxuan Zhang, Wai Lam, Yang Deng, and Jing Ma. 2020b. Review-guided helpful answer identification in e-commerce. In WWW '20: The Web Conference 2020, pages 2620-2626. \ No newline at end of file diff --git a/answerfactfactcheckinginproductquestionanswering/images.zip b/answerfactfactcheckinginproductquestionanswering/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..59d78170ae15acae5a68018273ab31fc73873076 --- /dev/null +++ b/answerfactfactcheckinginproductquestionanswering/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abfb39c1a8457242be2c167e3b7ad4143a76e75719b4e170e4a923a3c3b619ca +size 318493 diff --git a/answerfactfactcheckinginproductquestionanswering/layout.json b/answerfactfactcheckinginproductquestionanswering/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7314175edcf9574ce5116d8d8dbdc3982fbb3e84 --- /dev/null +++ b/answerfactfactcheckinginproductquestionanswering/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d35e23e33cba9d4d0c11e94c41e3a99859c4415b945d84a7a51dd29dcfcd6efc +size 357935 diff --git a/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_content_list.json b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6af74a886108eedd7da110cf192fc8492dc49cd2 --- /dev/null +++ b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80cb3068a295f68d7bf2da65f7a0a2048cd20e4f4bcafc23f65ad961b4a2a52e +size 100610 diff --git a/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_model.json b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1877c1e675339b400fab6e008f15acaa9fb2c27e --- /dev/null +++ b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cdfe0c47e33f07ead93f89ffba5094577157a365b547f30c9449367adab4990 +size 121200 diff --git a/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_origin.pdf b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2e01862a29acc48fca141e9329b23e42f3036375 --- /dev/null +++ b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/1ff607ff-835c-45f9-8a37-6b4741eef517_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6507888bee67207c7c60dd2284efebd3613f851b00b446009bbd79f01ba4a58d +size 775383 diff --git a/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/full.md b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..fb4b53cb8210c469406547fa48db9ea447a5257e --- /dev/null +++ b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/full.md @@ -0,0 +1,373 @@ +# An Unsupervised Joint System for Text Generation from Knowledge Graphs and Semantic Parsing + +Martin Schmitt1 Sahand Sharifzadeh2 Volker Tresp2,3 Hinrich Schütze1 + +$^{1}$ Center for Information and Language Processing (CIS), LMU Munich + $^{2}$ Department of Informatics, LMU Munich + $^{3}$ Siemens AG Munich +martin@cis.lmu.de + +# Abstract + +Knowledge graphs (KGs) can vary greatly from one domain to another. Therefore supervised approaches to both graph-to-text generation and text-to-graph knowledge extraction (semantic parsing) will always suffer from a shortage of domain-specific parallel graph-text data; at the same time, adapting a model trained on a different domain is often impossible due to little or no overlap in entities and relations. This situation calls for an approach that (1) does not need large amounts of annotated data and thus (2) does not need to rely on domain adaptation techniques to work well in different domains. To this end, we present the first approach to unsupervised text generation from KGs and show simultaneously how it can be used for unsupervised semantic parsing. We evaluate our approach on WebNLG v2.1 and a new benchmark leveraging scene graphs from Visual Genome. Our system outperforms strong baselines for both text $\leftrightarrow$ graph conversion tasks without any manual adaptation from one dataset to the other. In additional experiments, we investigate the impact of using different unsupervised objectives. + +# 1 Introduction + +Knowledge graphs (KGs) are a general-purpose approach for storing information in a structured, machine-accessible way (Van Harmelen et al., 2008). They are used in various fields and domains to model knowledge about topics as different as lexical semantics (Fellbaum, 2005; van Assem et al., 2006), common sense (Speer et al., 2017; Sap et al., 2019), biomedical research (Wishart et al., 2018) and visual relations in images (Lu et al., 2016). + +This ubiquity of KGs necessitates interpretability because diverse users – both experts and non-experts – work with them. Even though, in prin + +ciple, a KG is human-interpretable, non-experts may have difficulty making sense of it. Thus, there is a need for methods, such as automatic natural language generation ("graph→text"), that support them. + +Semantic parsing, i.e., the conversion of a text to a formal meaning representation, such as a KG, ("text $\rightarrow$ graph") is equally important because it makes information that only exists in text form accessible to machines, thus assisting knowledge base engineers in KG creation and completion. + +As KGs are so flexible in expressing various kinds of knowledge, separately created KGs vary a lot. This unavoidably leads to a shortage of training data for both graph $\leftrightarrow$ text tasks. We therefore propose an unsupervised model that (1) easily adapts to new KG domains and (2) only requires unlabeled (i.e., non-parallel) texts and graphs from the target domain, together with a few fact extraction heuristics, but no manual annotation. + +To show the effectiveness of our approach, we conduct experiments on the latest release (v2.1) of the WebNLG corpus (Shimorina and Gardent, 2018) and on a new benchmark we derive from Visual Genome (Krishna et al., 2016). While both of these datasets contain enough annotations to train supervised models, we evaluate our unsupervised approach by ignoring these annotations. The datasets are particularly well-suited for our evaluation as both graphs and texts are completely human-generated. Thus for both our tasks, models are evaluated with natural, i.e., human-generated targets. + +Concretely, we make the following contributions: (1) We present the first unsupervised non-template approach to text generation from KGs (graph $\rightarrow$ text). (2) We jointly develop a new unsupervised approach to semantic parsing that automatically adjusts to a target KG schema (text $\rightarrow$ graph). (3) In contrast to prior unsupervised graph $\rightarrow$ text and text $\rightarrow$ graph work, our model does not re + +quire manual adaptation to new domains or graph schemas. (4) We provide a thorough analysis of the impact of different unsupervised objectives, especially the ones we newly introduce for text $\leftrightarrow$ graph conversion. (5) We create a new large-scale dataset for text $\leftrightarrow$ graph transformation tasks in the visual domain. + +# 2 Related Work + +graph $\rightarrow$ text. Our work is the first attempt at fully unsupervised text generation from KGs. In this respect it is only comparable to traditional rule- or template-based approaches (Kukich, 1983; McRoy et al., 2000). However, in contrast to these approaches, which need to be manually adapted to new domains and KG schemas, our method is generally applicable to all kinds of data without modification. + +There is a large body of literature about supervised text generation from structured data, notably about the creation of sports game summaries from statistical records (Robin, 1995; Tanaka-Ishii et al., 1998). Recent efforts make use of neural encoder-decoder mechanisms (Wiseman et al., 2017; Puduppully et al., 2019). Although text creation from relational databases is related and our unsupervised method is, in principle, also applicable to this domain, in our work we specifically address text creation from graph-like structures such as KGs. + +One recent work on supervised text creation from KGs is (Bhowmik and de Melo, 2018). They generate a short description of an entity, i.e., a single KG node, based on a set of facts about the entity. We, however, generate a description of the whole KG, which involves multiple entities and their relations. Koncel-Kedziorski et al. (2019) generate texts from whole KGs. They, however, do not evaluate on human-generated KGs but automatically generated ones from the scientific information extraction tool SciIE (Luan et al., 2018). Their supervised model is based on message passing through the topology of the incidence graph of the KG input. Such graph neural networks (Kipf and Welling, 2017; Velicković et al., 2018) have been widely adopted in supervised graph-to-text tasks (Beck et al., 2018; Damonte and Cohen, 2019; Ribeiro et al., 2019, 2020). + +Even though Marcheggiani and Perez-Beltrachini (2018) report that graph neural networks can make better use of graph input than RNNs for supervised learning, for our unsuper + +vised approach we follow the line of research that uses RNN-based sequence-to-sequence models (Cho et al., 2014; Sutskever et al., 2014) operating on serialized triple sets (Gardent et al., 2017b; Trisedya et al., 2018; Gehrmann et al., 2018; Castro Ferreira et al., 2019; Fan et al., 2019). We make this choice because learning a common semantic space for both texts and graphs by means of a shared encoder and decoder is a central component of our model. It is a nontrivial, separate research question whether and how encoder-decoder parameters can effectively be shared for models working on both sequential and non-sequential data. We thus leave the adaptation of our approach to graph neural networks for future work. + +text $\rightarrow$ graph. Converting a text into a KG representation, our method is an alternative to prior work on open information extraction (Niklaus et al., 2018) with the advantage that the extractions, though trained without labeled data, automatically adjust to the KGs used for training. It is therefore also related to relation extraction in the unsupervised (Yao et al., 2011; Marcheggiani and Titov, 2016; Simon et al., 2019) and distantly supervised setting (Riedel et al., 2010; Parikh et al., 2015). However, these systems merely predict a single relation between two given entities in a single sentence, while we translate a whole text into a KG with potentially multiple facts. + +Our text $\rightarrow$ graph task is therefore most closely related to semantic parsing (Kamath and Das, 2019), but we convert statements into KG facts whereas semantic parsing typically converts a question into a KG or database query. Poon and Domingos (2009) proposed the first unsupervised approach. They, however, still need an additional KG alignment step, i.e., are not able to directly adjust to the target KG. Other approaches overcome this limitation but only in exchange for the inflexibility of manually created domain-specific lexicons (Popescu et al., 2004; Goldwasser et al., 2011). Poon (2013)'s approach is more flexible but still relies on preprocessing by a dependency parser, which generally means that language-specific annotations to train such a parser are needed. Our approach is end-to-end, i.e., does not need any language-specific preprocessing during inference and only depends on a POS tagger used in the rule-based text $\rightarrow$ graph system to bootstrap training. + +Unsupervised sequence generation. Our unsu- + +pervised training regime for both text $\leftrightarrow$ graph tasks is inspired by (Lample et al., 2018b). They used self-supervised pretraining and backtranslation for unsupervised translation from one language to another. We adapt these principles and their noise model to our tasks, and introduce two new noise functions specific to text $\leftrightarrow$ graph conversion. + +# 3 Preliminaries + +# 3.1 Data structure + +We formalize a KG as a labeled directed multigraph $(V,E,s,t,l)$ where entities are nodes $V$ and edges $E$ represent relations between entities. The lookup functions $s,t:E\to V$ assign to each edge its source and target node. The labeling function $l$ assigns labels to nodes and edges where node labels are entity names and edge labels come from a predefined set $\mathcal{R}$ of relation types. + +An equivalent representation of a KG is the set of its facts. A fact is a triple consisting of an edge's source node (the subject), the edge itself (the predicate), and its target node (the object). So the set of facts $\mathcal{F}$ of a KG can be obtained from its edges: + +$$ +\mathcal {F} := \left\{\left(s (e), e, t (e)\right) \mid e \in E \right\}. +$$ + +Applying $l$ to all triple elements and writing out $\mathcal{F}$ in an arbitrary order generates a serialization that makes the KG accessible to sequence models otherwise used only for text. This has the advantage that we can train a sequence encoder to embed text and KGs in the same semantic space. Specifically, we serialize a KG by writing out its facts separated with end-of-fact symbols (EOF) and elements of each fact with special SEP symbols. We thus define our task as a sequence-to-sequence (seq2seq) task. + +# 3.2 Scene Graphs + +The Visual Genome (VG) repository is a large collection of images with associated manually annotated scene graphs; see Fig. 1. A scene graph formally describes image objects with their attributes, e.g., (hydrant, attr, yellow), and their relations to other image objects, e.g., (woman, in, shorts). Each scene graph is organized into smaller subgraphs, known as region graphs, representing a subpart of a more complex larger picture that is interesting on its own. Each region graph is associated with an English text, the region description. Texts and graphs were not automatically produced from each other, but were collected from crowdworkers who + +![](images/767256399640fef03c4585746b9f42ed0b2898fe33f8e8ae156831f7fe7c112a.jpg) +Figure 1: Region graphs and textual region descriptions in Visual Genome (VG). Image regions serve as common reference for text and graph creation but are disregarded in our work. We solely focus on the pairs of corresponding texts and graphs. Illustration adapted from (Krishna et al., 2016). + +![](images/5a153438d30335cd1584566eb108e1ef139ca12fb31cf98a6426e0c9da4d0989.jpg) +Figure 2: Example graph in our new VG benchmark. + +were presented an image region and then generated text and graph. So although the graphs were not specifically designed to closely resemble the texts, they describe the same image region. This semantic correspondence makes scene graph $\leftrightarrow$ text conversion an interesting and challenging problem because text and graph are not simple translations of each other. + +Scene graphs are formalized in the same way as other KGs: $V$ here contains image objects and their attributes, and $\mathcal{R}$ contains all types of visual relationships and the special label attr for edges between attribute and non-attribute nodes. Fig. 2 shows an example. + +VG scene graphs have been used before for traditional KG tasks, such as KG completion (Wan et al., 2018), but we are the first to use them for a text $\leftrightarrow$ graph conversion dataset. + +# 4 Approaches + +# 4.1 Rule-based systems + +We propose a rule-based system as unsupervised baseline for each of the text $\leftrightarrow$ graph tasks. Note that they both assume that the texts are in English. $\mathbf{R}^{\mathrm{graph}\rightarrow \mathrm{text}}$ . From a KG serialization, we remove + +
noise functionbehavior
swapapplies a random permutation σ of words or facts with +∀i ∈ {1, . . ., n}, |σ(i) - i| ≤ k; k = 3 for text, k = +∞ for knowledge graphs.
dropremoves each fact/word with a probability of pdrop.
blankreplaces each fact/word with a probability of pblank by a special symbol blanked.
repeatinserts repetitions with a probability of prepeat in a sequence of facts/words.
rulegenerates a noisy translation by applying Rgraph→text to a graph or Rtext→graph to a text.
+ +Table 1: Noise functions and their behavior on graphs and texts. + +![](images/c7de6ff2603537613771710e84df35074eedb61db9cae85d4ec496ff4de97e76.jpg) +Figure 3: Example noisy training instance for the graph $\rightarrow$ text task in the composed noise setting. The fact highlighted in red is removed by drop, the one in blue is replaced with blanked by blank, the one in orange is repeated by repeat. + +SEP symbols and replace EOF symbols by the word and. The special label attr is mapped to is. This corresponds to a template-based enumeration of all KG facts. See Table 5 for an example. + +$\mathbf{R}^{\mathrm{text}\rightarrow \mathrm{graph}}$ . After preprocessing a text with NLTK's default POS tagger (Loper and Bird, 2004) and removing stop words, we apply two simple heuristics to extract facts: (1) Each verb becomes a predicate; is creates facts with predicate attr. The content words directly before and after such a predicate word become subject and object. (2) Adjectives $a$ form attributes, i.e., build facts of the form $(X,\mathrm{attr},a)$ where $X$ is filled with the first noun after $a$ . These heuristics are similar in nature to a rudimentary parser. See Table 8 for an example. + +# 4.2 Neural seq2seq systems + +Our main system is a neural seq2seq architecture. We equip the standard encoder-decoder model with attention (Bahdanau et al., 2014) and copy mechanism (Gu et al., 2016). Allowing the model to + +directly copy from the source to the target side is beneficial in data to text generation (Wiseman et al., 2017; Puduppully et al., 2019). The encoder (resp. decoder) is a bidirectional (resp. unidirectional) LSTM (Hochreiter and Schmidhuber, 1997). Dropout (Hinton et al., 2012) is applied at the input of both encoder and decoder (Britz et al., 2017). We combine this model with the following concepts: + +Multi-task model. In unsupervised machine translation, systems are trained for both translation directions (Lample et al., 2018b). In the same way, we train our system for both conversion tasks text $\leftrightarrow$ graph, sharing encoder and decoder. To tell the decoder which type of output should be produced (text or graph), we initialize the cell state of the decoder with an embedding of the desired output type. The hidden state of the decoder is initialized with the last state of the encoder as usual. + +Noisy source samples. Lample et al. (2018a) introduced denoising auto-encoding as pretraining and auxiliary task to train the decoder to produce well-formed output and make the encoder robust to noisy input. The training examples for this task consist of a noisy version of a sentence as source and the original sentence as target. We adapt this idea and propose the following noise functions for the domains of graphs and texts: swap, drop, blank, repeat, rule. Table 1 describes their behavior. swap, drop and blank are adapted from (Lample et al., 2018a) with facts in graphs taking the role of words in text. As order should be irrelevant in a set of facts, we drop the locality constraint in the swap permutation for graphs by setting $k = +\infty$ . + +Denoising samples generated by repeat requires the model to learn to remove redundant information in a set of facts. In the case of text, repeat mimics a behavior often observed with insufficiently trained neural models, i.e., repeating words considered important. + +Unlike the other noise functions, rule does not "perturb" its input, but rather noisily backtranslates + +it. We will see in Section 7 that bootstrapping with these noisy translations is essential. + +We consider two fundamentally different noise injection regimes: (1) The composed noise setting is an adaptation of Lample et al. (2018a)'s noise model (blankdropswap) where our newly introduced noise functions rule and repeat are added to the start and end of the pipeline, i.e., all data samples are treated equally with the same noise function $C_{\mathrm{comp}} \coloneqq \text{repeat} \circ \text{blank} \circ \text{drop} \circ \text{swap} \circ \text{rule}$ . Figure 3 shows an example. (2) In the sampled noise setting, we do not use all noise functions at once but sample a single one per data instance. + +# 4.3 Training regimes + +We denote the sets of graphs and corresponding texts by $\mathcal{G}$ and $\mathcal{T}$ . The set of available supervised examples $(x,y)\in \mathcal{G}\times \mathcal{T}$ is called $S\subset \mathcal{G}\times \mathcal{T}$ . $P_{g}$ and $P_{t}$ are probabilistic models that generate, conditioned on any input, a graph $(g)$ or a text $(t)$ . Unsupervised training. We first obtain a language model for both graphs and text by training one epoch with the denoising auto-encoder objective: + +$$ +\begin{array}{l} \mathcal {L} ^ {\text {d e n o i s e}} = \underset {x \sim \mathcal {G}} {\mathbb {E}} [ - \log P _ {g} (x | C (x)) ] + \\ \underset {y \sim \mathcal {T}} {\mathbb {E}} [ - \log P _ {t} (y | C (y)) ] \\ \end{array} +$$ + +where $C \in \{C_{\mathrm{comp}}\}$ for composed noise and $C \in \{\mathrm{swap}, \mathrm{blank}, \mathrm{drop}, \mathrm{repeat}, \mathrm{rule}\}$ for sampled noise. In this pretraining epoch only, we use all possible noise functions individually on all available data. As sampled noise incorporates five different noise functions and composed noise only one, this results in five times more pretraining samples for sampled noise than for composed noise. + +In subsequent epochs, we additionally consider $\mathcal{L}^{\mathrm{back}}$ as training signal: + +$$ +\begin{array}{l} \mathcal {L} ^ {\text {b a c k}} = \underset {x \sim \mathcal {G}} {\mathbb {E}} [ - \log P _ {g} (x | z ^ {*} (x)) ] + \\ \underset {y \sim \mathcal {T}} {\mathbb {E}} [ - \log P _ {t} (y | w ^ {*} (y)) ] \\ \end{array} +$$ + +$$ +z ^ {*} (x) = \underset {z} {\arg \max } P _ {t} (z | x) +$$ + +$$ +w ^ {*} (y) = \underset {w} {\arg \max} P _ {g} (w | y) +$$ + +This means that, in each iteration, we apply the current model to backtranslate a text (graph) to obtain a potentially imperfect graph (text) that we can use as noisy source with the clean original input being the target. This gives us a pseudo-parallel training instance for the next iteration - recall that + +
VGVGballWebNLG
train split size2,412,253151,79034,338
val split size323,47821,5414,313
test split size324,66420,5694,222
#relation types36,5065,167373
avg #facts in graph2.72.53.0
avg #tokens in text5.45.522.8
avg % text tokens in graph49.350.649.4
avg % graph tokens in text52.354.775.6
+ +Table 2: Statistics of WebNLG v2.1 and our newly created benchmark VG; $\mathrm{VG}_{\mathrm{ball}}$ is a subset of VG representing images from ball sports events. Data split sizes are given as number of graph-text pairs. + +we address unsupervised generation, i.e., without access to parallel data. + +The total loss in these epochs is $\mathcal{L}^{\mathrm{back}} + \mathcal{L}^{\mathrm{denoise}}$ , where now $\mathcal{L}^{\mathrm{denoise}}$ only samples one possible type of noise independently for each data instance. + +Supervised training. Our intended application is an unsupervised scenario. For our two datasets, however, we have labeled data (i.e., a "parallel corpus") and so can also compare our model to its supervised variant. Although supervised performance is generally better, it serves as a reference point and gives us an idea of the impact of supervision as opposed to factors like model architecture and hyperparameters. The supervised loss is simply defined as follows: + +$$ +\mathcal {L} ^ {\sup } = \underset {(x, y) \sim \mathcal {S}} {\mathbb {E}} \left[ - \log P _ {t} (y | x) - \log P _ {g} (x | y) \right] +$$ + +# 5 Experiments + +# 5.1 Data + +For our experiments, we randomly split the VG images 80/10/10 into train/val/test. We then remove all graphs from train that also occur in one of the images in val or test. Finally, we unify graph serialization duplicates with different texts to single instances with multiple references for graph $\rightarrow$ text and proceed analogously with text duplicates for text $\rightarrow$ graph. For WebNLG v2.1, we use the data splits as provided. Following (Gardent et al., 2017a), we resolve the camel case of relation names and remove underscores from entity names in a preprocessing step. For both datasets, the order of facts in graph serializations corresponds to the order of triples in the original dataset. Because of VG's enormous size and limited computation power, we additionally create a closed-domain ball + +
graph → textVisual GenomeWebNLG
BLEUMETEORCHRF++BLEUMETEORCHRF++
valtestvaltestvaltestvaltestvaltestvaltest
Rgraph→text5.95.928.228.143.443.318.318.333.533.655.055.2
Ours w/ sampled noise19.819.531.431.250.950.739.137.735.435.561.962.1
Ours w/ composed noise23.223.233.032.953.753.630.830.530.230.053.152.8
Ours supervised26.526.432.332.253.753.635.134.439.639.564.164.0
+ +sports subset of VG, called $\mathrm{VG}_{\mathrm{ball}}$ , which we can use to quickly conduct additional experiments (see Section 7). We identify all images where at least one region graph contains at least one fact that mentions an object ending with ball and take all regions from them (keeping data splits the same). In contrast to alternatives like random subsampling, we consider this domain-focused construction more realistic. + +Table 2 shows relevant statistics for all datasets. While VG and WebNLG have similar statistics, VG is around 70 times larger than WebNLG, which makes it an interesting benchmark for future research, both supervised and unsupervised. Apart from size, there are two important differences: (1) The VG graph schema has been freely defined by crowd workers and thus features a large variety of different relations. (2) The percentage of graph tokens occurring in the text, a measure important for the text $\rightarrow$ graph task, is lower for VG than for WebNLG. Thus, VG graphs contain more details than their corresponding texts, which is a characteristic feature of the domain of image captions: they mainly describe the salient image parts. + +# 5.2 Training details + +We train all models with the Adam optimizer (Kingma and Ba, 2015) for maximally 30 epochs. We stop supervised models early when $\mathcal{L}^{\mathrm{sup}}$ does not decrease on val for 10 epochs. Unsupervised models are stopped after 5 iterations on VG because of its big size and limited computational resources. All hyperparameters and more details are described in Appendices A and B. Our implementation is based on AllenNLP (Gardner et al., 2017). + +In unsupervised training, input graphs and texts are the same as in supervised training - only the gold target sides are ignored. While it is an artificial setup to split paired data and treat them as + +Table 3: Results for unsupervised and supervised text generation. Note that training a supervised model on millions of labeled samples is usually not an option. Best unsupervised models are identified by best BLEU on $\nu_{100}$ . BLEU and METEOR are computed with scripts from (Lin et al., 2018); the CHRF++ script is from (Popovic, 2017b). + +
#sampled noisecomposed noise
UV100valtestUV100valtest
180.47.810.19.972.215.919.819.7
250.77.29.29.141.214.015.215.1
367.619.519.419.261.022.723.523.4
456.421.219.819.551.922.221.421.3
562.920.019.619.460.524.523.223.2
+ +Table 4: BLEU scores on VG for our unsupervised models evaluated for graph $\rightarrow$ text at different iterations. $\mathcal{U}$ is calculated on all unlabeled data used for training. $\nu_{100}$ is a 100-size random sample from val. All results are computed with scripts from (Lin et al., 2018). + +unpaired, this not only makes the supervised and unsupervised settings more directly comparable, but also ensures that the text data resemble the evaluation texts in style and domain. For the purpose of experiments on a benchmark, this seems appropriate to us. For a concrete use case, it would be an important first step to find adequate texts that showcase the desired language style and that are about a similar topic as the KGs that are to be textualized. As KGs are rarely the only means of storing information, e.g., in an industrial context, such texts should not be hard to come by in practice. + +# 6 Results and Discussion + +# 6.1 Text generation from graphs + +Model selection. Table 4 shows how performance of our unsupervised model changes at every back-translation iteration, measured in BLEU (Papineni et al., 2002), a common metric for natural language generation. For model selection, we adopt the two methods proposed by Lample et al. (2018b), i.e., a small validation set (we take a 100-size random subset of val, called $\nu_{100}$ ) and a fully unsupervised criterion $(\mathcal{U})$ where BLEU compares an unlabeled sample with its back-and-forth translation. We confirm their finding that $\mathcal{U}$ is not reliable for neural + +
(a) Reference texta baseball cap on a baby's head
(b) Rgraph→textbaby is small and baby is wrapped in blanket and hat is pink and hat is baseball hat and baby wearing hat
(c) Unsuperv. neural modelsmall baby wrapped in blanket with pink baseball hat
(d) Superv. neural modelbaby wearing a pink hat
+ +text generation models whereas $\nu_{100}$ correlates better with performance on the larger test sets. We use $\nu_{100}$ for model selection in the rest of this paper. + +Quantitative evaluation. Table 3 shows BLEU, METEOR (Banerjee and Lavie, 2005) and $\mathrm{CHRF} + +$ (Popovic, 2017a) for our unsupervised models and the rule baseline $\mathbf{R}^{\mathrm{graph}\rightarrow \mathrm{text}}$ , which is in many cases, i.e., if parallel graph-text data are scarce, the only alternative. + +First, we observe that $\mathrm{R}^{\mathrm{graph}\rightarrow\mathrm{text}}$ performs much better on WebNLG than VG, indicating that our new benchmark poses a tougher challenge. Second, our unsupervised models consistently outperform this baseline on all metrics and on both datasets, showing that our method produces textual descriptions much closer to human-generated ones. Third, noise composition, the general default in unsupervised machine translation, does not always perform better than noise sampling. Thus, it is worthwhile to try different noise settings for new tasks or datasets. + +Surprisingly, supervised and unsupervised models perform nearly on par. Real supervision does not seem to give much better guidance in training than our unsupervised regime, as measured by our three metrics on two different datasets. Some metric-dataset combinations even favor one of the unsupervised models. Our qualitative observations provide a possible explanation for that. + +Qualitative observations. Taking a look at example generations (Table 5), we also see qualitatively how much easier it is to grasp the content of our natural language summarization than reading through a simple enumeration of KG facts. We find that the unsupervised model (c) seems to output the KG information in a more complete manner than its supervised counterpart (d). The supervision probably introduces a bias present in the training data that image captions focus on salient image parts and therefore the supervised model is encouraged to omit information. As it never sees a corresponding + +Table 5: Texts generated from graph in Fig. 2. + +
#sampled noisecomposed noise
UV100valtestUV100valtest
119.11.01.21.217.02.02.22.2
271.021.719.118.849.322.122.121.7
358.219.318.618.345.918.719.719.4
462.318.319.118.854.419.920.820.5
563.719.819.018.749.018.819.018.8
+ +Table 6: F1 scores on VG for our models from Table 4 evaluated on text $\rightarrow$ graph at different iterations. + +
text → graphVGWebNLG
valtestvaltest
Rtext→graph13.413.10.00.0
Stanford SG Parser19.519.30.00.0
Ours w/ sampled noise19.118.838.539.1
Ours w/ composed noise22.121.732.533.1
Ours supervised23.523.052.852.8
+ +Table 7: F1 scores of facts extracted by our unsupervised semantic parsing (text→graph) systems and our model trained with supervision. + +text-graph pair together, the unsupervised model cannot draw such a conclusion. + +# 6.2 Graph extraction from texts + +We evaluate semantic parsing (text→graph) performance by computing the micro-averaged F1 score of extracted facts. If there are multiple reference graphs (cf. Section 5.1), an extracted fact is considered correct if it occurs in at least one reference graph. For the ground truth number of facts to be extracted from a given text, we take the maximum number of facts of all its reference graphs. + +Model selection. Table 6 shows that (compared to text generation quality) $\mathcal{U}$ is more reliable for text $\rightarrow$ graph performance. For sampled noise, it correctly identifies the best iteration, whereas for composed noise it chooses second best. In both noise settings, $\nu_{100}$ perfectly chooses the best model. + +Quantitative observations. Table 7 shows a comparison of our unsupervised models with two rule-based systems, our $\mathrm{R}^{\mathrm{text}\rightarrow \mathrm{graph}}$ and the highly domain-specific Stanford Scene Graph Parser (SSGP) by Schuster et al. (2015). + +We choose these two baselines to adequately represent the state of the art in the unsupervised setting. Recall from Section 2 that the only previous unsupervised works either cannot adapt to a target graph schema (open information extraction), which means their precision and recall of retrieved facts is always 0, or have been created for SQL query + +
Input sentenceMan wearing a colorful shirt and white pants playing tennis
Reference (RG)(shirt, attr, colorful) +(pants, attr, white) +(man, wearing, shirt) +(man, wearing, pants)
Rtext→graph(Man, wearing, colorful)
(shirt, attr, colorful)
(pants, attr, white)
(pants, playing, tennis)
Stanford Scene Graph Parser(shirt, play, tennis) , +(pants, play, tennis) , +(shirt, attr, colorful) , +(pants, attr, white)
Unsuperv. model w/ composed noise(pants, attr, colorful)
(pants, attr, white)
(man, wearing, shirt)
(man, playing, tennis)
Supervised model(shirt, attr, colorful)
(pants, attr, white)
(Man, wearing, shirt)
(Man, wearing, pants)
+ +generation from natural language questions (Poon, 2013), a related task that is yet so different than an adaptation to triple set generation from natural language statements is nontrivial. While rule-based systems do not automatically adapt to new graph schemas either, $\mathbf{R}^{\mathrm{text}}\rightarrow \mathrm{graph}$ and SSGP were at least designed with the scene graph domain in mind. + +Although SSGP was not optimized to match the scene graphs from VG, its rules were still engineered to cover typical idiosyncrasies of textual image descriptions and corresponding scene graphs. Besides, we evaluate it with lemmatized reference graphs because it only predicts lemmata as predicates. All this gives it a major advantage over the other presented systems but it is nonetheless outperformed by our best unsupervised model - even on VG. This shows that our automatic method can beat even hand-crafted domain-specific rules. + +Both $\mathrm{R}^{\text {text } \rightarrow \text {graph }}$ and SSGP fail to predict any fact from WebNLG. The DBpedia facts from WebNLG often contain multi-token entities while $\mathrm{R}^{\text {text } \rightarrow \text {graph }}$ only picks single tokens from the text. Likewise, SSGP models multi-token entities as two nodes + +Table 8: Example fact extractions and evaluation wrt reference graph (RG). Green: correct $(\in$ RG). Yellow: acceptable fact, but $\notin$ RG. Red: incorrect $(\notin$ RG). + +
VGballWebNLG
g→t BLEUt→gF1g→tBLEUt→gF1
No noise0.90.014.80.0
sample all noise funs19.917.339.138.5
compose all noise funs19.619.030.832.5
use only rule19.518.537.431.0
use only swap0.90.013.10.0
use only drop0.90.039.930.1
use only blank0.90.014.90.0
use only repeat1.10.015.70.0
sample all but rule0.90.014.90.0
sample all but swap19.217.039.637.3
sample all but drop19.516.039.235.3
sample all but blank19.917.541.037.0
sample all but repeat20.416.636.737.1
comp. all but rule0.90.013.50.0
comp. all but swap20.216.335.940.8
comp. all but drop21.518.636.441.1
comp. all but blank20.216.334.840.4
comp. all but repeat21.120.138.542.3
+ +Table 9: Ablation study of our models on val of $\mathrm{VG_{ball}}$ and WebNLG v2.1. Models selected based on $\nu_{100}$ . Bold: best performance per column and block. Underlined: worse than corresponding rule-based system. + +with an attr relation. This illustrates the importance of automatic adaptation to the target KG. Although our system uses $\mathbf{R}^{\mathrm{text}\rightarrow \mathrm{graph}}$ during unsupervised training and is similarly not adapted to the WebNLG dataset, it performs significantly better. + +Supervision helps more on WebNLG than on VG. The poor performance of $\mathrm{R}^{\mathrm{text}\rightarrow \mathrm{graph}}$ on WebNLG is probably a handicap for unsupervised learning. + +Qualitative observations. Table 8 shows example facts extracted by different systems. $\mathbf{R}^{\mathrm{text}} \rightarrow \mathrm{graph}$ and SSGP are both fooled by the proximity of the noun pants and the verb play whereas our model correctly identifies man as the subject. It, however, fails to identify shirt as an entity and associates the two attributes colorful and white to pants. Only the supervised model produces perfect output. + +# 6.3 Noise and translation completeness + +Sampled noise only creates training pairs that either are complete rule-based translations or reconstruction pairs from a noisy graph to a complete graph or a noisy text to a complete text. In contrast, composed noise can introduce translations from a noisy text to a complete graph or vice versa and thus encourage a system to omit input information (cf. Fig. 3). This difference is mirrored nicely in the results of our unsupervised systems for both tasks: composed noise performs better on VG where omit + +ted information in an image caption is common and sampled noise works better on WebNLG where the texts describe their graphs completely. + +# 7 Noise Ablation Study + +Our unsupervised objectives are defined by different types of noise models. Hence, we examine their impact in a noise ablation study. Table 9 shows results for text $\rightarrow$ graph and graph $\rightarrow$ text on the validation splits of $\mathrm{VG}_{\mathrm{ball}}$ and WebNLG. + +For both datasets and tasks, introducing variation via noise functions is crucial for the success of unsupervised learning. The model without noise (i.e., $C(x) = x$ ) fails completely as do all models lacking rule as type of noise, the only exception being the only-drop system on WebNLG. Even though drop seems to work equally well in this one case, the simple translations delivered by our rule-based systems clearly provide the most useful information for the unsupervised models – notably in combination with the other noise functions: removing rule and keeping all other types of noise (cf. "sample all but rule" and "comp. all but rule") performs much worse than leaving out drop. + +We hypothesize that our two rule systems provide two important pieces of information: (1) $\mathrm{R}^{\mathrm{graph}\rightarrow \mathrm{text}}$ helps distinguish data format tokens from text tokens and (2) $\mathrm{R}^{\mathrm{text}\rightarrow \mathrm{graph}}$ helps find probable candidate words in a text that form facts for the data output. As opposed to machine translation, where usually every word in a sentence is translated into a fluent sentence in the target language, identifying words that probably form a fact is more important in data-to/from-text generation. + +We moreover observe that our unsupervised models always improve on the rule-based systems even when rule is the only type of noise: graph $\rightarrow$ text BLEU increases from 6.2/18.3 to 19.5/37.4 on $\mathrm{VG_{ball}}/$ WebNLG and text $\rightarrow$ graph F1 from 14.4/0.0 to 18.5/31.0. + +Finally, our ablation study makes clear that there is no best noise model for all datasets and tasks. We therefore recommend experimenting with both different sets of noise functions and noise injection regimes (sampled vs. composed) for new data. + +# 8 Conclusion + +We presented the first fully unsupervised approach to text generation from KGs and a novel approach to unsupervised semantic parsing that automatically adapts to a target KG. We showed + +the effectiveness of our approach on two datasets, WebNLG v2.1 and a new text $\leftrightarrow$ graph benchmark in the visual domain, derived from Visual Genome. We quantitatively and qualitatively analyzed our method on text $\leftrightarrow$ graph conversion. We explored the impact of different unsupervised objectives in an ablation study and found that our newly introduced unsupervised objective using rule-based translations is essential for the success of unsupervised learning. + +# Acknowledgments + +We thank the anonymous reviewers for their helpful comments and gratefully acknowledge a Ph.D. scholarship awarded to the first author by the German Academic Scholarship Foundation (Studienstiftung des deutschen Volkes). This work was supported by by the BMBF as part of the project MLWin (01IS18050). + +# References + +Mark van Assem, Aldo Gangemi, and Guus Schreiber. 2006. Conversion of wordnet to a standard rdf/owl representation. In Proceedings of the Fifth Edition of the International Conference on Language Resources and Evaluation (LREC 2006). +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. Computing Research Repository, arXiv:1409.0473. +Satanjeev Banerjee and Alon Lavie. 2005. METEOR: An automatic metric for MT evaluation with improved correlation with human judgments. In Proceedings of the ACL Workshop on Intrinsic and Extrinsic Evaluation Measures for Machine Translation and/or Summarization, pages 65-72, Ann Arbor, Michigan. 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. +Rajarshi Bhowmik and Gerard de Melo. 2018. Generating fine-grained open vocabulary entity type descriptions. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 877-888, Melbourne, Australia. Association for Computational Linguistics. + +Denny Britz, Anna Goldie, Minh-Thang Luong, and Quoc Le. 2017. Massive exploration of neural machine translation architectures. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, Copenhagen, Denmark. Association for Computational Linguistics. +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. +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. +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. +Angela Fan, Claire Gardent, Chloe Braud, and Antoine Bordes. 2019. Using local knowledge graph construction to scale Seq2Seq models to multi-document inputs. 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 4184-4194, Hong Kong, China. Association for Computational Linguistics. +Christiane Fellbaum. 2005. Wordnet and wordnets. In Keith Brown et al., editor, Encyclopedia of Language and Linguistics, second edition, pages 665-670. Elsevier, Oxford. +Claire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. 2017a. 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, Vancouver, Canada. Association for Computational Linguistics. +Claire Gardent, Anastasia Shimorina, Shashi Narayan, and Laura Perez-Beltrachini. 2017b. 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. +Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F. Liu, Matthew Peters, Michael Schmitz, and Luke S. Zettlemoyer. 2017. Allennlp: A deep semantic natural language processing platform. Computing Research Repository, arXiv:1803.07640. +Sebastian Gehrmann, Falcon Dai, Henry Elder, and Alexander Rush. 2018. End-to-end content and plan selection for data-to-text generation. In Proceedings of the 11th International Conference on Natural Language Generation, pages 46-56, Tilburg University, The Netherlands. Association for Computational Linguistics. +Dan Goldwasser, Roi Reichart, James Clarke, and Dan Roth. 2011. Confidence driven unsupervised semantic parsing. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 1486-1495, Portland, Oregon, USA. Association for Computational Linguistics. +Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O.K. Li. 2016. Incorporating copying mechanism in sequence-to-sequence learning. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 1631-1640, Berlin, Germany. Association for Computational Linguistics. +Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2012. Improving neural networks by preventing co-adaptation of feature detectors. Computing Research Repository, arXiv:1207.0580. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural Computation, 9(8):1735-1780. +Aishwarya Kamath and Rajarshi Das. 2019. A survey on semantic parsing. In *Automated Knowledge Base Construction* (AKBC). +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 International Conference on Learning Representations (ICLR). +Rik Koncel-Kedziorski, Dhanush Bekal, Yi Luan, Mirella Lapata, and Hannaneh Hajishirzi. 2019. Text Generation from Knowledge Graphs with Graph Transformers. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human + +Language Technologies, Minneapolis, Minnesota. +Association for Computational Linguistics. +Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A. Shamma, Michael S. Bernstein, and Fei-Fei Li. 2016. Visual genome: Connecting language and vision using crowdsourced dense image annotations. Computing Research Repository, arXiv:1602.07332. +Karen Kukich. 1983. Design of a knowledge-based report generator. In 21st Annual Meeting of the Association for Computational Linguistics, pages 145-150, Cambridge, Massachusetts, USA. Association for Computational Linguistics. +Guillaume Lample, Alexis Conneau, Ludovic Denoyer, and Marc'Aurelio Ranzato. 2018a. Unsupervised machine translation using monolingual corpora only. In International Conference on Learning Representations. +Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, and Marc'Aurelio Ranzato. 2018b. Phrase-based & neural unsupervised machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, Brussels, Belgium. Association for Computational Linguistics. +Tsung-Yi Lin, Xinlei Chen, Hao Fang, and Ramakrishna Vedantam. 2018. GitHub repository: tylin/coco-caption (Microsoft COCO caption evaluation). https://github.com/tylin/coco-caption. +Edward Loper and Steven Bird. 2004. Nltk: The natural language toolkit. In Proceedings of the ACL Interactive Poster and Demonstration Sessions, pages 214-217, Barcelona, Spain. Association for Computational Linguistics. +Cewu Lu, Ranjay Krishna, Michael Bernstein, and Li Fei-Fei. 2016. Visual relationship detection with language priors. In European Conference on Computer Vision. +Yi Luan, Luheng He, Mari Ostendorf, and Hannaneh Hajishirzi. 2018. Multi-task identification of entities, relations, and coreference for scientific knowledge graph construction. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3219-3232, Brussels, Belgium. Association for Computational Linguistics. +Diego Marcheggiani and Laura Perez-Beltrachini. 2018. Deep graph convolutional encoders for structured data to text generation. In Proceedings of the 11th International Conference on Natural Language Generation, pages 1-9, Tilburg University, The Netherlands. Association for Computational Linguistics. + +Diego Marcheggiani and Ivan Titov. 2016. Discrete-state variational autoencoders for joint discovery and factorization of relations. Transactions of the Association for Computational Linguistics, 4:231-244. +Susan W. McRoy, Songsak Channarukul, and Syed S. Ali. 2000. YAG: A template-based generator for real-time systems. In INLG'2000 Proceedings of the First International Conference on Natural Language Generation, pages 264-267, Mitzpe Ramon, Israel. Association for Computational Linguistics. +Christina Niklaus, Matthias Cetto, André Freitas, and Siegfried Handschuh. 2018. A survey on open information extraction. In Proceedings of the 27th International Conference on Computational Linguistics, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311-318, Philadelphia, Pennsylvania, USA. Association for Computational Linguistics. +Ankur P. Parikh, Hoifung Poon, and Kristina Toutanova. 2015. Grounded semantic parsing for complex knowledge extraction. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 756-766, Denver, Colorado. Association for Computational Linguistics. +Hoifung Poon. 2013. Grounded unsupervised semantic parsing. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 933-943, Sofia, Bulgaria. Association for Computational Linguistics. +Hoifung Poon and Pedro Domingos. 2009. Unsupervised semantic parsing. In Proceedings of the 2009 Conference on Empirical Methods in Natural Language Processing, pages 1-10, Singapore. Association for Computational Linguistics. +Ana-Maria Popescu, Alex Armanasu, Oren Etzioni, David Ko, and Alexander Yates. 2004. Modern natural language interfaces to databases: Composing statistical parsing with semantic tractability. In COLING 2004: Proceedings of the 20th International Conference on Computational Linguistics, pages 141-147, Geneva, Switzerland. COLING. +Maja Popovic. 2017a. $\mathrm{chrF}++$ : words helping character n-grams. In Proceedings of the Second Conference on Machine Translation, pages 612-618, Copenhagen, Denmark. Association for Computational Linguistics. +Maja Popovic. 2017b. GitHub repository: m-popovic/chrf (chrF). https://github.com/m-popovic/chrF. + +Ratish Puduppully, Li Dong, and Mirella Lapata. 2019. Data-to-Text Generation with Content Selection and Planning. In Proceedings of the 33rd Conference on Artificial Intelligence. +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 3181-3192, Hong Kong, China. Association for Computational Linguistics. +Leonardo F. R. Ribeiro, Yue Zhang, Claire Gardent, and Iryna Gurevych. 2020. Modeling global and local node contexts for text generation from knowledge graphs. Computing Research Repository, arXiv:2001.11003. +Sebastian Riedel, Limin Yao, and Andrew McCallum. 2010. Modeling relations and their mentions without labeled text. In *Machine Learning and Knowledge Discovery in Databases*, pages 148-163, Berlin, Heidelberg. Springer Berlin Heidelberg. +Jacques Pierre Robin. 1995. Revision-based Generation of Natural Language Summaries Providing Historical Background: Corpus-based Analysis, Design, Implementation and Evaluation. Ph.D. thesis, Columbia University, New York, NY, USA. UMI Order No. GAX95-33653. +Maarten Sap, Ronan Le Bras, Emily Allaway, Chandra Bhagavatula, Nicholas Lourie, Hannah Rashkin, Brendan Roof, Noah A. Smith, and Yejin Choi. 2019. ATOMIC: an atlas of machine commonsense for if-then reasoning. In 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 3027-3035. +Sebastian Schuster, Ranjay Krishna, Angel Chang, Li Fei-Fei, and Christopher D. Manning. 2015. Generating semantically precise scene graphs from textual descriptions for improved image retrieval. In Proceedings of the Fourth Workshop on Vision and Language, pages 70–80, Lisbon, Portugal. Association for Computational Linguistics. +Anastasia Shimorina and Claire Gardent. 2018. Handling rare items in data-to-text generation. In Proceedings of the 11th International Conference on Natural Language Generation, pages 360-370, Tilburg University, The Netherlands. Association for Computational Linguistics. +Étienne Simon, Vincent Guigue, and Benjamin Piwowarski. 2019. Unsupervised information extraction: Regularizing discriminative approaches with relation distribution losses. In Proceedings of the + +57th Annual Meeting of the Association for Computational Linguistics, pages 1378-1387, Florence, Italy. Association for Computational Linguistics. +Robyn Speer, Joshua Chin, and Catherine Havasi. 2017. Conceptnet 5.5: An open multilingual graph of general knowledge. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, AAAI'17, pages 4444-4451. AAAI Press. +Ilya Sutskever, Oriol Vinyals, and Quoc V Le. 2014. Sequence to sequence learning with neural networks. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 27, pages 3104-3112. Curran Associates, Inc. +Kumiko Tanaka-Ishii, Koiti Hasida, and Itsuki Noda. 1998. Reactive content selection in the generation of real-time soccer commentary. In 36th Annual Meeting of the Association for Computational Linguistics and 17th International Conference on Computational Linguistics, Volume 2, pages 1282-1288, Montreal, Quebec, Canada. Association for Computational Linguistics. +Bayu Distiawan Trisedya, Jianzhong Qi, Rui Zhang, and Wei Wang. 2018. GTR-LSTM: A triple encoder for sentence generation from RDF data. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1627-1637, Melbourne, Australia. Association for Computational Linguistics. +Frank Van Harmelen, Vladimir Lifschitz, and Bruce Porter. 2008. Handbook of knowledge representation, volume 1. Elsevier. +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2018. Graph Attention Networks. In International Conference on Learning Representations. +Hai Wan, Yonghao Luo, Bo Peng, and Wei-Shi Zheng. 2018. Representation learning for scene graph completion via jointly structural and visual embedding. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI-18, pages 949–956. International Joint Conferences on Artificial Intelligence Organization. +Sam Wiseman, Stuart Shieber, and Alexander Rush. 2017. Challenges in data-to-document generation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2253-2263, Copenhagen, Denmark. Association for Computational Linguistics. +David S Wishart, Yannick D Feunang, An C Guo, Elvis J Lo, Ana Marcu, Jason R Grant, Tanvir Sajed, Daniel Johnson, Carin Li, Zinat Sayeeda, Nazanin Assempour, Ithayavani Iynkkaran, Yifeng Liu, Adam Maciejewski, Nicola Gale, Alex Wilson, Lucy Chin, Ryan Cummings, Diana Le, Allison Pon, Craig Knox, and Michael Wilson. 2018. DrugBank 5.0: a major update to the DrugBank database + +for 2018. Nucleic Acids Research, 46(D1):D1074-D1082. + +Limin Yao, Aria Haghighi, Sebastian Riedel, and Andrew McCallum. 2011. Structured relation discovery using generative models. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pages 1456-1466, Edinburgh, Scotland, UK. Association for Computational Linguistics. + +# A Hyperparameters + +We use the following settings for all our experiments: learning rate of $10^{-4}$ , word embeddings of size 300, an LSTM hidden size of 250, a dropout rate of 0.2 and a batch size of 10. Following Lample et al. (2018b), we set $p_{\mathrm{blank}} = p_{\mathrm{repeat}} = 0.2$ , $p_{\mathrm{drop}} = 0.1$ . For inference, we decode greedily with a maximum number of 40 decoding steps. To speed up unsupervised learning, we increase the batch size to 64 when creating backtranslations. + +# B Model details + +We train with homogeneous batches of one target output type (text or graph) at a time. We use a single GeForce GTX 1080 GPU for training and inference. In this environment, pure training takes approximately $9\mathrm{ms}$ per instance and inference, which also means backtranslation, takes approximately $21\mathrm{ms}$ per instance. This means that unsupervised learning approximately needs $30\mathrm{ms}$ per instance. WebNLG models use 10.6 million parameters, VG models have 60.7 million parameters. The difference is due to a larger vocabulary size of 70,800 for VG compared to 8,171 for WebNLG. + +# C Results of all iterations on WebNLG + +See Table 10 for all intermediate graph $\rightarrow$ text results of unsupervised training on WebNLG and Table 11 for text $\rightarrow$ graph. We find similar trends as for VG (Tables 4 and 6) except for $\mathcal{U}$ being a less reliable performance indicator for text $\rightarrow$ graph in the sampled noise setting. + +
#sampled noisecomposed noise
UV100valUV100val
191.712.813.023.015.915.5
294.014.715.853.222.220.7
385.225.526.071.023.222.8
465.927.728.875.225.326.2
565.531.430.769.225.927.2
658.131.531.071.527.627.7
748.031.332.379.229.027.7
848.332.833.452.528.127.5
937.533.234.057.130.530.0
1042.132.833.452.430.629.9
1138.734.734.859.932.031.6
1238.736.436.242.130.430.8
1339.333.535.150.030.730.7
1440.536.936.646.730.930.7
1541.836.537.548.231.130.3
1643.236.938.043.730.329.6
1739.135.636.643.129.029.7
1838.537.538.331.129.729.8
1938.837.838.439.529.029.8
2037.537.238.636.231.329.8
2136.436.838.435.230.030.8
2244.836.339.737.632.430.7
2340.835.838.239.631.430.3
2435.839.239.639.632.430.3
2540.638.539.537.033.230.9
2636.838.940.341.332.330.2
2744.139.740.637.333.030.4
2839.336.938.939.034.730.8
2936.137.638.641.531.030.6
3038.740.739.142.930.630.0
+ +Table 10: BLEU scores on WebNLG for our unsupervised models evaluated for graph $\rightarrow$ text at different iterations. $\mathcal{U}$ is calculated on all unlabeled data used for training. $\nu_{100}$ is a 100-size random sample from val. All results are computed with scripts from (Lin et al., 2018). + +
#sampled noisecomposed noise
UV100valUV100val
169.40.00.00.00.00.0
264.00.00.116.21.21.6
335.60.90.37.53.33.0
447.82.62.337.55.55.5
539.25.73.435.37.06.6
639.26.25.644.99.78.0
745.89.87.958.38.010.3
850.012.610.051.114.012.8
954.913.612.953.112.514.0
1058.314.914.351.115.916.8
1162.519.317.853.815.617.3
1254.220.318.258.316.718.0
1357.123.120.247.819.820.6
1437.525.521.449.020.622.1
1548.025.722.454.223.022.8
1652.027.924.346.222.525.4
1750.026.725.135.626.826.8
1848.032.127.752.227.827.7
1956.032.328.958.326.428.1
2060.031.030.155.326.429.2
2151.032.330.459.327.630.7
2255.334.932.062.531.732.0
2344.934.332.754.934.032.6
2458.838.433.761.231.532.4
2546.839.634.158.333.333.1
2653.840.636.354.234.432.5
2762.541.836.450.033.933.3
2855.341.037.440.832.633.7
2956.040.737.058.829.533.7
3059.641.938.553.831.633.4
+ +Table 11: F1 scores on WebNLG for our unsupervised models evaluated for text $\rightarrow$ graph at different iterations. $\mathcal{U}$ is calculated on all unlabeled data used for training. $\nu_{100}$ is a 100-size random sample from val. \ No newline at end of file diff --git a/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/images.zip b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a28086e33a88938145b5ad6fd0155ce33468c8df --- /dev/null +++ b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6de41974d2f5b00485bc35af79fb74885e2aa2e727352d76a4e4ac190c74636 +size 711294 diff --git a/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/layout.json b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a5ea0c18ed3e9025520664725f64034167f6e7 --- /dev/null +++ b/anunsupervisedjointsystemfortextgenerationfromknowledgegraphsandsemanticparsing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68b4f446002c6f044a29cb116427b3b7febfa8b72eb3f4eef2439e32a52f7e20 +size 457839 diff --git a/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_content_list.json b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c900f1a521ab2942f3ef984289bb3f451390d11b --- /dev/null +++ b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5691a90a3c9c88e244a8617c16824f0eb4760bf2fd70c1d33922096d9e60802c +size 68866 diff --git a/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_model.json b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_model.json new file mode 100644 index 0000000000000000000000000000000000000000..01e3bc65eece2b3cb6bf5880ca19263de076e161 --- /dev/null +++ b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb8e073a2943f0da575d465f9be1038ec2ba6875b2674237447d533e4959545a +size 84461 diff --git a/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_origin.pdf b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..49acd80c3696a96e5eea90eb4d33a12f0cbf58cf --- /dev/null +++ b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/e3dc47fd-d496-499c-8b94-406fe96c40f6_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ef300849bf833936a56b1396134fb6a5836aae652d1f9ebcae81d35efc21472 +size 404358 diff --git a/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/full.md b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..71dd4a200f6a75ae5b44cc921327ffdea3e4de59 --- /dev/null +++ b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/full.md @@ -0,0 +1,248 @@ +# An Unsupervised Sentence Embedding Method by Mutual Information Maximization + +Yan Zhang $^{1,2}$ Ruidan He $^{*2}$ Zuozhu Liu $^{\dagger3}$ Kwan Hui Lim $^{1}$ Lidong Bing $^{2}$ + +$^{1}$ Singapore University of Technology and Design + +$^{2}$ DAMO Academy, Alibaba Group + +$^{3}$ ZJU-UIUC Institute + +yan_zhang@mymail.sutd.edu.sg, ruidan.he@alibaba-inc.com + +zuozhuliu@intl.zju.edu.cn, kwanhui_lim@sutd.edu.sg + +l.bing@alibaba-inc.com + +# Abstract + +BERT is inefficient for sentence-pair tasks such as clustering or semantic search as it needs to evaluate combinatorially many sentence pairs which is very time-consuming. Sentence BERT (SBERT) attempted to solve this challenge by learning semantically meaningful representations of single sentences, such that similarity comparison can be easily accessed. However, SBERT is trained on corpus with high-quality labeled sentence pairs, which limits its application to tasks where labeled data is extremely scarce. In this paper, we propose a lightweight extension on top of BERT and a novel self-supervised learning objective based on mutual information maximization strategies to derive meaningful sentence embeddings in an unsupervised manner. Unlike SBERT, our method is not restricted by the availability of labeled data, such that it can be applied on different domain-specific corpus. Experimental results show that the proposed method significantly outperforms other unsupervised sentence embedding baselines on common semantic textual similarity (STS) tasks and downstream supervised tasks. It also outperforms SBERT in a setting where in-domain labeled data is not available, and achieves performance competitive with supervised methods on various tasks. + +# 1 Introduction + +BERT-based pretrained language models (Devlin et al.; Liu et al., 2019) have set new state-of-the-art performance on various downstream NLP tasks. However, they are inefficient for sentence-pair regression tasks such as clustering or semantic search because they need to evaluate combinatorially many sentence pairs during inference, which will result in a massive computational overhead. + +For example, finding the most similar pair in a collection of 10k sentences requires about 50 million $\binom{10k}{2}$ inference computations with BERT, which requires about 65 hours on a V100 GPU (Reimers and Gurevych, 2019). + +Much previous work attempted to address this problem by learning semantically meaningful representations for each sentence, such that similarity measures like cosine distance can be easily evaluated for sentence-pair regression tasks. The straightforward way to derive a fixed-size sentence embedding from BERT-based models is to average the token representations at the last layer or using the output of the [CLS] token. Reimers and Gurevych (2019) showed that both approaches yield rather unsatisfactory sentence embeddings. They proposed a model, Sentence-BERT (SBERT), to further fine-tune BERT on natural language inference (NLI) tasks with labeled sentence pairs and achieved state-of-the-art performance on many semantic textual similarity tasks. However, such improvements are induced by high-quality supervision, and we find that their performance is degraded where labeled data of the target task is extremely scarce or the distribution of test set differs significantly from the NLI dataset used for training. + +Learning sentence representations in an unsupervised manner is a critical step to work with unlabeled or partially labeled dataset to address the aforementioned challenge (Kiros et al., 2015; Gan et al., 2017; Hill et al., 2016; Pagliardini et al., 2017; Yang et al., 2018). A common approach for unsupervised sentence representation learning is to leverage on self-supervision with large unlabeled corpus. For example, early methods explored various auto-encoders for sentence embedding (Socher et al., 2011; Hill et al., 2016). Recent work such as skip-thought (Kiros et al., 2015) and FastSent (Hill et al., 2016) assumed that a sentence is likely to have similar semantics to its context, and designed + +self-supervised objectives that encourage models to learn sentence representations by predicting contextual information. However, the performance of these models is far behind that of supervised learning ones on many tasks, which unveils an urgent need of better unsupervised sentence embedding methods. + +In this work, we propose a novel unsupervised sentence embedding model with light-weight feature extractor on top of BERT for sentence encoding, and train it with a novel self-supervised learning objective. Our model is not restricted by the availability of labeled data and can be applied to any domain of interest. Instead of simply averaging BERT token embeddings, we use convolutional neural network (CNN) layers with mean-over-time pooling that transform BERT token embeddings to a global sentence embedding (Kim, 2014). Moreover, we propose a novel self-supervised learning objective that maximises the mutual information (MI) between the global sentence embedding and all its local contexts embeddings, inspired by recent advances on unsupervised representation learning for images and graphs (Hjelm et al., 2019; Velickovic et al., 2019). Our model is named InfoSentence BERT (IS-BERT). In IS-BERT, the representation of a specific sentence is encouraged to encode all aspects of its local context information, using local contexts derived from other input sentences as negative examples for contrastive learning. This learning procedure encourages the encoder to capture the unique information that is shared across all local segments of the specific input sentence while different from other inputs, leading to more expressive and semantically meaningful sentence embeddings. + +We evaluate our method on two groups of tasks - Semantic Textual Similarity (STS) and SentEval (Conneau and Kiela, 2018). Empirical results show that IS-BERT significantly outperforms other unsupervised baselines on STS and SentEval tasks. In addition, we show that IS-BERT substantially outperforms SBERT in a setting where task-specific labeled data is not available. This demonstrates that IS-BERT has the flexibility to be applied to new domains without label restriction. Finally, IS-BERT can achieve performance competitive with or even better than supervised learning methods in certain scenarios. + +# 2 Related Work + +# 2.1 Sentence Representation Learning + +Prior approaches for sentence embedding include two main categories: (1) unsupervised sentence embedding with unlabeled sentences, and (2) supervised learning with labeled sentences, while a few methods might leverage on both of them. + +Unsupervised Sentence Embedding. There are two main directions to work with unlabeled corpus, according to whether the input sentences are ordered or not. In the scenario with unordered sentences, the input is usually a single sentence and models are designated to learn sentence representations base on the internal structures within each sentence, such as recursive auto-encoders (Socher et al., 2011), denoising auto-encoders (Hill et al., 2016), and the paragraph vector model (Le and Mikolov, 2014). Our model follows this setting as well but benefits from the model capacity of BERT and knowledge in large pretraining corpus. + +Methods working with ordered sentences utilize the distributional hypothesis which assumes that a sentence is likely to have similar semantics to its context. Under this assumption, they formulate generative or discriminative tasks that require the models to correctly predict the contextual information, such as skip-thought (Kiros et al., 2015) and FastSent (Hill et al., 2016), or to distinguish target sentences from contrastive ones (Jernite et al., 2017; Logeswaran and Lee, 2018) for sentence embedding (Jernite et al., 2017; Logeswaran and Lee, 2018). These methods require ordered sentences or corpus with inter-sentential coherence for training, which limits their applications to domains with only short texts. + +Supervised Sentence Embedding. There have also been attempts to use labeled data for sentence embedding. Conneau et al. (2017) proposed the InferSent model that uses labeled data of the Stanford Natural Language Inference dataset (SNLI) (Bowman et al., 2015) and the Multi-Genre NLI dataset (Williams et al., 2018) to train a BiLSTM siamese network for sentence embedding. Universal Sentence Encoder (Cer et al., 2018) utilized supervised training with SNLI to augment the unsupervised training of a transformer network. SBERT (Reimers and Gurevych, 2019) also trained a siamese network on NLI to encode sentences, but it further benefits from the pretraining procedure of BERT. Though effective, those models could be + +problematic to port to new domains where high-quality labeled data is not available, or the text distribution is significantly different from the NLI dataset such that knowledge learned from NLI cannot be successfully transferred. Addressing this limitation requires unsupervised methods. + +# 2.2 Representation Learning with MI + +Unsupervised representation learning with mutual information has a long history, such as the informax principle and ICA algorithms (Bell and Sejnowski, 1995; Hyvarinen and Oja, 2000). Theoretically, many generative models for representation learning based on reconstruction such as auto-encoders or GANs (Nowozin et al., 2016) are closely related to the idea of maximizing the MI between the model inputs and outputs. Despite the pivotal role in machine learning, MI is historically hard to compute, especially in high-dimensional and continuous settings such as neural networks. Recently, multiple estimators were proposed as lower bounds for mutual information estimation (Belghazi et al., 2018; van den Oord et al., 2018), which were demonstrated to be effective for unsupervised representation learning in various scenarios (Hjelm et al., 2019; Ji et al., 2019; Sun et al., 2020; Kong et al., 2020). Our model is mainly inspired by the DIM model (Hjelm et al., 2019) for vision tasks, associated with a novel self-supervised learning objective to maximize the MI between the global sentence embedding and the representations of all its local contexts. Different from (Hjelm et al., 2019), we mainly work with sequential sentence data with the pretrained BERT model and further investigate the generalization ability of the learned representation across different domains. Kong et al. (2020) also used MI with BERT, but their objective is for language modeling while our focus is on sentence representation learning. The corresponding downstream tasks are completely different as well. + +# 3 Model + +In this section, we outline a general model, the Info-Sentence BERT (IS-BERT), for unsupervised sentence representation learning. We first give the problem formulation, then we present the details of our method and the corresponding neural network architecture. + +# 3.1 Problem Formulation + +Given a set of input sentences $\mathcal{X} = \{\mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_n\}$ , our goal is to learn a representation $\mathbf{y}_i \in R^d$ in $\mathcal{Y}$ for each sentence $\mathbf{x}_i$ in an unsupervised manner. For simplicity, we denote this process with a parameterized function $\mathcal{E}_{\Theta}: \mathcal{X} \longrightarrow \mathcal{Y}$ , and denote the empirical distribution of the input set $\mathcal{X}$ as $\mathbb{P}$ . + +We aim to acquire sentence representations by maximizing the mutual information between the sentence-level global representation and the token-level local representations. This idea was inspired by recent advances on unsupervised representation learning for images and graphs (Hjelm et al., 2019; Sun et al., 2020). The motivation behind such learning strategy is to encourage sentence representations to encode multiple aspects shared by the local information of tokens such as n-gram contextual dependencies. + +# 3.2 Model Architecture + +Our model architecture is illustrated in Figure 1. We first use BERT to encode an input sentence $\mathbf{x}$ to a length- $l$ sequence of token embeddings $\mathbf{h}_1,\mathbf{h}_2,\dots,\mathbf{h}_l$ . Then we apply 1-D convolutional neural network (CNN) layers with different window (kernel) sizes on top of these token embeddings to capture the n-gram local contextual dependencies of the input sentence. Formally, an n-gram embedding $\mathbf{c}_i$ generated by a CNN with window size $k$ is computed as + +$$ +\mathbf {c} _ {i} = f \left(\mathbf {w} \cdot \mathbf {h} _ {i: i + k - 1} + \mathbf {b}\right), \tag {1} +$$ + +where $\mathbf{h}_{i:i + k - 1}$ is the concatenation of the token embeddings within a window. $\mathbf{w}$ and $\mathbf{b}$ are learnable parameters of the CNN layer shared across all windows over the sequence, and $f$ is the ReLU activation. We use padding to keep the sequence length of outputs the same as inputs. + +To better capture contextual information with various ranges, we apply several CNNs with different window sizes (e.g. 1, 3, 5) to the input sentences. The final local representation of a token is the concatenation of its representations obtained with different window sizes, as shown in Figure 1. We denote the length- $l$ local token representations sequence for a sentence $\mathbf{x}$ as $\mathcal{F}_{\theta}(\mathbf{x})\coloneqq \{\mathcal{F}_{\theta}^{(i)}(\mathbf{x})\in \mathbb{R}^d\}_{i = 1}^l$ , where $\mathcal{F}_{\theta}$ is the encoding function consisting of BERT and CNNs with trainable parameters $\theta$ , and $i$ is the token index. The global sentence + +![](images/a3e877eb39af4caede60aa88d6b9927df0cf08a953cddc4bbd2ef53a5c8e2434.jpg) +Figure 1: Model Architecture. Two sentences are encoded by BERT and multiple CNNs with different window sizes to get concatenated local n-gram token embeddings. A discriminator $T$ takes all pairs of {sentence representation, token representation} as input and decides whether they are from the same sentence. In this example, we treat sentence "A" as the positive sample and "B" as negative, then n-gram embeddings of "A" will be summarized to a global sentence embedding via pooling. The discriminator produces scores for all token representations from both "A" and "B" to maximize the MI estimator in Eq.2. + +representation of $\mathbf{x}$ denoted as $\mathcal{E}_{\theta}(\mathbf{x}) \in \mathbb{R}^{d}$ is computed by applying a mean-over-time pooling layer on the token representations $\mathcal{F}_{\theta}(\mathbf{x})$ . Both sentence and token representations are parameterized by $\theta$ as pooling does not introduce additional parameters. The induction of the these representations is different from the previous sentence-BERT model (Reimers and Gurevych, 2019). While Reimers and Gurevych (2019) simply used mean- or max-pooling strategies over the token representations from BERT outputs which can be regarded as 1-gram embeddings, we use a set of parallel CNN layers with various window sizes to capture n-gram contextual dependencies. Both the sentence representation and token representations will be fed into a discriminator network to produce scores for MI estimation as presented in 3.3. + +# 3.3 MI Maximization Learning + +The learning objective is to maximize the mutual information (MI) between the global sentence representation $\mathcal{E}_{\theta}(\mathbf{x})$ and each of its local token representation $\mathcal{F}_{\theta}^{(i)}(\mathbf{x})$ . As MI estimation is generally intractable for continuous and high-dimensional random variables, we usually maximizing over lower bound estimators of MI, such as the Noise-Contrastive estimator (Gutmann and Hyvarinen, 2012) and Jensen-Shannon estimator (Nowozin et al., 2016; Hjelm et al., 2019). In this paper, we use the Jensen-Shannon estimator. Mathematically, the Jensen-Shannon estimator + +$\mathcal{I}_{\omega}^{JSD}(\mathcal{F}_{\theta}^{(i)}(\mathbf{x}); \mathcal{E}_{\theta}(\mathbf{x}))$ is defined as + +$$ +\begin{array}{l} \widehat {\mathcal {I}} _ {\omega} ^ {J S D} \left(\mathcal {F} _ {\theta} ^ {(i)} (\mathbf {x}); \mathcal {E} _ {\theta} (\mathbf {x})\right) := \\ E _ {\mathbb {P}} \left[ - s p \left(- T _ {\omega} \left(\mathcal {F} _ {\theta} ^ {(i)} (\mathbf {x}), \mathcal {E} _ {\theta} (\mathbf {x}))\right) \right] \right. \tag {2} \\ - E _ {\mathbb {P} \times \tilde {\mathbb {P}}} [ s p (T _ {\omega} (\mathcal {F} _ {\theta} ^ {(i)} (\mathbf {x} ^ {\prime}), \mathcal {E} _ {\theta} (\mathbf {x}))) ], \\ \end{array} +$$ + +where $T_{\omega}:\mathcal{F}\times \mathcal{E}\to \mathbb{R}$ is a discriminator parameterized by a neural network with learnable parameters $\omega$ . It takes all the pairs of a global sentence embeddings and local token embeddings as input and generates corresponding scores to estimate $\widehat{\mathcal{I}}_{\omega}^{JSD}$ see Figure 1. $\mathbf{x}'$ is the negative sample drawn from distribution $\tilde{\mathbb{P}} = \mathbb{P}$ , and $sp(z) = \log (1 + e^z)$ is the softplus activation function. The end-goal learning objective over the whole dataset $\mathcal{X}$ is defined as: + +$$ +\begin{array}{l} \omega^{*},\theta^{*} = \operatorname *{argmax}_{\omega ,\theta}\frac{1}{|\mathcal{X}|}\Bigg( \\ \left. \sum_ {\mathbf {x} \in \mathcal {X}} \sum_ {i = 1} ^ {l _ {x}} \widehat {\mathcal {I}} _ {\omega} ^ {J S D} \left(\mathcal {F} _ {\theta} ^ {(i)} (\mathbf {x}); \mathcal {E} _ {\theta} (\mathbf {x})\right)\right), \tag {3} \\ \end{array} +$$ + +where $|\mathcal{X}|$ is the size of the dataset, $l_{x}$ is the length of sentence $\mathbf{x}$ , and $\omega^{*},\theta^{*}$ denote the optimum. + +In Eq. 2, $\mathcal{F}_{\theta}^{(i)}(\mathbf{x}^{\prime})$ corresponds to a local representation of the negative sample $\mathbf{x}^{\prime}$ drawn from $\widetilde{\mathbb{P}} = \mathbb{P}$ . In practice, given a batch of sentences, we can treat each sentence and its local context representations as positive examples, and treat all the local context representations from other sentences in this batch as negative examples. Through maximizing $\widehat{\mathcal{I}}^{JSD}$ , $\mathcal{E}_{\theta}(\mathbf{x})$ is encouraged to have high + +MI with its local context representations. This will push the encoder to capture the unique information that is shared across all local segments of the input sentence while different from other sentences, which leads to expressive sentence representation. + +# 4 Experiment + +Following previous works (Reimers and Gurevych, 2019; Hill et al., 2016), we conduct evaluation on two kinds of tasks: + +- Unsupervised Semantic Textual Similarity (STS): These tasks measure a model's performance on sentence similarity prediction. The results are good indicators of effectiveness on unsupervised tasks such as clustering and semantic search. +- Supervised downstream tasks: These tasks measure the effectiveness of sentence embeddings on downstream supervised tasks. + +We consider two groups of baselines. The first group corresponds to models trained with unlabeled sentences. This includes the unigramTFIDF mdoel, the Paragraph Vector model (Le and Mikolov, 2014), the Sequential Denoising Auto-Encoder (SDAE) (Hill et al., 2016), the Skipthought (Kiros et al., 2015) model and the FastSent (Hill et al., 2016) model, all trained on the Toronto book corpus (Zhu et al., 2015) consisted of 70M sentences. We also consider representing sentence with the average of Glove embeddings, the average of the last layer representations of BERT, and the [CLS] embedding of BERT, respectively. The second group consists of models trained on labeled NLI data including InferSent (Conneau et al., 2017), Universal Sentence Encoder (USE) (Cer et al., 2018), and sentence BERT (SBERT-NLI) (Reimers and Gurevych, 2019). uncased-BERT-base is used for all BERT-related models including IS-BERT. + +# 4.1 Unsupervised Evaluations + +For STS tasks, we conduct evaluations on two types of datasets. 4.1.1 shows the results on seven STS benchmarks, which include texts from various domains and are commonly used for evaluating general-purpose sentence representations. 4.1.2 further shows the results on the challenging Argument Facet Similarity (AFS) dataset (Misra et al., 2016), which is more suitable for evaluating model's performance in domain-specific scenarios. For all methods compared in this subsection, + +cosine-similarity of the obtained sentence embeddings is used to compute their similarity, avoiding the time-consuming regression evaluation as with original BERT-based models. + +# 4.1.1 Unsupervised STS + +Experimental Details: We evaluate our model on the STS tasks 2012-2016 (Agirre et al., 2012, 2013, 2014, 2015, 2016), the STS benchmark (STSb for short) (Cer et al., 2017), and the SICK-Relatedness dataset (Marelli et al., 2014). The corresponding datasets consist of sentence pairs with labels from 0 to 5 indicating the semantic relatedness. As pointed out in Reimers et al. (2016) that Pearson correlation is badly suited for STS, Spearman's rank correlation between the cosine-similarity of the sentence embeddings and the gold labels is instead used as the evaluation metric. + +Following SBERT which was trained on the combination of the SNLI (Bowman et al., 2015) and the Multi-Genre NLI (MultiNLI) (Williams et al., 2018) datasets with gold labels, we train IS-BERT on the same collection of sentences, but without using the label information. We denote our model in this setting as IS-BERT-NLI. SNLI contains 570,000 sentence pairs annotated with the labels contradiction, entailment, and neutral. MultiNLI contains 430,000 sentence pairs which are from a wider range of genres of spoken and written texts. Note that IS-BERT-NLI was only trained on the 1 million pairs with the labels excluded. + +We strictly follow the evaluation process of Reimers and Gurevych (2019) to make our results comparable to theirs. The development set of STSb is used for hyperparameter tuning. On all datasets, we apply three CNNs with window sizes 1, 3, and 5. Each CNN has 256 filters, making the final concatenated token representations of size $256^{*}3$ . The learning rate is set to 1e-6 and the batch size is 32. + +Results: Table 1 presents the results. Models are grouped into two sets by the nature of the data on which they were trained. We make the following observations. First, BERT out-of-the-box gives surely poor results on STS tasks. Both the [CLS] and averaging BERT embeddings perform worse than averaging GloVe embeddings. Second, all supervised methods outperform other unsupervised baselines, which suggests that the knowledge obtained from supervised learning on NLI can be well transferred to these STS tasks. This is also indicated in previous works (Hill et al., 2016; Cer et al., 2018) + +
ModelSTS12STS13STS14STS15STS16STSbSICK-RAvg.
Using unlabeled data (unsupervised methods)
Unigram-TFIDF†--58.00---52.00-
SDAE†--12.00---46.00-
ParagraphVec DBOW†--43.00---42.00-
ParagraphVec DM†--44.00---44.00-
SkipThought†--27.00---57.00-
FastSent†--63.00---61.00-
Avg. GloVe embeddings‡55.1470.6659.7368.2563.6658.0253.7661.32
Avg. BERT embeddings‡38.7857.9857.9863.1561.0646.3558.4054.81
BERT CLS-vector‡20.1630.0120.0936.8838.0816.5042.6329.19
Ours: IS-BERT-NLI56.7769.2461.2175.2370.1669.2164.2566.58
Using labeled NLI data (supervised methods)
InferSent - GloVe‡52.8666.7562.1572.7766.8768.0365.6565.01
USE‡64.4967.8064.6176.8373.1874.9276.6971.22
SBERT-NLI‡70.9776.5373.1979.0974.3077.0372.9174.89
+ +Table 1: Spearman rank correlation $\rho$ between the cosine similarity of sentence representations and the gold labels for various Semantic Textual Similarity (STS) tasks. $\rho * 100$ is reported in this paper. All BERT-based models use uncased-BERT-base as the transformer encoder. Results of baselines marked with $\dagger$ are extracted from (Hill et al., 2016) (with a different number of decimal places). Results of baselines marked with $\ddagger$ are extracted from (Reimers and Gurevych, 2019). + +that the dataset on which sentence embeddings are trained significantly impacts their performance on STS benchmarks and they found NLI datasets are particularly useful. + +On average, IS-BERT-NLI significantly outperforms other unsupervised baselines. It even outperforms InferSent trained on labeled SNLI and MultiNLI datasets in 5 out of 7 tasks. This demonstrates the effectiveness of the proposed training strategy. USE and SBERT are the top two performers. As expected, IS-BERT-NLI is in general inferior to these two supervised baselines because they are trained with the particularly useful labeled NLI data as well as large unlabeled data, but IS-BERT-NLI also achieves performance comparable to them in certain scenarios, e.g., STS13 and STS15, even it was only trained on the NLI unlabeled data. + +# 4.1.2 Argument Facet Similarity + +We have shown in Section 4.1.1 that the proposed model substantially outperforms other unsupervised methods. However, the STS benchmarks in Section 4.1.1 are not domain or task specific, and it has been shown that they favor the supervised methods trained on NLI more (Hill et al., 2016; Cer et al., 2018). In this subsection, we further conduct evaluation on an Argument Facet Similarity (AFS) dataset (Misra et al., 2016) which is more task-specific. Models are compared in a setting + +without task or domain-specific labeled data. In this setting, SBERT needs to be trained on NLI and transferred to the AFS dataset for evaluation. Since IS-BERT does not require labeled data, it can be directly trained on the task-specific raw texts. We denote our model in this setting as IS-BERT-AFS. + +Experimental Details: The AFS corpus annotated 6,000 sentential argument pairs from social media dialogs on three controversial topics: gun control, gay marriage, and death penalty. Each argument pair was annotated on a scale from 0 (different) to 5 (equivalent). To be considered similar, argument must not only make similar claims, but also provide a similar reasoning. In addition, the lexical gap between the sentences in AFS is much larger, making it a more challenging task compared to STS tasks. The proposed IS-BERT-AFS is trained on sentences from all three domains. It uses CNNs with window size set to 3, 5, and 7, as the average sentence length is longer in AFS. Other hyperparameters are the same as in Section 4.1.1. + +Results: Table 2 presents the results. We also provide the Pearson correlation $r$ to make the results comparable to (Reimers and Gurevych, 2019). The models in the top group are trained without task-specific labeled data. IS-BERT-AFS clearly outperforms other models in this setting. One ma + +jor finding is that SBERT-NLI and InferSent, the models trained on the labeled NLI data, perform the worst on this task. We believe this is due to the fact that the NLI corpus significantly differs from the AFS dataset. An improper training set could lead to extremely bad performance in the unsupervised transfer learning setting, which supports our claim that supervised sentence embedding methods are problematic to port to new domains when the distribution of target data (i.e. AFS) differs significantly from the pretraining one (i.e. NLI). + +We also show results of BERT and SBERT in another two settings when trained with task-specific labeled data as in (Reimers and Gurevych, 2019). When trained on all topics (10-fold cross-validation), both BERT and SBERT easily achieve scores above 70, while we observe large performance drop when they are trained in a cross-topic setting (i.e. train on two topics of AFS and evaluate on the third topic). The even larger performance drop of SBERT when trained on NLI ( $\rho$ from 74.13 to 15.84) again demonstrates that the domain-relatedness between the training set and the target test set has a huge impact on supervised sentence embedding learning, as a result, the supervised methods are problematic to be applied to downstream tasks of domains without labeled data. + +# 4.2 Supervised Evaluations + +# 4.2.1 SentEval + +Experimental Details: Here we evaluate the sentence representations in IS-BERT on a set of supervised tasks. Following Reimers and Gurevych (2019), we use a set of classification tasks that covers various types of sentence classification, including sentiment analysis (CR (Hu and Liu, 2004), MR (Pang and Lee, 2005) and SST (Socher et al., 2013)), question-type classification (TREC (Li and Roth, 2002)), subjectivity classification (SUBJ (Pang and Lee, 2004)), opinion polarity classification (MPQA (Wiebe et al., 2005)) and paraphrase identification (MRPC (Dolan et al., 2004)). + +Since these tasks are more domain-specific, we train IS-BERT on each of the task-specific dataset (without label) to produce sentence embeddings, which are then used for training downstream classifiers. We denote this setting as IS-BERT-task. SentEval (Conneau and Kiela, 2018) toolkit is used to automate the evaluation process. It takes sentence embeddings as fixed input features to a logistic regression classifier, which is trained in a + +
Modelrρ
Without task-specific labeled data
Unigram-TFIDF46.7742.95
InferSent-GloVe27.0826.63
Avg. GloVe embeddings32.4034.00
Avg. BERT embeddings35.3935.07
SBERT-NLI16.2715.84
Ours: IS-BERT-AFS49.1445.25
Supervised: 10-fold cross-validation
BERT-AFS77.2074.84
SBERT-AFS76.5774.13
Supervised: cross-topic evaluation
BERT-AFS58.4957.23
SBERT-AFS52.3450.65
+ +Table 2: Average Pearson correlation $r$ and average Spearman's rank correlation $\rho$ over three topics on the Argument Facet Similarity (AFS) corpus. Results of baselines are extracted from (Reimers and Gurevych, 2019; Reimers et al., 2019) + +10-fold cross-validation setup and the prediction accuracy is computed for the test-fold. + +Results: Table 3 presents the results. Overall, supervised methods outperform unsupervised baselines. This indicates that pretraining sentence encoder with high-quality labeled data such as NLI is helpful in a supervised transfer learning setting. Note that in this task, SentEval fits a logistic regression classifier to the sentence embeddings with labels of the downstream tasks. Thus, the models that achieve good results on this task do not necessarily work well on unsupervised tasks such as clustering. As shown in Section 4.1.2, training on NLI could lead to extremely bad performance on downstream unsupervised tasks when the domain data significantly differs from NLI. + +IS-BERT-task is able to outperform other unsupervised baselines on 6 out of 7 tasks, and it is on par with InferSent and USE which are strong supervised baselines trained on NLI task. This demonstrates the effectiveness of the proposed model in learning domain-specific sentence embeddings. + +# 4.2.2 Supervised STS + +Experimental Details: Following Reimers and Gurevych (2019), we use the STSb (Cer et al., 2017) dataset to evaluate models' performance on the supervised STS task. This dataset includes 8,628 sentence pairs from the three categories cap- + +
ModelMRCRSUBJMPQASSTTRECMRPCAvg.
Using unlabeled data (unsupervised methods)
Unigram-TFIDF†73.779.290.382.4-85.073.6-
SDAE†74.678.090.886.9-78.473.7-
ParagraphVec DBOW†60.266.976.370.7-59.472.9-
SkipThought†76.580.193.687.182.092.273.083.50
FastSent†70.878.488.780.6-76.872.2-
Avg. GloVe embeddings‡77.2578.3091.1787.8580.1883.072.8781.52
Avg. BERT embeddings‡78.6686.2594.3788.6684.4092.869.5484.94
BERT CLS-vector‡78.6884.8594.2188.2384.1391.471.1384.66
Ours: IS-BERT-task81.0987.1894.9688.7585.9688.6474.2485.91
Using labeled NLI data (supervised methods)
InferSent - GloVe‡81.5786.5492.5090.3884.1888.275.7785.59
USE‡80.0985.1993.9886.7086.3893.270.1485.10
SBERT-NLI‡83.6489.4394.3989.8688.9689.676.0087.41
+ +Table 3: Evaluation accuracy using the SentEval toolkit. Scores are based on a 10-fold cross-validation. Results of baselines marked with $\dagger$ are extracted from (Hill et al., 2016) (with a different number of decimal places). Results of baselines marked with $\ddagger$ are extracted from (Reimers and Gurevych, 2019). + +
Modelρ
BERT-STSb84.30 ± 0.76
SBERT-STSb84.67 ± 0.19
Ours: IS-BERT-STSb (ft)74.25 ± 0.94
Ours: IS-BERT-STSb (ssl + ft)84.84 ± 0.43
+ +Table 4: Spearman's rank correlation $\rho$ on the STSb test set. Results of baselines are extracted from (Reimers and Gurevych, 2019). All systems are trained with 10 random seeds to counter variances (Reimers and Gurevych, 2019). + +tions, news, and forums. It is divided into train (5,749), dev (1,500) and test (1,379). + +We compare IS-BERT to the state-of-the-art BERT and SBERT methods on this task. BERT is trained with a regression head on the training set with both sentences passed to the network (BERT-STSb). SBERT is trained on the training set by encoding each sentence separately and using a regression objective function. + +We experiment with two setups: 1) Without self-supervised learning with the max-MI objective in Eq.3, IS-BERT is directly used for encoding each sentence and fine-tuned on the training set with a regression objective. We denote this setting as IS-BERT-STSb (ft). 2) IS-BERT is first trained on the training set without label using the self-supervised learning objective. Then, it is fine-tuned on the labeled data with a regression objective. We denote this setting as IS-BERT-STSb (ssl+ft). At the pre + +diction time, cosine similarity is computed between each pair of sentences. + +Results: The results are depicted in Table 4. BERT and SBERT performs similarly on this task. IS-BERT-STSb (ssl+ft) outperforms both baselines. Another interesting finding is that when directly fine-tuning IS-BERT on the labeled data, it performs much worse than SBERT. The only difference between them is that IS-BERT-STSb(ft) uses CNN layers with mean pooling to obtain sentence embeddings while SBERT simply uses a pooling layer to do so. This suggests that a more complex sentence encoder does not automatically lead to better sentence embeddings. However, when comparing IS-BERT-STSb(ft) with IS-BERT-STSbssl+ft), we observe that adding self-supervised learning before fine-tuning leads to more than $10\%$ performance improvements. This indicates that the our self-supervise learning method can also be used as an effective domain-adaptation approach before fine-tuning the network. + +# 5 Conclusions + +In this paper, we proposed the IS-BERT model for unsupervised sentence representation learning with a novel MI maximization objective. IS-BERT outperforms all unsupervised sentence embedding baselines on various tasks and is competitive with supervised sentence embedding methods in certain scenarios. In addition, we show that sentence + +BERT (SBERT), the state-of-the-art supervised method, is problematic to apply to certain unsupervised tasks when the target domain significantly differs from the dataset it was trained on. IS-BERT achieves substantially better results in this scenario as it has the flexibility to be trained on the task-specific corpus without label restriction. In the future, we want to explore semi-supervised methods for sentence embedding and its transferability across domains. + +# References + +Eneko Agirre, Carmen Banea, Claire Cardie, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, Weiwei Guo, Inigo Lopez-Gazpio, Montse Maritxalar, Rada Mihalcea, German Rigau, Larraitz Uria, and Janyce Wiebe. 2015. Semeval-2015 task 2: Semantic textual similarity, english, spanish and pilot on interpretability. In Proc. of SemEval@ACL. +Eneko Agirre, Carmen Banea, Claire Cardie, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, Weiwei Guo, Rada Mihalcea, German Rigau, and Janyce Wiebe. 2014. Semeval-2014 task 10: Multilingual semantic textual similarity. In Proc. of SemEval@ACL. +Eneko Agirre, Carmen Banea, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, Rada Mihalcea, German Rigau, and Janyce Wiebe. 2016. Semeval-2016 task 1: Semantic textual similarity, monolingual and cross-lingual evaluation. In Proc. of SemEval@ACL. +Eneko Agirre, Daniel Cer, Mona Diab, and Aitor Gonzalez-Agirre. 2012. Semeval-2012 task 6: A pilot on semantic textual similarity. In Se-mEval@ACL. +Eneko Agirre, Daniel Cer, Mona Diab, Aitor Gonzalez-Agirre, and Weiwei Guo. 2013. *sem 2013 shared task: Semantic textual similarity. In The Second Joint Conference on Lexical and Computational Semantics. +Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and R Devon Hjelm. 2018. Mine: mutual information neural estimation. +Anthony J Bell and Terrence J Sejnowski. 1995. An information-maximization approach to blind separation and blind deconvolution. Neural computation, 7(6):1129-1159. +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In Proc. of EMNLP. + +Daniel Cer, Mona Diab, Eneko Agirre, Inigo Lopez-Gazpio, and Lucia Specia. 2017. Semeval-2017 task 1: Semantic textual similarity multilingual and cross-lingual focused evaluation. In Proc. of SemEval@ACL. +Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St. John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, Brian Strope, and Ray Kurzweil. 2018. Universal sentence encoder for English. In Proc. of EMNLP. +Alexis Conneau and Douwe Kiela. 2018. SentEval: An evaluation toolkit for universal sentence representations. In Proc. of LREC. +Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. 2017. Supervised learning of universal sentence representations from natural language inference data. In Proc. of EMNLP. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proc. of NAACL-HLT. +Bill Dolan, Chris Quirk, and Chris Brockett. 2004. Unsupervised construction of large paraphrase corpora: Exploiting massively parallel news sources. In Proc. of COLING. +Zhe Gan, Yunchen Pu, Ricardo Henao, Chunyuan Li, Xiaodong He, and Lawrence Carin. 2017. Learning generic sentence representations using convolutional neural networks. In Proc. of EMNLP. +Michael U Gutmann and Aapo Hyvarinen. 2012. Noise-contrastive estimation of unnormalized statistical models, with applications to natural image statistics. Journal of Machine Learning Research, 13(Feb):307-361. +Felix Hill, Kyunghyun Cho, and Anna Korhonen. 2016. Learning distributed representations of sentences from unlabelled data. In Proc. of NAACL-HLT. +Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Philip Bachman, Adam Trischler, and Yoshua Bengio. 2019. Learning deep representations by mutual information estimation and maximization. In Proc. of ICLR. +Minqing Hu and Bing Liu. 2004. Mining and summarizing customer reviews. In Proc. of KDD. +Aapo Hyvarinen and Erkki Oja. 2000. Independent component analysis: algorithms and applications. Neural networks, 13(4-5):411-430. +Yacine Jernite, Samuel R. Bowman, and David A. Sontag. 2017. Discourse-based objectives for fast unsupervised sentence representation learning. arXiv preprint arXiv:1705.00557. + +Xu Ji, F. Joao Henriques, and Andrea Vedaldi. 2019. Invariant information clustering for unsupervised image classification and segmentation. arXiv preprint arXiv:1807.06653. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882. +Ryan Kiros, Yukun Zhu, Russ R Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. Skip-thought vectors. In Proc. of NIPS. +Lingpeng Kong, Cyprien de Masson d'Autume, Lei Yu, Wang Ling, Zihang Dai, and Dani Yogatama. 2020. A mutual information maximization perspective of language representation learning. In Proc. of ICLR. +Quoc V. Le and Tomas Mikolov. 2014. Distributed representations of sentences and documents. In Proc. of ICML. +Xin Li and Dan Roth. 2002. Learning question classifiers. In Proc. of COLING. +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. +Lajanugen Logeswaran and Honglak Lee. 2018. An efficient framework for learning sentence representations. In Proc. of ICLR. +Marco Marelli, Stefano Menini, Marco Baroni, Luisa Bentivogli, Raffaella Bernardi, and Roberto Zamparelli. 2014. A SICK cure for the evaluation of compositional distributional semantic models. In Proc. of LREC. +Amita Misra, Brian Ecker, and Marilyn Walker. 2016. Measuring the similarity of sentential arguments in dialogue. In Proc. of the 17th Annual Meeting of the Special Interest Group on Discourse and Dialogue. +Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. 2016. f-gan: Training generative neural samplers using variational divergence minimization. In Proc. of NIPS. +Aäron van den Oord, Yazhe Li, and Oriol Vinyals. 2018. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748. +Matteo Pagliardini, Prakhar Gupta, and Martin Jaggi. 2017. Unsupervised learning of sentence embeddings using compositional n-gram features. arXiv preprint arXiv:1703.02507. +Bo Pang and Lillian Lee. 2004. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. In Proc. of ACL. + +Bo Pang and Lillian Lee. 2005. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proc. of ACL. +Nils Reimers, Philip Beyer, and Iryna Gurevych. 2016. Task-oriented intrinsic evaluation of semantic textual similarity. In Proc. of COLING. +Nils Reimers and Iryna Gurevych. 2019. SentenceBERT: Sentence embeddings using Siamese BERT-networks. In Proc. of EMNLP-IJCNLP. +Nils Reimers, Benjamin Schiller, Tilman Beck, Johannes Daxenberger, Christian Stab, and Iryna Gurevych. 2019. Classification and clustering of arguments with contextualized word embeddings. In Proc. of ACL. +Richard Socher, Eric H. Huang, Jeffrey Pennin, Christopher D Manning, and Andrew Y. Ng. 2011. Dynamic pooling and unfolding recursive autoencoders for paraphrase detection. In Proc. of NIPS. +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 Proc. of EMNLP. +Fan-Yun Sun, Jordan Hoffmann, and Jian Tang. 2020. Infograph: Unsupervised and semi-supervised graph-level representation learning via mutual information maximization. In Proc. of ICLR. +Petar Velickovic, William Fedus, William L. Hamilton, Pietro Lio, Yoshua Bengio, and R. Devon Hjelm. 2019. Deep graph infomax. In Proc. of ICLR. +Janyce Wiebe, Theresa Wilson, and Claire Cardie. 2005. Annotating expressions of opinions and emotions in language. *Language Resources and Evaluation*. +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proc. of NAACL-HLT. +Yinfei Yang, Steve Yuan, Daniel Matthew Cer, Shengyi Kong, Noah Constant, P. Pilar, Heming Ge, YunHsuan Sung, B. Strope, and R. Kurzweil. 2018. Learning semantic textual similarity from conversations. In Proc. of RepL4NLP@ACL. +Yukun Zhu, Ryan Kiros, S. Richard 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 Proc. of ICCV. \ No newline at end of file diff --git a/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/images.zip b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..abb3b4de40a26d68862117ba907a21ceaf0cae6e --- /dev/null +++ b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53726bf9d7f0c068e6666eeaeeaa8df88e618f10063dc5c0590adfd19e3f8d7c +size 383802 diff --git a/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/layout.json b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2b4ded4513624d263c0bddbb95f6496ed95f5874 --- /dev/null +++ b/anunsupervisedsentenceembeddingmethodbymutualinformationmaximization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8465926780a5d865708f1a5f973576e8dd6bd8843226df5f056817d0a13186c5 +size 303898 diff --git a/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_content_list.json b/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..5078b2e4676d05a7b4d448ddd2a0436bb2005acb --- /dev/null +++ b/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:106f338fd85b00b1466aa9648d7f9b736f4e73e8160fe294373e6696022e3cc5 +size 91435 diff --git a/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_model.json b/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f054246cc0da94ff9a4e22f8d860a07a7ac47934 --- /dev/null +++ b/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5d6a900197dc4f30419413404612882ffd5400f759258e91860e579c1d1d309 +size 116257 diff --git a/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_origin.pdf b/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..885cd09b764bd5302829c5b966c4d7de7444b3e4 --- /dev/null +++ b/areallgoodwordvectorspacesisomorphic/f5b7aff3-2e69-4c37-9072-e84407a0ba18_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39af2695927097a01f2d710e0a2555f7ff93006e72e6474f01b1330f5e210c2f +size 619580 diff --git a/areallgoodwordvectorspacesisomorphic/full.md b/areallgoodwordvectorspacesisomorphic/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9d8fb0e3e6b28b6888b805f72a256ee48621f7ca --- /dev/null +++ b/areallgoodwordvectorspacesisomorphic/full.md @@ -0,0 +1,360 @@ +# Are All Good Word Vector Spaces Isomorphic? + +Ivan Vulic $^{1*}$ Sebastian Ruder $^{2*}$ Anders Søgaard $^{3,4*}$ + +$^{1}$ Language Technology Lab, University of Cambridge + +$^{2}$ DeepMind + +$^{3}$ Department of Computer Science, University of Copenhagen + +4 Google Research, Berlin + +iv250@cam.ac.uk ruder@google.com soegaard@di.ku.dk + +# Abstract + +Existing algorithms for aligning cross-lingual word vector spaces assume that vector spaces are approximately isomorphic. As a result, they perform poorly or fail completely on non-isomorphic spaces. Such non-isomorphism has been hypothesised to result from typological differences between languages. In this work, we ask whether non-isomorphism is also crucially a sign of degenerate word vector spaces. We present a series of experiments across diverse languages which show that variance in performance across language pairs is not only due to typological differences, but can mostly be attributed to the size of the monolingual resources available, and to the properties and duration of monolingual training (e.g. "under-training"). + +# 1 Introduction + +Word embeddings have been argued to reflect how language users organise concepts (Mandera et al., 2017; Torabi Asr et al., 2018). The extent to which they really do so has been evaluated, e.g., using semantic word similarity and association norms (Hill et al., 2015; Gerz et al., 2016), and word analogy benchmarks (Mikolov et al., 2013c). If word embeddings reflect more or less language-independent conceptual organisations, word embeddings in different languages can be expected to be near-isomorphic. Researchers have exploited this to learn linear transformations between such spaces (Mikolov et al., 2013a; Glavaš et al., 2019), which have been used to induce bilingual dictionaries, as well as to facilitate multilingual modeling and cross-lingual transfer (Ruder et al., 2019). + +In this paper, we show that near-isomorphism arises only with sufficient amounts of training. This is of practical interest for applications of linear + +![](images/8ae9aca741128e208a06a8434adc55d7579e68107d9e3e2c48860b8fc606bccb.jpg) +Figure 1: Performance of a state-of-the-art BLI model mapping from English to a target language and the size of the target language Wikipedia are correlated. Linear fit shown as a blue line (log scale). + +alignment methods for cross-lingual word embeddings. It furthermore provides us with an explanation for reported failures to align word vector spaces in different languages (Søgaard et al., 2018; Artetxe et al., 2018a), which has so far been largely attributed only to inherent typological differences. + +In fact, the amount of data used to induce the monolingual embeddings is predictive of the quality of the aligned cross-lingual word embeddings, as evaluated on bilingual lexicon induction (BLI). Consider, for motivation, Figure 1; it shows the performance of a state-of-the-art alignment method—RCSLS with iterative normalisation (Zhang et al., 2019)—on mapping English embeddings onto embeddings in other languages, and its correlation $(\rho = 0.72)$ with the size of the tokenised target language Polyglot Wikipedia (Al-Rfou et al., 2013). + +We investigate to what extent the amount of data available for some languages and corresponding training conditions provide a sufficient explanation for the variance in reported results; that is, whether it is the full story or not: The answer is 'almost', + +that is, its interplay with inherent typological differences does have a crucial impact on the 'alignability' of monolingual vector spaces. + +We first discuss current standard methods of quantifying the degree of near-isomorphism between word vector spaces (§2.1). We then outline training settings that may influence isomorphism (§2.2) and present a novel experimental protocol for learning cross-lingual word embeddings that simulates a low-resource environment, and also controls for topical skew and differences in morphological complexity (§3). We focus on two groups of languages: 1) Spanish, Basque, Galician, and Quechua, and 2) Bengali, Tamil, and Urdu, as these are arguably spoken in culturally related regions, but have very different morphology. Our experiments, among other findings, indicate that a low-resource version of Spanish is as difficult to align to English as Quechua, challenging the assumption from prior work that the primary issue to resolve in cross-lingual word embedding learning is language dissimilarity (instead of, e.g., procuring additional raw data for embedding training). We also show that by controlling for different factors, we reduce the gap between aligning Spanish and Basque to English from 0.291 to 0.129. Similarly, under these controlled circumstances, we do not observe any substantial performance difference between aligning Spanish and Galician to English, or between aligning Bengali and Tamil to English. + +We also investigate the learning dynamics of monolingual word embeddings and their impact on BLI performance and near-isomorphism of the resulting word vector spaces (§4), finding training duration, amount of monolingual resources, preprocessing, and self-learning all to have a large impact. The findings are verified across a set of typologically diverse languages, where we pair English with Spanish, Arabic, and Japanese. + +We will release our new evaluation dictionaries and subsampled Wikipedias controlling for topical skew and morphological differences to facilitate future research at: github.com/ cambridgeltl/iso-study. + +# 2 Isomorphism of Vector Spaces + +Studies analyzing the qualities of monolingual word vector spaces have focused on intrinsic tasks (Baroni et al., 2014), correlations (Tsvetkov et al., 2015), and subspaces (Yaghoobzadeh and Schütze, 2016). In the cross-lingual setting, the most impor + +tant indicator for performance has been the degree of isomorphism, that is, how (topologically) similar the structures of the two vector spaces are. + +Mapping-based approaches The prevalent way to learn a cross-lingual embedding space, especially in low-data regimes, is to learn a mapping between a source and a target embedding space (Mikolov et al., 2013a). Such mapping-based approaches assume that the monolingual embedding spaces are isomorphic, i.e., that one can be transformed into the other via a linear transformation (Xing et al., 2015; Artetxe et al., 2018a). Recent unsupervised approaches rely even more strongly on this assumption: They assume that the structures of the embedding spaces are so similar that they can be aligned by minimising the distance between the transformed source language and the target language embedding space (Zhang et al., 2017; Conneau et al., 2018; Xu et al., 2018; Alvarez-Melis and Jaakkola, 2018; Hartmann et al., 2019). + +# 2.1 Quantifying Isomorphism + +We employ measures that quantify isomorphism in three distinct ways—based on graphs, metric spaces, and vector similarity. + +Eigenvector similarity (Søgaard et al., 2018) Eigenvector similarity (EVS) estimates the degree of isomorphism based on properties of the nearest neighbour graphs of the two embedding spaces. We first length-normalise embeddings in both embedding spaces and compute the nearest neighbour graphs on a subset of the top most frequent $N$ words. We then calculate the Laplacian matrices $L_{1}$ and $L_{2}$ of each graph. For $L_{1}$ , we find the smallest $k_{1}$ such that the sum of its $k_{1}$ largest eigenvalues $\sum_{i=1}^{k_{1}} \lambda_{1i}$ is at least $90\%$ of the sum of all its eigenvalues. We proceed analogously for $k_{2}$ and set $k = \min(k_{1}, k_{2})$ . The eigenvector similarity metric $\Delta$ is now the sum of the squared differences of the $k$ largest Laplacian eigenvalues: $\Delta = \sum_{i=1}^{k} (\lambda_{1i} - \lambda_{2i})^{2}$ . The lower $\Delta$ , the more similar are the graphs and the more isomorphic are the embedding spaces. + +# Gromov-Hausdorff distance (Patra et al., 2019) + +The Hausdorff distance is a measure of the worst case distance between two metric spaces $\mathcal{X}$ and $\mathcal{Y}$ with a distance function $d$ : + +$$ +\begin{array}{l} \mathcal{H}(\mathcal{X},\mathcal{Y}) = \max \{\sup_{x\in \mathcal{X}}\inf_{y\in \mathcal{Y}}d(x,y), \\ \sup_{y\in \mathcal{Y}}\inf_{x\in \mathcal{X}}d(x,y)\} \\ \end{array} +$$ + +Intuitively, it measures the distance between the nearest neighbours that are farthest apart. The Gromov-Hausdorff distance (GH) in turn minimises this distance over all isometric transforms (orthogonal transforms in our case as we apply mean centering) $\mathcal{X}$ and $\mathcal{Y}$ as follows: + +$$ +\mathcal {G H} (\mathcal {X}, \mathcal {Y}) = \inf _ {f, g} \mathcal {H} (f (\mathcal {X}), g (\mathcal {Y})) +$$ + +In practice, $\mathcal{GH}$ is calculated by computing the Bottleneck distance between the metric spaces (Chazal et al., 2009; Patra et al., 2019). + +Relational similarity As an alternative, we consider a simpler measure inspired by Zhang et al. (2019). This measure, dubbed RSIM, is based on the intuition that the similarity distributions of translations within each language should be similar. We first take $M$ translation pairs $(m_s, m_t)$ from our bilingual dictionary. We then calculate cosine similarities for each pair of words $(m_s, n_s)$ on the source side where $m_s \neq n_s$ and do the same on the target side. Finally, we compute the Pearson correlation coefficient $\rho$ of the sorted lists of similarity scores. Fully isomorphic embeddings would have a correlation of $\rho = 1.0$ , and the correlation decreases with lower degrees of isomorphism. + +# 2.2 Isomorphism and Learning + +Non-isomorphic embedding spaces have been attributed largely to typological differences between languages (Søgaard et al., 2018; Patra et al., 2019; Ormazabal et al., 2019). We hypothesise that non-isomorphism is not solely an intrinsic property of dissimilar languages, but also a result of a poorly conditioned training setup. In particular, languages that are regarded as being dissimilar to English, i.e. non-Indo-European languages, are often also low-resource languages where comparatively few samples for learning word embeddings are available. As a result, embeddings trained for low-resource languages may often not match the quality of their high-resource counterparts, and may thus constitute the main challenge when mapping embedding spaces. To investigate this hypothesis, we consider different aspects of poor conditioning as follows. + +Corpus size It has become standard to align monolingual word embeddings trained on Wikipedia (Glavaš et al., 2019; Zhang et al., 2019). As can be seen in Figure 1, and also in Table 1, Wikipedias of low-resource languages are more than a magnitude smaller than Wikipedias of high-resource languages.3 Corpus size has been shown to play a role in the performance of monolingual embeddings (Sahlgren and Lenci, 2016), but it is unclear how it influences their structure and isomorphism. + +Training duration As it is generally too expensive to tune hyper-parameters separately for each language, monolingual embeddings are typically trained for the same number of epochs in large-scale studies. As a result, word embeddings of low-resource languages may be "under-trained". + +Preprocessing Different forms of preprocessing have been shown to aid in learning a mapping (Artetxe et al., 2018b; Vulic et al., 2019; Zhang et al., 2019). Consequently, they may also influence the isomorphism of the vector spaces. + +Topical skew The Wikipedias of low-resource languages may be dominated by few contributors, skewed towards particular topics, or generated automatically. Embeddings trained on different domains are known to be non-isomorphic (Søgaard et al., 2018; Vulić et al., 2019). A topical skew may thus also make embedding spaces harder to align. + +# 3 Simulating Low-resource Settings + +As low-resource languages—by definition—have only a limited amount of data available, we cannot easily control for all aspects using only a low-resource language. Instead, we modify the training setup of a high-resource language to simulate a low-resource scenario. For most of our experiments, we use English (EN) as the source language and modify the training setup of Spanish (ES). Additional results where we modify the training setup of English instead are available in the appendix; they further corroborate our key findings. We choose this language pair as both are similar, i.e. Indo-European, high-resource, and BLI performance is typically very high. Despite this high performance, unlike English, Spanish is a highly inflected language. In + +
ES Wikipedia sampleComparable Wikis
# Sentences# Tokens
50k1.3MAmharic, Yoruba, Khmer
100k2.7MIlocano, Punjabi
200k5.4MBurmese, Nepali, Irish
500k13.4MTelugu, Tatar, Afrikaans
1M26.8MArmenian, Uzbek, Latvian
2M53.7MCroatian, Slovak, Malay
5M134.1MFinnish, Indonesian
10M268.3MCatalan, Ukrainian
+ +Table 1: Spanish Wikipedia samples of different sizes and comparable Wikipedias in other languages. + +order to inspect if similar patterns also hold across typologically more dissimilar languages, we also conduct simulation experiments with two other target languages with large Wikipedias in lieu of Spanish: Japanese (JA, an agglutinative language) and Arabic (AR, introflexive). + +When controlling for corpus size, we subsample the target language (i.e., Spanish, Japanese, or Arabic) Wikipedia to obtain numbers of tokens comparable to low-resource languages as illustrated in Table 1. When controlling for training duration, we take snapshots of the "under-trained" vector spaces after seeing an exact number of $M$ word tokens (i.e., after performing $M$ updates). + +To control for topical skew, we need to sample similar documents as in low-resource languages. To maximise topical overlap, we choose low-resource languages that are spoken in similar regions as Spanish and whose Wikipedias might thus also focus on similar topics—specifically Basque (EU), Galician (GL), and Quechua (QU). These four languages have very different morphology. Quechua is an agglutinative language, while Spanish, Galician, and Basque are highly inflected. Basque additionally employs case marking and derivation. If non-isomorphism was entirely explained by language dissimilarity, we would expect even low-resource versions of Spanish to have high BLI performance with English. We repeat the same experiment with another set of languages with distinct properties but spoken in similar regions: Bengali, Urdu, and Tamil. + +Typological differences however, may still explain part of the difference in performance. For instance, as we cannot simulate Basque by changing the typological features of Spanish5, we instead + +make Spanish, Basque, Galician, and Quechuan "morphologically similar": we remove inflections and case marking through lemmatisation. We follow the same process for Bengali, Urdu, and Tamil. + +# 4 Experiments and Analyses + +# 4.1 Experimental Setup + +Embedding algorithm Previous work has shown that learning embedding spaces with different hyper-parameters leads to non-isomorphic spaces (Søgaard et al., 2018; Hartmann et al., 2018). To control for this aspect, we train monolingual embeddings with fastText in the standard setup (skipgram, character n-grams of sizes 3 to 6, a learning rate of 0.025, 15 negative samples, a window size of 5) (Bojanowski et al., 2017). Unless specified otherwise, we train for 15 epochs. + +Mapping algorithm We use the supervised variant of VecMap (Artetxe et al., 2018a) for our experiments, which is a robust and competitive choice according to the recent empirical comparative studies (Glavaš et al., 2019; Vulić et al., 2019; Hartmann et al., 2019). VecMap learns an orthogonal transformation based on a seed translation dictionary with additional preprocessing and postprocessing steps, and it can additionally enable self-learning in multiple iterations. For further details we refer the reader to the original work (Artetxe et al., 2018a). + +Evaluation We measure isomorphism between monolingual spaces using the previously described intrinsic measures: eigenvector similarity (EVS), Gromov-Hausdorff distance (GH), and relational similarity (RSIM). In addition, we evaluate on bilingual lexicon induction (BLI), a standard task for evaluating cross-lingual word representations. Given a list of $N_{s}$ source words, the task is to find the corresponding translation in the target language as a nearest neighbour in the cross-lingual embedding space. The list of retrieved translations is then compared against a gold standard dictionary. Following prior work (Glavaš et al., 2019), we employ mean reciprocal rank (MRR) as evaluation measure, and use cosine similarity as similarity measure. + +Training and test dictionaries Standard BLI test dictionaries over-emphasise frequent words (Czarnowska et al., 2019; Kementchedjheva et al., + +![](images/cc287d27ddfea451697ee3d761fe48a200323cb2f2a48298e3ec8fe51121ae33.jpg) +(a) EN $\rightarrow$ ES (1k) + +![](images/8ea7bb0afd8085e1741257a8034f1ed59a09dba3739b25926b9bb0ac2fe83121.jpg) +(b) EN $\rightarrow$ ES (5k) + +![](images/8f25a8336c97b0ad10f51068d794da3eef29769e201088160671eb0da9a9ec95.jpg) +(c) EN $\rightarrow$ AR/JA (1k) + +![](images/7572cbc8bc0ddd8cdea2afc9c35ca6082bfa62548d32f7462f11b33b2b53489f.jpg) +Figure 2: Impact of dataset size on BLI when aligning ES, AR, and JA vector spaces fully trained on corpora of different sizes (obtained through sampling from the full corpus) to an EN space fully trained on complete data. We report scores without self-learning (solid lines) and with self-learning (dotted lines; same colour) with seed dictionary sizes of (a) 1k and (b) 5k on our EN-ES BLI evaluation sets, while the corresponding isomorphism scores are provided in Figure 6 for clarity. (c) We again report scores without and with self-learning on EN-AR/JA BLI evaluation sets from the MUSE benchmark with 1k seed translation pairs. The results with 5k seed pairs for EN-AR/JA are available in the appendix. Dashed lines without any marks show isomorphism scores (computed by RSIM; higher is better) computed across different AR and JA snapshots. +(a) EN $\rightarrow$ ES (1k) +Figure 3: Impact of training duration on BLI when aligning a partially trained Spanish (ES), Arabic (AR), and Japanese (JA) vector space, where snapshots are taken after seeing $M$ word tokens in training, to the fully trained EN space. We report scores without self-learning (solid lines) and with self-learning (dotted lines; same colour) with seed dictionary sizes of (a) 1k and (b) 5k on our EN-ES BLI evaluation sets. For clarity, the corresponding isomorphism scores (and impact of training duration on isomorphism of vector spaces) over the same training snapshots for Spanish are shown in Figure 5. (c) We again report scores without and with self-learning on EN-AR/JA BLI evaluation sets from the MUSE benchmark with 1k seed translation pairs. The results with 5k seed pairs for EN-AR/JA are available in the appendix. Dashed lines without any marks show isomorphism scores (computed by RSIM; higher is better) computed across different AR and JA snapshots. + +![](images/e5a2ab4811dc967d0c323317a7fb4d42e1f07ea13073000f70a5ffd8eba10574.jpg) +(b) EN $\rightarrow$ ES (5k) + +![](images/15dad513480977d47189b7d2d619be19ae3b6c58e998cd777f19d3fb2dc2228f.jpg) +(c) EN $\rightarrow$ AR/JA (1k) + +2019) whose neighbourhoods may be more isomorphic (Nakashole, 2018). We thus create new evaluation dictionaries for English-Spanish that consist of words in different frequency bins: we sample EN words for 300 translation pairs respectively from (i) the top 5k words of the full English Wikipedia (HFREQ); (ii) the interval [10k, 20k] (MFREQ); (iii) the interval [20k, 50k] (LFREQ). The entire dataset (ALL-FREQ; 900 pairs) consists of $(\mathrm{i}) + (\mathrm{ii}) + (\mathrm{iii})$ . We exclude named entities as they are over-represented in many test sets (Kementchedjhieva et al., 2019) and include nouns, verbs, adjectives, and adverbs in all three sets. All 900 words have been carefully manually translated and double-checked by a native Spanish speaker. There are no duplicates. We also report BLI results + +on the PanLex test lexicons (Vulic et al., 2019). + +For English-Spanish, we create training dictionaries of sizes 1k and 5k based on PanLex (Kamholz et al., 2014) following Vulić et al. (2019). We exclude all words from ALL-FREQ from the training set. For EN-JA/AR BLI experiments, we rely on the standard training and test dictionaries from the MUSE benchmark (Conneau et al., 2018). Isomorphism scores with RSIM for EN-JA/AR are computed on a fixed random sample of 1k one-to-one translations from the respective MUSE training dictionary. For learning monolingual embeddings, we use tokenised and sentence-split Polyglot + +Wikipedias (Al-Rfou et al., 2013). In §4.6, we process Wiki dumps, using Moses for tokenisation and sentence splitting. For lemmatisation of Spanish, Basque, Galician, Tamil, and Urdu we employ the UDPipe models (Straka and Straková, 2017). For Quechua and Bengali, we utilise the unsupervised Morfessor model provided by Polyglot NLP. + +# 4.2 Impact of Corpus Size + +To evaluate the impact of the corpus size on vector space isomorphism and BLI performance, we shuffle the target language (i.e., Spanish, Arabic, Japanese) Wikipedias and take $N$ sentences where $N \in \{10k, 20k, 500k, 100k, 500k, 1M, 2M, 10M, 15M\}$ corresponding to a range of low-resource languages (see Table 1). Each smaller dataset is a subset of the larger one. We learn target language embeddings for each sample, map them to the English embeddings using dictionaries of sizes $1k$ and $5k$ and supervised VecMap with and without self-learning, and report their BLI performance and isomorphism scores in Figure 2. Both isomorphism and BLI scores improve with larger training resources. $^8$ Performance is higher with a larger training dictionary and self-learning but shows a similar convergence behaviour irrespective of these choices. What is more, despite different absolute scores, we observe a similar behaviour for all three language pairs, demonstrating that our intuition holds across typologically diverse languages. + +In English-Spanish experiments performance on frequent words converges relatively early, between 1-2M sentences, while performance on medium and low-frequency words continues to increase with more training data and only plateaus around 10M sentences. Self-learning improves BLI scores, especially in low-data regimes. Note that isomorphism scores increase even as BLI scores saturate, which we discuss in more detail in $\S 4.6$ . + +# 4.3 Impact of Training Duration + +To analyse the effect of under-training, we align English embeddings with target language embeddings that were trained for a certain number of iterations/updates and compute their BLI scores. The results for the three language pairs are provided in Figure 3. As monolingual vectors are trained for longer periods, BLI and isomorphism scores improve monotonously, and this holds for all three + +language pairs. Even after training for a large number of updates, BLI and isomorphism scores do not show clear signs of convergence. Self-learning again seems beneficial for BLI, especially at earlier, "under-training" stages. + +# 4.4 Impact on Monolingual Mapping + +As a control experiment, we repeat the two previous experiments controlling for corpus size and training duration when mapping an English embedding space to another EN embedding space. Previous work (Hartmann et al., 2018) has shown that EN embeddings learned with the same algorithm achieve a perfect monolingual "BLI" score of 1.0 (mapping EN words to the same EN word). If typological differences were the only factor affecting the structure of embedding spaces, we would thus expect to achieve a perfect score also for shorter training and smaller corpus sizes. For comparison, we also provide scores on a standard monolingual word similarity benchmark, SimVerb-3500 (Gerz et al., 2016). We show results in Figure 4. We observe that BLI scores only reach 1.0 after 0.4B and 0.6B updates for frequent and infrequent words or with corpus sizes of 1M and 5M sentences respectively, which is more than the size of most low-resource language Wikipedias (Table 1). This clearly shows that even aligning EN to EN is challenging in a low-resource setting due to different vector space structures, and we cannot attribute performance differences to typological differences in this case. + +# 4.5 Impact of Preprocessing + +We next evaluate the impact of different forms of preprocessing. Specifically, we consider: 1) No preprocessing (unnormised vectors); 2) Length normalisation (L2) only (required for orthogonal Procrustes); 3) L2, mean centering (MC), followed by L2; used by VecMap (Artetxe et al., 2018a); and 4) Iterative normalisation (Zhang et al., 2019). + +Iterative normalisation consists of multiple steps of L2 +MC +L2. We have found it to achieve performance nearly identical to L2 +MC +L2, so we do not report it separately. We show results for the remaining methods in Figure 5 and Figure 6. For GH, using no preprocessing leads to much less isomorphic spaces, particularly for infrequent words during very early training. For RSIM with cosine similarity, L2 is equivalent to no normalisation as cosine applies length normalisation. L2 +MC +L2 + +![](images/3bcc9607a796128231b31ff96879d4c93d53c70a049d96fd587dd1a24b98e030.jpg) +(a) Updates: EN + +![](images/9eb3d7d5eebb63fedd1d3f484a4eb8015de96b1a772c188636e4e7e57ae8f84b.jpg) +(b) Different Wiki sizes: EN + +![](images/0b47e455e9e9b8cae26ae93e388f8b5c6b85ae577941702dfb3a6edeed6d9a8a.jpg) +Figure 4: Monolingual "control" experiments when aligning (a) a partially trained EN vector space (after $M$ updates, that is, seen word tokens) to a fully trained vector space, and (b) an EN vector space fully trained on Wikipedia of different sizes (number of sentences). We show RSIM scores, mapping performance (i.e., monolingual "BLI") on HFREQ and LFREQ EN words, and monolingual word similarity scores on SimVerb-3500. +(a) HFREQ subset (ES) +Figure 5: Impact of different monolingual vector space preprocessing strategies on isomorphism scores when aligning a partially trained ES vector space, where snapshots are taken after seeing $M$ word tokens in training, to a fully trained EN vector space. We report RSIM (solid; higher is better, i.e., more isomorphic) and GH distance (dashed; lower is better) on (a) HFREQ, (b) MFREQ, and (c) LFREQ test sets. + +![](images/2d05eb5276a34dc3944a3b3fa9eb2622a63a10aa36c4641134cbdab56987aa12.jpg) +(b) MFREQ subset (ES) + +![](images/e97555b0fbc2ca85a22ab184816a024c72e13c7318d71365e3708dc9f1da7de2.jpg) +(c) LFREQ subset (ES) + +![](images/82d59bd50fdfbb76168da5ac7d8056e9779b459eea79c3493cf982b90ffd5881.jpg) +Figure 6: Impact of dataset size on vector space isomorphism when aligning an ES vector space fully trained on corpora of different sizes to an EN space fully trained on complete data. RSIM (solid lines; higher is better, i.e. more isomorphic) and Eigenvector similarity (dotted lines; lower is better) scores are reported. See Figures 2a-2b for the corresponding EN-ES BLI scores. + +leads to slightly better isomorphism scores overall compared to L2 alone, though it has a slightly + +negative impact on Gromov-Hausdorff scores over longer training duration. Most importantly, the results demonstrate that such preprocessing steps do have a profound impact on near-isomorphism between monolingual vector spaces. + +# 4.6 Impact of Topical Skew and Morphology + +To control for topical skew, we sample the Spanish Wikipedia so that its topical distribution is as close as possible to that of low-resource languages spoken in similar regions—Basque, Galician, and Quechua. To this end, for each language pair, we first obtain document-level alignments using the Wiki API10. We only consider documents that occur in both languages. We then sample sentences from the ES Wikipedia so that the number of tokens per document and the number of tokens overall is similar to the document-aligned sample of the low-resource Wikipedia. This results in topic-adjusted Wikipedias consisting of 14.3M tokens for ES and + +
Basque (EU)Quechua (QU)Galician (GL)
EN-ESEN-EUES/EU gapEN-ESEN-QUES/QU gapEN-ESEN-GLES/GL gap
Full wiki0.7570.4660.2910.5720.0660.5060.7570.6890.068
Random sample0.6620.4110.2510.0370.054-0.0170.6800.6630.017
Comparable sample0.6630.4200.2430.0810.0600.0210.6690.671-0.002
Comp. sample + lemma0.5330.4040.1290.0520.0410.0110.6190.5960.023
Tamil (TA)Urdu (UR)
EN-BNEN-TABN/TA gapEN-BNEN-URBN/UR gap
Full wiki0.2530.1520.1010.1180.132-0.014
Random sample0.1930.1240.0690.0760.093-0.017
Comparable sample0.1960.1310.0650.1080.112-0.004
Comp. sample + lemma0.1520.1210.0310.0720.0700.002
+ +Table 2: BLI scores (MRR) when mapping from a fully trained EN embedding space to one trained on full Wikipedia corpora, random samples, and topic-adjusted comparable samples of the same size with and without lemmatisation for Spanish (ES) and Basque (EU), Quechua (QU), and Galician (GL), respectively (Top table); Bengali (BN) and Tamil (TA), and BN and Urdu (UR) (Bottom table). + +![](images/ed4c832465113d3597dec1d3e160e20798a5837b8839807dbea30488e77e7fc8.jpg) +(a) HFREQ subset (ES) + +![](images/647d5282990602c43f9ba21362b271d78d915a7e214e0c7a1158d42b056afa92.jpg) +(b) MFREQ subset (ES) +Figure 7: Monolingual learning dynamics and isomorphism (RSIM): We align a partially trained ES vector space, after seeing $M$ word tokens, with a fully trained EN vector space, and evaluate on (a) HFREQ, (b) MFREQ, and (c) LFREQ test sets. While BLI performance plateaus, the isomorphism score (computed with RSIM) does not. + +![](images/e649ff93e0709d78ee6c0b1214afe9192eee5e3393e72c03bbbdade410d02096.jpg) +(c) LFREQ subset (ES) + +EU, 26.1M tokens for ES and GL, and 409k tokens for ES and QU. We additionally control for morphology by lemmatising the Wikipedia samples. For Spanish paired with each other language, we use training dictionaries that are similar in size and distribution. We learn monolingual embeddings on each subsampled Wikipedia corpus and align the resulting embeddings with English. We follow the same process to sample the Bengali Wikipedia to make its topical distribution aligned with the samples of the Urdu and Tamil Wikipedias: this results in topic-adjusted Wikipedias consisting of 3.8M tokens for Bengali-Urdu, and 8.1M word tokens for Bengali-Tamil. + +The results are provided in Table 2. We observe that inequality in training resources accounts for a large part of the performance gap. Controlling for topical skew and morphology reduces the gap further and results in nearly identical performance for Spanish compared to Quechua and Galician, respectively. For Galician, lemmatisation slightly widens the gap, likely due to a weaker lemmatiser. For Basque, the remaining gap may be explained by the remaining typological differences between the + +two languages. $^{11}$ We also observe similar patterns in experiments with BN, UR, and TA in Table 2: training with comparable samples with additional morphological processing reduces the observed gap in performance between EN-BN and EN-TA, as well as between EN-BN and EN-UR. This again hints that other factors besides inherent language dissimilarity are at play and contribute to reduced isomorphism between embedding spaces. + +Does isomorphism increase beyond convergence? In our experiments, we have measured how training monolingual word embeddings improves their isomorphism with embeddings in other languages. In doing so, we observed that isomorphism increases even as validation (BLI) scores and training losses plateau (see Figure 7). One possible explanation is that the random oscillations of SGD may lead the weights towards a high-entropy solution, which is more likely to be isomorphic. We highlight and discuss connections to work in opti + +mization and generalization in the appendix. There, we also discuss more speculative implications and connections between (non-)isomorphism and vocabulary alignment across different languages. + +# 5 Conclusion + +We have provided a series of analyses that demonstrate together that non-isomorphism is not—as previously assumed—primarily a result of typological differences between languages, but in large part due to degenerate vector spaces and discrepancies between monolingual training regimes and data availability. Through controlled experiments in simulated low-resource scenarios, also involving languages with different morphology that are spoken in culturally related regions, we found that such vector spaces mainly arise from poor conditioning during training. The study suggests that besides improving our alignment algorithms for distant languages (Vulic et al., 2019), we should also focus on improving monolingual word vector spaces, and monolingual training conditions to unlock a true potential of cross-lingual learning. + +# Acknowledgments + +The work of IV is supported by the ERC Consolidator Grant LEXICAL: Lexical Acquisition Across Languages (no 648909). AS is supported by a Google Focused Research Award. We thank Chris Dyer and Phil Blunsom for feedback on a draft. + +# References + +Rami Al-Rfou, Bryan Perozzi, and Steven Skiena. 2013. Polyglot: Distributed word representations for multilingual nlp. In Proceedings of CoNLL 2013, pages 183-192. +David Alvarez-Melis and Tommi S. Jaakkola. 2018. Gromov-Wasserstein alignment of word embedding spaces. In Proceedings of EMNLP 2018, pages 1881-1890. +Waleed Ammar, George Mulcaire, Yulia Tsvetkov, Guillaume Lample, Chris Dyer, and Noah A. Smith. 2016. Massively multilingual word embeddings. arXiv preprint arXiv:1602.01925. +Mikel Artetxe, Gorka Labaka, and Eneko Agirre. 2018a. A robust self-learning method for fully unsupervised cross-lingual mappings of word embeddings. In Proceedings of ACL 2018, pages 789-798. +Mikel Artetxe, Gorka Labaka, and Eneko Agirre. 2018b. Generalizing and improving bilingual word embedding mappings with a multi-step framework + +of linear transformations. In Proceedings of AAAI 2018, pages 5012-5019. +Marco Baroni, Georgiana Dinu, and German Kruszewski. 2014. Don't count, predict! A systematic comparison of context-counting vs. context-predicting semantic vectors. In Proceedings of ACL 2014, pages 238-247. +Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. 2017. Enriching word vectors with subword information. Transactions of the ACL, 5:135-146. +Frédéric Chazal, David Cohen-Steiner, Leonidas J Guibas, Facundo Mémoli, and Steve Y Oudot. 2009. Gromov-Hausdorff stable signatures for shapes using persistence. In Computer Graphics Forum, volume 28, pages 1393-1403. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. 2020. Unsupervised cross-lingual representation learning at scale. In Proceedings of ACL 2020, pages 8440-8451. +Alexis Conneau, Guillaume Lample, Marc'Aurelio Ranzato, Ludovic Denoyer, and Hervé Jégou. 2018. Word translation without parallel data. In Proceedings of ICLR 2018. +Paula Czarnowska, Sebastian Ruder, Edouard Grave, Ryan Cotterell, and Ann Copestake. 2019. Don't forget the long tail! A comprehensive analysis of morphological generalization in bilingual lexicon induction. In Proceedings of EMNLP 2019, pages 974-983. +Haim Dubossarsky, Ivan Vulic, Roi Reichart, and Anna Korhonen. 2020. The secret is in the spectra: Predicting cross-lingual task performance with spectral similarity measures. In Proceedings of EMNLP 2020. +Yoshinari Fujinuma, Jordan Boyd-Graber, and Michael J. Paul. 2019. A resource-free evaluation metric for cross-lingual word embeddings based on graph modularity. In Proceedings of ACL 2019, pages 4952-4962. +Daniela Gerz, Ivan Vulić, Felix Hill, Roi Reichart, and Anna Korhonen. 2016. SimVerb-3500: A large-scale evaluation set of verb similarity. In Proceedings of EMNLP 2016, pages 2173-2182. +Goran Glavaš, Robert Litschko, Sebastian Ruder, and Ivan Vulić. 2019. How to (properly) evaluate cross-lingual word embeddings: On strong baselines, comparative analyses, and some misconceptions. In Proceedings of ACL 2019, pages 710-721. +Edouard Grave, Piotr Bojanowski, Prakhar Gupta, Armand Joulin, and Tomas Mikolov. 2018. Learning word vectors for 157 languages. In Proceedings of LREC 2018, pages 3483-3487. + +Mareike Hartmann, Yova Kementchedjhieva, and Anders Søgaard. 2018. Why is unsupervised alignment of English embeddings from different algorithms so hard? In Proceedings of EMNLP 2018, pages 582-586. +Mareike Hartmann, Yova Kementchedjhieva, and Anders Søgaard. 2019. Comparing unsupervised word translation methods step by step. In Proceedings of NeurIPS 2019, pages 6031-6041. +Felix Hill, Roi Reichart, and Anna Korhonen. 2015. Simlex-999: Evaluating semantic models with (genuine) similarity estimation. Computational Linguistics, 41(4):665-695. +David Kamholz, Jonathan Pool, and Susan M. Colowick. 2014. PanLex: Building a resource for panlingual lexical translation. In Proceedings of LREC 2014, pages 3145-3150. +Yova Kementchedjhieva, Mareike Hartmann, and Anders Søgaard. 2019. Lost in evaluation: Misleading benchmarks for bilingual dictionary induction. In Proceedings of EMNLP 2019, pages 3336-3341. +Asifa Majid. 2010. Comparing lexicons cross-linguistically. In Oxford Handbook of the Word. +Pawel Mandera, Emmanuel Keuleers, and Marc Brysbaert. 2017. Explaining human performance in psycholinguistic tasks with models of semantic similarity based on prediction and counting: A review and empirical validation. Journal of Memory and Language, 92:57-78. +Tomas Mikolov, Quoc V. Le, and Ilya Sutskever. 2013a. Exploiting similarities among languages for machine translation. arXiv preprint arXiv:1309.4168. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. 2013b. Distributed representations of words and phrases and their compositionality. In Proceedings of NeurIPS 2013, pages 3111-3119. +Tomas Mikolov, Wen-tau Yih, and Geoffrey Zweig. 2013c. Linguistic regularities in continuous space word representations. In Proceedings of NAACL-HLT 2013, pages 746-751. +Ndapa Nakashole. 2018. NORMA: Neighborhood sensitive maps for multilingual word embeddings. In Proceedings of EMNLP 2018, pages 512-522. +Aitor Ormazabal, Mikel Artetxe, Gorka Labaka, Aitor Soroa, and Eneko Agirre. 2019. Analyzing the limitations of cross-lingual word embedding mappings. In Proceedings of ACL 2019, pages 4990-4995. +Barun Patra, Joel Ruben Antony Moniz, Sarthak Garg, Matthew R. Gormley, and Graham Neubig. 2019. Bilingual lexicon induction with semi-supervision in non-isometric embedding spaces. In Proceedings of ACL 2019, pages 184-193. + +Aneta Pavlenko, editor. 2009. The Bilingual Mental Lexicon. +Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. Glove: Global vectors for word representation. In Proceedings of EMNLP 2014, pages 1532-1543. +Shauli Ravfogel, Yoav Goldberg, and Tal Linzen. 2019. Studying the inductive biases of RNNs with synthetic variations of natural languages. In Proceedings of NAACL-HLT 2019, pages 3532-3542. +Sebastian Ruder, Ivan Vulic, and Anders Søgaard. 2019. A survey of cross-lingual word embedding models. Journal of Artificial Intelligence Research, 65:569-631. +Magnus Sahlgren and Alessandro Lenci. 2016. The effects of data size and frequency range on distributional semantic models. In Proceedings of EMNLP 2016, pages 975-980. +Ravid Shwartz-Ziv and Naftali Tishby. 2017. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810. +Anders Søgaard, Sebastian Ruder, and Ivan Vulić. 2018. On the limitations of unsupervised bilingual dictionary induction. In Proceedings of ACL 2018, pages 778-788. +Milan Straka and Jana Strakova. 2017. Tokenizing, POS tagging, lemmatizing and parsing UD2.0 with UDPipe. In Proceedings of the CoNLL 2017 Shared Task: Multilingual Parsing from Raw Text to Universal Dependencies, pages 88-99. +Bill Thompson, Sean Roberts, and Gary Lupyan. 2018. Quantifying semantic alignment across languages. *MPI Tech Report*. +Fatemeh Torabi Asr, Robert Zinkov, and Michael Jones. 2018. Querying word embeddings for similarity and relatedness. In Proceedings of NAACL-HLT 2018, pages 675-684. +Yulia Tsvetkov, Manaal Faruqui, Wang Ling, Guillaume Lample, and Chris Dyer. 2015. Evaluation of word vector representations by subspace alignment. In Proceedings of EMNLP 2015, pages 2049-2054. +Piet Vossen. 2002. WordNet, EuroWordNet and Global WordNet. Revue française de linguistique appliquée, VII. +Ivan Vulic, Goran Glavaš, Roi Reichart, and Anna Korhonen. 2019. Do we really need fully unsupervised cross-lingual embeddings? In Proceedings of EMNLP 2019, pages 4407-4418. +Chao Xing, Chao Liu, Dong Wang, and Yiye Lin. 2015. Normalized word embedding and orthogonal transform for bilingual word translation. In Proceedings of NAACL-HLT 2015, pages 1005-1010. + +Ruochen Xu, Yiming Yang, Naoki Otani, and Yuexin Wu. 2018. Unsupervised cross-lingual transfer of word embedding spaces. In Proceedings of EMNLP 2018, pages 2465-2474. +Yadollah Yaghoobzadeh and Hinrich Schütze. 2016. Intrinsic subspace evaluation of word embedding representations. In Proceedings of ACL 2016, pages 236-246. +Meng Zhang, Yang Liu, Huanbo Luan, and Maosong Sun. 2017. Earth mover's distance minimization for unsupervised bilingual lexicon induction. In Proceedings of EMNLP 2017, pages 1934-1945. +Mozhi Zhang, Keyulu Xu, Ken-ichi Kawarabayashi, Stefanie Jegelka, and Jordan Boyd-Graber. 2019. Are girls neko or shojo? Cross-lingual alignment of non-isomorphic embeddings with iterative normalization. In Proceedings of ACL 2019, pages 3180-3189. +Yao Zhang, Andrew Saxe, Madhu Advani, and Alpha Lee. 2018. Energy-entropy competition and the effectiveness of stochastic gradient descent in machine learning. Molecular Physics, 116. + +# A Further Discussion + +# A.1 Does isomorphism increase beyond convergence? + +Recent studies of learning dynamics in deep neural nets observe that flatter optima generalise better than sharp optima (Zhang et al., 2018): intuitively, it is because sharp minima correspond to more complex, likely over-fitted, models. Zhang et al. (2018) show that analogous to the energy-entropy competition in statistical physics, wide but shallow minima can be optimal if the system is undersampled. SGD is assumed to generalise well because its inherent anisotropic noise biases it towards higher entropy minima. We hypothesise a similar explanation of our observations in terms of energy-entropy competition. Once loss is minimised, the random oscillations due to SGD noise lead the weights toward a high-entropy solution. We hypothesise monolingual high-entropy minima are more likely to be isomorphic. A related possible explanation is that the increased isomorphism results from model compression. This is analogous to the idea of two-phase learning (Shwartz-Ziv and Tishby, 2017), whereby the initial fast convergence of SGD is related to sufficiency of the representation, while the later asymptotic phase is related to compression of the activations. + +# A.2 Do vocabularies align? + +If languages reflect the world, they should convey semantic knowledge in a similar way, and it is therefore reasonable to assume that with enough data, induced word embeddings should be isomorphic. On the other hand, if languages impose structure on our conceptualisation of the world, non-isomorphic word embeddings could easily arise. Studies that engage with speakers of different languages in the real world (Majid, 2010) are naturally limited in scope. Large-scale studies, on the other hand, have generally relied on distributional methods (Thompson et al., 2018), leading to a chicken-and-egg scenario. Vossen (2002) discuss mismatches between WordNets across languages, including examples of hypernyms without translation equivalents, e.g., dedo in Spanish (fingers and toes in English). Such examples break isomorphism between languages, but are relatively rare. Another approach to the question of vocabulary alignment is to study lexical organisation in bilinguals and how it differs from that of monolingual speakers (Pavlenko, 2009). While this paper obviously does not pro + +vide hard evidence for or against Sapir-Whorf-like hypotheses, our results suggest that the variation observed in BLI performance cannot trivially be attributed only to linguistic differences. + +# B Additional Experiments + +Additional experiments that further support the main claims of the paper have been relegated to the appendix for clarity and compactness of presentation. We provide the following additional information: + +- Table 3. It provides "reference" BLI scores and scores stemming from isomorphism measures when we align fully trained EN and ES spaces, that is, when we rely on standard 15 epochs of fastText training on respective Wikipedias. +- Figure 8 and Figure 9 show BLI and isomorphism scores at very early stages of training, both for EN and ES. In other words, one vector space is fully trained, while we take early-training snapshots (after seeing only 10M, 20M, ..., 100M word tokens in training) of the other vector space. The results again stress the importance of training corpus size as well as training duration—early training stages clearly lead to suboptimal performance and non-isomorphic spaces. However, such shorter training durations (in terms of the number of tokens) are often encountered “in the wild” with low-resource languages. +- Figure 10a and Figure 10b show the results with 5k seed translation pairs in different training regimes for EN-AR and EN-JA experiments. The results with 1k seed translation pairs are provided in the main paper. +- Figure 11a and Figure 11b demonstrate the impact of vector space preprocessing (only L2-normalization versus L2 + mean centering + L2) on the RSIM isomorphism scores in different training regimes for EN-AR and EN-JA experiments. +- Table 4 provides additional isomorphism scores, not reported in the paper, again stressing the importance of monolingual vector space preprocessing before learning any crosslingual mapping. + +(The actual tables and figures start on the next page for clarity.) + +# C Reproducibility: Data and Code + +- Polyglot Wikipedias are available at: https://sites.google.com/site/rmyeid/projects/polyglot +- Used fastText code is available at: https://github.com/facebookresearch/fastText +- MUSE dictionaries: https://github.com/facebookresearch/MUSE/tree/master/data +- VecMap framework accessible at: https://github.com/artetxem/vecmap +- Iterative normalisation code available at: https://github.com/zhangmozhi/ itemnorm +- Bilingual lexicons used in the study: https://github.com/cambridgeltl/iso-study +- Subsampled corpora for all languages: https://github.com/cambridgeltl/iso-study + +For BLI, we use evaluation scripts from Glavaš et al. (2019), available here: https://github.com/codogogo/xling-eval. + +Our (research) code available for computing near-isomorphism via RSIM, EVS, and GH is also hosted online at: https://github.com/cambridgeltl/iso-study. The code relies on standard Python's stack for scientific computing (e.g., it uses numpy, scipy, scikit-learn, networkx). + +
Full EN Vector Space - Full ES Vector Space
HFREQMFREQLFREQPANLEXMUSE
BLI: Supervised (1k)0.7330.6310.6210.4480.489
BLI: Supervised+SL (1k)0.7740.7110.6950.4920.536
BLI: Supervised (5k)0.7590.6850.6580.4900.533
BLI: Supervised+SL (5k)0.7780.7040.6910.4910.538
RŠIM0.6520.6330.559--
Gromov-Hausdorff0.2740.2080.205--
Eigenvector Similarity4.866.3210.95--
+ +Table 3: Reference BLI (MRR reported) and isomorphism scores (all three measures discussed in the main paper are reported, computed on L2-normalised vectors) in a setting where we fully train both English and Spanish monolingual vector spaces (i.e., training lasts for 15 epochs for both languages) on the full data, without taking snapshots at earlier stages, and without data reduction simulation experiments. + +![](images/96bccb51c74b7b04c472072d78dc79234bc4acf5be250ab0af074087c70a7ee1.jpg) +(a) Early updates: EN (1k) + +![](images/2a44f09e1c73fd965c3941d7b2d483816645f6c452b8d3b407c9f28d268916b7.jpg) +(b) Early updates: EN (5k) +(c) Early updates: EN (isomorphism) +Figure 8: Impact of training duration on BLI and isomorphism, with a focus on the early training stages. BLI scores (a+b) and isomorphism (c) measures of aligning a partially trained EN vector space, where snapshots are taken after seeing $N$ word tokens in training, to a fully trained ES vector space with a seed dictionary of 1k words (a) and 5k words (b) on the three evaluation sets representing different frequency bins. (c) shows how embedding spaces become more isomorphic over the course of training as measured by second-order similarity (on different frequency bins; solid lines, higher is better) and by Gromov-Hausdorff distance (dotted lines of the same colour and with the same symbols; lower is better). + +![](images/bf075d18a275c42391ee78dc5df1cdae4712fb9e77b53c387dadbf603f27c4e6.jpg) + +![](images/8b1bc50e8646a2888aeaca9df719490842b05503c02008f00a5189043513de0a.jpg) +(a) Early updates: EN (1k) +Figure 9: Impact of training duration on BLI and isomorphism, with a focus on the early training stages. BLI scores (a+b) and isomorphism (c) measures of aligning a partially trained ES vector space, where snapshots are taken after seeing $N$ word tokens in training, to a fully trained EN vector space with a seed dictionary of 1k words (a) and 5k words (b) on the three evaluation sets representing different frequency bins. (c) shows how embedding spaces become more isomorphic over the course of training as measured by second-order similarity (on different frequency bins; solid lines, higher is better) and by Gromov-Hausdorff distance (dotted lines of the same colour and with the same symbols; lower is better). + +![](images/f37e0bbaaa6d3ff24ac155381349675ef76e5b0e286ec311ab57fb1cd1cb8c1b.jpg) +(b) Early updates: EN (5k) +(c) Early updates: EN (isomorphism) + +![](images/d0c2321ced2aab85c13acf5a7deaf9596d08161f36169077a6d9a43c8664f695.jpg) + +![](images/779cd80aaf379f9eeb9e9626bb06576b6bfdef0a829f72a0dae2cc4a096803f5.jpg) +(a) Updates: AR and JA + +![](images/70487473ef3424ffc87b84544cbdf5445b535bd3ed3f556465d561387735230b.jpg) +(b) Different Wiki sizes: AR and JA +Figure 10: EN-AR/JA BLI scores on the MUSE BLI benchmark relying on 5k seed pairs for learning the alignment. (a) Results with partially trained AR and JA vector spaces where snapshots are taken after $M$ updates (i.e., impact of training duration); b) Results with AR and JA vector spaces induced from data samples of different sizes (i.e., impact of dataset size). See the main paper for BLI scores with 5k seed translation pairs. + +![](images/942bcba91028d8390052dd122d11bca081664f498b92ec66be0e999e7b823d91.jpg) +(a) Updates: AR and JA + +![](images/b7967761a8d5dc068f15f451387aeff7c3b7d161c35a9c65d3b9d66abaf15210.jpg) +(b) Different Wiki sizes: AR and JA +Figure 11: The impact of (a) training duration and (b) dataset size on EN-AR/JA isomorphism scores, also showing the impact of vector space preprocessing steps. We report the RSIM measure (higher is better, i.e., more isomorphic). + +
EN (full) - ES (snapshot)EN (snapshot) - ES (full)
EVSGHEVSGH
# UpdatesUNNORML2+MC+L2UNNORML2+MC+L2UNNORML2+MC+L2UNNORML2+MC+L2
100M89.1 [42.7]6.46 [5.88]3.03 [3.19]0.22 [0.30]43.4 [20.9]6.74 [26.3]1.91 [3.66]0.23 [0.33]
200M162 [24.5]3.67 [2.86]3.45 [2.16]0.25 [0.31]38.3 [50.0]9.15 [18.0]2.51 [3.39]0.27 [0.38]
600M235 [26.2]7.47 [3.13]3.54 [1.80]0.27 [0.29]26.1 [20.0]4.51 [15.0]3.50 [2.21]0.34 [0.37]
1B125 [21.3]4.69 [5.90]3.31 [2.32]0.24 [0.28]45.2 [32.4]12.5 [13.7]3.35 [1.49]0.27 [0.30]
2B252 [23.4]5.88 [6.44]3.03 [2.13]0.21 [0.31]25.4 [9.43]16.5 [10.1]3.71 [2.03]0.25 [0.29]
4B360 [21.0]8.78 [7.28]2.54 [2.55]0.15 [0.29]141 [22.5]5.33 [7.99]3.04 [1.37]0.18 [0.31]
6B411 [16.1]6.96 [8.22]1.32 [2.22]0.15 [0.23]191 [16.7]8.98 [11.4]3.22 [0.99]0.15 [0.37]
+ +Table 4: Eigen Vector Similarity (EVS) and Gromov-Hausdorff distance (GH) distance scores with two different monolingual vector space preprocessing strategies: (a) no normalisation at all (UNNORM); (c) L2-normalisation followed by mean centering (MC) and another L2-normalisation step, done as standard preprocessing in the VecMap framework (Artetxe et al., 2018a) (L2+MC+L2). We show the scores in relation to training duration (provided in the number of updates, i.e., seen word tokens), taking snapshots of the English or the Spanish vector space, and aligning it to a fully trained space on the other side. We show scores on HFREQ and [LFREQ] sets; lower is better (i.e., "more isomorphic"). \ No newline at end of file diff --git a/areallgoodwordvectorspacesisomorphic/images.zip b/areallgoodwordvectorspacesisomorphic/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0f015977978d86071583cd0fee7a02edc1bb1c4b --- /dev/null +++ b/areallgoodwordvectorspacesisomorphic/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:369254cf331ecceee0ef8bc52c82ceffa78635d409b3f9a67e7a6ebb3be50d49 +size 889574 diff --git a/areallgoodwordvectorspacesisomorphic/layout.json b/areallgoodwordvectorspacesisomorphic/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4ede15a42652e03ae068e2c8928fe8cea95dfa10 --- /dev/null +++ b/areallgoodwordvectorspacesisomorphic/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:502ac7ce3ee2dbcc1ebc354f883a7b0536f3fcdd2a5dcdeaa864e6e3ab9bd515 +size 443465 diff --git a/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_content_list.json b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..0ad05826a4115a6c301067cab63aafa171476e0c --- /dev/null +++ b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03a1eb463db03f7c859d46c92c567e7f7dde9f3dcdb9c562eee995ee0c3555c0 +size 97706 diff --git a/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_model.json b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_model.json new file mode 100644 index 0000000000000000000000000000000000000000..23f96733db1ddf570104401c79214baa9b3254c9 --- /dev/null +++ b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:792edb524b90a7e1069e31df2fa1b2898123b92e3a458980f80e7c898b5c4db8 +size 116207 diff --git a/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_origin.pdf b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ecb6e0910f97d2efdede72c8fcf6ccde8c23b74b --- /dev/null +++ b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/c19aa496-98d2-4105-a70b-a745c5c8b360_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f536c6802b6a01d87ac285796d43bad89b1688545bab2a6a07be23ebc663c057 +size 2071378 diff --git a/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/full.md b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ec9136d847b9209b97071c3344315126e7a7de76 --- /dev/null +++ b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/full.md @@ -0,0 +1,348 @@ +# Are "Undocumented Workers" the Same as "Illegal Aliens"? Disentangling Denotation and Connotation in Vector Spaces + +Albert Webson $^{1,2}$ , Zhizhong Chen $^{3}$ , Carsten Eickhoff $^{1}$ , and Ellie Pavlick $^{1}$ + +{albert_webson, zhizhong_chen, carsten, ellie_pavlick} $@$ brown.edu + $^{1}$ Department of Computer Science, Brown University + $^{2}$ Department of Philosophy, Brown University + $^{3}$ Department of Physics, Brown University + +# Abstract + +In politics, neologisms are frequently invented for partisan objectives. For example, "undocumented workers" and "illegal aliens" refer to the same group of people (i.e., they have the same denotation), but they carry clearly different connotations. Examples like these have traditionally posed a challenge to reference-based semantic theories and led to increasing acceptance of alternative theories (e.g., Two-Factor Semantics) among philosophers and cognitive scientists. In NLP, however, popular pretrained models encode both denotation and connotation as one entangled representation. In this study, we propose an adversarial neural network that decomposes a pretrained representation as independent denotation and connotation representations. For intrinsic interpretability, we show that words with the same denotation but different connotations (e.g., "immigrants" vs. "aliens", "estate tax" vs. "death tax") move closer to each other in denotation space while moving further apart in connotation space. For extrinsic application, we train an information retrieval system with our disentangled representations and show that the denotation vectors improve the viewpoint diversity of document rankings. + +# 1 Introduction + +Language carries information through both denotation and connotation. For example, a reporter writing an article about the leftmost wing of the Democratic party can choose to refer to the group as "progressives" or as "radicals". The word choice does not change the individuals referred to, but it does communicate significantly different sentiments about the policy positions discussed. This type of linguistic nuance presents a significant challenge for natural language processing systems, most of which fundamentally assume words to have similar meanings if they are surrounded in similar + +![](images/f657eb411ea77a74cc25c6d503badc5fcb47dee54a05135607dab851a2b37900.jpg) +Figure 1: Nearest neighbors of government-run healthcare (triangles) and economic stimulus (circles). Note that words cluster as strongly by policy denotation (shapes) as by partisan connotation (colors); namely, pretrained representations conflate denotation with connotation. Plotted by t-SNE with perplexity $= 10$ . + +word contexts. Such assumption risks confusing differences in connotation for differences in denotation or vice versa. For example, using a common skip-gram model (Mikolov et al., 2013) trained on a news corpus (described in §3.2), Figure 1 shows nearest neighbors of "government-run healthcare" and "economic stimulus". The resulting t-SNE clusters are influenced as much by policy denotation (shapes) as they are by partisan connotation (colors $^{1}$ ). Using these entangled representations in applications such as information retrieval could have pernicious consequences such as reinforcing ideological echo chambers and political polarization. For example, a right-leaning query like "taxpayer-funded healthcare" could make one equally (if not more) likely to see articles about "totalitarian" and "horror stories" than about "affordable healthcare". + +To address this, we propose classifier probes that + +measure denotation and connotation information in a given pretrained representation, and we arrange the probe losses in an adversarial setup in order to decompose the entangled pretrained meaning into distinct denotation and connotation representations (§4). We evaluate our model intrinsically and show that the decomposed representations effectively disentangle these two dimensions of semantics (§5). We then apply the decomposed vectors to an information retrieval task and demonstrate that our method improves the viewpoint diversity of the retrieved documents (§6). All data, code, preprocessing procedures, and hyperparameters are included in the appendix and our GitHub repository.2 + +# 2 Philosophical Motivation + +Consider the following two sentences: "Undocumented workers are undocumented workers" vs. "Undocumented workers are illegal aliens". Frege (1892) famously used sentence pairs like these, which have the same truth conditions but clearly different meanings, in order to argue that meaning is composed of two components: "reference", which is some set of entities or state of affairs, and "sense", which accounts for how the reference is presented, encompassing a large range of aspects such as speaker belief and social convention. + +In contemporary philosophy of language, the sense and reference argument has evolved into debates of semantic externalism vs. internalism and referential vs. conceptual role semantics. Externalists and referentialists3 continue the truth-conditional tradition and emphasize meaning as some entity to which one is causally linked, invariant of one's psychological encoding of the referent (Putnam, 1975; Kripke, 1972). On the other hand, conceptual role semanticists emphasize meaning as what inferences one can draw from a lexical concept, deemphasizing the exact entities which the concept includes (Greenberg and Harman, 2005). Naturally, a popular position takes the Cartesian product of both schools of meaning (Block, 1986; Carey, 2009). This view is known as Two-Factor Semantics, and it forms the inspiration for our work. To avoid confusion with definitions from existing literature, we use the terms "denotation" and "connotation" rather than "reference" and "concept" when discussing our models in this paper. + +# 3 Data + +We assume that it is possible to disentangle the two factors of semantics by grounding language to different components of the non-linguistic context. In particular, our approach assumes access to a set of training sentences, each of which grounds to a denotation $d$ (which approximates reference) or a connotation $c$ (which approximates conceptual inferences). We require at least one of $d$ or $c$ to be observed, but we do not require both (elaborated in §4.3). In this work, $d$ and $c$ are discrete symbols. However, our model could be extended to settings in which $d$ and $c$ are feature vectors. + +While we are interested in learning lexical-level denotation and connotation, we train on sentence- and document-level speaker and reference labels. We argue that this emulates a more realistic form of supervision. For example, we often have metadata about a politician (e.g., party and home state) when reading or listening to what they say, and we are able to aggregate this to make lexical-level judgements about denotation and connotation. + +We experiment on two corpora: the Congressional Record (CR) and the Partisan News Corpus (PN), which differ in linguistic style, partisanship distribution (Figure 2), and the available labels for grounding denotation and connotation. + +![](images/d66ebeeb512e5cee60c2e61c4202804cef05c4c3c5e3769dd3b4ef8eb6de8d51.jpg) +Figure 2: Vector spaces that result from training vanilla word2vec on the Congressional Record (left) and Partisan News (right). We evaluate on both corpora, but note that the Partisan News corpus better exemplifies the problem we target where words cluster strongly according to ideological stance. + +![](images/2a04659768021672b9e44253222b400c121e678600fa64aaaccb0299cff9f4c9.jpg) + +# 3.1 Congressional Record + +The Congressional Record (CR) is the official transcript of the floor speeches and debates of + +
NameCorpusVocab.Num. Sent.Denotation GroundingConnotation Grounding
CR BILLCongr. Record21,170381,847legislation title (1,029-class)speaker party (2-class)
CR TOPICCongr. Record21,170381,847policy topic (41-class)speaker party (2-class)
CR PROXYCongr. Record111,2155,686,864none (LM proxy)speaker party (2-class)
PN PROXYPartisan News138,4393,209,933none (LM proxy)publisher partisan leaning (3-class)
+ +Table 1: Summary of model variants experimented. + +the United States Congress dating back to 1873. Gentzkow et al. (2019) digitized and identified approximately $70\%$ of these speeches with a unique speaker, where each speaker is labeled with their gender, party, chamber, state, and district. To constrain the political and linguistic change over time, we use a subset of the corpus from 1981 to 2011. $^{4}$ + +In order to assign labels that can be used as proxies of denotation, we weakly label each sentence with both its legislative topic and the specific bill being debated.5 To do this, we collected a list of congressional bills from the U.S. Government Publishing Office.6 For our purposes, this data provides the congressional session, policy topic, and an informal short title for each bill. We perform a regular expression search for each bill's short title among the speeches in its corresponding congressional session. For bills that are mentioned at least 3 times, we assume that the speech in which the bill was mentioned as well as 3 subsequent speeches are referring to that bill, and we label each speech with the title and the policy topic of that bill. Speeches that are not labeled by this process are discarded. Additional details and examples are given in Appendix D. + +# 3.2 Partisan News Corpus + +Hyperpartisan News is a set of web articles collected for a 2019 SemEval Task (Kiesel et al., 2019). It consists of articles scraped from the political sections of 383 news outlets in English. Each article is associated with a publisher which, in turn, has been manually labeled with a partisan leaning on a five-point scale: "left, center-left, center, center-right, right". Upon manual inspection, we + +find that the distinctions between right vs. center-right and left vs. center-left are prone to annotation artifacts. Therefore, we collapse these labels into a three-point scale, and we refer to this 3-class corpus as the Partisan News (PN) corpus throughout. No denotation label is available for this corpus. + +# 4 Model + +Section 4.1 describes our model architecture. Sections 4.2 and 4.3 then describe specific instantiations that we use in our experiments. These variants are summarized in Table 1. + +# 4.1 Overall Architecture + +Let $V_{\mathrm{demo}}$ , $V_{\mathrm{conno}}$ , $V_{\mathrm{pretrained}}$ be the vector spaces of denotation, connotation, and pretrained spaces respectively. Our model consists of two adversarial decomposers: + +$$ +\begin{array}{l} D: V _ {\text {p r e t r a i n e d}} \to V _ {\text {d e n o}} \\ C: V _ {\text {p r e t r a i n e d}} \rightarrow V _ {\text {c o n n o}} \\ \end{array} +$$ + +The goal is to train $D$ to preserve as much denotation information as possible while removing as much connotation information as possible from the pretrained representation. Symmetrically, $C$ will preserve as much connotation as possible while removing as much denotation as possible from the pretrained representation. + +For clarity, let us focus on $D$ for now. To measure how much denotation or connotation structure is encoded in $V_{\mathrm{demo}}$ , we use two classifiers probes trained to predict the denotation label $d$ or connotation label $c$ , which yield two cross-entropy losses $\ell_{\mathrm{demo}}$ , probe and $\ell_{\mathrm{cono}}$ , probe respectively. In order to encourage the decomposer $D$ to preserve denotation and remove connotation, we define its loss function as + +$$ +L _ {D} = \sigma (\ell_ {\text {d e n o . p r o b e}}) + \sigma (\ell_ {\text {c o n n o . a d v e r s a r y}}) +$$ + +where $\sigma$ is the sigmoid function and + +$$ +\begin{array}{c} \ell_ {\text {c o n n o . a d v e r s a r y}} = \mathrm {K L D i v} (\text {c o n n o . p r o b e p r e d i c t e d d i s t .}, \\ \text {u n i f o r m d i s t .}) \end{array} +$$ + +![](images/5572ed0bc66fe9a6332198f9ddd0614eb9abb5a498922588eb5332271408aaa5.jpg) +Figure 3: Overall model and composition of losses + +The adversarial loss $\ell_{\mathrm{conno. adversary}}$ rewards $D$ to remove connotation structure such that the probe prediction is random. Meanwhile, the probes themselves are still only gradient updated with the usual cross-entropy losses—extracting and measuring as much denotation or connotation information as possible—independent of the decomposer $D$ . + +As shown in Figure 3, $C$ is set up symmetrically, so it is trained with the usual classification loss from its connotation probe and a KL divergence adversarial loss from its denotation probe. + +Finally, we impose a reconstruction probe $R$ with the loss function: + +$$ +\ell_ {\text {r e c o n .}} = 1 - \cos \sin (R (v _ {\text {d e n o}}, v _ {\text {c o n n o}}), v _ {\text {p r e t r a i n e d}}) +$$ + +which enforces that the combination of denotation and connotation subspaces preserves all the semantic meaning of the original pretrained space, as opposed to merely encoding predictive features that maximize probe accuracies. (We verified in ablation experiments that this is in fact what happens without $R$ .) Assembling everything together, the decomposers $D$ and $C$ are jointly trained with $L_{\mathrm{Joint}} = L_D + L_C + \ell_{\mathrm{recon}}$ . + +In principle, $D$ and $C$ can be a variety of sentence encoders. In this work, we implement them as simple mean bags of static embedding for two reasons: First, it is difficult to interpret contextualized embedding for an individual word (especially for the type of analysis we present in $\S 5$ ). Second, many of the interesting heavily connotative + +expressions consist of multiple words (e.g., "socialized medicine", "universal healthcare") and compositionality is still far from being solved. Therefore, we conjoin multiword expressions with underscores so that we can model them in the same way as atomic words. $^7$ + +# 4.2 Connotation Probes + +We exploit the fact that much of the debate in American politics today is (sadly) reducible to partisan division (Lee, 2009; Klein, 2020), thus it is safe to define the connotation label of every document to be simply the partisanship of the speaker. Of course, connotation in the general domain can encompass much more than liberals vs. conservatives, and in future work, we hope to extend this to multifaceted connotations that are more true to the semantic theories as discussed in §2. For now, in CR, connotation is the speaker's party, and in PN, connotation is the partisan leaning of the publisher. + +Again, in principle, the probes can be a variety of neural modules. In this work, we implement the connotation probes as 4-layer MLPs. We experimented with the more popular 1-layer MLP and 1-linear-layer probes. However, when the probes are shallow, the model converges before most of the information that should be removed is in fact removed. For example, when we use a 4-layer MLP + +probe on a decomposed representation trained with a 1-layer probe, the 4-layer probe accuracies are just as good as if the representation has not been decomposed at all. That is, our experiments suggest that the probes have to be sufficiently complex in order to truly measure what denotation/connotation structure is removed or preserved in a decomposed representation. + +# 4.3 Denotation Probes + +For the CR corpus, we experimented with two types of denotation labels: The specific piece of legislation under discussion and the general policy topic under discussion. In CR BILL, the label is one of the 1,029 short titles of bills. In CR TOPIC, the label is one of 41 policy topics. Both types of labels are annotated as described in §3.1. For the same reason as discussed in the previous paragraph, we implement the denotation probes as 4-layer MLPs. + +Additionally, as mentioned in Footnote 5, precise denotation labels are difficult to collect, so we also experimented with more realistic settings (CR PROXY and PN PROXY) which do not use any denotation labels. In this case, we return to the theories discussed in §2 and note that, because semantic meaning can be partitioned into two components, we may assume pretrained representations encode the overall meaning and any aspects of meaning that are not explained by our connotation labels must belong to denotation. Thus, we may continue to use the pretraining objective (in this implementation, skip-gram-style context word prediction) as a proxy probe for denotation information and rely on the adversarial connotation probe to remove connotation structure in the denotation space. + +# 5 Intrinsic Evaluation + +We confirm that our decomposed denotation and connotation spaces reflect their intended purposes by measuring their structures with homogeneity metrics (§5.1) on three sets of evaluation words (§5.2) as well as inspecting their t-SNE clusters. + +# 5.1 Homogeneity Metrics + +To quantify how much denotation or connotation structure is encoded in a vector space, we define + +the homogeneity $(h_{\mathrm{deno}}, h_{\mathrm{conno}})$ of a given space to be the average proportion of a query word's top- $k$ nearest neighbors9 which share the same denotation/connotation label as the query's own denotation/connotation label.10 In particular, we are interested in comparing the delta of $V_{\mathrm{deno}}$ and $V_{\mathrm{conno}}$ against $V_{\mathrm{pretrained}}$ . For $V_{\mathrm{deno}}$ , we hope to see $h_{\mathrm{deno}}$ increase relative to the pretrained space and see $h_{\mathrm{conno}}$ decrease relative to the pretrained space. For $V_{\mathrm{conno}}$ , we hope to observe movement in the opposite direction. + +As motivated in §3, our model is trained with labels at the sentence-level, while homogeneities are evaluated at the word-level. We assign a word's connotation label to simply be the party that uses the word most often. For CR BILL and CR TOPIC, we assign the word-level denotation label as either the bill or the topic that uses the word most often. For the PN corpus, no ground truth denotation label is available, so we cannot directly measure $h_{\mathrm{deno}}$ but we show alternative evaluation in §5.3. Table 3 shows the baseline $h_{\mathrm{deno}}$ and $h_{\mathrm{conno}}$ scores for embeddings pretrained on each corpus and evaluating over two test sets of words (described in the next section). + +# 5.2 Test Sets + +We evaluate on words sampled in three different ways: Random is a random sample of 500 words drawn from each corpus' vocabulary that occur at least 100 times in order to filter out web scraping artifacts, e.g., URLs and author bylines. High Partisan is a sample of around 300 words from each corpus's vocabulary that occur at least 100 times and have high partisan skew; namely, words that are uttered by a single party more than $70\%$ of the time. This threshold is chosen based on manual inspection, but we have evaluated on other thresholds as well with no significant difference in results. This High Partisan set is then bisected into two disjoint sets as dev and test data for model selection. All word sets sampled at different ratios are included in our released data. Finally, Luntz-esque is a small set of manually-vetted pairs of words that are known to have the same denotation but different connotations. Most of them are drawn + +![](images/02a3a285aa31b69ffb94f815922c40dc2e3ea5d53f9c83006cd1b7116d380fdd.jpg) +Figure 4: Neighborhood of "deficit" in $V_{\text{pretained}}$ , $V_{\text{deno}}$ , and $V_{\text{conno}}$ of PN PROXY. Arrows point to the top-10 nearest neighbors. Colors reflect partisan leaning, where more opaque dots are more heavily partisan words. Note that in $V_{\text{pretained}}$ and in $V_{\text{conno}}$ , the nearest neighbors are all Republican-leaning words, whereas they are balanced in $V_{\text{deno}}$ . + +![](images/6b2bdc74e17e6901efa254a9a640dbce432193267f4d958a9ba9a8595f294417.jpg) + +![](images/e1d924a4900a881625dec2b03e82dc272c3fd5f973bb8608b7bc018c00d2c968.jpg) + +
Test SetModel\( V_{\text{demo}} \) (and \( \Delta \) with \( V_{\text{pre}} \))\( V_{\text{conno}} \) (and \( \Delta \) with \( V_{\text{pre}} \))
\( h_{\text{demo}} \)\( \Delta \)(↑)\( h_{\text{conno}} \)\( \Delta \)(↓)\( h_{\text{demo}} \)\( \Delta \)(↓)\( h_{\text{conno}} \)\( \Delta \)(↑)
High PartisanCR BILL0.28+0.090.65-0.110.02-0.170.89+0.13
CR TOPIC0.53+0.180.59-0.170.07-0.280.98+0.21
CR PROXY0.07+0.000.71-0.000.04-0.030.99+0.28
PN PROXY--0.40-0.26--0.76+0.10
RandomCR BILL0.14+0.050.69-0.010.04-0.060.77+0.07
CR TOPIC0.31+0.020.63-0.070.14-0.150.81+0.11
CR PROXY0.04+0.000.64-0.000.02-0.030.85+0.21
PN PROXY--0.39-0.21--0.69+0.09
+ +Table 2: Intrinsic evaluation results across models and test sets. $\Delta$ is change relative to $V_{\mathrm{pretrained}}$ (Table 3). Arrows in parentheses mark the desired directions of change. Note that because denotation labels have far more classes than connotation labels, the magnitude of $h_{\mathrm{deno}}$ and $h_{\mathrm{conno}}$ are not directly comparable with each other. + +
High PartisanRandom
hdenohconnohdenohconno
CR BILLS0.190.760.090.70
CR TOPIC0.350.760.290.70
CR PROXY0.070.710.050.64
PN PROXY-0.66-0.60
+ +Table 3: Baseline homogeneity scores of embeddings pretrained on each corpus. + +from The New American Lexicon (Luntz 2006 $^{11}$ ), a famous report from focus group research which explicitly prescribes word choices that are empirically favorable to the Republican party line. + +# 5.3 Results + +Overall, we see that our $V_{\mathrm{demo}}$ and $V_{\mathrm{conno}}$ spaces demonstrate the desired shift in homogeneities and structures, which is intuitively illustrated by Figure 4. Quantitatively, Table 2 enumerates the homogeneity scores of both decomposed spaces as well as their directions of change relative to the pretrained space. For $V_{\mathrm{demo}}$ , we see that denotation homogeneity $h_{\mathrm{demo}}$ consistently increases and con + +notation homogeneity $h_{\mathrm{conno}}$ consistently decreases as desired. Conversely, for $V_{\mathrm{conno}}$ , we see $h_{\mathrm{conno}}$ increases and $h_{\mathrm{deno}}$ decreases as desired. Further, we see that the magnitude of change is greater across the board for the highly partisan words than for random words, which is expected as the highly partisan words are usually loaded with more denotation or connotation information that can be manipulated. The only exception is CR Proxy's $V_{\mathrm{deno}}$ , which sees no significant movement in either direction. This is understandable because CR Proxy is not trained with ground truth denotation labels. (We evaluate it with the labels from CR BILL). + +As means of closer inspection, we compute the cosine similarities of words in our Luntz-esque analysis set. Because these pairs of words are known to be political euphemisms (e.g. "estate tax" and "death tax", which refer to the same tax policy but imply opposite partisanship), we expect these pairs to become more cosine similar in $V_{\text{demo}}$ and less cosine similar in $V_{\text{conno}}$ . As shown in Table 4, even without ground truth denotation labels, the $V_{\text{demo}}$ of CR PROXY and PN PROXY still preserve the pretrained denotation structure reasonably well. For pairs that do see decrease in $V_{\text{demo}}$ similarity, the errors are far smaller relative to their correct + +
CR BILLCR TOPICCR PROXYPN PROXY
VpreΔVd(↑)ΔVc(↓)VpreΔVd(↑)ΔVc(↓)VpreΔVd(↑)ΔVc(↓)VpreΔVd(↑)ΔVc(↓)
undocumented workers/illegal aliens0.81+0.03-0.010.81-0.09+0.140.95+0.03-1.280.96+0.01-0.20
estate tax/death tax0.89+0.05-0.760.89+0.08-0.840.96+0.00-0.980.93+0.01-0.06
capitalism/free market0.79+0.11+0.030.79+0.14+0.160.85-0.07-0.200.96-0.01-0.02
foreign trade/international trade0.90-0.05+0.020.90+0.02-0.010.86+0.05-0.400.93+0.03+0.00
public option/government-run0.67+0.06-0.570.67+0.24-0.840.92+0.02-1.080.97+0.00-0.01
trickle-down/cut taxes------0.87+0.02-0.510.95+0.02-0.12
voodoo economics/supply-side------0.95-0.04-0.070.91+0.05-0.05
tax expenditures/spending programs------0.93-0.17-1.030.99+0.00-0.16
waterboarding/interrogation------0.90-0.04-0.220.97+0.01-0.01
socialized medicine/single-payer------0.88-0.11-0.560.89+0.02-0.03
political speech/campaign spending------0.86-0.02-0.810.99+0.00-0.05
star wars/strategic defense initiative------0.91-0.16-0.69---
nuclear option/constitutional option------0.97-0.14-1.30---
Changes in the Correct Direction4/53/54/53/55/1313/1310/1110/11
+ +Table 4: Changes in cosine similarity (relative to $V_{\mathrm{pretrained}}$ ) for known political euphemism' pairs, i.e. words with the same denotation but opposite partisan connotation. Omitted entries are out of vocabulary. + +reduction in $V_{\text{conno}}$ similarity. For example, "political speech" and "campaign spending" experience a small $(-0.02)$ decrease in denotation similarity; in exchange, the model correctly recognizes that the two words have opposite ideologies $(-0.81$ in connotation similarity) on the issue of whether unlimited campaign donation is shielded by the First Amendment as "political speech". + +# 6 Extrinsic Evaluation + +Ultimately, our work aims to be more than just a theoretical exercise, but also to enable greater control over how sensitive NLP systems are to denotation vs. connotation in downstream tasks. To this end, we construct an ad hoc information retrieval task. We compare a system built on top of $V_{\text{pretrained}}$ to systems built on top of $V_{\text{demo}}$ and $V_{\text{conno}}$ in terms of both the quality of the ranking and the ideological diversity represented among the top results. + +# 6.1 Setup + +We focus only on PN PROXY for this evaluation since it best matches the setting where we would expect to apply these techniques in practice: (1) We cannot always assume access to discrete denotation labels. (2) Language in the PN corpus is strongly influenced by ideology (as shown in Figure 2). + +To generate a realistic set of queries, we start with 12 seed words from our vocabulary, chosen based on a list of the most important election issues for Democrat and Republican voters according to a recent Gallup Poll12. This results in the following + +list: "economy, healthcare, immigration, women's rights, taxes, wealth, guns, climate change, foreign policy, supreme court, tariffs, special counsel". Then, for each seed word, we take 5 left-leaning seeds to be the 5 nearest neighbors according to $V_{\text{pretrained}}$ , filtered to words which occur at least 100 times and for which at least $70\%$ of occurrences appeared in left-leaning articles. We similarly chose 5 right-leaning seeds. We then submit each partisan seed to the Bing Autosuggest API and retrieve 10 suggestions each. We manually filter the list of queries to remove those that do not reflect the intended word sense (e.g., "VA" leading to queries about Virginia rather than the Veterans Administration) and those which are not well matched to our document collection (e.g., queries seeking dictionary definitions, job openings, or specific websites such as Facebook). Our final list contains 410 queries, 216 left-leaning and 194 right-leaning. Table 5 shows several examples, the full list is included in the supplementary material. + +Wealth: globalist agenda $\circ$ globalist leaders $\circ$ extreme poverty rates $\circ$ romneys ties to burisma Women's Rights: title ix impact $\circ$ safe spaces and snowflakes $\circ$ anti-choice zealots $\circ$ marriage equality court case Immigration: illegal immigrants at southern border $\circ$ illegals caught voting $2016\circ$ drug policy fbi $\circ$ opioid crisis afghanistan + +Table 5: Example right- and left-leaning queries generated using the procedure described. + +# 6.2 Models + +We generate a ranked list of documents for each query in a two-step manner: (1) We pre-select the 5,000 most relevant documents according to a tra + +ditional BM25 model (Robertson et al., 1995) with default parameters. (2) This initial set of documents is then ranked using DRMM (Guo et al., 2016), a neural relevance matching model for ad-hoc retrieval. We train our retrieval model on the MS MARCO collection (Bajaj et al., 2016) of 550,000 queries and 8.8 million documents from Bing. To highlight the effect of pretrained vs. decomposed word embeddings, we freeze our word embeddings during retrieval model training. While (1) is purely based on TF-IDF style statistics and remains static for all compared conditions, (2) is repeated for every proposed word embedding. This results in a ranked list of the top 100 most relevant documents for each query and word embedding. + +# 6.3 Results + +We compare the results of the DRMM retrieval model using different word embeddings in terms of quality and diversity of viewpoints reflected in the ranked results. To measure diversity, we report the overall distribution of political leanings among the top 100 documents and the rank-weighted $\alpha$ -nDCG (Clarke et al., 2008) diversity score. For $\alpha$ -nDCG, higher values indicate a more diverse list of results whose political leanings are evenly distributed across result list ranks. To measure ranking quality, we take a sample of 10 queries and collect top 10 results returned by each model variant, for a total of 300 query/document pairs. We shuffle the list of pairs to avoid biasing ourselves, and manually label each pair for whether or not the document is relevant to the query. We report Precision@10 estimated based on these 10 queries. + +Figure 5 shows the overall party distributions. Table 6 reports the $\alpha$ -nDCG and $\mathrm{P@10}$ metrics. We can see that models which use $V_{\mathrm{demo}}$ produce more diverse rankings than do models that use $V_{\mathrm{pertained}}$ , with $V_{\mathrm{demo}}$ producing an $\alpha$ -nDCG@100 of 0.94 vs. 0.92 for pretrained. This trend is especially apparent in the rankings returned for right-leaning queries: Under the pretrained model, $57\%$ of the documents returned came from right-leaning news sources, whereas under the $V_{\mathrm{demo}}$ -based model, the results are nearly perfectly balanced between news sources. However, we do see a drop in precision when using $V_{\mathrm{demo}}$ . This is not surprising given the limitations observed in §5. If we had access to ground-truth denotation labels when training $V_{\mathrm{demo}}$ , we might expect to see these numbers improve. This is a promising direction for future work. + +![](images/9031dd0e793ba38b887bed6f9f709bdc296105cf4a51c4e359ce208ca6b99d4e.jpg) +Figure 5: Distribution of partisanship of news source for top 100 documents for right-leaning and left-leaning queries. Red = right-leaning news sources; blue = left-leaning; gray = nonpartisan or apolitical. + +
α-nDCGGini
@10@100LRP@10
Vpretrained0.9070.9150.2150.2070.78
Vdemo0.9220.9440.1600.0800.37
Vconno0.9040.9140.1470.1530.64
+ +Table 6: Retrieval metrics. For $\alpha$ -nDCG, higher means more diverse; for Gini, lower means more diverse. + +# 7 Related Work + +Embedding Augmentation. At the lexical level, there is substantial literature that supplements pretrained representations with desired information (Faruqui et al., 2015; Bamman et al., 2014) or improves their interpretability (Murphy et al., 2012; Arora et al., 2018; Lauretig, 2019). However, existing works tend to focus on evaluating the dictionary definitions of words, less so on grounding words to specific real world referents and, to our knowledge, no major attempt yet in interpreting and manipulating the denotation and connotation dimensions of meaning as suggested by the semantic theories discussed in §2. While we do not claim to do full justice to conceptual role semantics either, this paper furnishes a first attempt at implementing a school of semantics introduced by philosophers of language and increasingly popular among cognitive scientists. + +Style Transfer. At the sentence level, adversarial setups similar to ours have been previously ex + +plored for differentiating style and content. For example, Romanov et al. (2019); Yamshchikov et al. (2019); John et al. (2019) converted informal English to formal English and Yelp reviews from positive to negative sentiment. The motivation for such models is primarily natural language generation and the personalization thereof (Li et al., 2016). Additionally, our framing in terms of Frege's sense and reference adds clarity to the sometimes ill-defined problems explored in style transfer (e.g., treating sentiment as "style"). For example, "she is an undocumented immigrant" and "she is an illegal alien" have the same truth conditions but different connotations, whereas "the cafe is great" and "the cafe is terrible" have different truth conditions. + +Modeling Political Language. There is a wealth of work on computational approaches for modeling political language (Glavaš et al., 2019). Within NLP, such efforts tend to focus more on describing how language differs between political subgroups, rather than recognizing similarities in denotation across ideological stances, which is the primary goal of our work. For example, Preoţić-Pietro et al. (2017); Han et al. (2019) attempt to predict a person's political ideology from their social media posts, Sim et al. (2013) detect ideological trends present in political speeches, Fulgoni et al. (2016) predict political leaning of news articles, and Padó et al. (2019) focuses on modeling the network structure of policy debates within society. Also highly related is work analyzing linguistic framing in news (Greene and Resnik, 2009; Choi et al., 2012; Baumer et al., 2015). + +Echo Chambers and Search. The dangers of ideological "echo chambers" have received significant attention across NLP, information retrieval, and social science research communities. Dori-Hacohen et al. (2015) discuss the challenges of deploying information retrieval systems in controversial domains, and Puschmann (2019) looks specifically at the effects of search personalization on election-related information. Many approaches have been proposed to improve the diversity of search results, typically by identifying search facets a priori and then training a model to optimize for diversity (Tintarev et al., 2018; Tabrizi and Shakery, 2019; Lunardi, 2019). In terms of linguistic analyses, Rashkin et al. (2017) and Potthast et al. (2018) analyze stylistic patterns that distinguish fake news from real news. Duseja and Jhamtani (2019) study + +linguistic patterns that distinguish whether individuals are within social media echo chambers. + +# 8 Summary + +In this paper, we describe the problem of pretrained word embeddings conflating denotation and connotation. We address this issue by introducing an adversarial network that explicitly represents the two properties as two different vector spaces. We confirm that our decomposed spaces encode the desired structure of denotation or connotation by both quantitatively measuring their homogeneity and qualitatively evaluating their clusters and their representation of well-known political euphemisms. Lastly, we show that our decomposed spaces are capable of improving the diversity of document rankings in an information retrieval task. + +# Acknowledgment + +We are grateful to Jesse Shapiro, Stephen Bach, Yongming Han, Tucker Berckmann, Daniel Smits, Jessica Forde, Dylan Ebert, Aaron Traylor, Charles Lovering, and Roma Patel for comments and discussions on the (many) early drafts of this paper. This research was supported by the Google Faculty Research Awards Program. + +# References + +Sanjeev Arora, Yuanzhi Li, Yingyu Liang, Tengyu Ma, and Andrej Risteski. 2018. Linear algebraic structure of word senses, with applications to polysemy. +Payal Bajaj, Daniel Campos, Nick Craswell, Li Deng, Jianfeng Gao, Xiaodong Liu, Rangan Majumder, Andrew McNamara, Bhaskar Mitra, Tri Nguyen, et al. 2016. Ms marco: A human generated machine reading comprehension dataset. arXiv preprint arXiv:1611.09268. +David Bamman, Chris Dyer, and Noah A. Smith. 2014. Distributed representations of geographically situated language. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 828-834, Baltimore, Maryland. Association for Computational Linguistics. +Eric Baumer, Elisha Elovic, Ying Qin, Francesca Polletta, and Geri Gay. 2015. Testing and comparing computational approaches for identifying the language of framing in political news. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1472-1482, Denver, Colorado. Association for Computational Linguistics. + +Ned Block. 1986. Advertisement for a semantics for psychology. Midwest studies in philosophy, 10:615-678. +Susan Carey. 2009. The Origin of Concepts. Oxford series in cognitive development. Oxford University Press. +Eunsol Choi, Chenhao Tan, Lillian Lee, Cristian Danescu-Niculescu-Mizil, and Jennifer Spindel. 2012. Hedge detection as a lens on framing in the GMO debates: A position paper. In Proceedings of the Workshop on Extra-Propositional Aspects of Meaning in Computational Linguistics, pages 70-79, Jeju, Republic of Korea. Association for Computational Linguistics. +Charles LA Clarke, Maheedhar Kolla, Gordon V Cormack, Olga Vechtomova, Azin Ashkan, Stefan Böttcher, and Ian MacKinnon. 2008. Novelty and diversity in information retrieval evaluation. In Proceedings of the 31st annual international ACM SIGIR conference on Research and development in information retrieval, pages 659-666. +Shiri Dori-Hacohen, Elad Yom-Tov, and James Allan. 2015. Navigating controversy as a complex search task. In SCST@ ECIR. CiteSeer. +Nikita Duseja and Harsh Jhamtani. 2019. A sociolinguistic study of online echo chambers on twitter. In Proceedings of the Third Workshop on Natural Language Processing and Computational Social Science, pages 78-83, Minneapolis, Minnesota. Association for Computational Linguistics. +Manaal Faruqui, Jesse Dodge, Sujay Kumar Jauhar, Chris Dyer, Eduard Hovy, and Noah A. Smith. 2015. Retrofitting word vectors to semantic lexicons. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1606-1615, Denver, Colorado. Association for Computational Linguistics. +Gottlob Frege. 1892. Über sinn und bedeutung. Zeitschrift für Philosophie und philosophische Kritik, 100:25-50. +Dean Fulgoni, Jordan Carpenter, Lyle Ungar, and Daniel Preotciuc-Pietro. 2016. An empirical exploration of moral foundations theory in partisan news sources. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 3730-3736, Portoroz, Slovenia. European Language Resources Association (ELRA). +Luca Gasparri and Diego Marconi. 2019. Word Meaning. In Edward N. Zalta, editor, The Stanford Encyclopedia of Philosophy, fall 2019 edition. Metaphysics Research Lab, Stanford University. +Matthew Gentzkow, Jesse M Shapiro, and Matt Taddy. 2019. Measuring group differences in high-dimensional choices: method and application to + +congressional speech. *Econometrica*, 87(4):1307-1340. +Goran Glavas, Federico Nanni, and Simone Paolo Ponzetto. 2019. Computational analysis of political texts: Bridging research efforts across communities. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Tutorial Abstracts, pages 18-23, Florence, Italy. Association for Computational Linguistics. +Mark Greenberg and Gilbert Harman. 2005. Conceptual role semantics. +Stephan Greene and Philip Resnik. 2009. More than words: Syntactic packaging and implicit sentiment. In Proceedings of Human Language Technologies: The 2009 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pages 503-511, Boulder, Colorado. Association for Computational Linguistics. +Jiafeng Guo, Yixing Fan, Qingyao Ai, and W Bruce Croft. 2016. A deep relevance matching model for ad-hoc retrieval. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, pages 55-64. +Jiyoung Han, Youngin Lee, Junbum Lee, and Meeyoung Cha. 2019. The fallacy of echo chambers: Analyzing the political slants of user-generated news comments in Korean media. In Proceedings of the 5th Workshop on Noisy User-generated Text (W-NUT 2019), pages 370-374, Hong Kong, China. Association for Computational Linguistics. +Vineet John, Lili Mou, Hareesh Bahuleyan, and Olga Vechtomova. 2019. Disentangled representation learning for non-parallel text style transfer. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 424-434, Florence, Italy. Association for Computational Linguistics. +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, Minneapolis, Minnesota, USA. Association for Computational Linguistics. +Ezra Klein. 2020. Why We're Polarized. Profile Books. +Saul A Kripke. 1972. Naming and necessity. In Semantics of natural language, pages 253-355. Springer. +Adam Lauretig. 2019. Identification, interpretability, and Bayesian word embeddings. In Proceedings of the Third Workshop on Natural Language Processing and Computational Social Science, pages 7-17, Minneapolis, Minnesota. Association for Computational Linguistics. + +Frances E Lee. 2009. Beyond ideology: Politics, principles, and partisanship in the US Senate. University of Chicago Press. +Jiwei Li, Michel Galley, Chris Brockett, Georgios Spithourakis, Jianfeng Gao, and Bill Dolan. 2016. A persona-based neural conversation model. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 994-1003, Berlin, Germany. Association for Computational Linguistics. +Gabriel Machado Lunardi. 2019. Representing the filter bubble: Towards a model to diversification in news. In International Conference on Conceptual Modeling, pages 239-246. Springer. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems 26, pages 3111-3119. Curran Associates, Inc. +Brian Murphy, Partha Talukdar, and Tom Mitchell. 2012. Learning effective and interpretable semantic models using non-negative sparse embedding. In Proceedings of COLING 2012, pages 1933-1950, Mumbai, India. The COLING 2012 Organizing Committee. +Sebastian Padó, Andre Blessing, Nico Blokker, Erenay Dayanik, Sebastian Haunss, and Jonas Kuhn. 2019. Who sides with whom? towards computational construction of discourse networks for political debates. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2841-2847, Florence, Italy. Association for Computational Linguistics. +Martin Potthast, Johannes Kiesel, Kevin Reinartz, Janek Bevendorff, and Benno Stein. 2018. A stylistometric inquiry into hyperpartisan and fake news. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 231-240, Melbourne, Australia. Association for Computational Linguistics. +Daniel Preoticiuc-Pietro, Ye Liu, Daniel Hopkins, and Lyle Ungar. 2017. Beyond binary labels: Political ideology prediction of twitter users. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 729-740, Vancouver, Canada. Association for Computational Linguistics. +Cornelius Puschmann. 2019. Beyond the bubble: Assessing the diversity of political search results. Digital Journalism, 7(6):824-843. +Hilary Putnam. 1975. The meaning of 'meaning'. Philosophical papers, 2. +Peng Qi, Yuhao Zhang, Yuhui Zhang, Jason Bolton, and Christopher D. Manning. 2020. Stanza: A Python natural language processing toolkit for many + +human languages. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations. +Hannah Rashkin, Eunsol Choi, Jin Yea Jang, Svitlana Volkova, and Yejin Choi. 2017. Truth of varying shades: Analyzing language in fake news and political fact-checking. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2931-2937, Copenhagen, Denmark. Association for Computational Linguistics. +Stephen E Robertson, Steve Walker, Susan Jones, Micheline M Hancock-Beaulieu, Mike Gatford, et al. 1995. Okapi at trec-3. Nist Special Publication Sp, 109:109. +Alexey Romanov, Anna Rumshisky, Anna Rogers, and David Donahue. 2019. Adversarial decomposition of text representation. 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 815-825, Minneapolis, Minnesota. Association for Computational Linguistics. +Yanchuan Sim, Brice D. L. Acree, Justin H. Gross, and Noah A. Smith. 2013. Measuring ideological proportions in political speeches. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 91-101, Seattle, Washington, USA. Association for Computational Linguistics. +Shayan A Tabrizi and Azadeh Shakery. 2019. Perspective-based search: a new paradigm for bursting the information bubble. *FACETS*, 4(1):350-388. +Nava Tintarev, Emily Sullivan, Dror Guldin, Sihang Qiu, and Daan Odjik. 2018. Same, same, but different: algorithmic diversification of viewpoints in news. In Adjunct Publication of the 26th Conference on User Modeling, Adaptation and Personalization, pages 7-13. +Ivan P. Yamshchikov, Viacheslav Shibaev, Aleksander Nagaev, Jürgen Jost, and Alexey Tikhonov. 2019. Decomposing textual information for style transfer. In Proceedings of the 3rd Workshop on Neural Generation and Translation, pages 128-137, Hong Kong. Association for Computational Linguistics. + +# A Hyperparameters + +- All classifier probes are 4-layer MLPs with hidden size 300, ReLU as nonlinearity, and dropout with $p = 0.33$ . +- Decomposers $D$ and $C$ are embedding matrices of shape (vocab_size, 300). Recomposer $R$ concatenates denotation and connotation as a 600-dimensional vector and then feed it into a linear layer of size (600, 300). +- The skip-gram loss follows the parameters recommended by Mikolov et al. (2013). Context window radius $= 5$ . Negative samples per true context word $= 10$ . We also subsample frequent words in exactly the same way as the original paper (equation 5) did with their threshold of $10^{-5}$ . +- We use Adam as our optimizer throughout. Learning rate $= 1 \times 10^{-3}$ for homogeneity and $1 \times 10^{-5}$ for Luntz-esque models. Other parameters left as PyTorch default. +- We train 30 epochs for large corpora (CR PROXY and PN PROXY). 150 epochs for smaller corpora (CR TOPIC and CR BILL). +- With batch size $= 1024$ , the smaller corpora take about half an hour to train on an RTX 2080 Ti or comparable GPUs. With batch size $= 8192$ , The larger corpora take about 50 hours to train. +PyTorch version $= 1.6$ CUDA version $= 10.2$ + +# B Preprocessing Procedures for Congressional Record + +We use Stanford Stanza (Qi et al., 2020) for tokenization, part-of-speech tag, dependency parsing, and named entity recognition. We replace multi-word phrases with an atomic token. We source our phrases of interests from the following three pipelines: + +1. Named entity recognizer. +2. Frequency-based collocation. (We experimented with PMI-based collocation, which yielded results that were more prone to artifacts and arbitrary threshold setting.) + +Luntz-esque: estate tax, death tax, capitalism, free market, undocumented, illegal aliens, foreign trade, international trade, public option, governmentrun, political speech, campaign spending, cut taxes, trickledown, Random (CR): cerro, brownfields, redtape, soon as possible, implicit, sup, habits, granted, personality, luis, internationally, itemize, fidel castro, centralize, restraint, pleadings, amendment before us, child custody protection, cheney, illegal aliens, Random (PN): reigning, burst, see happen, wandering, wp, conveying, obama obama, global politics, really serious, faggot, permanent normal, syrian observatory, native american, strength among, orbiting, protege, exclaimed, tunis, snopes staff, administration also, High Partisan (CR): the usa patriot act, mining, patterns, public safety, gorge, spills, wall street, joliet, bridges, tax code, registrants, freedom of speech, compensatory time, college education, shelter, hunger, oil companies, scourge, somalia, traders, High Partisan (PN): mrs. romney, pesticides, zionists, u.s. support, pacific northwest, economics defense, light bulbs, east asian, burton, smog, abdel fattah, banksters, work requirements, greenhouse gases, duggars, nigeria security, bolling, geopolitics, teng, newsom said + +Table 7: Sample words from each of our test sets as described in §5.2. + +3. Bigram and trigram constituents of parse trees that are (a) POS-tagged as noun phrase or verb phrase; (b) contain no stop words as in nltk.corpus.stop_words; (c) contain no parliamentary procedural words as in {"yield", "motion", "order", "ordered", "quorum", "roll", "unanimous", "mr.", "madam", "speaker", "chairman", "president", "senator", "gentleman", "colleague", "colleagues"} + +From these sources, we filter vocabulary with minimum frequency $= 15$ for small corpora, 30 for large corpora. We then replace each phrase in the corpus by their respective tokens joined by an underscore. When words can be replaced by multiple phrases, longer phrases take priority, and then more frequent phrases take second priority. + +Finally, we discard sentences with less than 5 words. We truncate sentences more than 20 words. + +# C Preprocessing Procedures for Partisan News + +Kiesel et al. (2019) includes 600k articles for train and 150k articles for validation, each labeled with a 5-way partisanship by their publisher. We only train on their validation set because it is comparable in size with Congressional Record and it requires less data cleaning. We discard duplicate sentences, and the rest of the processing pipeline is the same as the Congressional Record. + +As mentioned in the main paper, we find the + +corpus-given "left" vs. "left-center" and "right" and "right-center" labels are prone to artifacts of particular publishers. For example, many foreign policy related phrases dominate the "right-center" category simply because the publisher Foreign Affairs is labeled as "right-center", but this distinction is unsupported in ground truth. Therefore, we collapse "left-center" and "left" as one class, and we collapse "right-center" and "right" as one class. + +# D Grounding Bill Titles and Topics + +We first filter out bills that are mentioned less than 3 times in its corresponding two-year congressional session. The vast majority of bills are only mentioned one time (when they were introduced) or twice (often a bipartisan poster-child co-sponsor repeats the spiel.) + +After manual inspection, we define three speeches after the bill mentioned speech as context speeches and thus assigned the same denotation label (bill or topic) as the bill mentioned speech. Statistics of bill mentioned for each congressional session is summarized in Table 8. Subsequent tables show examples of bill topics, their frequency, and example bill mentioned speeches. + +
SessionBills ScrapedBill Title RegEx MatchesBills with ≥ 3 mentionsSpeeches with those Bills MentionedNum. Sentences
9714715394346420372
9816336885166533242
9918953604527316128
10020924404735818376
10126338058268435903
10227786265850326944
10322614434232516500
10421205484644021664
105258711749793151878
10634211317115103364605
107322510079275244901
10830396887543626783
10933638176261631838
1103928105210286541601
11137148687374036026
+ +Table 8: Corpus with regular expression search for bill titles. + +
Example TopicExample Bill Short Titles
HealthNational Diabetes ActMedical Devices Safety ActEmergency Medical Services Systems Act
EducationWomen’s Educational Equity ActElementary and Secondary Drug Abuse Eradication ActCommunity Education Development Act
GovernmentNonpartisan Commission on Campaign Reform Act
Operations and PoliticsGovernment in the Sunshine ActCongressional Disclosure of Income Act
+ +Table 9: Example bill topics. + +
Freq. per sentenceTopic
45815Health
38339Education
33993Government operations and politics
33462Labor and employment
28392Taxation
26435Crime and law enforcement
24204Finance and financial sector
22273Commerce
21451Transportation and public works
20865International affairs
18560Public lands and natural resources
17369Armed forces and national security
16376Economics and public finance
15660Law
14702Environmental protection
14472Foreign trade and international finance
13353Families
11752Energy
11741Agriculture and food
10512Science, technology, communications
7050Civil rights and liberties, minority issues
6599Housing and community development
6066Social welfare
5019Native Americans
3582Water resources development
3566Commemorations
3457Emergency management
2160Immigration
2116Congress
1640Animals
1559Sports and recreation
1303Day care
552Arts, culture, religion
545Awards, medals, prizes
473Public works
389Federal aid to handicapped services
344Monuments and memorials
241Administrative procedure
157Arms control
123Mines and mineral resources
94Fires
+ +Table 10: CR TOPIC + +# Example Speeches with Bill Mentions + +"Auto Stock for Every Taxpayer Act" These companies did all of this when the main company decided that the subsidiary was not consistent with the core business. That is what we should do with General Motors—give taxpayers its shares and get General Motors back in the marketplace where it belongs. This idea is fast. it is simple. and it creates a market for the shares... I ask unanimous consent to have printed in the RECORD newspaper articles supporting the Auto Stock for Every Taxpayer Act. + +"Radioactive Import Deterrence Act" Mr. Speaker, the Radioactive Import Deterrence Act is a bipartisan bill that would ban the importation of lowlevel radioactive waste unless the President provides a waiver. Lowlevel radioactive waste is generated by medical facilities, university research labs, and utility companies. This waste is generated all over the United States, but finding permanent disposal sites has proven difficult. Currently, 36 States and the District of Columbia have only one approved site to store all the waste generated by those industries. That site is located in Utah... + +"Help Find the Missing Act" I yield myself such time as I may consume. Madam Speaker, the Help Find the Missing Act. or Billys Law. will help families of missing persons find their loved ones by strengthening Federal databases about missing persons and unidentified remains. Every year. tens of thousands of Americans go missing and are never found. In the subcommittee we heard moving testimony from Ms. Janice Smolinski. whose son. Billy. went missing in 2004. While she has not found her son. she has dedicated her life to improving the system for others. including highlighting the need to strengthen and expand access to our missing persons databases. I thank her for her dedication to this worthy cause... + +"Emergency Aid to American Survivors of the Haiti Earthquake Act" Madam Speaker. I yield myself such time as I may consume. I rise in support of this Senate bill. S. 2949. As Representative MCDERMOTT described, it will provide assistance to thousands of Americans returning from Haiti following the devastating January 12 earthquake there. Let me reiterate that we are helping American citizens with this legislation. The bill entitled Emergency Aid to American Survivors of the Haiti Earthquake Act. will ensure that State and local governments and charitable agencies on the ground in Florida... + +"Enhanced Oversight of State and Local Economic Recovery Act" Mr. Speaker. I rise to thank my colleagues for favorable consideration of H.R. 2182. the Enhanced Oversight of State and Local Economic Recovery Act. I was pleased to cosponsor this legislation. which was introduced by the chairman of the Oversight and Government Reform Committee. At a hearing of that committee. we learned that dedicated oversight funding for State and local governments could improve oversight of money appropriated through the American Recovery and Reinvestment Act... + +"Veterans Dog Training Therapy Act" I yield myself such time as I may consume. Madam Speaker. I rise today in support of H.R. 3885. the Veterans Dog Training Therapy Act. I want to thank the ranking member of the Health Subcommittee. Congressman BROWN from South Carolina for bringing us this legislation. Madam Speaker. we all recognize how damaging the invisible wounds of war can be. The need for effective treatments for posttraumatic stress disorder and for other conditions. such as depression and substance abuse. is apparent. I think. to all Americans. This act recognizes and meets this need by exploring an innovative and promising new form of treatment using the training of service dogs as a therapeutic medium... + +"Prevent Deceptive Census Look Alike Mailings Act" Mr. Speaker. entering its 23rd decade, the U.S. Census is the longest running national census in the world. Our founders wrote it into the Constitution, because taking a fair count is an essential part of fair government. A comprehensive, accurate Census helps ensure that our common resources are distributed where they are most needed, so that our communities can get the roads, schools, and police protection that they need. Theres nothing partisan about that goal. Unfortunately, some groups have set out to deceive Americans by disguising their own private mailings as Census documents... + +Table 11: Seven random samples of bill mentions from the 111th Congress. Speeches truncated to fit the table. \ No newline at end of file diff --git a/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/images.zip b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a5f4e0bc4b2d10335013951e6eedc3cd6be84377 --- /dev/null +++ b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c56e10044625d7dc20723e3377f23b9d2009bb9ba99f43513dca9e414264b4d +size 764908 diff --git a/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/layout.json b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..9857b9a790dc0acac4c3315a4a58c623130d7ee9 --- /dev/null +++ b/areundocumentedworkersthesameasillegalaliensdisentanglingdenotationandconnotationinvectorspaces/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8d68e8f65ba6338ed904420690fa711662bac0cd9dcd498aa21b1a5a1494049 +size 451748 diff --git a/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_content_list.json b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e41ff0b8ec1b330fbd355d3ebe0866fb34ac3dc5 --- /dev/null +++ b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66d1c844bef10f626815ffc028fa9f2db73f93ccf3e3c37a09a046b2ef9a1f5f +size 114438 diff --git a/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_model.json b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_model.json new file mode 100644 index 0000000000000000000000000000000000000000..487e6b7731f9e6e642c12061ea96ac3e7e028d16 --- /dev/null +++ b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cefe1d0a898e9a21fac707d73d08f8ff0f146834d159b8692128008fc0c4f13 +size 141358 diff --git a/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_origin.pdf b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4ed45012cf69f5cabb40475f97588ef5e1fff9fc --- /dev/null +++ b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/77dba0dd-0a3f-4850-9039-4a057392f691_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:501acb037a2d62aeb090eccb1a19e5175f2a614fcaafae9403be59714197cf14 +size 1384611 diff --git a/askingwithouttellingexploringlatentontologiesincontextualrepresentations/full.md b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ce1ecc9a72838750874d58fcecd1ec60ed86c2a6 --- /dev/null +++ b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/full.md @@ -0,0 +1,449 @@ +# Asking without Telling: Exploring Latent Ontologies in Contextual Representations + +Julian Michael, $^{1*}$ Jan A. Botha, $^{2}$ and Ian Tenney $^{2}$ + +$^{1}$ Paul G. Allen School of Computer Science & Engineering, University of Washington + +2Google Research + +julianjm@cs.washington.edu + +{jabot,iftenney} $@$ google.com + +# Abstract + +The success of pretrained contextual encoders, such as ELMo and BERT, has brought a great deal of interest in what these models learn: do they, without explicit supervision, learn to encode meaningful notions of linguistic structure? If so, how is this structure encoded? To investigate this, we introduce latent subclass learning (LSL): a modification to classifier-based probing that induces a latent categorization (or ontology) of the probe's inputs. Without access to fine-grained gold labels, LSL extracts emergent structure from input representations in an interpretable and quantifiable form. In experiments, we find strong evidence of familiar categories, such as a notion of personhood in ELMo, as well as novel ontological distinctions, such as a preference for fine-grained semantic roles on core arguments. Our results provide unique new evidence of emergent structure in pretrained encoders, including departures from existing annotations which are inaccessible to earlier methods. + +# 1 Introduction + +The success of self-supervised pretrained models in NLP (Devlin et al., 2019; Peters et al., 2018a; Radford et al., 2019; Lan et al., 2020) on many tasks (Wang et al., 2018, 2019b) has stimulated interest in how these models work, and what they learn about language. Recent work on model analysis (Belinkov and Glass, 2019) indicates that they may learn a lot about linguistic structure, including part of speech (Belinkov et al., 2017a), syntax (Blevins et al., 2018; Marvin and Linzen, 2018), word sense (Peters et al., 2018a; Reif et al., 2019), and more (Rogers et al., 2020). + +Many of these results are based on predictive methods, such as probing, which measure how well a linguistic variable can be predicted from intermediate representations. However, the ability of + +![](images/614357e3d300d315e4941c372a1009a0815391bda7b4c535489c7ae26b9b6294.jpg) +Figure 1: LSL overview. A probing classifier over contextual embeddings produces multi-class latent logits, which are marginalized into a single logit trained on binary classification. In this example, "Pierre Vinken" is identified as a named entity and assigned to latent class 2, which aligns well with the PERSON label. We treat the classes as clusters representing a latent ontology that describes the underlying representation space. Figure 2 visualizes latent logits in more detail. + +supervised probes to fit weak features makes it difficult to produce unbiased answers about how those representations are structured (Saphra and Lopez, 2019; Voita et al., 2019). Descriptive methods like clustering and visualization explore this structure directly, but provide limited control and often regress to dominant categories such as lexical features (Singh et al., 2019) or word sense (Reif et al., 2019). This leaves open many questions: how are linguistic features like entity types, syntactic dependencies, or semantic roles represented by an encoder like ELMo (Peters et al., 2018a) or BERT (Devlin et al., 2019)? To what extent do familiar categories like PropBank roles or Universal Dependencies appear naturally? Do these unsupervised encoders learn their own categorization of language? + +To tackle these questions, we propose a systematic way to extract latent ontologies, or discrete categorizations of a representation space, which we call latent subclass learning (LSL); see Figure 1 for an overview. In LSL, we use a binary classification task (such as detecting entity mentions or syntactic dependency arcs) as weak supervision to induce a set of latent clusters relevant to that task (i.e., entity or dependency types). As with predictive methods, the choice of task allows us to explore varied phenomena, and induced clusters can be quantified and compared to gold annotations. But also, as with descriptive methods, our clusters can be inspected and qualified directly, and observations have high specificity: agreement with external (e.g., gold) categories provides strong evidence that those categories are salient in the representation space. + +We describe the LSL classifier in Section 3, and apply it to the edge probing paradigm (Tenney et al., 2019b) in Section 4. In Section 5 we evaluate LSL on multiple encoders, including ELMo and BERT. We find that LSL induces stable and consistent ontologies, which include both striking rediscoveries of gold categories—for example, ELMo discovers personhood of named entities and BERT has a notion of dates—and novel ontological distinctions—such as fine-grained core argument semantic roles—which are not easily observed by fully supervised probes. Overall, we find unique new evidence of emergent latent structure in our encoders, while also revealing new properties of their representations which are inaccessible to earlier methods. + +# 2 Background + +Predictive analysis A common form of model analysis is predictive: assessing how well a linguistic variable can be predicted from a model, whether in intrinsic behavioral tests (Goldberg, 2019; Marvin and Linzen, 2018; Petroni et al., 2019) or extrinsic probing tasks. + +Probing involves training lightweight classifiers over features produced by a pretrained model, and assessing the model's knowledge by the probe's performance. Probing has been used for low-level properties such as word order and sentence length (Adi et al., 2017; Conneau et al., 2018), as well as phenomena at the level of syntax (Hewitt and Manning, 2019), semantics (Tenney et al., 2019b; Liu et al., 2019b; Clark et al., 2019), and discourse structure (Chen et al., 2019). Error analysis on probes has been used to argue that BERT may sim + +ulate sequential decision making across layers (Tenney et al., 2019a), or that it encodes its own, soft notion of syntactic distance (Reif et al., 2019). + +Predictive methods such as probing are flexible: Any task with data can be assessed. However, they only track predictability of pre-defined categories, limiting their descriptive power. In addition, a powerful enough probe, given enough data, may be insensitive to differences between encoders, making it difficult to interpret results based on accuracy (Saphra and Lopez, 2019; Zhang and Bowman, 2018). So, many probing experiments appeal to the ease of extraction of a linguistic variable (Pimentel et al., 2020). Existing work has measured this by controlling for probing model capacity, either using relative claims between layers and encoders (Belinkov et al., 2017b; Blevins et al., 2018; Tenney et al., 2019b; Liu et al., 2019a) or using explicit measures to estimate and trade off capacity with accuracy (Hewitt and Liang, 2019; Voita and Titov, 2020). An alternative is to control amount of supervision, by restricting training set size (Zhang and Bowman, 2018), comparing learning curves (Talmor et al., 2019), or using description length with online coding (Voita and Titov, 2020). + +We extend this further by removing the distinction between gold categories in the training data and reducing the supervision to binary classification, as explained in Section 3. This extreme measure makes our test high specificity, in the sense that positive results—i.e., when comprehensible categories are recovered by our probe—are much stronger, since a category must be essentially invented without direct supervision. + +Descriptive analysis In contrast to predictive methods, which assess an encoder with respect to particular data, descriptive methods analyze models on their own terms, and include clustering, visualization (Reif et al., 2019), and correlation analysis techniques (Voita et al., 2019; Saphra and Lopez, 2019; Abnar et al., 2019; Chrupaña and Alishahi, 2019). Descriptive methods produce high-specificity tests of what structure is present in the model, and facilitate discovery of new patterns that were not hypothesized prior to testing. However, they lack the flexibility of predictive methods. Clustering results tend to be dominated by principal components of the embedding space, which correspond to only some salient aspects of linguistic knowledge, such as lexical features (Singh et al., 2019) and word sense (Reif et al., 2019). Alterna- + +![](images/cc943fe1295549e6572f44d9e966e5eb3838445d5de7627bc2bc8e228acffde2.jpg) +Figure 2: Latent logit vectors from BERT (left) and ELMo (right) for a sample from the Named Entities development set visualized in the Embedding Projector (Smilkov et al., 2016) using UMAP (McInnes et al., 2018), which is designed to preserve local clustering structure in a low dimensional visualization. Points are colored by gold label, and induced clusters are outlined in red. ELMo has a clear notion of personhood (PERSON), while BERT groups people with geopolitical entities (GPE) and nationalities (NORP). BERT strongly identifies dates (DATE) and organizations (ORG), and both models group numeric/quantitative entities together. Both models separate small CARDINAL numbers (roughly, seven or less) and group them with ORDINALs, separate from larger CARDINALs. The outlined areas in the bottom-right of the ELMo visualization include 2 and 4 induced clusters. + +![](images/e75e25efef62f4dbadf90bc7c62ab92174b15d8ac4989b5edd7009a8a16fcace.jpg) + +tively, more targeted analysis techniques generally have a restricted inventory of inputs, such as layer mixing weights (Peters et al., 2018b), transformer attention distributions (Clark et al., 2019), or pairwise influence between tokens (Wu et al., 2020). As a result of these issues, it is more difficult to discover the underlying structure corresponding to rich, layered ontologies. Our approach retains the advantages of descriptive methods, while admitting more control as the choice of binary classification targets can guide the LSL model to discover structure relevant to a particular linguistic task. + +Linguistic ontologies Questions of what encoders learn about language require well-defined linguistic ontologies, or meaningful categorizations of inputs, to evaluate against. Most analysis work uses formalisms from the classical NLP pipeline, such as part-of-speech and syntax from the Penn Treebank (Marcus et al., 1993) or Universal Dependencies (Nivre et al., 2015), semantic roles from PropBank (Palmer et al., 2005) or Dowty (1991)'s Proto-Roles (Reisinger et al., 2015), and named entities, which have a variety of available ontologies (Pradhan et al., 2007; Ling and Weld, 2012; Choi et al., 2018). Work on ontology-free, or open, rep + +resentations suggests that the linguistic structure captured by traditional ontologies may be encoded in a variety of possible ways (Banko et al., 2007; He et al., 2015; Michael et al., 2018) while being annotatable at large scale (FitzGerald et al., 2018). This raises the question: when looking for linguistic knowledge in pretrained encoders, what exactly should we expect to find? Predictive methods are useful for fitting an encoder to an existing ontology; but do our encoders latently hold their own ontologies as well? If so, what do they look like? That is the question we investigate in this work. + +# 3 Approach + +We propose a way to extract latent linguistic ontologies from pretrained encoders and systematically compare them to existing gold ontologies. We use a classifier based on latent subclass learning (Section 3.1), which is applicable in any binary classification setting. We propose several quantitative metrics to evaluate the induced ontologies (Section 3.2), providing a starting point for qualitative analysis (Section 5) and future research. + +# 3.1 Latent Subclass Learning + +Consider a logistic regression classifier over inputs $\mathbf{x} \in \mathbb{R}^d$ . It outputs probabilities according to the following formula: + +$$ +\mathrm {P} (y \mid \mathbf {x}) = \sigma (\mathbf {w} ^ {\top} \mathbf {x}), +$$ + +where $\mathbf{w} \in \mathbb{R}^d$ is a learned parameter. Instead, we propose the latent subclass learning classifier: + +$$ +\mathrm {P} _ {\mathrm {L S L}} (y \mid \mathbf {x}) = \sigma \left(\log \sum_ {i} ^ {N} e ^ {\mathbf {W} _ {i} \mathbf {x}}\right), +$$ + +where $\mathbf{W} \in \mathbb{R}^{N \times d}$ is a parameter matrix, and $N$ is a hyperparameter corresponding to the number of latent classes. + +This corresponds to $N + 1$ -way multiclass logistic regression with a fixed 0 baseline for a null class, but trained on binary classification by marginalizing over the $N$ non-null classes (Figure 1). The vector $\mathbf{W}\mathbf{x} \in \mathbb{R}^N$ may then be treated as a set of latent logits for a random variable $C(\mathbf{x}) \in \{1,\dots,N\}$ defined by the softmax distribution. Taking the hard maximum of $\mathbf{W}\mathbf{x}$ assigns a latent class $\hat{C}(\mathbf{x})$ to each input, which may be viewed as a weakly supervised clustering, learned on the basis of external supervision but not explicitly optimized to match prior gold categories. + +For the loss $\mathcal{L}_{\mathrm{LSL}}$ , we use the cross-entropy loss on $\mathrm{P_{LSL}}$ . However, this does not necessarily encourage a diverse, coherent set of clusters; an LSL classifier may simply choose to collapse all examples into a single category, producing an uninteresting ontology. To mitigate this, we propose two clustering regularizers. + +Adjusted batch-level negative entropy We wish for the model to induce a diverse ontology. One way to express this is that the expectation of $C$ has high entropy, i.e., we wish to maximize + +$$ +\mathrm {H} (\mathbb {E} _ {\mathbf {x}} C (\mathbf {x})). +$$ + +In practice, we use the expectation over a batch. The maximum value this can take is the entropy of the uniform distribution over $N$ items, or $\log N$ . Therefore, we wish to minimize the adjusted batch-level negative entropy loss: + +$$ +\mathcal {L} _ {\mathrm {b e}} = \log N - \mathrm {H} (\mathbb {E} _ {\mathbf {x}} C (\mathbf {x})), +$$ + +which takes values in $[0, \log N]$ . + +Instance-level entropy In addition to using all latent classes in the expected case, we also wish for the model to assign a single coherent class label to each input example. This can be done by minimizing the instance-level entropy loss: + +$$ +\mathcal {L} _ {\mathrm {i e}} = \mathbb {E} _ {\mathbf {x}} \mathrm {H} (C (\mathbf {x})). +$$ + +This also takes values in $[0, \log N]$ , and we compute the expectation over a batch. + +Loss We optimize the regularized LSL loss + +$$ +\mathcal {L} _ {\mathrm {L S L}} + \alpha \mathcal {L} _ {\mathrm {b e}} + \beta \mathcal {L} _ {\mathrm {i e}}, +$$ + +where $\alpha$ and $\beta$ are hyperparameters, via gradient descent. Together, the regularizers encourage a balanced solution where the model uses many clusters yet gives each input a distinct assignment. Note that if $\alpha = \beta$ , the this objective maximizes the mutual information between $\mathbf{x}$ and $C$ , encouraging the ontology to encode as much information as possible about the training data while still supporting the binary classification objective. + +# 3.2 Metrics + +Since our interest is in descriptively analyzing encoders' latent ontologies, there are no normatively 'correct' categories. However, we can leverage existing gold ontologies—such as PropBank role labels or Universal Dependencies—to quantify our results in terms of well-understood categories. For the following metrics, we consider only points in the gold positive class. + +$\mathbf{B}^3$ B-cubed (or $\mathbf{B}^3$ ) is a standard clustering metric (Bagga and Baldwin, 1998; Amigo et al., 2009) which calculates the precision and recall of each point's predicted cluster against its gold cluster, averaging over points. It allows for label-wise scoring by restricting to points with specific gold labels, allowing for fine-grained analysis, e.g., of whether a gold label is concentrated in few predicted clusters (high recall) or well-separated from other labels (high precision). + +Normalized PMI Pointwise mutual information (PMI) is commonly used as an association measure reflecting how likely two items (such as tokens in a corpus) are to occur together relative to chance (Church and Hanks, 1989). Normalized PMI (nPMI; Bouma, 2009) is a way of factoring out the effect of item frequency on PMI. Formally, + +the nPMI of two items $x$ and $y$ is + +$$ +\left(\log \frac {\mathrm {P} (x , y)}{\mathrm {P} (x) \mathrm {P} (y)}\right) \Bigg / - \log (\mathrm {P} (x, y)), +$$ + +taking the limit value of -1 when they never occur together, 1 when they only occur together, and 0 when they occur independently. We use nPMI to analyze the co-occurrence of gold labels in predicted clusters: A pair of gold labels with high nPMI are preferentially grouped together by the induced ontology, whereas two labels with low nPMI are preferentially distinguished. + +Plotting pairwise nPMI of gold labels allows us to see specific ways the induced clustering agrees or disagrees with a gold reference (Section 5, Figure 3). Since nPMI is information-theoretic and chance-corrected, it is a reliable indicator of the degree of information about gold labels contained in a set of predicted clusters. However, it is relatively insensitive to cluster granularity (e.g., the total number of predicted categories, or whether a single gold category is split into many different predicted clusters), which is better understood through our other metrics. + +Diversity We desire fine-grained ontologies with many meaningful classes. Number of attested classes may not be a good measure of this, since it could include classes with very few members and no broad meaning. So we propose diversity: + +$$ +\exp (\mathrm {H} (\mathbb {E} _ {\mathbf {x}} \hat {C} (\mathbf {x}))). +$$ + +This increases as the clustering becomes more fine-grained and evenly distributed, with a maximum of $N$ when $\mathrm{P}(\hat{C})$ is uniform. More generally, exponentiated entropy is sometimes referred to as the perplexity of a distribution, and corresponds (softly) to the number of classes required for a uniform distribution of the same entropy. In that sense, it may be regarded as the effective number of classes in an ontology. We use the predicted class $\hat{C}$ rather than its distribution $C$ because we care about the diversity of the model's clustering, and not just uncertainty in the model. + +Uncertainty In order for our learned classes to be meaningful, we desire distinct and coherent clusters. To measure this, we propose uncertainty: + +$$ +\mathbb {E} _ {\mathbf {x}} \exp (\mathrm {H} (C (\mathbf {x}))). +$$ + +This is also related to perplexity, but unlike diversity, it takes the expectation over the input after + +calculating the perplexity of the distribution. This reflects how many classes, on average, the model is confused between when provided with an input. Low values correspond to coherent clusters, with a minimum of 1 when every latent class is assigned with full confidence. As with diversity, we take the expectation over the evaluation set. + +# 4 Experimental Setup + +We adopt a similar setup to Tenney et al. (2019b) and Liu et al. (2019a), training probing models over several contextualizing encoders on a variety of linguistic tasks. + +# 4.1 Tasks + +We cast several structure labeling tasks from Tenney et al. (2019b) as binary classification by adding negative examples, bringing the positive to negative ratio to 1:1 where possible. + +Named entity labeling requires labeling noun phrases with entity types, such as person, location, date, or time. We randomly sample non-entity noun phrases as negatives. + +Nonterminal labeling requires labeling phrase structure constituents with syntactic types, such as noun phrases and verb phrases. We randomly sample non-constituent spans as negatives. + +Syntactic dependency labeling requires labeling token pairs with their syntactic relationship, such as a subject, direct object, or modifier. We randomly sample non-attached token pairs as negatives. + +Semantic role labeling requires labeling predicates (usually verbs) and their arguments (usually syntactic constituents) with labels that abstract over syntactic relationships in favor of more semantic notions such as agent, patient, modifier roles involving, e.g., time and place, or predicate-specific roles. We draw the closest non-attached predicateargument pairs as negatives. + +We use the English Web Treebank part of Universal Dependencies 2.2 (Silveira et al., 2014) for dependencies, and the English portion of Ontonotes 5.0 (Weischedel et al., 2013) for other tasks. + +# 4.2 Encoders + +We run experiments on the following encoders: + +ELMo (Peters et al., 2018a) is the concatenation of representations from 2-layer LSTMs (Hochreiter and Schmidhuber, 1997) trained with forward and + +
Named EntitiesUniversal Dependencies
P / R / F1Acc.Div↑Unc↓P / R / F1Acc.Div↑Unc↓
Gold1.0 / 1.0 / 1.01.09.711.001.0 / 1.0 / 1.01.022.911.00
Multi.86 / .88 / .87.948.581.88.86 / .83 / .84.9321.941.77
LSL.28 / .80 / .41.962.851.45.10 / .60 / .18.943.502.07
+be.20 / .43 / .27.964.7831.23.18 / .13 / .15.9429.8312.33
+ie.13 / 1.0 / .23.931.001.00.09 / .79 / .15.942.001.01
+be +ie.43 / .54 / .48.887.001.10.18 / .27 / .22.8614.961.35
Single.13 / 1.0 / .23-1.001.00.06 / 1.0 / .11-1.001.00
+ +Table 1: Model selection results over BERT-large. Multi is the standard multi-class model trained directly on gold labels, and Single is the degenerate single-cluster baseline. Our clustering regularizers (batch and/or instance-level entropy), when taken together, yield a good tradeoff between diversity and uncertainty, though at some expense to binary classification accuracy. + +backward language modeling objectives. We use the publicly available instance $^2$ trained on the One Billion Word Benchmark (Chelba et al., 2014). + +BERT (Devlin et al., 2019) is a deep Transformer stack (Vaswani et al., 2017) trained on masked language modeling and next sentence prediction tasks. We use the 24-layer BERT-large instance trained on about 2.3B tokens from English Wikipedia and BooksCorpus (Zhu et al., 2015). + +BERT-lex is a lexical baseline, using only BERT's context-independent wordpiece embedding layer. + +# 4.3 Probing Model + +We reimplement the model of Tenney et al. (2019b),4 which gives a unified architecture that works for a wide range of probing tasks. Specifically, it classifies single spans or pairs of spans in the following way: 1) construct token representations by pooling across encoder layers with a learned scalar mix (Peters et al., 2018a), 2) construct span representations from these token representations using self-attentive pooling (Lee et al., 2017), and 3) concatenate those span representations and feed the result through a fully-connected layer to produce input features for the classification layer. We follow Tenney et al. (2019b) in training a probing model over a frozen encoder, while using our LSL classifier (Section 3) as the final output layer in place of the usual softmax. + +# 4.4 Model selection + +We run initial studies to determine hidden layer sizes and regularization coefficients. For all LSL probes, we use $N = 32$ latent classes. + +Probe capacity To mitigate the influence of probe capacity on the results, we follow the best practice recommended by Hewitt and Liang (2019) and use a single hidden layer with the smallest size that does not sacrifice performance. For each task, we train binary logistic regression probes with a range of hidden sizes and select the smallest yielding at least $97\%$ of the best model's performance. Details are in Appendix A. + +Mitigating variance To decrease variance across random restarts, we use a consistency-based model selection criterion: train 5 models, compute their pairwise $\mathrm{B}^3$ F1 scores, and choose the one with the highest average F1. (However, as we find in Section 5, the qualitative patterns that emerged were consistent between runs.) + +Regularization coefficients We run preliminary experiments using BERT-large on Universal Dependencies and Named Entity Labeling with ablations on our clustering regularizers. For each ablation, we choose hyperparameters with the best F1 against gold. + +Results Results are shown in Table 1. As expected, the batch-level entropy loss drives up both diversity and uncertainty, while the instance-level entropy loss drives them down. In combination, + +
BERT-lexELMoBERT-largeGold
TaskP / R / F1DivP / R / F1DivP / R / F1DivDiv
Dependencies.06 / .86 / .111.33.23 / .42 / .2911.11.14 / .33 / .1911.2222.91
Named Entities.19 / .39 / .264.33.40 / .66 / .505.07.47 / .53 / .507.509.71
Nonterminals.22 / .80 / .341.47.36 / .25 / .3010.16.35 / .34 / .357.807.15
Semantic Roles.19 / .39 / .262.81.40 / .17 / .2422.35.37 / .17 / .2418.708.73
+ +however, they produce the right balance, with uncertainty near 1 while retaining diversity. + +Notably, the Named Entity model with the batch-level loss has higher diversity when the instance-level loss is added. This happens because batch-level entropy can be increased by driving up instance-level entropy without changing the entropy of the expected distribution of predictions $\mathrm{H}(\mathbb{E}_{\mathbf{x}}\mathrm{P}(\hat{C} (\mathbf{x})))$ . So by keeping the uncertainty down on each input, the instance-level entropy loss helps the batch-level entropy loss promote diversity in the induced ontology. + +Based on these results, we set $\alpha = \beta = 1.5$ for $\mathcal{L}_{be}$ and $\mathcal{L}_{ie}$ for the main experiments. + +# 5 Results and Analysis + +Table 2 shows aggregate results for the tasks and encoders described in Section 4.6 Taking all metrics into account, contextualized encodings produce richer ontologies that agree more with gold than the lexical baseline does. In fact, BERT-lex has normalized PMI scores very close to zero across the board (plots are provided in Appendix C), encoding virtually no information about gold categories. For this reason, we omit it from the rest of the analysis. + +Named entities As shown in Table 3, neither BERT nor ELMo are sensitive to categories that are related to specialized world knowledge, such as languages, laws, and events. However, they are in tune with other types: ELMo discovers a clear PERSON category, whereas BERT has distinguished DATES. Visualization of the clusters (Figure 2) corroborates this, furthermore showing that the models have a sense of scalar values and measurement; indeed, instead of the gold distinction between ORDINAL and CARDINAL numbers, both models distinguish between small and + +Table 2: Results by task for three pretrained encoding methods. All probing models were trained with the LSL loss and cluster regularization coefficients $\alpha = \beta = 1.5$ , and chosen by the best-of-5 consistency criterion and detailed in Section 4.4. Uncertainty for all models was close to 1 and is omitted for space. + +
DATEPERCENTORGPERSON...EVENTLAWLANG.
BERT.70.60.54.48·.03.02.01
ELMo.38.28.35.81·.02.01.01
+ +Table 3: Label-wise $\mathbf{B}^3$ F1 scores for Named Entities, sorted by decreasing BERT-large F1. Induced ontologies capture some labels surprisingly well, but are indifferent to more specialized categories which may require more world knowledge to distinguish. + +large (roughly, seven or greater) numbers. See Appendix C for detailed nPMI scores. + +Nonterminals Patterns in nPMI (Figure 3a) suggest basic syntactic notions: complete clauses (S, TOP, SINV) form a group, as do phrase types which take subjects (SBAR, VP, PP), and wh-phrases (WHADVP, WHPP, WHNP). + +Dependencies Patterns in nPMI (Figure 3b) indicate several salient groups: verb arguments (nsubj, obj, abl, xcomp), left-heads (det, nmod:poss, compound, amod, case), right-heads (acl, acl:relcl, $\mathrm{nmod}^7$ ), and punct. + +Semantic roles Patterns in nPMI (Figure 3c) roughly match intuition: primary core arguments (ARG0, ARG1) are distinguished, as well as modals (ARGM-MOD) and negation (ARGM-NEG), while trailing arguments (ARG2-5) and modifiers (ARGM-TMP, LOC, etc.) form a large group. On one hand, this reflects surface patterns: primary core arguments are usually close to the verb, with ARG0 on the left and ARG1 on the right; trailing arguments and modifiers tend to be prepositional phrases or subordinate clauses; and modals + +
Gold LabelP / R / F1
ARGM-MOD.62 / .41 / .49
ARG0.52 / .17 / .26
ARG1.50 / .09 / .15
ARGM-NEG.36 / .60 / .45
ARG2.28 / .13 / .18
+ +Table 4: Top semantic role labels by BERT-large $\mathbf{B}^3$ precision. Core arguments ARG0-2 are most preferentially split, with high precision but low recall. + +and negation are identified by lexical and positional cues. On the other hand, this also reflects error patterns in state-of-the-art systems, where label errors can sometimes be traced to ontological choices in PropBank, which distinguish between arguments and adjuncts that have very similar meaning (He et al., 2017; Kingsbury et al., 2002). + +While the number of induced classes roughly matches gold for most tasks, induced ontologies for semantic roles are considerably more diverse, with a diversity measure close to 20 for ELMo and BERT (Table 2). Even though the alignment of predicted clusters with gold is dominated by a few patterns (Figure 3), the induced clustering contains more information than just these patterns. To locate this information, we examine the gold classes exhibiting the highest $\mathbf{B}^3$ precision, shown in Table 4. Among these, core arguments ARG0, ARG1, and ARG2 have very low recall, indicating that the ontology splits them into finer-grained labels. + +This follows intuition for PropBank core argument labels, which have predicate-specific meanings. Other approaches based on Frame Semantics (Baker et al., 1998; Fillmore et al., 2006), Proto-Roles (Dowty, 1991; Reisinger et al., 2015), or Levin classes (Levin, 1993; Schuler, 2005) have more explicit fine-grained roles. Concurrent work (Kuznetsov and Gurevych, 2020) shows that the choice of semantic role formalism meaningfully affects the behavior of supervised probes; further comparisons using LSL probing may help shed light on the origins of such differences. + +# 6 Discussion + +Our exploration of latent ontologies has yielded some surprising results: ELMo knows people, BERT knows dates, and both sense scalar and measurable values, while distinguishing between small and large numbers. Both models preferentially split core semantic roles into many fine-grained + +![](images/451b16224748e7a50cf65d99255025b98799da562cff4f675122fd06d4ba4394.jpg) +(a) Nonterminals. + +![](images/7f99e2d4dd1a4e49f6098f01d0f2680510f953ae30adfa1e40169367a116018c.jpg) +(b) Universal dependencies. + +![](images/5a3d971351f7305e088700cca10b03621772f0324402625da7d905d7c1539aa9.jpg) +(c) Semantic roles. +Figure 3: Pairwise gold label nPMIs on selected categories for ontologies induced from BERT-large on selected tasks. Blue is positive nPMI, representing that gold labels are preferentially grouped together (i.e., conflated by the model) relative to chance. Red is negative nPMI, representing that gold labels are well-separated. Perfectly matching ontologies would be 1 (blue) along the diagonal and -1 (red) in all off-diagonal cells. Counts are summed over all 5 runs to better reflect the underlying representations, though variance was low and our observed trends hold across all runs. + +categories, and seem to encode broad notions of syntactic and semantic structure. These findings contrast with those from fully-supervised probes, which produce strong agreement with existing annotations (Tenney et al., 2019b) but can also report false positives by fitting to weak patterns in large feature spaces (Zhang and Bowman, 2018; Voita and Titov, 2020). Instead, agreement of latent categories with known concepts can be taken as strong evidence that these concepts (or similar ones) are present as important, salient features in an encoder's representation space. + +This issue is particularly important when looking for deep, inherent understanding of linguistic structure, which by nature must generalize. For supervised systems, generalization is often measured by out-of-distribution objectives like out-of-domain performance (Ganin et al., 2016), transferability (Wang et al., 2018), targeted forms of compositionality (Geiger et al., 2020), or robustness to adversarial inputs (Jia and Liang, 2017). Recent work also advocates for counterfactual learning and evaluation (Qin et al., 2019; Kaushik et al., 2020) to mitigate confounds, or contrastive evaluation sets (Gardner et al., 2020) to rigorously test local decision boundaries. Overall, these techniques target discrepancies between salient features in a model and causal relationships in a task. In this work, we extract such features directly and investigate them by comparing induced and gold ontologies. This identifies some very strong cases of transferability from the binary detection task to detection tasks over gold subcategories, such as ELMo's people and BERT's dates (Table 3). Future work may investigate cross-task ontology matching to identify other transferable features, the emergence of categories signifying pipelined reasoning (Tenney et al., 2019a), surface patterns, or new, perhaps unexpected distinctions which can appear when going beyond existing schemas (Michael et al., 2018). + +Our results point to a paradigm of probing with latent variables, for which LSL is one potential technique. We have only scratched the surface of what may emerge with such methods: while our probing test is high specificity, it is low power; extant latent structure may still be missed. LSL probing may produce different ontologies due to many factors, such as tokenization (Singh et al., 2019), encoder architecture (Peters et al., 2018b), probe architecture (Hewitt and Manning, 2019), data distribution (Gururangan et al., 2018), pretraining task + +(Liu et al., 2019a; Wang et al., 2019a), or pretraining checkpoint. Any such factors may be at work in the differences we observe between ELMo and BERT: for example, BERT's tokenization method may not as readily induce personhood features due to splitting of rare words (like names) in byte-pair encoding. Furthermore, concurrent work (Chi et al., 2020) has already found qualitative evidence of syntactic dependency types emergent in the special case of multilingual structural probes (Hewitt and Manning, 2019). With LSL, we provide a method that can be adapted to a variety of probing settings to both quantify and qualify this kind of structure. + +# 7 Conclusion + +We introduced a new model analysis method based on latent subclass learning: by factoring a binary classifier through a forced choice of latent subclasses, latent ontologies can be coaxed out of input features. Using this approach, we showed that encoders such as BERT and ELMo can be found to hold stable, consistent latent ontologies on a variety of linguistic tasks. In these ontologies, we found clear connections to existing categories, such as personhood of named entities. We also found evidence of ontological distinctions beyond traditional gold categories, such as distinguishing large and small numbers, or preferring fine-grained semantic roles for core arguments. In latent subclass learning, we have shown a general technique to uncover some of these features discretely, providing a starting point for descriptive analysis of our models' latent ontologies. The high specificity of our method opens doors to more insights from future work, which may include investigating how LSL results vary with probe architecture, developing intrinsic quality measures on latent ontologies, or applying the technique to discover new patterns in settings where gold annotations are not present. + +# Acknowledgments + +We would like to thank Tim Dozat, Kenton Lee, Emily Pitler, Kellie Webster, other members of Google Research, Sewon Min, and the anonymous reviewers, who all provided valuable feedback on this paper. We also thank Rafael Müller, Simon Kornblith, and Geoffrey Hinton for discussion on the LSL classifier, and Alessandro Sordoni for pointing out the connection between the clustering regularizers and mutual information. + +# References + +Samira Abnar, Lisa Beinborn, Rochelle Choenni, and Willem Zuidema. 2019. Blackbox meets blackbox: Representational similarity and stability analysis of neural language models and brains. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 191-203. +Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. 2017. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. In International Conference on Learning Representations. +Enrique Amigo, Julio Gonzalo, Javier Artiles, and Felisa Verdejo. 2009. A comparison of extrinsic clustering evaluation metrics based on formal constraints. Information retrieval, 12(4):461-486. +Amit Bagga and Breck Baldwin. 1998. Entity-based cross-document coreferencing using the vector space model. In 36th Annual Meeting of the Association for Computational Linguistics and 17th International Conference on Computational Linguistics, Volume 1, pages 79-85, Montreal, Quebec, Canada. Association for Computational Linguistics. +Collin F. Baker, Charles J. Fillmore, and John B. Lowe. 1998. The Berkeley FrameNet project. In *COLING* 1998 Volume 1: The 17th International Conference on Computational Linguistics, pages 86-90. Association for Computational Linguistics. +Michele Banko, Michael J. Cafarella, Stephen Soderland, Matt Broadhead, and Oren Etzioni. 2007. Open information extraction from the web. In Proceedings of the 20th International Joint Conference on Artificial Intelligence, IJCAI'07, pages 2670-2676, San Francisco, CA, USA. Morgan Kaufmann Publishers Inc. +Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. 2017a. What do neural machine translation models learn about morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 861-872. Association for Computational Linguistics. +Yonatan Belinkov and James Glass. 2019. Analysis methods in neural language processing: A survey. Transactions of the Association for Computational Linguistics, 7:49-72. +Yonatan Belinkov, Lluis Márquez, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2017b. Evaluating layers of representation in neural machine translation on part-of-speech and semantic tagging tasks. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1-10. Asian Federation of Natural Language Processing. + +Terra Blevins, Omer Levy, and Luke Zettlemoyer. 2018. Deep RNNs encode soft hierarchical syntax. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 14-19. Association for Computational Linguistics. +Gerlof Bouma. 2009. Normalized (pointwise) mutual information in collocation extraction. In GSCL. +Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, Phillip Koehn, and Tony Robinson. 2014. One billion word benchmark for measuring progress in statistical language modeling. In Proceedings of Interspeech. +Mingda Chen, Zewei Chu, and Kevin Gimpel. 2019. Evaluation benchmarks and learning criteria for discourse-aware sentence 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 649-662, Hong Kong, China. Association for Computational Linguistics. +Ethan A. Chi, John Hewitt, and Christopher D. Manning. 2020. Finding universal grammatical relations in multilingual BERT. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5564-5577. Association for Computational Linguistics. +Eunsol Choi, Omer Levy, Yejin Choi, and Luke Zettlemoyer. 2018. Ultra-fine entity typing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 87-96, Melbourne, Australia. Association for Computational Linguistics. +Grzegorz Chrupała and Afra Alishahi. 2019. Correlating neural and symbolic representations of language. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2952-2962, Florence, Italy. Association for Computational Linguistics. +Kenneth Ward Church and Patrick Hanks. 1989. Word association norms, mutual information, and lexicography. In 27th Annual Meeting of the Association for Computational Linguistics, volume 16, pages 76-83. 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. Association for Computational Linguistics. +Alexis Conneau, German Kruszewski, Guillaume Lample, Loïc Barrault, and Marco Baroni. 2018. What you can cram into a single $\$ \& !\#$ * vector: Probing sentence embeddings for linguistic properties. + +In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2126-2136. 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. +David Dowty. 1991. Thematic proto-roles and argument selection. Language, 67:547-619. +Charles J Fillmore et al. 2006. Frame semantics. Cognitive linguistics: Basic readings, 34:373-400. +Nicholas FitzGerald, Julian Michael, Luheng He, and Luke Zettlemoyer. 2018. Large-scale QA-SRL parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2051-2060. Association for Computational Linguistics. +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. +Matt Gardner, Yoav Artzi, Victoria Basmova, Jonathan Berant, Ben Bogin, Sihao Chen, Pradeep Dasigi, Dheeru Dua, Yanai Elazar, Ananth Gottumukkala, Nitish Gupta, Hanna Hajishirzi, Gabriel Ilharco, Daniel Khashabi, Kevin Lin, Jiangming Liu, Nelson F. Liu, Phoebe Mulcaire, Qiang Ning, Sameer Singh, Noah A. Smith, Sanjay Subramanian, Reut Tsarfaty, Eric Wallace, Ally Zhang, and Ben Zhou. 2020. Evaluating NLP models via contrast sets. +Atticus Geiger, Kyle Richardson, and Christopher Potts. 2020. Modular representation underlies systematic generalization in neural natural language inference models. arXiv preprint arXiv:2004.14623. +Yoav Goldberg. 2019. Assessing bert's syntactic abilities. arXiv preprint arXiv:1901.05287. +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), volume 2, pages 107-112. Association for Computational Linguistics. +Luheng He, Kenton Lee, Mike Lewis, and Luke Zettle-moyer. 2017. Deep semantic role labeling: What works and what's next. In Proceedings of the 55th + +Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 473-483, Vancouver, Canada. Association for Computational Linguistics. +Luheng He, Mike Lewis, and Luke Zettlemoyer. 2015. Question-answer driven semantic role labeling: Using natural language to annotate natural language. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 643-653. Association for Computational Linguistics. +John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +John Hewitt and Christopher D. Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138, Minneapolis, Minnesota. Association for Computational Linguistics. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735-1780. +Robin Jia and Percy Liang. 2017. Adversarial examples for evaluating reading comprehension systems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2021-2031, Copenhagen, Denmark. Association for Computational Linguistics. +Divyansh Kaushik, Eduard Hovy, and Zachary Lipton. 2020. Learning the difference that makes a difference with counterfactually-augmented data. In International Conference on Learning Representations. +Paul Kingsbury, Martha Palmer, and Mitch Marcus. 2002. Adding semantic annotation to the penn treebank. In *In Proceedings of the Human Language Technology Conference*. +Ilia Kuznetsov and Iryna Gurevych. 2020. A matter of framing: The impact of linguistic formalism on probing results. arXiv preprint arXiv:2004.14999. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. Albert: A lite bert for self-supervised learning of language representations. In International Conference on Learning Representations. +Kenton Lee, Luheng He, Mike Lewis, and Luke Zettle-moyer. 2017. End-to-end neural coreference resolution. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, + +pages 188-197. Association for Computational Linguistics. +B. Levin. 1993. English Verb Classes and Alternations: A Preliminary Investigation. University of Chicago Press. +Xiao Ling and Daniel S. Weld. 2012. Fine-grained entity recognition. In Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, AAAI'12, pages 94-100. AAAI Press. +Nelson F. Liu, Matt Gardner, Yonatan Belinkov, Matthew E. Peters, and Noah A. Smith. 2019a. Linguistic knowledge and transferability of contextual representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1073-1094, Minneapolis, Minnesota. Association for Computational Linguistics. +Xiaodong Liu, Pengcheng He, Weizhu Chen, and Jianfeng Gao. 2019b. Multi-task deep neural networks for natural language understanding. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4487-4496, Florence, Italy. Association for Computational Linguistics. +Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. 1993. Building a large annotated corpus of English: The Penn Treebank. Computational Linguistics, 19(2):313-330. +Rebecca Marvin and Tal Linzen. 2018. Targeted syntactic evaluation of language models. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1192-1202. Association for Computational Linguistics. +Leland McInnes, John Healy, and James Melville. 2018. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426. +Julian Michael, Gabriel Stanovsky, Luheng He, Ido Dagan, and Luke Zettlemoyer. 2018. Crowdsourcing question-answer meaning representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 560-568. Association for Computational Linguistics. +Rafael Müller, Simon Kornblith, and Geoffrey Hinton. 2020. Subclass distillation. arXiv preprint arXiv:2002.03936. +Joakim Nivre, Željko Agić, Maria Jesus Aranzabe, Masayuki Asahara, Aitziber Atutxa, Miguel Ballesteros, John Bauer, Kepa Bengoetxea, Riyaz Ahmad Bhat, Cristina Bosco, Sam Bowman, Giuseppe G. A. Celano, Miriam Connor, Marie-Catherine de Marneffe, Arantza Diaz de Ilarraza, Kaja Dobrovoljc, Timothy Dozat, Tomasz Erjavec, Richard + +Farkas, Jennifer Foster, Daniel Galbraith, Filip Ginter, Iakes Goenaga, Koldo Gojenola, Yoav Goldberg, Berta Gonzales, Bruno Guillaume, Jan Hajic, Dag Haug, Radu Ion, Elena Irimia, Anders Johannsen, Hiroshi Kanayama, Jenna Kanerva, Simon Krek, Veronika Laippala, Alessandro Lenci, Nikola Ljubesic, Teresa Lynn, Christopher Manning, Catalina Márnduc, David Mareček, Héctor Martínez Alonso, Jan Mašek, Yuji Matsumoto, Ryan McDonald, Anna Missilä, Verginica Mititelu, Yusuke Miyao, Simonetta Montemagni, Shunsuke Mori, Hanna Nurmi, Petya Ostenova, Lilja Øvrelid, Elena Pascual, Marco Passarotti, Cenel-Augusto Perez, Slav Petrov, Jussi Piitulainen, Barbara Plank, Martin Popel, Prokopis Prokopidis, Sampo Pyysalo, Loganathan Ramasamy, Rudolf Rosa, Shadi Saleh, Sebastian Schuster, Wolfgang Seeker, Mojgan Seraji, Natalia Silveira, Maria Simi, Radu Simionescu, Katalin Simko, Kiril Simov, Aaron Smith, Jan Štepánek, Alane Suhr, Zsolt Szántó, Takaaki Tanaka, Reut Tsarfaty, Sumire Uematsu, Larraitz Uria, Viktor Varga, Veronika Vincze, Zdeněk Žabokrtský, Daniel Zeman, and Hanzhi Zhu. 2015. Universal dependencies 1.2. LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (UFAL), Faculty of Mathematics and Physics, Charles University. +Martha Palmer, Daniel Gildea, and Paul Kingsbury. 2005. The Proposition Bank: An annotated corpus of semantic roles. Computational Linguistics, 31(1):71-106. +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018a. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227-2237. Association for Computational Linguistics. +Matthew Peters, Mark Neumann, Luke Zettlemoyer, and Wen-tau Yih. 2018b. Dissecting contextual word embeddings: Architecture and representation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1499-1509. Association for Computational Linguistics. +Fabio Petroni, Tim Roktaschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language models as knowledge bases? 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 2463-2473, Hong Kong, China. Association for Computational Linguistics. +Tiago Pimentel, Josef Valvoda, Rowan Hall Maudslay, Ran Zmigrod, Adina Williams, and Ryan Cotterell. 2020. Information-theoretic probing for linguistic structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, + +pages 4609-4622. Association for Computational Linguistics, Association for Computational Linguistics. +Sameer S Pradhan, Eduard Hovy, Mitch Marcus, Martha Palmer, Lance Ramshaw, and Ralph Weischedel. 2007. Ontonotes: A unified relational semantic representation. International Journal of Semantic Computing, 1(04):405-419. +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 5043-5053, Hong Kong, China. Association for Computational Linguistics. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. https://blog.opencai.com/better-language-models. +Emily Reif, Ann Yuan, Martin Wattenberg, Fernanda B Viegas, Andy Coenen, Adam Pearce, and Been Kim. 2019. Visualizing and measuring the geometry of BERT. 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 8592-8600. Curran Associates, Inc. +Drew Reisinger, Rachel Rudinger, Francis Ferraro, Craig Harman, Kyle Rawlins, and Benjamin Van Durme. 2015. Semantic proto-roles. Transactions of the Association for Computational Linguistics, pages 475-488. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2020. A primer in BERTology: What we know about how BERT works. arXiv preprint arXiv:2002.12327. +Naomi Saphra and Adam Lopez. 2019. Understanding learning dynamics of language models with SVCCA. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3257-3267, Minneapolis, Minnesota. Association for Computational Linguistics. +Karin Kipper Schuler. 2005. VerbNet: A broad-coverage, comprehensive verb lexicon. Ph.D. thesis, University of Pennsylvania. +Natalia Silveira, Timothy Dozat, Marie-Catherine de Marneffe, Samuel Bowman, Miriam Connor, John Bauer, and Chris Manning. 2014. A gold standard dependency corpus for English. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC'14), pages 2897-2904. European Language Resources Association (ELRA). + +Jasdeep Singh, Bryan McCann, Richard Socher, and Caiming Xiong. 2019. BERT is not an interlingua and the bias of tokenization. In Proceedings of the 2nd Workshop on Deep Learning Approaches for Low-Resource NLP (DeepLo 2019), pages 47-55, Hong Kong, China. Association for Computational Linguistics. +Daniel Smilkov, Nikhil Thorat, Charles Nicholson, Emily Reif, Fernanda B Viégas, and Martin Wattenberg. 2016. Embedding projector: Interactive visualization and interpretation of embeddings. In NIPS 2016 Workshop on Interpretable Machine Learning in Complex Systems. +Alon Talmor, Yanai Elazar, Yoav Goldberg, and Jonathan Berant. 2019. oLMpics - on what language model pre-training captures. arXiv preprint arXiv:1912.13283. +Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019a. 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. +Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R Thomas McCoy, Najoung Kim, Benjamin Van Durme, Sam Bowman, Dipanjan Das, and Ellie Pavlick. 2019b. What do you learn from context? probing for sentence structure in contextualized word representations. In International Conference on Learning Representations. +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 NIPS. +Elena Voita, Rico Sennrich, and Ivan Titov. 2019. The bottom-up evolution of representations in the transformer: A study with machine translation and language modeling objectives. 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 4396-4406. Association for Computational Linguistics. +Elena Voita and Ivan Titov. 2020. Information-theoretic probing with minimum description length. arXiv preprint arXiv:2003.12298. +Alex Wang, Jan Hula, Patrick Xia, Raghavendra Pappagari, R. Thomas McCoy, Roma Patel, Najoung Kim, Ian Tenney, Yinghui Huang, Katherin Yu, Shuning Jin, Berlin Chen, Benjamin Van Durme, Edouard Grave, Ellie Pavlick, and Samuel R. Bowman. 2019a. Can you tell me how to get past sesame street? sentence-level pretraining beyond language modeling. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4465-4476, Florence, Italy. Association for Computational Linguistics. + +Alex Wang, Yada Pruksachatkun, Nikita Nangia, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019b. SuperGLUE: A multi-task benchmark and analysis platform for natural language understanding. 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 3261-3275. Curran Associates, Inc. +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. Association for Computational Linguistics. +Ralph Weischedel, Martha Palmer, Mitchell Marcus, Eduard Hovy, Sameer Pradhan, Lance Ramshaw, Nianwen Xue, Ann Taylor, Jeff Kaufman, Michelle Franchini, et al. 2013. OntoNotes release 5.0 LDC2013T19. Linguistic Data Consortium, Philadelphia, PA. +Zhiyong Wu, Yun Chen, Ben Kao, and Qun Liu. 2020. Perturbed masking: Parameter-free probing for analyzing and interpreting BERT. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4166-4176. Association for Computational Linguistics. +Kelly Zhang and Samuel Bowman. 2018. Language modeling teaches you more than translation does: Lessons learned through auxiliary syntactic task analysis. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 359-361. Association for Computational Linguistics. +Yuhao Zhang, Victor Zhong, Danqi Chen, Gabor Angeli, and Christopher D. Manning. 2017. Position-aware attention and supervised data improve slot filling. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 35-45. Association for Computational Linguistics. +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 Probe capacity tuning + +Results from hidden size tuning are shown in Figure 4. We use the accuracy of a binary classifier trained only on binary labels, choosing the smallest hidden size with at least $97\%$ of the maximum + +performance over all trials. For comparison, we report the accuracy of a fully supervised multi-class model with the same hidden size. Our method sometimes chooses a hidden size where the accuracy of the fully supervised probe is much lower than max. While this suggests limits on the structure that can be produced, it makes our method independent of fine-grained gold labeling. Future work may investigate the role of probe expressiveness in determining induced ontologies. + +# B More Experimental Results + +Results on larger set of encoders and tasks are shown in Tables 5-11. The extra tasks are undirected Universal Dependencies (Nivre et al., 2015), TAC relation classification (Zhang et al., 2017), and OntoNotes coreference (Pradhan et al., 2007). The extra encoders are BERT-base, multilingual BERT $(\mathrm{mBERT})^8$ and ALBERT (Lan et al., 2020). + +# C More Analysis Results + +We show more comparative nPMI plots for BERT-large and ELMo in Figure 5 and Figure 6. These use co-occurrence counts summed over 5 runs, and exhibit the same overall trends as each run. + +Relation classification nPMI plots for BERT-large and ELMo are shown for TAC relation classification in Figure 7. ELMo produces two diffuse groups of gold labels, while BERT seems to more clearly identify several categories of relations. Some of these may seem intuitive, e.g., org: founded by and per: date_of_birth relate to the creation of an entity, and are grouped together. However, the model distinguishes these from per: origin and per: parents, which may also intuitively seem similar. The broad distribution and highly specific semantics of TAC relations makes direct qualitative assessment difficult. Further analysis, perhaps comparing induced clusters more surface-level features (e.g., dependency paths) may shed more light on these results. + +Lexical baseline results Normalized PMI plots for the lexical baseline on several tasks are shown in Figure 8. In most cases, these show essentially no relation to gold categories. In the few cases where groups seem to emerge, they are coarser and more diffuse than what we observe with probes over contextual representations. + +![](images/ae2e3cd9d0a8ad68c33b52cef656615ffe8cc0698f28075a0d83901d0efcc861.jpg) + +![](images/9adf382cbfc9a6602453b00b79ac1fb55e8e1d3947d705b0a27ded5ae6c0e04c.jpg) + +![](images/109c40ec000e162413735b4ff112d52868995f49657f3e70b1207e0ac46c0cdf.jpg) +Figure 4: Performance on hidden size tuning experiments for different tasks. Clockwise from top-left, they are nonterminals, named entities, semantic roles, and syntactic dependencies. coarse (red) is binary accuracy of a binary classifier, fine-binary (blue) is binary accuracy of a full multiclass classifier, and fine-full (green) is the full multiclass accuracy of the multiclass classifier. The black vertical line is the smallest hidden size that passes the $97\%$ performance threshold for coarse. + +![](images/c2e7b1b7222f31c3afc19f67ae694f2ab1ef6b320d294b44336ed1ef1b929624.jpg) + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.009.711.00
ELMo0.400.660.500.835.071.08
BERT-base0.430.570.490.886.091.11
BERT-large0.470.530.500.867.501.10
mBERT0.250.670.370.843.291.06
ALBERT-large0.380.530.440.896.001.15
BERT-large (lex)0.190.390.260.744.331.13
+ +Table 5: Results by encoder for OntoNotes named entity labeling. + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.007.151.00
ELMo0.360.250.300.5810.161.12
BERT-base0.360.410.380.605.761.06
BERT-large0.350.340.350.617.801.06
mBERT0.360.340.350.597.381.06
ALBERT-large0.380.280.320.599.071.08
BERT-large (lex)0.220.800.340.501.471.26
+ +Table 6: Results by encoder for OntoNotes nonterminal labeling. + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.0022.911.00
ELMo0.230.420.290.6711.111.22
BERT-base0.130.340.190.769.691.23
BERT-large0.140.330.190.7711.221.23
mBERT0.270.510.350.739.401.22
ALBERT-large0.230.410.290.729.841.20
BERT-large (lex)0.060.860.110.501.331.02
+ +Table 7: Results by encoder for Universal Dependency labeling. + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.0022.911.00
ELMo0.190.230.210.7119.121.14
BERT-base0.270.240.250.8522.791.20
BERT-large0.230.230.230.8218.511.17
mBERT0.240.200.210.8320.311.19
ALBERT-large0.300.270.280.8120.531.14
BERT-large (lex)0.090.540.160.503.391.00
+ +Table 8: Results by encoder for undirected Universal Dependency labeling. + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.008.731.00
ELMo0.400.170.240.7622.351.08
BERT-base0.390.180.250.8621.951.15
BERT-large0.370.170.240.8818.701.15
mBERT0.410.210.280.8819.051.12
ALBERT-large0.430.210.280.8719.901.12
BERT-large (lex)0.190.390.260.462.811.01
+ +Table 9: Results by encoder for OntoNotes semantic role labeling. + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.001.001.00
ELMo1.000.090.160.8014.221.18
BERT-base1.000.090.160.8614.671.24
BERT-large1.000.090.170.8715.571.27
mBERT1.000.090.160.8313.861.24
ALBERT-large1.000.090.160.8613.561.26
BERT-large (lex)1.000.780.870.781.601.03
+ +Table 10: Results by encoder for OntoNotes coreference. Note the high diversity scores, showing that the LSL model can find fine-grained structure even in the case of binary labels. + +
PRF1Acc.DiversityUncertainty
Gold1.001.001.001.0024.781.00
ELMo0.110.780.200.772.381.05
BERT-base0.110.900.200.761.941.05
BERT-large0.160.630.250.803.871.11
mBERT0.150.870.260.762.211.05
BERT-large (lex)0.070.970.130.761.111.02
+ +Table 11: Results by encoder for TAC relation classification. Note that the diversity scores are much lower than gold for most encoders. This accords with Tenney et al. (2019b)'s findings that ELMo and BERT have middling performance on the task; it seems unlikely that the highly specific relations in TACRED are salient in their feature spaces. + +![](images/e89971abd288dfaf8087ca84a87da151d131343833793709d7ce0195e597d127.jpg) +(a) Pairwise nPMIs for selected named entity classes in ontologies induced on BERT-large (left) and ELMo (right). + +![](images/670b9fd01d53b197c8c0dbebd8536dc7712536ea7e5f54a06272dd4caac36b6b.jpg) + +![](images/f4edcc5d41b6e3e628dededbb05ca27f0d1f7dcb4278db92cac66b9f63c2dded.jpg) +(b) Pairwise nPMIs for selected nonterminal classes in ontologies induced on BERT-large (left) and ELMo (right). + +![](images/3e04a37b233c5cf78d1c1519abb8ce81b4a868482e493bb75c14c3c1261f4f61.jpg) +Figure 5: Pairwise nPMI charts for named entities and nonterminals. + +![](images/5db263d7bf997fba3830e0aa305f24e59a55705ba60d11771426863a189f58e9.jpg) +(a) Pairwise nPMIs for selected named universal dependency labels in ontologies induced on BERT-large (left) and ELMo (right). + +![](images/5e8480d4b699bf774275dc22da5f4f611f270a8cfc67b571d9a3b39fd2c27e54.jpg) +(b) Pairwise nPMIs for selected semantic roles in ontologies induced on BERT-large (left) and ELMo (right). +Figure 6: Pairwise nPMI charts for syntactic dependencies and semantic roles. + +![](images/1ec739b3c19b56993f2087b232d459e5206896d63da0785c5b2d7c5f3e30abeb.jpg) + +![](images/86cc0b236f2747f49b7d747a68f55f20c903b4df77529b7ccbb2d8dd15cf634c.jpg) +Figure 7: Pairwise nPMIs for TAC relations in ontologies induced on BERT-large (top) and ELMo (bottom). + +![](images/0d63685f954a8ad4dbc703fb5c5547cca66fbdbc43e0673094bbd73b8e1b9df8.jpg) + +![](images/ebd2fbb38165faed13cd4276ae5c02e63cde3ef9826bfa8012e5029f0b9a646a.jpg) + +![](images/9273a21fe58bd8bc678e47a4a93cd88414fb65b4ea562c0668f21a6ec5b9c535.jpg) + +![](images/564c9927b2a2af24d9d0991f7f26a3cba58d52e18e7bc704d7b7c05c6ce961be.jpg) + +![](images/679d4c7aeaf3ca402c1ce28591bd83352fc27710a0524ade2735b68ce05c4244.jpg) +Figure 8: Pairwise nPMI charts for the lexical baseline using non-contextual embeddings from BERT-large. Clockwise from top-left, they are named entities, Universal Dependencies, nonterminals, TAC relations, semantic roles, and undirected Universal Dependencies. In most cases this model seems to have no relation to gold labels, and in the few cases with interesting structure, this structure is weaker and coarser than with contextual embeddings. + +![](images/6cde00e7ee4728d626cf646b0fbc13e2503786de08a42d131b96ef19e14238b0.jpg) \ No newline at end of file diff --git a/askingwithouttellingexploringlatentontologiesincontextualrepresentations/images.zip b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0f3519e44c9bfcbe8fd69c1841af7b70c3c6d6b6 --- /dev/null +++ b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4136a7473319e11a32166f149c132a93e665cf2900bf610f6dbdba1d128374f6 +size 1357808 diff --git a/askingwithouttellingexploringlatentontologiesincontextualrepresentations/layout.json b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..12376206a5f663977b3d80e7a5cd0344b46d1a1d --- /dev/null +++ b/askingwithouttellingexploringlatentontologiesincontextualrepresentations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a4ec4bae89e63bc76e777a05f197cd39864b469bdebe605a4d4cf6fc24d6e2c +size 509052 diff --git a/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_content_list.json b/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e35e24063ab494c89a1c53372f84a039ac2fd58b --- /dev/null +++ b/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8052943b3f806dfaba1f0d2f11f9e921f549330a0d4b4907bb82cb34001ea28e +size 49736 diff --git a/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_model.json b/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_model.json new file mode 100644 index 0000000000000000000000000000000000000000..655e518f41155e9ad60f83603afe2d9df3b33604 --- /dev/null +++ b/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:823a045af136c99bf9c43991abdd9bc6f4fec3950b9af1be8dbdd531f6f4d7b9 +size 62761 diff --git a/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_origin.pdf b/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7fddf41befa79a4486d8d0bc1f745998412b3d54 --- /dev/null +++ b/aspectsentimentclassificationwithaspectspecificopinionspans/b56bd9bf-08fb-4404-804c-9c0886309112_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:679726605f7ee01e61eab3431f0f1fd8d1f23d60ed9ce39a960f009ea3fbed30 +size 868203 diff --git a/aspectsentimentclassificationwithaspectspecificopinionspans/full.md b/aspectsentimentclassificationwithaspectspecificopinionspans/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2de0df89c056f0633d8b765b669739745aad91d8 --- /dev/null +++ b/aspectsentimentclassificationwithaspectspecificopinionspans/full.md @@ -0,0 +1,225 @@ +# Aspect Sentiment Classification with Aspect-Specific Opinion Spans + +Lu Xu\*1,2, Lidong Bing2, Wei Lu1, Fei Huang2 StatNLP Research Group, Singapore University of Technology and Design 2DAMO Academy, Alibaba Group xu_lu@mymail.sutd.edu.sg, luwei@sutd.edu.sg {1.bing, f.huang}@alibaba-inc.com + +# Abstract + +Aspect sentiment classification, predicting the sentiment polarity of given aspects, has drawn extensive attention. Previous attention-based models emphasize using aspect semantics to help extract opinion features for classification. However, these works are either not able to capture opinion spans as a whole or capture variable-length opinion spans. In this paper, we present a neat and effective multiple CRFs based structured attention model that is capable of extracting aspect-specific opinion spans. The sentiment polarity of the target is then classified based on the extracted opinion features and contextual information. The experimental results on four datasets demonstrate the effectiveness of the proposed model, and our further analysis shows that our model can capture aspect-specific opinion spans. + +# 1 Introduction + +Aspect Based Sentiment Analysis (ABSA) (Pang and Lee, 2008; Liu, 2012) is an extensively studied sentiment analysis task on a fine-grained semantic level, i.e., opinion targets explicitly mentioned in sentences. Previous ABSA studies focused on a few sub-tasks, such as Aspect Sentiment Classification (ASC) (Wang et al., 2016; Chen et al., 2017; Ma et al., 2018), Aspect Term Extraction (ATE) (Li et al., 2018b; He et al., 2017), Aspect and Opinion Co-Extraction (Liu et al., 2013; Wang et al., 2017; Xu et al., 2018; Dai and Song, 2019), E2E-ABSA (a joint task of ASC and ATE) (Li et al., 2019a; He et al., 2019; Li et al., 2019b), Aspect Sentiment Triplet Extraction (ASTE) (Peng et al., 2019; Xu et al., 2020), etc. ASC analyzes the sentiment polarity of given aspects/targets in a review. + +For example, consider the review sentence "Food is usually very good, though occasionally I worry about freshness of raw vegetables in side orders." This review mentions two aspects: Food and raw vegetables, and for ASC, the objective is to give a positive sentiment on Food and a negative sentiment on raw vegetables. Most of the previous works (Wang et al., 2016; Chen et al., 2017; Liu and Zhang, 2017; Yang et al., 2017; Li et al., 2018c; He et al., 2018; Li and Lu, 2019; Hu et al., 2019) adopt attention mechanism (Bahdanau et al., 2015) to capture the semantic relatedness among the context words and the aspect, and learn aspect-specific features for sentiment classification. + +However, it is challenging for attention-based approaches to consider an opinion span as a whole during feature extraction because they are over-reliant on neural models to learn the context-structural information and perform feature extraction over individual hidden representations. Previous work (Wang and Lu, 2018) engage structured attention networks (Kim et al., 2017), which extend the previous attention mechanism to incorporate structure dependencies, to model the interaction among context words, and perform softselections of word spans. In particular, they introduce two hand-coded regularizers to constrain the soft-selection process to attend to few short opinion spans. However, such regularizers disturb the structure dependencies, and their method is not capable of emphasizing aspect-specific opinion spans for sentiment classification. + +To better capture opinion features for aspect sentiment classification, we propose the MCRF-SA model, which introduces multiple conditional random fields (CRF) (Lafferty et al., 2001) to structured attention model. While exploiting the advantages of structured attention mechanisms, our model avoids the regularizers by the complementarity among multiple CRFs. We also improve the + +previous position decay function (Li et al., 2018a; Tang et al., 2019) to reduce the importance of context words that are further away from the aspect so as to emphasize aspect-specific opinion spans. Our multi-CRF layer with the effective decay function extracts aspect-specific features from different representation sub-spaces to overcome the previous limitations. The experimental results on the four datasets demonstrate the effectiveness of our model, and the analysis shows that the behaviors are in alignment with our intuition. + +# 2 Model Description + +Given a context sequence $\mathbf{w}^{\mathrm{c}} = \{w_{1},w_{2},\dots ,w_{n}\}$ and a aspect sequence $\mathbf{w}^{\mathrm{a}} = \{w_i,\dots ,w_j\}$ $(1\leq i\leq$ $j\leq n)$ which is a sub-sequence of $\mathbf{w}^{\mathrm{c}}$ , the goal of ASC is to predict sentiment polarity $y\in \{positive$ negative, neutral} over the given aspect. Our model is mainly constructed with a few neural layers, including an input layer, an aspect-specific contextualized representation layer, a position decay layer, a multi-CRF structured attention layer, and a sentiment classification layer. Figure 1 presents the architecture of our MCRF-SA model. + +# 2.1 Input Layer + +The input of our model consists of word embedding $\mathbf{w}_t^{word}$ and aspect indicator embedding $\mathbf{w}_t^{as}$ . The aspect indicator embedding is to differentiate aspect words and context words and is randomly initialized. The input representation $\mathbf{x}_t$ is as follows: + +$$ +\mathbf {x} _ {\mathrm {t}} = \left[ \mathbf {w} _ {t} ^ {w o r d}; \mathbf {w} _ {t} ^ {a s} \right] \qquad (1) +$$ + +# 2.2 Aspect-Specific Contextualized Representation + +We employ a bi-directional GRU (Cho et al., 2014) to generate the contextualized representation. Since the input representation has already contained the aspect information, the aspect-specific contextualized representation is obtained by concatenating the hidden states from both directions: + +$$ +\mathbf {h} _ {\mathrm {t}} = \left[ \overrightarrow {\mathbf {h}} _ {t}; \overleftarrow {\mathbf {h}} _ {t} \right] \tag {2} +$$ + +where $\overrightarrow{\mathbf{h}_t}$ is the hidden state from the forward GRU and $\overleftarrow{\mathbf{h}_t}$ is from the backward. + +# 2.3 Position Decay + +Following the previous work (Li et al., 2018a; Zhang et al., 2019; Tang et al., 2019), we also use a position decay function to reduce the influence of + +![](images/e34d0d7c0544506f25b5ec78b2b807007523192302ef284cacfc60c282f70fa0.jpg) +Figure 1: MCRF-SA Architecture. + +the context words on the aspect as it goes further away from the aspect. We propose a higher-order decay function, which is more sensitive to distance, and the sensitivity can be tuned by $\gamma$ on different datasets. + +$$ +f (t) = \left\{ \begin{array}{l l} \left(\frac {L - i + t}{L}\right) ^ {\gamma} & t < i \\ 1 & i \leq t \leq j \\ \left(\frac {L - t + j}{L}\right) ^ {\gamma} & j < t \end{array} \right. \tag {3} +$$ + +where $i$ and $j$ are the starting and ending position of an aspect, $L$ is the maximum length of sentences across all datasets, $\gamma$ is a hyper-parameter and a larger value enables more influence from the context words that are close to the aspect. Then, the decayed contextual word representation is as follows: + +$$ +\mathbf {r} _ {t} = f (t) \mathbf {h} _ {t} \tag {4} +$$ + +# 2.4 Multi-CRF Structured Attention + +We use multiple linear-chain CRFs to intensively incorporate structure dependencies to capture the corresponding opinion spans of an aspect. In particular, we create a latent label (Wang and Lu, 2018) $z \in \{Yes, No\}$ to indicate whether each context word belongs to part of opinion spans. Similar to (Lample et al., 2016), given the sentence representation $\mathbf{x}$ , the CRF is defined as: + +$$ +P (\mathbf {z} | \mathbf {x}) = \frac {\exp (s c o r e (\mathbf {z} , \mathbf {x}))}{\sum_ {\mathbf {z} ^ {\prime}} \exp (s c o r e (\mathbf {z} ^ {\prime} , \mathbf {x}))} \tag {5} +$$ + +where $score(\mathbf{z}, \mathbf{x})$ is a score function that is defined as the summation of transition scores and emission scores from the Bi-GRU: + +$$ +\operatorname {s c o r e} (\mathbf {z}, \mathbf {x}) = \sum_ {t = 0} ^ {n} T _ {z _ {t}, z _ {t + 1}} + \sum_ {t = 1} ^ {n} E _ {\mathbf {t}, z _ {t}} \tag {6} +$$ + +where $T$ is a transition matrix and $T_{zt,zt + 1}$ denotes the transition score from label $z_{t}$ to $z_{t + 1}$ . $E_{\mathbf{t},z_t}$ denotes the emission score of label $z_{t}$ at the $t$ -th position, and the score is obtained from a linear layer, which takes $\mathbf{r}_t$ as input and returns a vector whose length is label size. + +# 2.4.1 Marginal Inference + +The latent labels introduced in the CRF layer show whether the word influences the given aspect's sentiment. Intuitively, we can understand that the marginal probabilities on the Yes label indicate the influence of the current context word on the aspect word's sentiment. By using the forward-backward algorithm, we calculate the marginal distribution of the latent label. With the marginal distribution, the sentence representation s is obtained: + +$$ +\mathbf {s} = \sum_ {t = 1} ^ {n} P (z _ {t} = Y e s | \mathbf {x}) \mathbf {r} _ {t} \tag {7} +$$ + +The final representation for classification is obtained by concatenating the sentence representations from all CRFs: + +$$ +\mathbf {q} = \left[ \mathbf {s} _ {1}; \mathbf {s} _ {2}; \dots ; \mathbf {s} _ {a} \right] \tag {8} +$$ + +where $a$ is the number of CRFs. + +# 2.5 Sentiment Classification + +The sentence representation $\mathbf{q}$ is passed to a sentiment classifier to obtain the distribution of sentiment polarities: + +$$ +P (\mathbf {y} \mid \mathbf {q}) = \operatorname {S o f t m a x} (W \mathbf {q} + \mathbf {b}) \tag {9} +$$ + +where $W$ and $\mathbf{b}$ are learnable parameters for the sentiment classifier layer. We learn model parameters by minimizing the negative log-likelihood. + +# 3 Experiments + +# 3.1 Experimental Setup + +Our proposed MCRF-SA model is evaluated on four benchmark datasets: SemEval 2014 Task4 (Pontiki et al., 2014), SemEval 2015 Task12 (Pontiki et al., 2015) and SemEval 2016 Task 5 (Pontiki et al., 2016). Following the previous works (Tang et al., 2016; Chen et al., 2017; Wang and Lu, 2018; + +
DatasetTrainDevTest
#Pos.#Neu.#Neg.#Pos.#Neu.#Neg.#Pos.#Neu.#Neg.
14Rest179653966636894139728196196
14Lap82438371716172149340167128
15Rest8082922814754434028195
16Rest11065440619196047429127
+ +Table 1: Statistics of datasets. + +He et al., 2018), we remove a few examples that have conflicting labels. Detailed statistics of the datasets can be found in Table 1. + +We use the 300d GloVe (Pennington et al., 2014) to initialize our word embeddings. One-sixth of instances are randomly selected from the original training dataset as the development dataset, and the model is only trained with the remaining data. With the development set, we tune our model hyperparameters using an open-source black-box tuner (Alberto and Giacomo, 2018). We set the hidden size of GRU to 32 or 64. The batch size is set to 64 or 96. The dropout rate is selected from 0.3 to 0.8, with a step size of 0.1. The dimension of the aspect indicator is selected from $\{50,70,90\}$ . The value of $\gamma$ in the position decay function is selected from $\{1,2,3\}$ . The number of layer of GRU is selected from $\{1,2,3\}$ . We adopt Adam (Kingma and Ba, 2014) to optimize our model with a learning rate of 0.008. All hyper-parameters are selected based on the best performance on the development set. + +# 3.2 Baselines + +Our MCRF-SA model is compared with the following methods2. SVM (Kiritchenko et al., 2014) is a support vector machine based method that integrates surface, lexicon, and parse features. ATAE-LSTM (Wang et al., 2016) is an LSTM (Hochreiter and Schmidhuber, 1997) based model, which has an extra attention to perform soft-selection over the context words. MemNet (Tang et al., 2016) introduces a deep memory network to implement attention mechanisms to learn the relatedness of context words towards the aspect. IAN (Ma et al., 2017) utilizes two LSTM based attention models to learn both context and aspect representations interactively. SA-LSTM-P (Wang and Lu, 2018) employs structured attention networks with multiple regularizers to capture the opinion spans for ASC. TNets (Li et al., 2018a) implements a context-preserving mechanism to get the aspect-specific word representations and uses a Convolutional Neu + +
Models14Rest14Lap15Rest16Rest
Acc.F1Acc.F1Acc.F1Acc.F1
BaselinesSVM (Kiritchenko et al., 2014)80.16‡-70.49‡-----
ATAE-LSTM (Wang et al., 2016)77.20‡-68.70‡-----
MemNet (Tang et al., 2016)79.61*69.64*70.64*65.17*77.31*58.28*85.44*65.99*
IAN (Ma et al., 2017)79.26*70.09*72.05*67.38*78.54*52.65*84.74*55.21*
SA-LSTM-P (Wang and Lu, 2018)81.60‡-75.10‡---88.70‡-
TNet-LF (Li et al., 2018a)80.42*71.03*74.61*70.14*78.47*59.47*89.07*70.43*
TNet-ATT (Tang et al., 2019)81.53‡72.90‡77.62‡73.84‡----
ASCNN (Zhang et al., 2019)81.73*73.10*72.62*66.72*78.48*58.90*87.39*64.56*
ASGCN (Zhang et al., 2019)80.86*72.19*74.14*69.24*79.34*60.78*88.69*66.64*
Reproduce3TNet-ATT (Tang et al., 2019)79.3869.4476.2271.51----
ASGCN (Zhang et al., 2019)79.7370.4872.9168.0678.7457.6787.7170.29
OursMCRF-SA82.86†73.78†77.64†74.23†80.82†61.59†89.51†75.92†
+ +Table 2: Experimental results (\%). The results with symbol " $\square$ " are retrieved from the original papers, and those with * are retrieved from Zhang et al. (2019). The marker $\dagger$ refers to $p$ -value $< 0.01$ when comparing with ASGCN. + +ral Network (CNN) (Lecun et al., 1998) layer to obtain the sentence representation. TNet-ATT (Tang et al., 2019) is an extension of TNet-LF, and it provides an attention supervision mining mechanism to improve the previous model. ASCNN and ASGCN (Zhang et al., 2019) use CNN and Graph Convolutional Network (GCN) (Kipf and Welling, 2017) to capture the long-range dependencies and syntactic information. + +# 3.3 Experimental Results + +Our proposed model shows significant improvements on the four datasets, Table 2 shows the performance comparisons. Our method outperforms SVM (Kritchenko et al., 2014) by 2.7 and 7.15 Acc. score on 14Rest and 14Lap, respectively. This indicates that our neural approach extracts more effective features than hard-coded feature engineering. Compared to the attention-based methods - ATAE (Wang et al., 2016), MemNet (Tang et al., 2016), IAN (Ma et al., 2017), and TNet-ATT (Tang et al., 2019), our MCRF-SA model pays more attention to the aspect-specific opinion spans, which bring significant performance improvement on the four datasets. + +We also compare our model with methods that focus on word segmentations for sentiment classification. Our method outperforms the previous regularizers guided structured attention model SA-LSTM-P (Wang and Lu, 2018) by more than 1.2 Acc. score on 14Rest and 14Lap. TNet-LF (Li et al., 2018a) and ASCNN (Zhang et al., 2019) em + +ploy CNN to evaluate word spans regarding how much it contributed to the sentiment, but the kernel size limits the length of the span. ASGCN (Zhang et al., 2019) employs GCN over the dependency tree to capture syntactic and dependency information. However, the performance heavily relies on the accuracy of the dependency trees. Our proposed multi-CRF structured attention along with the position decay function allows MCRF-SA to perform soft-selection of multiple aspect-specific opinion spans that influence the aspect's sentiment. The large performance gaps between our model and baseline models confirm the effectiveness of our proposed architecture. Such results also demonstrate that sentiment classification can benefit greatly from aspect-specific opinion spans. + +Furthermore, we observe that the performance on 15Rest is not as good as the other three datasets. Such behavior is caused by the different distribution of positive, neutral, and negative sentiment between training and test set, shown in Table 1. + +# 4 Analysis + +# 4.1 Effect of Number of CRFs + +To fully investigate the effect of the number of CRFs, we conduct additional experiments on 14Rest and 14Lap with the number of CRFs $\in$ $\{1,2,3,\dots,16\}$ . Figure 2 shows the experimental results. The model achieves the best performance when the number of CRFs equals to 4. Particularly, the performance becomes relatively plateau when a large number of CRFs is adopted. We believe this is because the sizes of the four benchmark datasets are relatively small, and an excessively large number of parameters may not be able to further extract + +![](images/781276dd5e68b5b53d663a7df61f355cf73b323668143622b8161b6295a00991.jpg) +Figure 2: Effect of number of CRFs. + +![](images/79c21e91cad8d79c69aeadaf9676793908022c488da01096fdec90c8f777fc46.jpg) +Figure 3: Marginal distributions of "Yes" label. + +effective features. + +# 4.2 Case Study and Error Analysis + +Figure 3 shows the marginal distributions (Equation 5) of SA-LSTM-P (Wang and Lu, 2018) and our MCRF-SA model. The aspect for the given example is "Indian food" with negative sentiment, and only our model predicts correct sentiment. From Figure 3b heat map, the different marginal distributions on the four CRFs indicate that our model indeed captures different opinion features. It can be observed that MCRF-SA is able to attend to the two major opinion spans: "real" and "n't". The SA-LSTM-P model returns positive sentiment as it focuses too much on wrong opinion words. + +We also analyze some common errors from our MCRF-SA model, ASGCN, and TNet-ATT on the Lap14 dataset. We observe two major types of errors, and Table 3 shows the examples for error analysis. The first two sentences belong to the type 1 error and the last one presents a type 2 error. The first type of errors appear frequently in neutral cases. In general, the neural models cannot well differentiate if the negative expressions (e.g. "cost", "shouldn't", etc.) is associated with the target/aspect. The second type typically involves complicated sentence structures with non-trivial semantics, which requires advanced language understanding capability. + +
Case StudyMCRF-SAASGCNTNet-ATT
1. When considering a Mac, look at the total cost of ownership and not just the initial price tag \( _{\text{NEU}} \) .NEU\( NEG_{\times} \)\( NEG_{\times} \)
2. It shouldn't happen like that, I don't have any design app \( _{\text{NEU}} \) open or anything .\( NEG_{\times} \)NEUNEU
3. The smaller size \( _{\text{POS}} \) was a bonus because of space restrictions.\( NEG_{\times} \)\( NEG_{\times} \)\( NEG_{\times} \)
+ +Table 3: The words highlighted in blue denote the given aspects, and gold sentiment labels are marked as subscripts. $\times$ indicates incorrect prediction. + +
Models14Rest14Lap
Acc.F1Acc.F1
MCRF-SA82.8673.7877.6474.23
- aspect indicator79.0266.9672.7667.56
- decay function81.5270.9476.6973.12
- structured attention80.0068.8969.6163.74
+ +Table 4: Ablation Study. + +# 4.3 Ablation Study + +We examine the effectiveness of the major components of our MCRF-SA model, and Table 3 presents the ablation results on 14Rest and 14Lap datasets. Without the aspect indicator, our model becomes a sentence-level sentiment classification method which inevitably produces wrong predictions for sentences having multiple aspects with different sentiments. Removing the position decay function hurts the performance by 2.84 and $1.11 F_{1}$ score on 14Rest and 14Lap, respectively. Lastly, without multi-CRF structured attention layer, the architecture becomes a simple Bi-GRU based model and the performance drops significantly by 4.89 and $10.49 F_{1}$ points on 14Rest and 14Lap. + +# 5 Conclusion + +We propose a simple and effective MCRF-SA model to extract aspect-specific opinion span features. In particular, with the proposed multi-CRF structured attention layer and the effective position decay function, our model is capable of extracting various aspect-specific opinion span features from different representation sub-spaces. The experimental results demonstrate that our method effectively exploits the corresponding opinion features for sentiment classification. One future direction is to investigate how to integrate the two different attention mechanisms, namely the standard attention and structured attention for NLP applications. + +# Acknowledgements + +We would like to thank the anonymous reviewers for their helpful comments. This research is partially supported by Ministry of Education, Singapore, under its Academic Research Fund (AcRF) Tier 2 Programme (MOE AcRF Tier 2 Award No: MOE2017-T2-1-156). Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not reflect the views of the Ministry of Education, Singapore. + +# References + +Costa Alberto and Nannicini Giacomo. 2018. Rbfopt: an open-source library for black-box optimization with costly function evaluations. Mathematical Programming Computation. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2015. Neural machine translation by jointly learning to align and translate. In Proceedings of ICLR. +Peng Chen, Zhongqian Sun, Lidong Bing, and Wei Yang. 2017. Recurrent attention network on memory for aspect sentiment analysis. In Proceedings of EMNLP. +Kyunghyun Cho, Bart van Merrienboer, Dzmitry Bah-danau, and Yoshua Bengio. 2014. On the properties of neural machine translation: Encoder-decoder approaches. In Proceedings of SSST. +Hongliang Dai and Yangqiu Song. 2019. Neural aspect and opinion term extraction with mined rules as weak supervision. In Proceedings of ACL. +Ruidan He, Wee Sun Lee, Hwee Tou Ng, and Daniel Dahlmeier. 2017. An unsupervised neural attention model for aspect extraction. In Proceedings of ACL. +Ruidan He, Wee Sun Lee, Hwee Tou Ng, and Daniel Dahlmeier. 2018. Effective attention modeling for aspect-level sentiment classification. In Proceedings of COLING. +Ruidan He, Wee Sun Lee, Hwee Tou Ng, and Daniel Dahlmeier. 2019. An interactive multi-task learning network for end-to-end aspect-based sentiment analysis. In Proceedings of ACL. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural Computation. +Mengting Hu, Shiwan Zhao, H. Guo, Renhong Cheng, and Z. Su. 2019. Learning to detect opinion snippet for aspect-based sentiment analysis. In Proceedings of CoNLL. +Yoon Kim, Carl Denton, Luong Hoang, and Alexander M. Rush. 2017. Structured attention networks. In Proceedings of ICLR. + +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. In Proc. of ICLR. +Thomas N Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In Proceedings of ICLR. +Svetlana Kiritchenko, Xiaodan Zhu, Colin Cherry, and Saif Mohammad. 2014. Nrc-canada-2014: Detecting aspects and sentiment in customer reviews. In Proceedings of SemEval. +John D. Lafferty, Andrew McCallum, and Fernando C. N. Pereira. 2001. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In Proceedings of ICML. +Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. 2016. Neural architectures for named entity recognition. In Proceedings of NAACL. +Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. 1998. Gradient-based learning applied to document recognition. Proceedings of the IEEE. +Hao Li and Wei Lu. 2019. Learning explicit and implicit structures for targeted sentiment analysis. In Proceedings of EMNLP. +Xin Li, Lidong Bing, Wai Lam, and Bei Shi. 2018a. Transformation networks for target-oriented sentiment classification. In Proceedings of ACL. +Xin Li, Lidong Bing, Piji Li, and Wai Lam. 2019a. A unified model for opinion target extraction and target sentiment prediction. In Proceedings of AAAI. +Xin Li, Lidong Bing, Piji Li, Wai Lam, and Zhimou Yang. 2018b. Aspect term extraction with history attention and selective transformation. In Proceedings of IJCAI. +Zheng Li, Xin Li, Ying Wei, Lidong Bing, Yu Zhang, and Qiang Yang. 2019b. Transferable end-to-end aspect-based sentiment analysis with selective adversarial learning. In Proceedings of EMNLP. +Zheng Li, Ying Wei, Yu Zhang, Xiang Zhang, Xin Li, and Qiang Yang. 2018c. Exploiting coarse-to-fine task transfer for aspect-level sentiment classification. In Proceedings of AAAI. +Bing Liu. 2012. Sentiment analysis and opinion mining. Synthesis Lectures on Human Language Technologies, 5(1):1-167. +Jiangming Liu and Yue Zhang. 2017. Attention modeling for targeted sentiment. In Proceedings of EACL. +Kang Liu, Liheng Xu, and Jun Zhao. 2013. Syntactic patterns versus word alignment: Extracting opinion targets from online reviews. In Proceedings of ACL. + +Dehong Ma, Sujian Li, Xiaodong Zhang, and Houfeng Wang. 2017. Interactive attention networks for aspect-level sentiment classification. In Proceedings of IJCAI. +Yukun Ma, Haiyun Peng, and Erik Cambria. 2018. Targeted aspect-based sentiment analysis via embedding commonsense knowledge into an attentive LSTM. In Proceedings of AAAI. +Bo Pang and Lillian Lee. 2008. Opinion mining and sentiment analysis. Found. Trends Inf. Retr. +Haiyun Peng, Lu Xu, Lidong Bing, Fei Huang, Wei Lu, and Luo Si. 2019. Knowing what, how and why: A near complete solution for aspect-based sentiment analysis. In Proceedings of AAAI. +Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. Glove: Global vectors for word representation. In Proceedings of EMNLP, pages 1532-1543. +Maria Pontiki, Dimitris Galanis, Haris Papageorgiou, Ion Androutsopoulos, Suresh Manandhar, Mohammad AL-Smadi, Mahmoud Al-Ayyoub, Yanyan Zhao, Bing Qin, Orphée De Clercq, Véronique Hoste, Marianna Apidianaki, Xavier Tannier, Natalia Loukachevitch, Evgeniy Kotelnikov, Nuria Bel, Salud María Jiménez-Zafra, and Gülşen Eryigit. 2016. SemEval-2016 task 5: Aspect based sentiment analysis. In Proceedings of SemEval. +Maria Pontiki, Dimitris Galanis, Haris Papageorgiou, Suresh Manandhar, and Ion Androutsopoulos. 2015. SemEval-2015 task 12: Aspect based sentiment analysis. In Proceedings of SemEval. +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 SemEval. +Duyu Tang, Bing Qin, and Ting Liu. 2016. Aspect level sentiment classification with deep memory network. In Proceedings of EMNLP. +Jialong Tang, Ziyao Lu, Jinsong Su, Yubin Ge, Linfeng Song, Le Sun, and Jiebo Luo. 2019. Progressive self-supervised attention learning for aspect-level sentiment analysis. In Proceedings of ACL. +Bailin Wang and Wei Lu. 2018. Learning latent opinions for aspect-level sentiment classification. In Proceedings of AAAI. +Wenya Wang, Sinno Jialin Pan, Daniel Dahlmeier, and Xiaokui Xiao. 2017. Coupled multi-layer attentions for co-extraction of aspect and opinion terms. In Proceedings of AAAI. +Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. 2016. Attention-based LSTM for aspect-level sentiment classification. In Proceedings of EMNLP. + +Hu Xu, Bing Liu, Lei Shu, and Philip S. Yu. 2018. Double embeddings and cnn-based sequence labeling for aspect extraction. In Proceedings of ACL. +Lu Xu, Hao Li, Wei Lu, and Lidong Bing. 2020. Position-aware tagging for aspect sentiment triplet extraction. In Proceedings of EMNLP. +Min Yang, Wenting Tu, Jingxuan Wang, Fei Xu, and Xiaojun Chen. 2017. Attention based lstm for target dependent sentiment classification. In Proceedings of AAAI. +Chen Zhang, Qiuchi Li, and Dawei Song. 2019. Aspect-based sentiment classification with aspect-specific graph convolutional networks. In Proceedings of EMNLP. \ No newline at end of file diff --git a/aspectsentimentclassificationwithaspectspecificopinionspans/images.zip b/aspectsentimentclassificationwithaspectspecificopinionspans/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9c4cfbd8697cfded4cfa70177d4965c21f1e3911 --- /dev/null +++ b/aspectsentimentclassificationwithaspectspecificopinionspans/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:374c9226a39df7b9cf6620a205001e93ab76854ac0e134d4a64b753945b2ce73 +size 309806 diff --git a/aspectsentimentclassificationwithaspectspecificopinionspans/layout.json b/aspectsentimentclassificationwithaspectspecificopinionspans/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..a9d47d74693cf3b240139410f3bb65a419f8dfad --- /dev/null +++ b/aspectsentimentclassificationwithaspectspecificopinionspans/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:410995485c94388f0cefc3da99a4fca9aa467accaf630cd3b42a518d6bd02fab +size 243332 diff --git a/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_content_list.json b/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b06e618bde4c66fc8c8521cae4066fb11471a9f6 --- /dev/null +++ b/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7714c239c07d4efef7b52f4f106210c5076a4979185d5899253f8a85ce3a551 +size 79753 diff --git a/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_model.json b/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_model.json new file mode 100644 index 0000000000000000000000000000000000000000..53a6f1060261cf431be801a54f339281f7e15c25 --- /dev/null +++ b/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d9879138522bb0d1714a0d61e7c872e5a7457a4990f3b93a0bdd33744eedf47 +size 98775 diff --git a/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_origin.pdf b/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b968048f402e560a03b4512edcac54df8f4d3ace --- /dev/null +++ b/assessingphrasalrepresentationandcompositionintransformers/b96859f1-95a0-4c04-a17c-b6b24b28d0ec_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d382d7514f770aeda5854c6783b07e85a3e7255a1c73ba3fd72e1beca74a47e1 +size 1257826 diff --git a/assessingphrasalrepresentationandcompositionintransformers/full.md b/assessingphrasalrepresentationandcompositionintransformers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..41c4b7b0ead2fac2845f0778b8a0d583ac471c34 --- /dev/null +++ b/assessingphrasalrepresentationandcompositionintransformers/full.md @@ -0,0 +1,318 @@ +# Assessing Phrasal Representation and Composition in Transformers + +Lang Yu + +Department of Computer Science + +University of Chicago + +langyu@uchicago.edu + +Allyson Ettinger + +Department of Linguistics + +University of Chicago + +aettinger@uchicago.edu + +# Abstract + +Deep transformer models have pushed performance on NLP tasks to new limits, suggesting sophisticated treatment of complex linguistic inputs, such as phrases. However, we have limited understanding of how these models handle representation of phrases, and whether this reflects sophisticated composition of phrase meaning like that done by humans. In this paper, we present systematic analysis of phrasal representations in state-of-the-art pre-trained transformers. We use tests leveraging human judgments of phrase similarity and meaning shift, and compare results before and after control of word overlap, to tease apart lexical effects versus composition effects. We find that phrase representation in these models relies heavily on word content, with little evidence of nuanced composition. We also identify variations in phrase representation quality across models, layers, and representation types, and make corresponding recommendations for usage of representations from these models. + +# 1 Introduction + +A fundamental component of language understanding is the capacity to combine meaning units into larger units—a phenomenon known as composition—and to do so in a way that reflects the nuances of meaning as understood by humans. Transformers (Vaswani et al., 2017) have shown impressive performance in NLP, particularly transformers using pre-training, like BERT (Devlin et al., 2019) and GPT (Radford et al., 2018, 2019), suggesting that these models may be succeeding at composition of complex meanings. However, because transformers (like other contextual embedding models) typically maintain representations for every token, it is unclear how and at what points they might be combining word meanings into phrase meanings. This contrasts with models that incorporate explicit phrasal composition into their architecture, + +e.g. RNNG (Dyer et al., 2016; Kim et al., 2019), recursive models for semantic composition (Socher et al., 2013), or transformers with attention-based composition modules (Yin et al., 2020). + +In this paper we take steps to clarify the nature of phrasal representation in transformers. We focus on representation of two-word phrases, and we prioritize identifying and teasing apart two important but distinct notions: how faithfully the models are representing information about the words that make up the phrase, and how faithfully the models are representing the nuances of the composed phrase meaning itself, over and above a simple account of the component words. To do this, we begin with existing methods for testing how well representations align with human judgments of meaning similarity: similarity correlations and paraphrase classification. We then introduce controlled variants of these datasets, removing cues of word overlap, in order to distinguish effects of word content from effects of more sophisticated composition. We complement these phrase similarity analyses with classic sense selection tests of phrasal composition (Kintsch, 2001). + +We apply these tests for systematic analysis of several state-of-the-art transformers: BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019b), DistilBERT (Sanh et al., 2019), XLNet (Yang et al., 2019b) and XLM-RoBERTa (Conneau et al., 2019). We run the tests in layerwise fashion, to establish the evolution of phrase information as layers progress, and we test various tokens and token combinations as phrase representations. We find that when word overlap is not controlled, models show strong correspondence with human judgments, with noteworthy patterns of variation across models, layers, and representation types. However, we find that correspondence drops substantially once word overlap is controlled, suggesting that although these transformers contain faithful repre + +sentations of the lexical content of phrases, there is little evidence that these representations capture sophisticated details of meaning composition beyond word content. Based on the observed representation patterns, we make recommendations for selection of representations from these models. All code and controlled datasets are made available for replication and application to additional models. $^{1}$ + +# 2 Related work + +This paper contributes to a growing body of work on analysis of neural network models. Much work has studied recurrent neural network language models (Linzen et al., 2016; Wilcox et al., 2018; Chowdhury and Zamparelli, 2018; Gulordava et al., 2018; Futrell et al., 2019) and sentence encoders (Adi et al., 2016; Conneau et al., 2018; Ettinger et al., 2016). Our work builds in particular on analysis of information encoded in contextualized token representations (Bacon and Regier, 2019; Tenney et al., 2019b; Peters et al., 2018; Hewitt and Manning, 2019; Klafka and Ettinger, 2020) and in different layers of transformers (Tenney et al., 2019a; Jawahar et al., 2019). The BERT model has been a particular focus of analysis work since its introduction. Previous work has focused on analyzing the attention mechanism (Vig and Belinkov, 2019; Clark et al., 2019), parameters (Roberts et al., 2020; Radford et al., 2019; Raffel et al., 2020) and embeddings (Shwartz and Dagan, 2019; Liu et al., 2019a). We build on this work with a particular, controlled focus on the evolution of phrasal representation in a variety of state-of-the-art transformers. + +Composition has been a topic of frequent interest when examining neural networks and their representations. One common practice relies on analysis of internal representations via downstream tasks (Baan et al., 2019; Ettinger et al., 2018; Conneau et al., 2019; Nandakumar et al., 2019; McCoy et al., 2019). One line of work analyzes word interactions in neural networks' internal gates as the composition signal (Saphra and Lopez, 2020; Murdoch et al., 2018), extending the Contextual Decomposition algorithm proposed by Jumelet et al. (2019). Another notable branch of work constructs synthetic datasets of small size to investigate compositionality in neural networks (Liška et al., 2018; Hupkes et al., 2018; Baan et al., 2019). Some work + +controls for word content, as we do, to study composition at the sentence level (Ettinger et al., 2018; Dasgupta et al., 2018). We complement this work with a targeted and systematic study of phrase-level representations in transformers, with a focus on teasing apart lexical properties versus reflections of accurate compositional phrase meaning. + +Our work relates closely to classic work on two-word phrases, which have used methods like landmark tests (Kintsch, 2001; Mitchell and Lapata, 2008, 2010), or compared against distribution-based phrase representations (Baroni and Zamparelli, 2010; Fyshe et al., 2015). Our work also draws on work using correlation with similarity judgments (Finkelstein et al., 2001; Gerz et al., 2016; Hill et al., 2015; Conneau and Kiela, 2018) and paraphrase classification (Ganitkevitch et al., 2013; Wang et al., 2018; Zhang et al., 2019; Yang et al., 2019a) to assess quality of models and representations. We build on this work by combining these methods together, applying them to a systematic analysis of transformers and their components, and introducing controlled variants of existing tasks to isolate accurate composition of phrase meaning from capturing of lexical information. + +# 3 Testing phrase meaning similarity + +Our methods begin with familiar approaches for assessing representations via meaning similarity: correlation with human phrase similarity judgments, and ability to identify paraphrases. The goal is to gauge the extent to which models arrive at representations reflecting the nuances of composed phrase meaning understood by humans. We draw on existing datasets, and begin by testing models on the original versions of these datasets—then we tease apart effects of word content from effects of more sophisticated meaning composition by introducing controlled variants of the datasets. The reasoning is that strong correlations with human similarity judgments, or strong paraphrase classification performance, could be influenced by artifacts that are not reflective of accurate phrase meaning composition per se. In particular, we may see strong performance simply on the basis of the amount of overlap in word content between phrases. To address this possibility, we create controlled datasets in which word overlap is no longer a cue to similarity. + +As a starting point we focus on two-word phrases, as these are the smallest phrasal unit and the most conducive to these types of lexical con + +
Normal Examples
Source PhraseTarget Phrase & Score
average personordinary citizen (0.724)
person average (0.518)
country (0.255)
AB-BA Examples
Source PhraseTarget Phrase & Score
law schoolschool law (0.382)
adult femalefemale adult (0.812)
arms controlcontrol arms (0.473)
+ +Table 1: Examples of correlation items. Numbers in parentheses are similarity scores between target phrase and source phrase. Upper half shows normal examples, and lower half shows controlled items. + +trols, and because this allows us to leverage larger amounts of annotated phrase similarity data. + +# 3.1 Phrase similarity correlation + +We first evaluate phrase representations by assessing their alignment with human judgments of phrase meaning similarity. For testing this correspondence, we use the BiRD (Asaadi et al., 2019) dataset. BiRD is a bigram relatedness dataset designed to evaluate composition, consisting of 3,345 bigram pairs (examples in Table 1), with source phrases paired with numerous target phrases, and human-rated similarity scores ranging from 0 to 1. + +In addition to testing on the full dataset, we design a controlled experiment to remove effects of word overlap, by filtering the dataset to pairs in which the two phrases consist of the same words. We refer to these pairs as "AB-BA" pairs (following terminology of the authors of the BiRD dataset), and show examples in the lower half of Table 1. + +We run similarity tests as follows: given a model $M$ with layers $L$ , for $i$ th layer $l_i \in L$ and a source-target phrase pair, we compute representations of source phrase $p_{rep}^i(\mathrm{src})$ and target phrase $p_{rep}^i(\mathrm{trg})$ , where $rep$ is a representation type from Section 4, and we compute their cosine $\cos(p_{rep}^i(\mathrm{src}), p_{rep}^i(\mathrm{trg}))$ . Pearson correlation $\boldsymbol{r}_i$ of layer $l_i$ is then computed between cosine and human-rated score for all source-target pairs. + +# 3.2 Paraphrase classification + +We further investigate the nature of phrase representations by testing their capacity to support binary paraphrase classification. This test allows us to explore whether we will see better alignment with human judgments of meaning similarity if we use + +more complicated operations than cosine similarity comparison. For the classification tasks, we draw on PPDB 2.0 (Pavlick et al., 2015), a widely-used database consisting of paraphrases with scores generated by a regression model. To formulate our binary classification task, after filtering out low-quality paraphrases (discussed in Section 5), we use phrase pairs (source phrase, target phrase) from PPDB as positive pairs, and randomly sample phrases from the complete PPDB dataset to form negative pairs (source phrase, random phrase). + +Because word overlap is also a likely cue for paraphrase classification, we filter to a controlled version of this dataset as well, as illustrated in Table 2. We formulate the controlled experiment here as holding word overlap between source phrase and target phrase to be exactly $50\%$ for both positive and negative samples. Our choice of $50\%$ word overlap in this case is necessary for construction of a sufficiently large, balanced classification dataset (AB-BA pairs in PPDB are too few to support classifier training, and AB-BA pairs are more likely to be non-paraphrases). Note, however, that by controlling word overlap to be exactly $50\%$ for all phrase pairs, we still hold constant the amount of word overlap between phrases, which is the cue that we wish to remove. As an additional control, each source phrase is paired with an equal number of paraphrases and non-paraphrases, to avoid the classifier inferring labels based on phrase identity. + +Formally, for each model layer $l_{i}$ and representation type rep, we train + +$$ +\mathrm {C L F} _ {r e p} ^ {i} = \mathrm {M L P} ([ \text {p a i r} _ {r e p} ^ {i} ]) +$$ + +where $pair_{rep}^{i}$ represents embedding concatenations of each source phrase and target phrase: + +$$ +p a i r _ {r e p} ^ {i} = [ p _ {r e p} ^ {i} (s r c); p _ {r e p} ^ {i} (t r g) ] +$$ + +The classifier is trained on binary classification of whether concatenated inputs represent paraphrases. + +# 4 Representation types + +A variety of approaches have been taken for representing sentences and phrases when all tokens output contextualized representations, as in our tested transformers. To clarify the phrasal information present in different forms of phrase representation, we experiment with a number of different combinations of token embeddings as representation types. + +Formally, let $[T_0,\dots ,T_k]$ be an input sequence of length $k + 1$ , with corresponding embeddings + +
Normal Examples
Source PhraseTarget Phrase
are crucialis absolutely vital (pos)
was a matter of concern (neg)
is an essential part (pos)
are exacerbating (neg)
Controlled Examples
Source PhraseTarget Phrase
communication infrastructuretelecommunications infrastructure (pos)
data infrastructure (neg)
+ +Table 2: Examples of classification items. Classification labels between target phrase and source phrase are in parentheses. Upper half shows normal examples, and lower half shows controlled items. + +![](images/b058e8c7a67847fef07a96895386e7f85ef2a1203ae9ebc72d7bab81734b05f7.jpg) +Figure 1: Example input sequences (BERT format). CLS is a special token at beginning of sequence. Tokens in yellow correspond to Head-Word. Avg-Phrase contains element-wise average of phrase word embeddings. Avg-All averages embeddings of all tokens. + +at $i$ th layer $[e_0^i,\dots ,e_k^i ]$ . Assume the phrase spans the sequence $[a,b]$ , where $0\leq a\leq b\leq k$ . Because two-word phrases are atypical inputs for these models, we experiment both with inputs of the two-word phrases alone ("phrase-only"), as well as inputs with the phrases embedded in sentences ("context-available"). This is illustrated in Figure 1 along with phrase representation types. + +We test the following forms of phrase representation, drawn from each model and layer separately: + +CLS Depending on specific models, this special token can be the first or last token of the input sequence (i.e. $e_0^i$ or $e_k^i$ ). In many applications, this token is used to represent the full input sequence. + +Head-Word In each phrase, the head word is the semantic center the phrase. For instance, in the phrase "public service", "service" is the head word, expressing the central meaning of the phrase, while "public" is a modifier. Because phrase heads are not annotated in our datasets, we approximate the head by taking the embedding of the final word of the phrase. This representation is proposed as + +a potential representation of the whole phrase, if information is being composed into a central word: + +$$ +p _ {h w} ^ {i} = e _ {b} ^ {i} +$$ + +Avg-Phrase For this representation type we average the embeddings of the tokens in the target phrase (dashed box in Figure 1). This type of averaging of token embeddings is a common means of aggregate representation (Wieting et al., 2015). + +$$ +p _ {a p} ^ {i} = \frac {1}{b - a + 1} \sum_ {x = a} ^ {b} e _ {x} ^ {i} +$$ + +Avg-All Expanding beyond the tokens in "Avg-Phrase", this representation averages embeddings from the full input sequence. + +$$ +p _ {a a} ^ {i} = \frac {1}{k + 1} \sum_ {x = 0} ^ {k} e _ {x} ^ {i} +$$ + +SEP With some variation between models, the SEP token is typically a separator for distinguishing input sentences, and is often the last token $(e_{k}^{i})$ or second to last token $(e_{k - 1}^{i})$ of a sequence. + +# 5 Experimental setup + +Embeddings of each token are obtained by feeding input sequences through pre-trained contextual encoders. We investigate the "base" version of five transformers: BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019b), DistilBERT (Sanh et al., 2019), XLNet (Yang et al., 2019b) and XLM-RoBERTa (Conneau et al., 2019). For the models analyzed in this paper, we are using the implementation of Wolf et al. (2019), which is based on PyTorch (Paszke et al., 2019). + +![](images/7b5e14f66bc1cd42ad088ea76c72848ec1531e9da30410a1f252c3f7bdfe6e01.jpg) + +![](images/f8724078e3979c7b09ca2dd336e0a8a7c782c2f3f4a24748ae585b0674210f96.jpg) + +![](images/289b3564d89118bbb28964f8c68d5f64224d69c3760f36eaa475b987259c6fb9.jpg) + +![](images/b2f7bf721c525fc170935115e1ad5d6c5addfc516e776566d90f38d61d27d661.jpg) + +![](images/39f6e47b0b1e234faf0a5d2f08f8e8ac5dc293c19c7480bca0321e1cfdce0b9d.jpg) + +![](images/6022916a2845cfeebc215006e2b75e3c94dd0fd854ec6cb41eafab8b04f0bf3a.jpg) +Figure 2: Correlation on BiRD dataset, phrase-only input setting. First row shows results on full dataset, and second row on controlled AB-BA pairs. Layer 0 corresponds to input embeddings passing to the model. + +![](images/c2808fcd4168cdfd6e359b951100ad7f77c830ee15e95e474e147728b010c8e4.jpg) +CLS Head Word SEP Avg Phrase Avg All + +![](images/b2bbab747e582eaa894bb2df3909763b2b8885e44ffd542b399b31ab4f207b3a.jpg) + +![](images/2c20461c3fa9dc0ab23d916b15a8ddc106d8a5f48046caaa4f72551e25c8d84a.jpg) + +![](images/b8964b7aa29c58cb067acd0cf7ae8817c9e0996b9c43d7d1eb6354a11c3fe111.jpg) + +For correlation analysis, we first use the complete BiRD dataset, consisting of 3,345 phrase pairs. We then test with our controlled subset of the data, consisting of 410 AB-BA pairs. For classification tasks, we first do preprocessing on PPDB 2.0, filtering out pairs containing hyperlinks, non-alphabetical symbols, and trivial paraphrases based on abbreviation or tense change. For our initial classification test, we use 13,050 source-target phrase pairs (of varying word overlap) from this preprocessed dataset. We then test with our controlled dataset, consisting of 11,770 source-target phrase pairs (each with precisely $50\%$ word overlap). For each paraphrase classification task, $25\%$ of selected data is reserved for testing. We use a multi-layer perceptron classifier with a single hidden layer of size 256 with ReLU activation, and a softmax layer to generate binary labels. We use a relatively simple classifier following the reasoning of Adi et al. (2016), that this allows examination of how easily extractable information is in these representations. + +For both correlation and classification tasks, we experiment with phrase-only inputs and context-available (full-sentence) inputs. To obtain sentence contexts, we search for instances of source phrases in a Wikipedia dump, and extract sentences containing them. For a given phrase pair, target phrases are embedded in the same sentence context as the source phrase, to avoid effects of varying sentence position between phrases of a given pair. + +# 6 Results + +# 6.1 Similarity correlation + +Full dataset The top row of Figure 2 shows correlation results on the full BiRD dataset for all models, layers, and representation types, with phrase-only inputs. Among representation types, Avg-Phrase and Avg-All consistently achieve the highest correlations across models and layers. In all models but DistilBERT, correlation of Avg-Phrase and Avg-All peaks at layer 1 and decreases in subsequent layers with minor fluctuations. Head-Word and SEP both show weaker, but non-trivial, correlations. The CLS token is of note with a consistent rapid rise as layers progress, suggesting that it quickly takes on properties of the words of the phrase. For all models but DistilBERT, CLS token correlations peak in middle layers and then decline. + +Model-wise, XLM-RoBERTa shows the weakest overall correlations, potentially due to the fact that it is trained to infer input language and to handle multiple languages. BERT retains fairly consistent correlations across layers, while RoBERTa and XLNet show rapid declines as layers progress, suggesting that these models increasingly incorporate information that deviates from human intuitions about phrase similarity. DistilBERT, despite being of smaller size, demonstrates competitive correlation. The CLS token in DistilBERT is notable for its continuing rise in correlation strength across + +![](images/16fdd404f4ad345b79a0f4e93558e855bb55f3a272486e13dbf37d96dd75edc3.jpg) +Figure 3: Correlation on BiRD dataset with phrases embedded in sentence context (context-available input setting). + +layers. This suggests that DistilBERT in particular makes use of the CLS token to encode phrase information, and unlike other models, its representations retain the relevant properties to the final layer. + +Controlled dataset Turning to our controlled AB-BA dataset, we examine the extent to which the above correlations indicate sophisticated phrasal composition versus effective encoding of information about phrases' component words. The bottom row of Figure 2 shows the correlations on this controlled subset. We see that performance of all models drops significantly, often with roughly zero correlation. Avg-All and Avg-Phrase no longer dominate the correlations, suggesting that these representations capture word information, but not higher-level compositional information. XLM-RoBERTa and XLNet show particularly low correlations, suggesting heavier reliance on word content. Notably, the CLS tokens in RoBERTa and DistilBERT stand out with comparatively strong correlations in later layers. This suggests that the rise that we see in CLS correlations for DistilBERT in particular may correspond to some real compositional signal in this token, and for this model the CLS token may in fact correspond to something more like a representation of the meaning of the full input sequence. The Avg-Phrase representation for RoBERTa also makes a comparatively strong showing. + +Including sentence context Figure 3 shows the correlations when target phrases are embedded as part of a sentence context, rather than in isolation. As can be expected, Avg-Phrase is now consistently the highest in correlation on the full dataset—other tokens are presumably more impacted by the + +presence of additional words in the context. We also see that the Avg-Phrase correlations no longer drop so dramatically in later layers, suggesting that when given full sentence inputs, models retain more word properties in later layers than when given only phrases. This general trend holds also for Avg-All and Head-Word representations. + +In the AB-BA setting, we see that presence of context does boost overall correlation with human judgment. Of note is XLM-RoBERTa's AvgPhrase, which without sentence context has zero correlation in the AB-BA setting, but which with sentence context reaches our highest observed AB-BA correlations in its final layers. However, even with context, the strongest correlation across models is still less than 0.3. It is still the case, then, that correlation on the controlled data degrades significantly relative to the full dataset. This indicates that even when phrases are input within sentence contexts, phrase representations in transformers reflect heavy reliance on word content, largely missing additional nuances of compositional phrase meaning. + +# 6.2 Paraphrase classification + +Full dataset Results for our full paraphrase classification dataset, with phrase-only inputs, are shown in the top row of Figure 4. Accuracies are overall very high, and we see generally similar patterns to the correlation tasks. Best accuracy is achieved by using Avg-Phrase and AvgAll representations. RoBERTa, XLM-RoBERTa, and XLNet show decreasing correlations for top-performing representations in later layers, while BERT and DistilBERT remain more consistent across layers. Performance of CLS requires a few + +![](images/35cdd95edbb310093eb11d2c78b4ecedfc273bc9d865b8a81e685d7bb0e23caf.jpg) +Figure 4: Classification accuracy on PPDB dataset (phrase-only input setting). First row shows classification accuracy on original dataset, and second row shows accuracy on controlled dataset. + +![](images/d7fbccdb2c7274312f0a2086f9a4edbd06a3a7054c2a4d4c86cc406c005f179c.jpg) +Figure 5: Classification accuracy on PPDB dataset with phrases embedded in sentence context. First row shows classification accuracy on original dataset, and second row shows accuracy on controlled dataset. + +layers to peak, with top performance around middle layers, and in some models shows poor performance in later layers. SEP shows unstable performance compared to other representations, especially in DistilBERT and RoBERTa. + +Controlled dataset The bottom row of Figure 4 shows classification accuracy when word overlap is held constant. Consistent with the drop in correlations on the controlled AB-BA experiments above, classification performance of all models drops down to only slightly above chance performance of $50\%$ . This suggests that the high classification performance on the full dataset relies largely on word overlap information, and that there is little higher-level phrase meaning information to aid classification in the absence of the overlap cue. We see in some cases a very slight trend such that classification accuracy increases a bit toward middle + +layers—so to the extent that there is any compositional phrase information being captured, it may increase within representations in the middle layers. Overall, the consistency of these results with those of the correlation analysis suggests that the apparent lack of accurate compositional meaning information in our tested phrase representations is not simply a result of cosine correlations being inappropriate for picking up on correspondences. + +Including sentence context Figure 5 shows the classification results for representations of phrases embedded in sentence contexts. The patterns largely align with our observations from the correlation task. Performance on the full dataset is still high, with Avg-Phrase now showing consistently highest performance, being least influenced by the presence of new context words. In the controlled setting, we see the same substantial drop in per + +
horse rancolor ran
gallopPOSNEG
dissolveNEGPOS
+ +Table 3: An example of landmark experiment of verb "run". Representations are expected to have higher cosine similarities between phrase and landmark word that are marked "POS". + +formance relative to the full dataset—there is very slight improvement over the phrase-only representations, but the highest accuracy among all models is still around 0.6. Thus, the inclusion of sentence context again does not provide any additional evidence for sophisticated compositional meaning information in the tested phrase representations. + +# 7 Qualitative analysis: sense disambiguation + +The above analyses rely on testing models' sensitivity to meaning similarity between two phrases. In this section we complement these analyses with another test aimed at assessing phrasal composition: testing models' ability to select the correct senses of polysemous words in a composed phrase, as proposed by Kintsch (2001). Each test item consists of a) a central verb, b) two subject-verb phrases that pick out different senses of the verb, and c) two landmark words, each associating with one of the target senses of the verb. Table 3 shows an example with central verb "ran" and phrases "horse ran"/ "color ran". The corresponding landmark words are "gallop", which associates with "horse ran", and "dissolve", which associates with "color ran". The reasoning is that composition should select the correct verb meaning, shifting representations of the central verbs—and of the phrase as a whole—toward landmarks with closer meaning. For this example, models should produce phrase embeddings such that "horse ran" is closer to "gallop" and "color ran" is closer to "dissolve". We use the items introduced in Kintsch (2001), which consist of a total of 4 sets of landmark tests. We feed landmarks and phrases respectively through each transformer, without context, to generate corresponding representations $p_{rep}^{i}$ for each layer $l_{i}$ and representation type rep. Cosine similarity between each phrase-landmark pair is computed and compared against expected similarities. + +Figure 6 shows the percentage of phrases that fall closer to the correct landmark word than to the + +incorrect one, averaged over 16 phrase-landmark word pairs. We see strong overall performance across models, suggesting that the information needed for this task is successfully captured by these models' representations. Additionally, we see that the patterns largely mirror the results above for correlation and classification on uncontrolled datasets. Particularly, Avg-Phrase and Avg-All show comparatively strong performance across models. RoBERTa and XLNet show stronger performance in early layers, dropping off in later layers, while BERT and DistilBERT show more consistency across layers. XLM-RoBERTa and XLNet show lower performance overall. + +For this verb sense disambiguation analysis, the Head-Word token is of note because it corresponds to the central verb of interest, so its sense can only be distinguished by its combination with the other word of the phrase. XLM-RoBERTa has the weakest performance with Head-Word, while BERT and DistilBERT demonstrate strong disambiguation with this token. As for the CLS token, RoBERTa produces the highest quality representation at layer 1, and BERT outperforms other models starting from layer 6, with DistilBERT also showing strong performance across layers. + +Notably, the observed parallels to our correlation and classification results are in alignment with the uncontrolled rather than the controlled versions of those tests. So while these parallels lend further credence to the general observations that we make about phrase representation patterns across models, layers, and representation types, it is worth noting that these landmark composition tests may be susceptible to lexical effects similar to those controlled for above. Since these test items are too few to filter with the above methods, we leave in-depth investigation of this question to future work. + +# 8 Discussion + +The analyses reported above yield two primary takeaways. First, they shed light on the nature of these models' phrase representations, and the extent to which they reflect word content versus phrasal composition. At many points in these models there is non-trivial alignment with human judgments of phrase similarity, paraphrase classification, and verb sense selection. However, when we control our correlation and classification tests to remove the cue of word overlap, we see little evidence that the representations reflect sophisticated + +![](images/0772c36dd678948f9dd590d5d0919476d0c970c11fed2559a5cdccec0536039a.jpg) +Figure 6: Landmark experiments. Y-axis denotes the percentage of samples that are shifted towards the correct landmark words in each layer. Missing bars occur when representations are independent of input at layer 0, such that cosine similarity between phrases and landmarks will always be 1. + +![](images/b20e7aaff959a0cc19859a78bfa185d959ae6a585a3b4209cbba315175bd1457.jpg) + +![](images/24229dd98b8c5e771b29087f5414ffd2b30f1d96e25222f9cf6bae9165726a69.jpg) + +![](images/b9e9b69117d901f192b64cc728e7611fd2576628e2259d2cadd62def7050058d.jpg) + +![](images/bae64c7b1e4ed02c524d13c85dc7af64590762101587a6044f901e8bc53897a0.jpg) + +phrase composition beyond what can be gleaned from word content. While we see strong performance on classic sense selection items designed to test phrase composition, the observed results largely parallel those from the uncontrolled versions of the correlation and classification analyses, suggesting that success on this landmark test may reflect lexical properties more than sophisticated composition. Given the importance of systematic meaning composition for robust and flexible language understanding, based on these results we predict that we will see corresponding weaknesses as more tests emerge for these models' handling of subtle meaning differences in downstream tasks. + +Our systematic examination of models, layers and representation types yields a second takeaway in the form of practical implications for selecting and extracting representations from these models. For faithful representations of word content, AvgPhrase is generally the strongest candidate. If only the phrase is embedded, drawing from earlier layers is best in RoBERTa, XLM-RoBERTa, and XLNet, while middle layers are better in BERT, and later layers in DistilBERT. If the phrase is input as part of a sentence, middle layers are generally best across models. Though the CLS token is often interpreted to represent a full input sequence, we find it to be a poor phrase representation even with phrase-only input, with the notable exception of the final layer of DistilBERT. + +As for representations that reflect true phrase meaning composition, we have established that such representations may not currently be available in these models. However, to the extent that we do see weak evidence of potential compositional meaning sensitivity, this appears to be + +strongest in DistilBERT's CLS token in final layers, in RoBERTa's Avg-Phrase representation in later layers, and in XLM-RoBERTa's Avg-Phrase representation from later layers only when the phrase is contained within a sentence context. + +# 9 Conclusions and future directions + +We have systematically investigated the nature of phrase representations in state-of-the-art transformers. Teasing apart sensitivity to word content versus phrase meaning composition, we find strong sensitivity across models when it comes to word content encoding, but little evidence of sophisticated phrase composition. The observed sensitivity patterns across models, layers, and representation types shed light on practical considerations for extracting phrase representations from these models. + +Future work can apply these tests to a broader range of models, and continue to develop controlled tests that target encoding of complex compositional meanings, both for two-word phrases and for larger meaning units. We hope that our findings will stimulate further work on leveraging the power of these generalized transformers while improving their capacity to capture compositional meaning. + +# Acknowledgments + +We would like to thank three anonymous reviewers for valuable questions and suggestions for improving this paper. We also thank members of the University of Chicago CompLing Lab, and the Toyota Technological Institute at Chicago, for helpful comments and feedback on this work. This material is based upon work supported by the National Science Foundation under Award No. 1941160. + +# References + +Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. 2016. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. arXiv preprint arXiv:1608.04207. +Shima Asaadi, Saif Mohammad, and Svetlana Kiritchenko. 2019. Big bird: A large, fine-grained, bigram relatedness dataset for examining semantic composition. 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 505-516. +Joris Baan, Jana Leible, Mitja Nikolaus, David Rau, Dennis Ulmer, Tim Baumgartner, Dieuwke Hupkes, and Elia Bruni. 2019. On the realization of compositionality in neural networks. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 127-137. +Geoff Bacon and Terry Regier. 2019. Does bert agree? evaluating knowledge of structure dependence through agreement relations. arXiv preprint arXiv:1908.09892. +Marco Baroni and Roberto Zamparelli. 2010. Nouns are vectors, adjectives are matrices: Representing adjective-noun constructions in semantic space. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 1183-1193. Association for Computational Linguistics. +Shammur Absar Chowdhury and Roberto Zamparelli. 2018. RNN simulations of grammaticality judgments on long-distance dependencies. In Proceedings of the 27th international conference on computational linguistics, pages 133-144. +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. +Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettle-moyer, and Veselin Stoyanov. 2019. Unsupervised cross-lingual representation learning at scale. arXiv preprint arXiv:1911.02116. +Alexis Conneau and Douwe Kiela. 2018. Senteval: An evaluation toolkit for universal sentence representations. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +Alexis Conneau, Germán Kruszewski, Guillaume Lample, Loïc Barrault, and Marco Baroni. 2018. What you can cram into a single $ &!#* vector: Probing + +sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2126-2136. +Ishita Dasgupta, Demi Guo, Andreas Stuhlmuller, Samuel J Gershman, and Noah D Goodman. 2018. Evaluating compositionality in sentence embeddings. arXiv preprint arXiv:1802.04302. +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. +Chris Dyer, Adhiguna Kuncoro, Miguel Ballesteros, and Noah A Smith. 2016. Recurrent neural network grammars. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 199-209. +Allyson Ettinger, Ahmed Elgohary, Colin Phillips, and Philip Resnik. 2018. Assessing composition in sentence vector representations. In Proceedings of the 27th International Conference on Computational Linguistics, pages 1790-1801. +Allyson Ettinger, Ahmed Elgohary, and Philip Resnik. 2016. Probing for semantic evidence of composition by means of simple classification tasks. In Proceedings of the 1st Workshop on Evaluating Vector-Space Representations for NLP, pages 134-139. +Lev Finkelstein, Evgeniy Gabrilovich, Yossi Matias, Ehud Rivlin, Zach Solan, Gadi Wolfman, and Eytan Ruppin. 2001. Placing search in context: The concept revisited. In Proceedings of the 10th international conference on World Wide Web, pages 406-414. +Richard Futrell, Ethan Wilcox, Takashi Morita, Peng Qian, Miguel Ballesteros, and Roger Levy. 2019. Neural language models as psycholinguistic subjects: Representations of syntactic state. 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 32-42. +Alona Fyshe, Leila Wehbe, Partha Talukdar, Brian Murphy, and Tom Mitchell. 2015. A compositional and interpretable semantic space. In Proceedings of the 2015 conference of the north american chapter of the association for computational linguistics: Human language technologies, pages 32-41. +Juri Ganitkevitch, Benjamin Van Durme, and Chris Callison-Burch. 2013. Ppdb: The paraphrase database. In Proceedings of the 2013 Conference of the North American Chapter of the Association for + +Computational Linguistics: Human Language Technologies, pages 758-764. +Daniela Gerz, Ivan Vulic, Felix Hill, Roi Reichart, and Anna Korhonen. 2016. Simverb-3500: A large-scale evaluation set of verb similarity. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2173-2182. +Kristina Gulordava, Piotr Bojanowski, Edouard Grave, Tal Linzen, and Marco Baroni. 2018. Colorless green recurrent networks dream hierarchically. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. +John Hewitt and Christopher D Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138. +Felix Hill, Roi Reichart, and Anna Korhonen. 2015. Simlex-999: Evaluating semantic models with (genuine) similarity estimation. Computational Linguistics, 41(4):665-695. +Dieuwke Hupkes, Anand Singh, Kris Korrel, German Kruszewski, and Elia Bruni. 2018. Learning compositionally through attentive guidance. arXiv preprint arXiv:1805.09657. +Ganesh Jawahar, Benoit Sagot, and Djamé Seddah. 2019. What does bert learn about the structure of language? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3651-3657. +Jaap Jumelet, Willem Zuidema, and Dieuwke Hupkes. 2019. Analysing neural language models: Contextual decomposition reveals default reasoning in number and gender assignment. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 1-11. +Yoon Kim, Alexander M Rush, Lei Yu, Adhiguna Kuncoro, Chris Dyer, and Gabor Melis. 2019. Unsupervised recurrent neural network grammars. 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 1105-1117. +Walter Kintsch. 2001. Predication. Cognitive science, 25(2):173-202. +Josef Klafka and Allyson Ettinger. 2020. Spying on your neighbors: Fine-grained probing of contextual embeddings for information about surrounding words. arXiv preprint arXiv:2005.01810. +Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. 2016. Assessing the ability of LSTMs to learn syntax-sensitive dependencies. Transactions of the + +Association for Computational Linguistics, 4:521-535. +Adam Líška, Germán Kruszewski, and Marco Baroni. 2018. Memorize or generalize? searching for a compositional rnn in a haystack. arXiv preprint arXiv:1802.06467. +Nelson F Liu, Matt Gardner, Yonatan Belinkov, Matthew E Peters, and Noah A Smith. 2019a. Linguistic knowledge and transferability of contextual representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 1073-1094. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Tom McCoy, Ellie Pavlick, and Tal Linzen. 2019. Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3428-3448. +Jeff Mitchell and Mirella Lapata. 2008. Vector-based models of semantic composition. In proceedings of ACL-08: HLT, pages 236-244. +Jeff Mitchell and Mirella Lapata. 2010. Composition in distributional models of semantics. Cognitive science, 34(8):1388-1429. +W James Murdoch, Peter J Liu, and Bin Yu. 2018. Beyond word importance: Contextual decomposition to extract interactions from lstms. In International Conference on Learning Representations. +Navnita Nandakumar, Timothy Baldwin, and Bahar Salehi. 2019. How well do embedding models capture non-compositionality? a view from multiword expressions. In Proceedings of the 3rd Workshop on Evaluating Vector Space Representations for NLP, pages 27-34. +Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. 2019. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pages 8024-8035. +Ellie Pavlick, Pushpendre Rastogi, Juri Ganitkevitch, Benjamin Van Durme, and Chris Callison-Burch. 2015. Ppdb 2.0: Better paraphrase ranking, fine-grained entailment relations, word embeddings, and style 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 2: Short Papers), pages 425-430. + +Matthew Peters, Mark Neumann, Luke Zettlemoyer, and Wen-tau Yih. 2018. Dissecting contextual word embeddings: Architecture and representation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1499-1509. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openai-assetss/researchcovers/languageunsupervised/language understanding paper.pdf. +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. Journal of Machine Learning Research, 21(140):1-67. +Adam Roberts, Colin Raffel, and Noam Shazeer. 2020. How much knowledge can you pack into the parameters of a language model? arXiv preprint arXiv:2002.08910. +Victor Sanh, Lysandre Debut, Julien Chaumont, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108. +Naomi Saphra and Adam Lopez. 2020. Word interdependence exposes how lstms compose representations. arXiv preprint arXiv:2004.13195. +Vered Shwartz and Ido Dagan. 2019. Still a pain in the neck: Evaluating text representations on lexical composition. Transactions of the Association for Computational Linguistics, 7:403-419. +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. +Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019a. Bert rediscovers the classical nlp pipeline. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4593-4601. +Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R Thomas McCoy, Najoung Kim, Benjamin Van Durme, Samuel Bowman, Dipanjan Das, et al. 2019b. What do you learn from context? probing for sentence structure in contextualized word representations. In 7th International Conference on Learning Representations, ICLR 2019. + +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. +Jesse Vig and Yonatan Belinkov. 2019. Analyzing the structure of attention in a transformer language model. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 63-76. +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. +John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. 2015. Towards universal paraphrastic sentence embeddings. arXiv preprint arXiv:1511.08198. +Ethan Wilcox, Roger Levy, Takashi Morita, and Richard Futrell. 2018. What do RNN language models learn about filler-gap dependencies? In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 211-221. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Yinfei Yang, Yuan Zhang, Chris Tar, and Jason Baldridge. 2019a. PAWS-X: A Cross-lingual Adversarial Dataset for Paraphrase Identification. In Proc. of EMNLP. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019b. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pages 5754-5764. +Da Yin, Tao Meng, and Kai-Wei Chang. 2020. Sentibert: A transferable transformer-based architecture for compositional sentiment semantics. +Yuan Zhang, Jason Baldridge, and Luheng He. 2019. PAWS: Paraphrase Adversaries from Word Scrambling. In Proc. of NAACL. \ No newline at end of file diff --git a/assessingphrasalrepresentationandcompositionintransformers/images.zip b/assessingphrasalrepresentationandcompositionintransformers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b2a88244c1f43a1a7e6bd8753f7653094f4f0e21 --- /dev/null +++ b/assessingphrasalrepresentationandcompositionintransformers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72706c3b101c2d74b73b34f80a1033379557c47d5647e70ed06dd915b8893468 +size 662012 diff --git a/assessingphrasalrepresentationandcompositionintransformers/layout.json b/assessingphrasalrepresentationandcompositionintransformers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ba9f9e641936c5b0752dfe36434535f5efd915ec --- /dev/null +++ b/assessingphrasalrepresentationandcompositionintransformers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:734d1ce62ccaa579c1005754ebc04d94f7a2e23985615670b6a67cbabe04332f +size 349113 diff --git a/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_content_list.json b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..a2b4ea4266e420d23733495cbed6e6b327f65da3 --- /dev/null +++ b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e8f03d1c0092fda103029804e52c9ebd5901117668066619fd8c2c2bdebcf18 +size 79750 diff --git a/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_model.json b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9aa45c4c55b3cd16feb3dad0604523ff3e184e6e --- /dev/null +++ b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11d6dbf1eeb9f2c1138011cd3ae001d0e03b7e136636190e2bcfc2d57b303e89 +size 93128 diff --git a/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_origin.pdf b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8b34b37af92ce904bf2957141e1f9837fa9f8415 --- /dev/null +++ b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/2c5c189a-88f2-4587-a47b-dad648d5cd74_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1381276be672981c6aba34657da097660056f997f15125e4f9006dbb9bedc555 +size 2405908 diff --git a/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/full.md b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/full.md new file mode 100644 index 0000000000000000000000000000000000000000..39d68280096bb02e86cde4d16d739d4c0fb48ba5 --- /dev/null +++ b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/full.md @@ -0,0 +1,346 @@ +# Assessing the Helpfulness of Learning Materials with Inference-Based Learner-Like Agent + +Yun-Hsuan Jen1, Chieh-Yang Huang2, Mei-Hua Chen3, Ting-Hao (Kenneth) Huang2, and Lun-Wei Ku1 + +$^{1}$ Academia Sinica, Taipei, Taiwan. + +yhjen2@gmail.com, lwku@iis.sinica.edu.tw + +$^{2}$ Pennsylvania State University, University Park, PA, USA. + +{chiehyang,txh710}@psu.edu + +$^{3}$ Tunghai University, Taichung, Taiwan. mhchen@thu.edu.tw + +# Abstract + +Many English-as-a-second language learners have trouble using near-synonym words (e.g., small vs. little; briefly vs. shortly) correctly, and often look for example sentences to learn how two nearly synonymous terms differ. Prior work uses hand-crafted scores to recommend sentences but have difficulty in adopting such scores to all the near-synonyms as near-synonyms differ in various ways. We notice that the helpfulness of the learning material would reflect on the learners' performance. Thus, we propose the inference-based learner-like agent to mimic learner behavior and identify good learning materials by examining the agent's performance. To enable the agent to behave like a learner, we leverages entailment modeling's capability of inferring answers from the provided materials. Experimental results show that the proposed agent is equipped with good learner-like behavior to achieve the best performance in both fill-in-the-blank (FITB) and good example sentence selection tasks. We further conduct a classroom user study with college ESL learners. The results of the user study show that the proposed agent can find out example sentences that help students learn more easily and efficiently. Compared to other models, the proposed agent improves the score of more than $17\%$ of students after learning. + +# 1 Introduction + +Many English-as-a-second-language (ESL) learners have trouble using near-synonyms correctly (Liu and Zhong, 2014; Liu, 2013). "Near-synonym" refers to a word whose meaning is similar but not identical to that of another word, for instance, establish and construct. An experience common to many ESL learners is looking for example sentences to learn how two nearly synonymous words differ (Liu, 2013; Liu and Jiang, 2009). To facilitate the learner's learning process, our focus + +![](images/1b1f6c67e2799e2f2b660217b0c46e4b9f216189ad926f680773829343983404.jpg) + +![](images/803283d2295a0aaf59573fc06a8d7613dd9e8b6f4cb3ce8504a4de7ab8f36ff2.jpg) +Figure 1: The Learner-Like Agent mimics learners' behavior of performing well when learning from good material and vice versa. We utilize such a behavior to find out helpful learning materials. + +is on finding example sentences to clarify English near-synonyms. + +In previous work, researchers develop linguistic search engines, such as Linggle (Boisson et al., 2013) and Netspeak1, to allow users to query English words in terms of n-gram frequency. However, these tools can only help people investigate the difference, where learners are required to make assumptions toward the subtlety and verify them with the tools, but can not tell the difference proactively. Other work attempts to automatically retrieve example sentences for dictionary entries (Kilgarriff et al., 2008); however, finding clarifying examples for near-synonyms is not the goal of such work. In a rare exception, Huang et al. (2017) retrieve useful examples for near-synonyms by defining a clarification score for a given English sentence and using it to recommend sentences. However, the sentence selection process depends on handcrafted scoring functions that are unlikely to work well for all near-synonym sets. For example, the difference between refuse and reject is their grammatical usages where we would use "refuse to verb" but not "reject to + +verb"; such a rule, yet, is not applicable for delay and postpone as they differ in sentiment where delay expresses more negative feeling. Though Huang et al. (2017) propose two different models to handle these two cases respectively, there is no clear way to automatically detect which model we should use for an arbitrary near-synonym set. + +In the search for a better solution, we noted that ESL learners learn better with useful learning materials—as evidenced by their exam scores—whereas bad materials cause confusion. Such behavior can be used to assess the usefulness of example sentences as shown in Figure 1. Therefore, we propose a Learner-Like Agent which mimics human learning behavior to enable the ability to select good example sentences. This task concerns the ability to answer questions according to the example sentences for learning. As such, we transform this research problem to an entailment problem, where the model needs to decide whether the provided example sentence can entail the question or not. Moreover, to encourage learner-like behavior, we propose perturbing instances for model training by swapping the target confusing word to its near-synonyms. We conduct a lexical choice experiment to show that the proposed entailment modeling can distinguish the difference of near-synonyms. A behavior check experiment is used to illustrate that perturbing instances do encourage learner-like behavior, that is inferring answers from the provided materials. In addition, we conduct a sentence selection experiment to show that such learner-like behavior can be used for identifying helpfulness materials. Last, we conduct a user study to analyze near-synonym learning effectiveness when deploying the proposed agent on students. + +Our contributions are three-fold. We $(i)$ propose a learner-like agent which perturbs instances to effectively model learner behavior, $(ii)$ use inference-based entailment modeling instead of context modeling to discern nuances between near-synonyms, and $(iii)$ construct the first dataset of helpful example sentences for ESL learners.2 + +# 2 Related Works + +This task is related to (i) learning material generation, (ii) near-synonyms disambiguation, and (iii) natural language inference. + +Learning Material Generation. Collecting learning material is one of the hardest tasks for both teachers and students. Researchers have long been looking for methods to generate high-quality learning material automatically. Sumita et al. (2005); Sakaguchi et al. (2013) proposed approaches to generate fill-in-the-blank questions to evaluate students language proficiency automatically. Lin et al. (2007); Susanti et al. (2018); Liu et al. (2018) worked on generating good distractors for multiple-choice questions. However, there are only a few tasks working on automatic example sentence collection and generation. Kilgarriff et al. (2008); Didakowski et al. (2012) proposed a set of criteria for a good example sentences and Tolmachev and Kurohashi (2017) used sentence similarity and quality as features to extract high-quality examples. These tasks only focused on the quality of a single example sentence, whereas our goal in this paper is to generate an example sentence set that clarifies near-synonyms. The only existing work is from Huang et al. (2017), who designed the fitness score and relative closeness score to represent the sentence's ability to clarify near-synonyms. Our work enables the models to learn the concept of "usefulness" directly from data to reduce the possible issues of the human-crafted scoring function. + +Near-synonyms Disambiguation. Unlike the language modeling task that aims at predicting the next word given the context, near-synonyms disambiguation focuses on differentiating the subtlety of the near-synonyms. Edmonds (1997) first introduced a lexical co-occurrence network with second-order co-occurrence for near-synonym disambiguation. Edmonds also suggested a fill-in-the-blank (FITB) task, providing a benchmark for evaluating lexical choice performance on near-synonyms. Islam and Inkpen (2010) used the Google 5-gram dataset to distinguish near-synonyms using language modeling techniques. Wang and Hirst (2010) encoded words into vectors in latent semantic space and applied a machine learning model to learn the difference. Huang et al. (2017) applied BiLSTM and GMM models to learn the subtle context distribution. Recently, BERT (Devlin et al., 2018) brought a big success in nearly all the Natural Language Processing tasks. Though BERT is not designed to differentiate near-synonyms, its powerful learning capability could be used to understand the subtlety lies in the near-synonyms. In this paper, our models are all designed on top of the pre + +trained BERT model. + +Natural Language Inference. Our proposed model directly learns the difference and sentence quality by imitating the human reactions of learning material and behavior of learning from example sentences. The idea of learning from example is similar to natural language inference (NLI) task and recognizing question entailment (RQE) task. There are various NLI dataset varied in size, construction, genre, labels classes (Bowman et al., 2015; Williams et al., 2018; Khot et al., 2018; Lai et al., 2017). In the NLI task, each instance consists of two natural language text: a premise, a hypothesis, and a label indicating the relationship whether a premise entails the hypothesis. RQE, on the other hand, identifies entailment between two questions in the context of question answering. Abacha and Demner-Fushman (2016) used the definition of question entailment: “a question $A$ entails a question $B$ if every answer to $B$ is also a complete or partial answer to $A$ .” Though NLI and RQE research has acquired lots of success, to the best of our knowledge, we are the first to attempt using these two tasks on language learning problems. + +Poliak et al. (2018)'s recast version of the definite pronoun resolution (DPR) task inspired us to build learner-like agents with entailment modeling. In the original DPR problem, sentences contain two entities and one pronoun, and the mission is to link the pronoun to its referent (Rahman and Ng, 2012). In the recast version, the premises are the original sentences, and the hypothesis is the same sentence with the pronoun replaced with its correct (entailed) and incorrect (not-entailed) reference. We believe our proposed entailment modeling can help the model to understand the relationship between the given example sentence and question for the target near-synonym. Thus entailment modeling enables the learner-like agent to mimic human behavior through inference. + +# 3 Method + +In this paper, we use learner-like agent to refer to a model that answers questions given examples. The goal of the learner-like agent is to answer fill-in-the-blank questions on near-synonyms selection. However, instead of answering the question from the agent's prior knowledge, the agent needs to answer the question using the information from the given examples. That is, if the given examples provide incorrect information, the agent should then come + +up with the wrong answer. This process is to simulate the learner behavior illustrated in the Figure 1. Since the model is required to infer the answer, we further formulate it as an entailment modeling problem to enable model's capability of inference. In this section, we (i) define the proposed learner-like agent, (ii) describe how to formulate it as an entailment modeling problem, and (iii) introduce the perturbed instances to further enhance the agent's learner behavior. + +# 3.1 Learner-Like Agent + +The overall structure of a learner-like agent is as follows: given six example sentences $\mathbb{E}$ (3 sentences for each word) and a fill-in-the blank question $Q$ as an input instance, the model is to answer the question based on the example hints. We adopt BERT (Devlin et al., 2018) to fine-tune the task-specific layer of the proposed learner-like agent using our training data, equipping the learner-like agent with the ability to discern differences between near-synonyms. The input of our model contains the following: + +- A question $Q^{w_i} = [q_1, q_2, \dots, q_n]$ , where $n$ is the length of the sentence and contains a word $w_i$ from the near-synonym pair, where $i \in \{1, 2\}$ denotes word 1 or word 2; +Example sentences set $\mathbb{E}$ $= [E_1^{w_1},\dots,E_3^{w_1},E_4^{w_2},\dots,E_6^{w_2}]$ where $E^{w_i}$ denotes a sentence containing $w_{i}$ +- A [CLS] token for the classification position, and several [SEP] tokens used to label the boundary of the question and the example sentences, following the BERT settings. + +The output will is the correct word for the input question, namely, $w_{1}$ or $w_{2}$ . + +We specifically define $E[w_j]^i$ where $i, j \in 1, 2$ to be the context of $w_i$ . The example sentence of case (2) in Table 1 shows a case of $E[w_1]^1$ where the target word $w_1$ is little and the rest of the sentence is called context $E[-]^{1}$ . When we change little to small to create case (9), it is described as $E[w_2]^1$ meaning an example sentence where $w_2$ fills the position of $w_1$ in sentence $E^{w_1}$ . This notation also applies to the question input $Q[w_j]^i$ . + +# 3.2 Inference-based Entailment Modeling + +We apply NLI and RQE tasks in the learner-like agent question design. The goal of the Entailment + +
Model TypeCaseExample SentenceQuestionLabel
EMLA(2)After founding the Institute he had [little] time for composing, and appears to have concentrated exclusively on teaching.When she finds out the truth, she makes a fateful decision to make the most of the [little] time they have together.{entail, ¬entail}
(3)After founding the Institute he had [little] time for composing, and appears to have concentrated exclusively on teaching.This may be an incorporated town or city, a subentity of a large city or an unincorporated census-designated place, or a [small] unincorporated community.{entail, ¬entail}
(4)After founding the Institute he had [little] time for composing, and appears to have concentrated exclusively on teaching.When she finds out the truth, she makes a fateful decision to make the most of the [small] time they have together.{entail, ¬entail}
(5)After founding the Institute he had [little] time for composing, and appears to have concentrated exclusively on teaching.This may be an incorporated town or city, a subentity of a large city or an unincorporated census-designated place, or a [little] unincorporated community.{entail, ¬entail}
(9)After founding the Institute he had [small] time for composing, and appears to have concentrated exclusively on teaching.When she finds out the truth, she makes a fateful decision to make the most of the [small] time they have together.{entail, ¬entail}
CMLA(12)After founding the Institute he had [little] time for composing, and appears to have concentrated exclusively on teaching. It makes me feel [small] when you keep things from me.When she finds out the truth, she makes a fateful decision to make the most of the [MASK] time they have together.{litle, small}
(14)It makes me feel [little] when you keep things from me. After founding the Institute he had [small] time for composing, and appears to have concentrated exclusively on teaching.When she finds out the truth, she makes a fateful decision to make the most of the [MASK] time they have together.{litle, small}
Inappropriate Ex-ample for EMLAAfter founding the Institute he had [small] time for composing, and appears to have concentrated exclusively on teaching.When she finds out the truth, she makes a fateful decision to make the most of the [little] time they have together.{entail, ¬entail}
Inappropriate Ex-ample for CMLAIt makes me feel [little] when you keep things from me. After founding the Institute he had [small] time for composing, and appears to have concentrated exclusively on teaching.When she finds out the truth, she makes a fateful decision to make the most of the [MASK] time they have together.{litle, small}
+ +Table 1: Training instances for learner-like agents. The instances are associated with the corresponding equations. Case (9) and (14) are the perturbed instances. The inappropriate examples are used in section 4 for behavior check. + +Modeling Learner-like Agent (EMLA) is to answer entailment questions given example sentences. We transform the original fill-in-the-blank question into an entailment question where the EMLA answers whether the given example sentence $E$ entails the question sentence $Q$ . If the word usage in the question sentence matches the word usage in the example sentence, the EMLA answers entail, or ¬entail otherwise. + +The EMLA $M_{e}$ is described as + +$$ +M _ {e} (E _ {k} ^ {i}, Q ^ {j}) = a n s, \tag {1} +$$ + +where ans—either entail or $\neg$ entail—is the prediction of the inference relationship of one of the six example sentences $E_{k}^{i}$ , where $k\in \{1,2,\ldots 6\}$ and $Q^{j}$ . To fill all the context possibilities of $Q[_{-}]^{j}$ for the same word in $E^{w_i}$ , an example has the following four cases: + +$$ +M _ {e} \left(E \left[ w _ {1} \right] ^ {1}, Q \left[ w _ {1} \right] ^ {1}\right) = e n t a i l \tag {2} +$$ + +$$ +M _ {e} \left(E \left[ w _ {1} \right] ^ {1}, Q \left[ w _ {2} \right] ^ {2}\right) = \neg e n t a i l \tag {3} +$$ + +$$ +M _ {e} \left(E \left[ w _ {1} \right] ^ {1}, Q \left[ w _ {2} \right] ^ {1}\right) = \neg e n t a i l \tag {4} +$$ + +$$ +M _ {e} \left(E \left[ w _ {1} \right] ^ {1}, Q \left[ w _ {1} \right] ^ {2}\right) = \neg e n t a i l. \tag {5} +$$ + +From the input and output of the instances (equations 2 to 5), we see that the target word and its context in $Q^j$ for all cases except for equation 2 do not follow the example word usage. The examples of the instances are shown in Table 1. Equation 3 and equation 4 tell us that an example sentence of $w_1$ does not provide any information for the model to infer anything about $w_2$ so both of them result in not entail. The question of equation 5 is incorrect, + +as shown in the Table 1 case (5), so it would also lead to not entail. + +After training the EMLA to understand the relation between example and question, we can convert its prediction $\{\text{entail}, \neg \text{entail}\}$ back into the fill-in-the-blank task by looking into the model predictions. Given the probability of $\{\text{entail}, \neg \text{entail}\}$ , we know which term in the near-synonym pair is more appropriate in the context of $\{Q[.]^1, Q[.]^2\}$ . If the question context and the example context match, then a word with a higher entail probability is the answer. If they do not match, that with the higher $\neg \text{entail}$ probability is the answer. + +# 3.3 Perturbed Instances + +To encourage learner-like behavior, i.e., good examples lead to the correct answer, and vice versa, we propose introducing automatically generated perturbed instances to the training process. + +A close look at the input and output of the instances (equations 2 to 5) shows that they consider only correct examples and their corresponding labels. We postulate that wrong word usage yields inappropriate examples; thus we perturb instances by swapping the current confusing word to its near-synonym as + +$$ +M _ {e} \left(E [ \neg w _ {i} ] _ {k} ^ {i}, Q ^ {w _ {j}}\right) = \neg a n s \tag {6} +$$ + +where $\neg$ ans is $\{\text{entail}, \neg \text{entail}\} - \text{ans}$ and $E[\neg w_i]_k^{w_i}$ is the example sentence in which the contexts in $w_1$ and $w_2$ are swapped. The corresponding perturbed instances from equations 2 to + +5 thus become + +$$ +M _ {e} \left(E \left[ w _ {2} \right] ^ {1}, Q \left[ w _ {1} \right] ^ {1}\right) = \neg e n t a i l \tag {7} +$$ + +$$ +M _ {e} \left(E \left[ w _ {2} \right] ^ {1}, Q \left[ w _ {2} \right] ^ {2}\right) = \neg e n t a i l \tag {8} +$$ + +$$ +M _ {e} \left(E \left[ w _ {2} \right] ^ {1}, Q \left[ w _ {2} \right] ^ {1}\right) = e n t a i l \tag {9} +$$ + +$$ +M _ {e} \left(E \left[ w _ {2} \right] ^ {1}, Q \left[ w _ {1} \right] ^ {2}\right) = \neg e n t a i l, \tag {10} +$$ + +respectively, in which $w_{2}$ 's context becomes $E[-]^{1}$ . Again, only equation 9, where both the context and the word usage match, is entail. The example instance is shown in Table 1 case 9. + +# 4 Experiments + +We conducted three experiments: lexical choice, behavior check, and sentence selection. The lexical choice task assesses whether the model differentiates confusing words, the behavior check measures whether the model responds to the quality of learning material as learners do, and sentence selection evaluates the model's ability to explore useful example sentences. + +# 4.1 Lexical Choice + +Lexical choice evaluates the model's ability to differentiate confusing words. We adopted the fill-in-the-blank (FITB) task, where the model is asked to choose a word from a given near-synonym word pair to fill in the blank. + +# 4.1.1 Baseline + +Context modeling is a common practice for near-synonym disambiguation in which the model learns the context of the target word via the FITB task. For this we use a Context Modeling Learner-like Agent (CMLA) as the baseline based on BERT (Devlin et al., 2018) as a two-class classifier to predict which of $w_{1}$ or $w_{2}$ is more appropriate given a near-synonym word pair. The question for CMLA is a sentence whose target word, i.e., one of the confusing words, is masked; the model is to predict the masked target word. + +The CMLA $M_{c}$ is then described as + +$$ +M _ {c} \left(\mathbb {E}, Q [ \text {M A S K} ] ^ {i}\right) = a n s, \tag {11} +$$ + +where $Q[\mathrm{MASK}]^i$ fills the position of $w_{i}$ with MASK, and $ans\in \{w_1,w_2\}$ is the prediction of [MASK] in the question, and $\mathbb{E}$ are the six example sentences. + +$Q[\mathrm{MASK}]^i$ is a question with the context of either $w_{1}$ or $w_{2}$ . This raises a problem of the model + +deriving the answer only from $Q^i$ + +$$ +M _ {c} \left(\mathbb {E}, Q \left[ \mathrm {M A S K} \right] ^ {1}\right) = w _ {1} \tag {12} +$$ + +$$ +M _ {c} \left(\mathbb {E}, Q \left[ \text {M A S K} \right] ^ {2}\right) = w _ {2} \tag {13} +$$ + +Equations 12 and 13 risk the model to selects $w_{i}$ given $Q^{i}$ . To encourage learner-like behavior, we incorporate perturbed instances into the training process corresponding to equations 12 and 13 as + +$$ +M _ {c} \left(\neg \mathbb {E}, Q [ \text {M A S K} ] ^ {1}\right) = w _ {2} \tag {14} +$$ + +$$ +M _ {c} \left(\neg \mathbb {E}, Q [ \text {M A S K} ] ^ {2}\right) = w _ {1}, \tag {15} +$$ + +$$ +\begin{array}{c c} , & \text {w h e r e} \quad \neg \mathbb {E} \\ [ E [ \neg w _ {2} ] _ {1} ^ {2},.., E [ \neg w _ {2} ] _ {3} ^ {2}, E [ \neg w _ {1} ] _ {1} ^ {1},.., E [ \neg w _ {1} ] _ {3} ^ {1} ] \end{array} = +$$ + +For context modeling, the perturbed instance has the additional benefit that it forces the model to make inferences based on the given example sentences, as illustrated in Table 1 case (14). + +# 4.1.2 Dataset and Settings + +We collected a set of near-synonym word pairs from online resources, including $\mathrm{BBC}^3$ , the Oxford Dictionary4, and a Wikipedia page about commonly misused English words5. + +An expert in ESL education manually selected 30 near-synonym word pairs as our experimental material. We collected our data for both training and testing from Wikipedia on January 20, 2020. Words in the confusing word pair were usually of a specific part of speech. This guaranteed that the part of speech of the confusing word in the sentence pool matched that in target near-synonym word pair. To construct a balanced dataset, we randomly selected 5,000 sentences for each word; 4,000 sentences for each word in a near-synonym word pair were used to train the learner-like model and 1,000 sentences for testing. + +For comparison, we trained four learner-like agents: EMLA, CMLA, EMLA without perturbed instances, and CMLA without perturbed instances. For the best learning effect, we empirically set the ratio of normal-to-perturbed instances to $2:1$ . The agents were trained using the Adam optimizer with a $30\%$ warm-up ratio and a 5e-5 learning rate. The maximum total input sequence length after tokenization was 256; other settings followed the BERT configuration. + +![](images/3bc49e2efdee8712dea611b1049fdc48a45a5777d26efddedcd1d04117934d47.jpg) +Figure 2: Visualization of lexical choice performance on near-synonym word pairs. Adding perturbed instances improves EMLA's ability of differentiating confusing words. However, perturbed instances does not cause big difference on CMLA. + +
T-scoreP-value
CMLA24.542.06e-21
CMLA w/o perturbing0.770.45
EMLA92.122.43e-37
EMLA w/o perturbing27.063.96e-22
+ +Table 2: Except for context modeling without perturbed instances, all models respond to changes in learning material quality + +# 4.1.3 Results and Discussion + +We compared the EMLA and CMLA and Figure 2 shows the model performance on 30 word pairs. The average accuracy of EMLA and CMLA is 0.90 and 0.86, while that excluding perturbing instances is 0.80 and 0.86, respectively. On average, EMLA performs the best; when perturbed instances are not included in the training, its performance for lexical choice drops. We expected training with perturbed instances to worsen model performance in exchange for learner-like behavior. However, results show that the perturbed instances enhance the inference ability of EMLA. Also, CMLA models seem to be unaffected by perturbed instances (yellow vs. green lines); this could be because CMLA tends to memorize the input context instead of making an actual inference, which in NLI is recognized as bias (Chien and Kalita, 2020). + +# 4.2 Behavior Check + +The behavior check evaluates whether the agent learns as learners do; that is, a learner-like agent should perform well on FITB questions when the given learning materials are helpful, and should perform poorly when the materials are not helpful. + +In this experiment, all models complete two FITB quizzes. For the first quiz, authentic sen + +tences are provided as appropriate learning materials; for the second quiz, inappropriate learning materials are provided. These materials are considered inappropriate because they are automatically generated using the authentic sentences but replacing their target words with near-synonyms for training, resulting in confusion and wrong word usage, as illustrated in Table 1 (see the last two "Inappropriate example" rows). In other words, given inappropriate example sentences, if the model is truly inferring answers from the examples, the model should select the other choice in the same quiz question. + +# 4.2.1 Results and Discussion + +We recorded the accuracy of every question and combined the 30 pairs of near-synonym wordsets from the same model into one graph. As shown in Figure 3, even without perturbed instances, the learning effect of EMLA corresponds to the learning material quality. In contrast, CMLA without perturbed instances, as in the lexical choice task, is no worse when given inappropriate examples. + +To determine whether the results of the two fill-in-the-blank quizzes are significantly different when given appropriate and inappropriate examples, we conducted a t-test. Table 2 shows that learner-like behavior is enabled in CMLA with perturbed instances, whereas EMLA learns like learners even without perturbed instances. This result conforms to that shown in Figure 3: the quiz results for both EMLA models can be clearly distinguished, and adding the perturbed instances to EMLA slightly magnifies their difference. However, the CMLA still relies on perturbed instances to learn the difference. + +Looking more closely, we present Table 3, in which $\Delta$ is the difference in accuracy between two quizzes. The higher $\Delta$ is, the better the model differentiates confusing words. We measure the correlation between the lexical choice accuracy and $\Delta$ with the Pearson correlation coefficient and obtain a value of 0.87, which demonstrates a strong positive correlation. + +# 4.3 Sentence Selection + +In the sentence selection experiment, we evaluate the ability of the learner-like agent to select useful example sentences. Our assumption is straightforward. We give the agent a set of example sentences and evaluate its performance on a number of quizzes. If it does well on many quizzes, the example sentences are deemed helpful for learning + +![](images/ae5367ec60153f7c43348afd41ed248328e41bb2b4a52c450cb04756481033c9.jpg) + +![](images/169af9a5daf6028d903beafbfdd1e3c3a9565e49f4aa0819c2ac0244d35f64c8.jpg) + +![](images/b8f113e161de256aaae813225f864ee01c07000e984b3c12c56cc68d053a09b6.jpg) +(a) EMLA +(c) CMLA +Figure 3: Behavior check visualization of quiz results given appropriate (blue) or inappropriate (orange) learning materials. Each quiz was completed 11250 times (375 example sentence sets for each of the 30 word pairs). + +![](images/db04319f9aee46cc49e1c96b77d52039d8bad42bc88164e8ad87c46a93e0ae81.jpg) +(b) EMLA w/o perturbing +(d) CMLA w/o perturbing + +
AccΔAccΔAccΔ
accountability, responsibility0.830.76traffic, transportation0.890.80duty, task0.920.84
particular, peculiar0.840.73tiny, little0.900.79real, authentic0.920.86
previous, former0.860.76elder, elderly0.900.80particular, specific0.920.86
elder, senior0.860.79creativity, innovation0.900.83briefly, shortly0.920.85
small, little0.870.71common, ordinary0.910.82decoration, ornament0.930.87
special, specific0.880.74senior, elderly0.910.82duty, job0.930.86
accountability, liability0.880.79acknowledge, admit0.910.81achievement, accomplishment0.930.88
specific, peculiar0.890.73opportunity, possibility0.910.82responsibility, liability0.940.88
career, job0.890.80delay, postpone0.910.82commitment, responsibility0.940.88
traffic, transport0.890.80task, job0.920.83cooperation, collaboration0.950.89
+ +Table 3: Mapping of lexical performance and model ability to differentiate near-synonyms for 30 word pairs using entailment modeling. Acc is the lexical choice accuracy on appropriate examples and $\Delta$ is the difference in accuracy between the two quizzes. + +confusing words. + +# 4.3.1 Baseline + +We compared agents with an implementation of Huang et al. (2017)'s Gaussian mixture model (GMM), which learns the distribution and semantics of the context. We set the number of Gaussian mixtures to 10 and trained the GMM with the dataset proposed here. In the testing phase, we retrieved the top three recommended sentences for each word in the confusing word pair and compared this to the expert's choices. + +# 4.3.2 Evaluation Dataset + +To evaluate the sentence selection, we employed an ESL teacher as an expert to carefully select the three best example sentences out of ten randomly selected, grammatically, and pragmatically correct examples for each word in all confusing word pairs. + +Specifically, the evaluation dataset had a total of 600 example sentences. For each near-synonym pair, three sentences for each word were labeled as helpful example sentences. To select sentences + +that clearly clarify the semantic difference between near-synonyms, the ESL expert considered suitability, informativeness, diversity, sentence complexity, and lexical complexity during selection. For suitability, the expert considered whether the two near-synonym words in one confusing word pair were interchangeable in the current sentence. Diversity was considered when constructing the selected pool. Suitability and diversity are designed from the (Huang et al., 2017)'s conclusion. Other criteria are from Kilgarriff's good example sentence (Kilgarriff et al., 2008). + +# 4.3.3 Selection Method + +For the proposed good example sentence set, we selected an example sentence combination that helps EMLA or CMLA to achieve the highest accuracy in the quiz. That is, the example sentence set that leads to the highest learning performance. + +One of a total of 14,400 $(C_3^{10} \times C_3^{10})$ example sentence sets, including six example sentences, was provided to the models to evaluate their helpfulness. + +
PrecisionRecallF1
EMLA0.330.710.45
CMLA0.310.560.38
GMM0.370.340.35
+ +Table 4: Sentence selection results. When compared with the human annotation, entailment modeling achieves the highest F1 of 0.45. + +Each example sentence set was used to answer a quiz composed of $k$ questions. Here, $k$ determines the representativeness and consistency of the testing result from each quiz. We used five independent quizzes to find a reliable $k$ by calculating the correlation of their testing results. Finally, we empirically set $k$ to 100, where the lowest correlation among 30 word pairs was 0.24, and the median was 0.67. That is, each quiz contained 100 questions. + +When testing example sentence sets, multiple example sentence sets could achieve the same highest accuracy for the quiz. We considered them equally good so sentences in these sets were all treated as selected. Thus, our method would possibly suggest more example sentences than the gold labels. + +# 4.3.4 Results and Discussion + +Table 4 shows the results of sentence selection. EMLA significantly outperforms CMLA and Huang's GMM in sentence selection. The improvement comes from the increasing recall, indicating that the proposed learner-like agent manages to find helpful example sentences for ESL learners. + +# 5 Learner Study + +We conducted a user study to see the effect of learning on example sentences selected by EMLA, CMLA, and a random baseline. In this learner study, a total of 29 Chinese-speaking college freshmen majored in English were recruited. All the participants were aged between 18 and 19. A proficiency test (Chen and Lin, 2011) was given before the study to identify their English level for further analysis. + +# 5.1 Experimental Design and Material + +We followed Huang et al. (2017)'s learner study design with some modification. The whole test consisted of a pre-test and a post-test section in a total of 80 minutes. The fill-in-the-blank multiplechoice question was used in both tests to examine students' understanding of near-synonym. A total of 30 word pairs were used to create 30 question sets where each set contained three questions. The + +![](images/43b8f7dc94b55e038fe935c4d61f867c784347c66bb6d1ba72ca54de89f5a5bc.jpg) +Figure 4: The interface of the user study contains two panel, (A) the example sentence panel and (B) the test panel. The example sentence panel will only be presented in the post-test. + +questions are manually selected by an ESL expert from the wiki, Cambridge, or BBC dictionary. Figure 4 shows the interface of the post-test. In the pretest, only the test panel, as shown in Figure 4 (B), was presented to students. The students were asked to finish the randomly assigned 15 question sets in the pre-test and a background questionnaire. During the post-test section, example sentences generated by EMLA, CMLA, or the random baseline will be presented in the example panel as shown in Figure 4 A. A maximum of three example sentences for each word can be obtained by clicking the readme button. The readme button can help us track how many example sentences were used for learning. Note that the students were asked to answer the same question sets in the post-test so we can measure the improvement they made between the pre-test and the post-test. For each question set, the model used for sentence selection was also randomly assigned in order to prevent learners from getting tired from the useless example sentences. Different from the sentence selection in Section 4.3, where all the combinations with the highest score in the quiz are selected, we picked the most common three example sentences from the combination to fulfill the experimental design. Here, we assume the most common three sentences for each word would be the best candidate in all the combinations. + +# 5.2 Results and Discussion + +When learning from example sentences from EMLA, 16 students improved. Only 12 and 11 students improved when learning from CMLA and random baseline, suggesting that EMLA helped more. Figure 5 shows the students' improvement score versus proficiency score. + +![](images/e576a1742ccf7e7f235515b3ceb0c05796b8a23a9509c5135f31d6c8e059287c.jpg) +Figure 5: Improvement of 29 learner scores in respect to entailment modeling, context modeling, and random baseline. A total of 16 learners improved when learning on the material generated by entailment modeling. + +
EMLACMLARandom
ImprovementAbove0.750.420.00
Below0.18-0.240.47
# ExamplesAbove4.34*4.43*3.46*
Below5.425.415.41
Difficulty RatingAbove2.402.36*2.39
Below2.582.682.47
+ +Table 5: Analysis of two groups. Above and Below stand for the above-average group and the below-average group respectively. EMLA helps the above-average group the most. We also find that the above-average group reads significantly fewer sentences than the below-average group. However, the below-average group rates the example sentences easier (scores range from 1 to 4 while 1 being "too difficult"). + +To further understand students' behaviors, we separated students into two groups using their English proficiency test scores. Students whose test scores were lower than the average score were grouped into the below-average group and were considered having lower English proficiency, and vice versa. The above-average group and the below-average group had 12 and 17 students respectively. The average improvement scores of the two groups are shown in Table 5. We can see the above-average students benefit more from example sentences while below-average benefit less or even confused by the example sentences. Again, EMLA helps above-average students the most. The random baseline provides a mixed result, and even the above-average students got affected. This echos results from Huang et al. (2017) where students can still learn from the random example sentences but more effort is needed to fully understand the near-synonym and the outcome is unstable. In Figure 5, we can find that there are two outliers in the ran + +dom baseline. The one improved a lot is from the below-average group, and the other one worsen a lot is from the above-average group. This evidence shows the uncertainty of the random baseline. + +We investigated the learner's behavior during the post-test and their questionnaire response toward example difficulty. The result is also shown in Table 5. The above-average students read significantly fewer examples while they also rate examples more difficult. On the other hand, most of the below-average students read all the six examples and rate them relatively easier. Though many above-average students improved in the post-test, we found that there are two of them read less than three examples and thus performed worse in the post-test. Such a case suggests that reading a fair amount of example sentences is required to fully understand the near-synonym. + +# 6 Conclusion + +We introduce the learner-like agent, in particular EMLA, which differentiates the helpfulness of learning materials using inference. Entailment modeling, unlike common context-based near-synonymous word disambiguation, makes inferences to learn the relationship between the example sentences and the question, similar to human behavior. Context modeling in the learner-like agent relies upon additional perturbed examples to mimic human behavior, whereas EMLA already has this ability. The agent can be used to evaluate the helpfulness of learning materials, or—more interestingly—to select the best materials from a large candidate pool. We select good example sentences in practice, which confirms the usefulness of modeling learner behavior. Using the EMLA learner-like agent, we find more helpful learning material for learners, as demonstrated by the learner study. These demonstrate the usefulness of modeling learner behavior using an inference approach. In the future, we would like to explore if the learner-like agent can be extended to materials and data beyond the example sentences for near-synonyms. + +# Acknowledgments + +This research was partially supported by the Ministry of Science and Technology of Taiwan under contracts MOST 108-2221-E-001-012-MY3 and MOST 109-2221-E-001-015-. + +# References + +Asma Ben Abacha and Dina Demner-Fushman. 2016. Recognizing question entailment for medical question answering. In AMIA Annual Symposium Proceedings, volume 2016, page 310. American Medical Informatics Association. +Joanne Boisson, Ting-Hui Kao, Jian-Cheng Wu, Tzu-Hsi Yen, and Jason S. Chang. 2013. Linggle: a web-scale linguistic search engine for words in context. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 139-144. +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. +Mei-Hua Chen and Maosung Lin. 2011. Factors and analysis of common miscollocations of college students in Taiwan. Studies in English Language and Literature. +Tiffany Chien and Jugal Kalita. 2020. Adversarial analysis of natural language inference systems. 2020 IEEE 14th International Conference on Semantic Computing (ICSC). +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. +Jörg Didakowski, Lothar Lemnitzer, and Alexander Geyken. 2012. Automatic example sentence extraction for a contemporary German dictionary. In Proceedings EURALEX, pages 343-349. +Philip Edmonds. 1997. Choosing the word most typical in context using a lexical co-occurrence network. In Proceedings of the Eighth Conference on European Chapter of the Association for Computational Linguistics, pages 507-509. Association for Computational Linguistics. +Chieh-Yang Huang, Mei-Hua Chen, and Lun-Wei Ku. 2017. Towards a better learning of near-synonyms: Automatically suggesting example sentences via fill in the blank. In Proceedings of the 26th International Conference on World Wide Web Companion, pages 293-302. International World Wide Web Conferences Steering Committee. +Aminul Islam and Diana Inkpen. 2010. Near-synonym choice using a 5-gram language model. Research in Computing Sciences, 46:41-52. +Tushar Khot, Ashish Sabharwal, and Peter Clark. 2018. SciTaiL: A textual entailment dataset from science question answering. In AAAI. +Adam Kilgarriff, Milos Husák, Katy McAdam, Michael Rundell, and Pavel Rychly. 2008. GDEX: Automatically finding good dictionary examples in a corpus. In Proc. Euralex. + +Alice Lai, Yonatan Bisk, and Julia Hockenmaier. 2017. Natural language inference from multiple premises. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 100-109, Taipei, Taiwan. Asian Federation of Natural Language Processing. +Yi-Chien Lin, Li-Chun Sung, and Meng Chang Chen. 2007. An automatic multiple-choice question generation scheme for English adjective understanding. In Workshop on Modeling, Management and Generation of Problems/Questions in eLearning, the 15th International Conference on Computers in Education (ICCE 2007), pages 137-142. +Dilin Liu. 2013. Using corpora to help teach difficult-to-distinguish english words. ENGLISH TEACH-ING, 68(3):27-50. +Dilin Liu and Ping Jiang. 2009. Using a corpus-based lexicogrammatical approach to grammar instruction in efl and esl contexts. The Modern Language Journal, 93(1):61-78. +Dilin Liu and Shouman Zhong. 2014. L2 vs. L1 Use of Synonymy: An Empirical Study of Synonym Use/Acquisition. Applied Linguistics, 37(2):239-261. +M. Liu, V. Rus, and L. Liu. 2018. Automatic Chinese multiple choice question generation using mixed similarity strategy. IEEE Transactions on Learning Technologies, 11(2):193-202. +Adam Poliak, Jason Naradowsky, Aparajita Haldar, Rachel Rudinger, and Benjamin Van Durme. 2018. Hypothesis only baselines in natural language inference. In Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, pages 180-191, New Orleans, Louisiana. Association for Computational Linguistics. +Altaf Rahman and Vincent Ng. 2012. Resolving complex cases of definite pronouns: The Winograd schema challenge. In Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pages 777-789, Jeju Island, Korea. Association for Computational Linguistics. +Keisuke Sakaguchi, Yuki Arase, and Mamoru Komachi. 2013. Discriminative approach to fill-in-the-blank quiz generation for language learners. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 238-242, Sofia, Bulgaria. Association for Computational Linguistics. +Eiichiro Sumita, Fumiaki Sugaya, and Seiichi Yamamoto. 2005. Measuring non-native speakers' proficiency of English by using a test with automatically-generated fill-in-the-blank questions. In Proceedings of the Second Workshop on Building Educational Applications Using NLP, EdAppsNLP + +05, pages 61-68, Stroudsburg, PA, USA. Association for Computational Linguistics. +Yuni Susanti, Takenobu Tokunaga, Hitoshi Nishikawa, and Hiroyuki Obari. 2018. Automatic distractor generation for multiple-choice English vocabulary questions. Research and Practice in Technology Enhanced Learning, 13(1):15. +Arseny Tolmachev and Sadao Kurohashi. 2017. Automatic extraction of high-quality example sentences for word learning using a determinantal point process. In Proceedings of the 12th Workshop on Innovative Use of NLP for Building Educational Applications, pages 133-142, Copenhagen, Denmark. Association for Computational Linguistics. +Tong Wang and Graeme Hirst. 2010. Near-synonym lexical choice in latent semantic space. In Proceedings of the 23rd International Conference on Computational Linguistics, pages 1182-1190. Association for Computational Linguistics. +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers). \ No newline at end of file diff --git a/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/images.zip b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..032c6d6d8484619aa8122df78d463729c87a35b6 --- /dev/null +++ b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e3d9173a7874c30b61fe1b323b4818bc03e52379c7ad2bcdc842a71d46dce8b +size 586111 diff --git a/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/layout.json b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..94507bf528fac545a350d1e28d25a788433dede8 --- /dev/null +++ b/assessingthehelpfulnessoflearningmaterialswithinferencebasedlearnerlikeagent/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1340a849d0e6a80f7cdc08c9c0e5ccc27082713c221e928b1294fbebf3754770 +size 359574 diff --git a/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_content_list.json b/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c05255f6fd558e107f9c10c7b6968af3c0ddd941 --- /dev/null +++ b/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb18446142e1ba31ab188ccaed9457e8b2c4c84889e38a7c171a3def323c0031 +size 82086 diff --git a/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_model.json b/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a013b614547bdb50b1e11529ea4aae8f08f370e5 --- /dev/null +++ b/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3921399488f2fa12f6751095088f6f336d3cb3f60534424766963fd3cb8553b7 +size 97717 diff --git a/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_origin.pdf b/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7d0a1dde612c2aa284a9e688fa94e6caa9269800 --- /dev/null +++ b/attentionisallyouneedforchinesewordsegmentation/ff8e3bea-72e7-41bc-99d8-10d7a2072106_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9837e90885e114c6cbaafb5a677c9676cc4c2b65023f246e15c96b7b533ca77 +size 497381 diff --git a/attentionisallyouneedforchinesewordsegmentation/full.md b/attentionisallyouneedforchinesewordsegmentation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..cf69f5039868ed9a4750a9142cb6204b06d03639 --- /dev/null +++ b/attentionisallyouneedforchinesewordsegmentation/full.md @@ -0,0 +1,350 @@ +# Attention Is All You Need for Chinese Word Segmentation + +Sufeng Duan $^{1,2,3}$ , Hai Zhao $^{1,2,3*}$ + +$^{1}$ Department of Computer Science and Engineering, Shanghai Jiao Tong University + +$^{2}$ Key Laboratory of Shanghai Education Commission for Intelligent Interaction and Cognitive Engineering, Shanghai Jiao Tong University, Shanghai, China + +$^{3}$ MoE Key Lab of Artificial Intelligence, AI Institute, Shanghai Jiao Tong University + +1140339019dsf@sjtu.edu.cn, zhaohai@cs.sjtu.edu.cn + +# Abstract + +Taking greedy decoding algorithm as it should be, this work focuses on further strengthening the model itself for Chinese word segmentation (CWS), which results in an even more fast and more accurate CWS model. Our model consists of an attention only stacked encoder and a light enough decoder for the greedy segmentation plus two highway connections for smoother training, in which the encoder is composed of a newly proposed Transformer variant, Gaussian-masked Directional (GD) Transformer, and a biaffine attention scorer. With the effective encoder design, our model only needs to take unigram features for scoring. Our model is evaluated on SIGHAN Bakeoff benchmark datasets. The experimental results show that with the highest segmentation speed, the proposed model achieves new state-of-the-art or comparable performance against strong baselines in terms of strict closed test setting. + +# 1 Introduction + +Chinese word segmentation (CWS) is the task of delimiting word boundaries in a sentence, as a basic and essential task for Chinese and many other East Asian languages which are written without explicit word delimiters, and thus different from alphabetical languages like English. + +Learning from an annotated corpus with segmentation, the CWS task may be generally modeled as a decoder which performs segmentation based on a scoring module in terms of contextual feature based representations. Table 1 summarizes typical CWS models according to their decoding ways. + +Markov models such as (Ng and Low, 2004) and (Zheng et al., 2013) depend on the maximum entropy model or maximum entropy Markov model both with Viterbi decoding. Besides, conditional random field (CRF) or Semi-CRF for sequence labeling has been used for both traditional and neural models though with different representations (Peng et al., 2004; Andrew, 2006; Wang and Xu, 2017; Ma et al., 2018). + +Recent neural CWS research have been concerned about the following three perspectives (Emerson, 2005). + +Decoder. As CWS is a kind of structure learning task, the decoder module generally determines which type of detailed algorithm should be adopted for segmentation, also it may limit the capability of defining feature. As shown in Table 2, not all models can support the word-level features as CWS is a task to predict word boundary. Thus recent works focus on finding more general or flexible decoder design to make model learn the representation of segmentation more effective such as (Cai and Zhao, 2016; Cai et al., 2017). + +Encoder. Practice in various natural language processing tasks has shown that effective representation is essential to the performance improvement. For such a module in neural models, it is more than an encoder now, which is regarded as the most improvement perspective against traditional models. Thus for better CWS, it is crucial to encode the input character, word or sentence into a distinguishable representation. Table 2 summarizes regular feature sets for typical CWS models including ours as well. The building blocks that encoders use include recurrent neural network (RNN) and convolutional neural network (CNN), and long short-term memory (LSTM) network. + +External resources and pre-trained embedding. Using external resource such as pre-trained embeddings or language representation provides + +
Traditional ModelsNeural ModelsDecoding Algorithm
Greedy Model-OursGreedy
Markov Model(Ng and Low, 2004), (Low et al., 2005)MMTNN: (Pei et al., 2014)
(Zheng et al., 2013), LSTM: (Chen et al., 2015)Viterbi
Sequence Labeling ModelCRF: (Peng et al., 2004), semi-CRF: (Andrew, 2006), (Sun et al., 2009)CNN+CRF: (Wang and Xu, 2017), BiLSTM+CRF: (Ma et al., 2018)
General Graph Model(Zhang and Clark, 2007)LSTM+GCNN: (Cai and Zhao, 2016), LSTM+GCNN: (Cai et al., 2017) (Wang et al., 2019a)Beam search
+ +Table 1: The classification of Chinese word segmentation model. + +
ModelsCharactersWords
character basedOursc0, c1, ..., ci, ci+1, ..., cn-
(Zheng et al., 2013), ...ci-2, ci-1, ci, ci+1, ci+2-
(Chen et al., 2015)c0, c1, ..., ci, ci+1, ci+2-
word based(Zhang and Clark, 2007), ...c inwj-1,wj,wj+1wj-1,wj,wj+1
(Cai and Zhao, 2016; Cai et al., 2017)c0, c1, ..., ciw0, w1, ...,wj
+ +Table 2: Feature windows of different models. $i(j)$ is the index of current character(word). + +an alternative for performance improvement other than designing better models (Yang et al., 2017). SIGHAN Bakeoff therefore defines two types of evaluation settings, closed test limits all the data for learning not to be beyond the given training set, while open test does not take this limitation (Emerson, 2005). This work will focus on the closed test setting by finding a better model design for further CWS. + +Generally speaking, both the major difference between traditional and neural models, and what mostly distinguishes the neural models are about the way to represent input sentences, while the options of decoding algorithms are bounded to how to formalize the CWS into a structural learning task. As shown in Table 1, using Markov contextualized features, Markov models and CRF-based models are capable of using Viterbi decoders with polynomial time complexity. Furthermore, to accommodate more rich features means that the model has to take a deeper structural learning which also requires more complex decoding algorithms (Zhang and Clark, 2007; Cai and Zhao, 2016). However, for such a case, deterministic decoding algorithms may have an intractable complexity, thus it forces the model to use an approximate beam search strategy luckily with low-order polynomial time complexity $O(Mnb^2)$ , where $b$ is beam width, $n$ is the sentence size, and $M$ is a constant representing the model complexity. When the beam width $b = 1$ , the beam search will reduce to greedy algorithm with a much better time complexity $O(Mn)$ . + +To make the decoding practical, the beam width + +$b$ has to be carefully tuned for a tradeoff between accuracy and efficiency: A larger $b$ will make the learning and segmentation extremely slow, while a small $b$ cannot sufficiently guarantee the segmentation performance. However, there has long been a unheeded observation that good enough representations can offer good enough segmentation even though only using a greedy segmentation algorithm. (Sproat and Emerson, 2003) create a topline evaluation by using only using vocabulary from test set to perform a greedy segmentation (maximum matching), which yields around $99\%$ F-scores on all datasets. For neural models, (Cai et al., 2017) verify that if the representations are good enough, beam width 1 can still give state-of-the-art performance compared to their early model with a full beam search decoder in (Cai and Zhao, 2016). Therefore, undertaking a fixed greedy segmentation algorithm, this paper only focuses on more effective encoder design for even better representation. + +Our model only consists of attention mechanisms as building blocks plus two highway connections via a virtual hidden layer for smooth training. Our model is simply stacked by a variant of Transformer encoder (Vaswani et al., 2017) and a biaffine attention scorer (Dozat and Manning, 2017). Empowered by the self-attention mechanism, the Transformer has been good at capturing long-range dependencies for input sentence. We propose Gaussian-masked Directional (GD) multihead attention to facilitate the learning of localness, position and directional information for CWS, so + +that we have the proposed GD-Transformer. + +With our further improved encoder, our model uses only simple unigram features to generate representation of sentences for scoring. Our model will be strictly evaluated on benchmark datasets from SIGHAN Bakeoff shared task in terms of closed test setting, and experimental results show that our model achieves new state-of-the-art. + +The technical contributions of this paper can be summarized as follows. + +- To especially enhance the representation of localness information and directional information, we propose a new Gaussian-masked Directional Transformer encoder. +Motivated from a simple design idea, we present a new CWS model which is stacked with only attention blocks. +- With a powerful enough encoder, for the first time, we show that unigram (character) features plus greedy segmentation algorithm can support yielding strong performance instead of using diverse $n$ -gram (character and word) features and highly complex decoding algorithms. + +# 2 Related Work + +(Xue, 2003) first formalize CWS as a sequence labeling task, considering CWS as a supervised learning from annotated corpus with human segmentation. (Peng et al., 2004) further adopt standard sequence labeling tool CRFs for CWS modeling, achieving new state-of-the-art. (Zhao et al., 2006b) show that different character tag sets can make essential impact for segmentation performance. (Zhao et al., 2006a) propose a CWS system developed for Bakeoff-2006 based on CRF, which is based on their proposed 6-tag set for character position tagging and achieved state-of-the-art performance at then. (Zhao and Kit, 2007) present a novel Character tagging based CRF framework which is capable of exploiting global information for performance enhancement. + +Neural word segmentation has been widely used to minimize the efforts in feature engineering. (Zheng et al., 2013) first introduce the neural model into CWS with sliding-window based sequence labeling. (Chen et al., 2015) use LSTM to enhance the learning of long distance information. + +However, introducing neural models themselves does not really introduce substantial performance improvement in terms of strict closed test of SIGHAN Bakeoff according to (Zhao et al., 2017). + +Most researchers actually seek help from joint learning, extra learning resources including dictionaries, pre-trained embedding, deeper information extracted from training set and so on. (1) For joint learning, (Lyu et al., 2016) explore a joint model that performs segmentation, POS-Tagging and chunking simultaneously. (Zhang et al., 2017) present a joint model to enhance the segmentation of Chinese microtext by performing CWS and informal word detection simultaneously. (2) For extra resources or clues, (Wang et al., 2019b) propose to incorporate unlabeled and partially-labeled data. + +Only a few researches are known for concentrating on strengthening the model itself. To accommodate more rich features through a more broadly structural modeling (Cai and Zhao, 2016) propose a neural framework that eliminates context windows and utilize complete segmentation history. (Wang and Xu, 2017) propose a character-based convolutional neural model to capture $n$ -gram features automatically and an effective approach to incorporate word embeddings. (Cai et al., 2017) further improve the model in (Cai and Zhao, 2016) and show that a greedy segmenter can perform fast and accurately in terms of only presenting effective representations. This work follows this line of research by offering even strengthened model design from simple idea, including the least building block type for encoder (attention only), the least feature type for scoring (unigram only) and the least computational complexity for decoding (greedy segmentation). + +The original Transformer encoder consists of a stack of $\mathbf{N}$ identical layers and each layer has one multi-head self-attention layer and one position-wise fully connected feed-forward layer (Vaswani et al., 2017). One residual connection is around two sub-layers and followed by layer normalization. Several variants are proposed to enhance ability of capturing the localness relationship. (Shaw et al., 2018) propose an efficient way to incorporate relative and absolute position representation. (Yang et al., 2018) cast localness modeling as a learnable Gaussian bias to enhance the ability of capturing useful local context. (Kim et al., 2020) propose a Transformer with Gaussian-weighted self-attention to improved speech-enhancement performance. (Zhang et al., 2020b) propose using syntax to guide the text modeling based on self-attention network sponsored Transformer-based encoder. Transformer based pre-trained language + +![](images/2a4f379a08208297025cff2a92bd4eb64f2b98ea696b87cb1797d85772f99ff3.jpg) +Figure 1: The architecture of our model. + +models have become a standard performance enhancement means for various NLP tasks (Zhang et al., 2020a). + +# 3 Models + +Our model for CWS task is composed of an encoder to represent the input and a decoder based on the encoder to perform actual segmentation. Figure 1 is the architecture of our model. The model feeds sentence into encoder. Embedding captures the vector $e$ of the input character sequences of $c$ . The encoder maps vector sequences of $e$ to two sequences of vector which are $v^b$ and $v^f$ as the representation of sentences. With $v^b$ and $v^f$ , the bi-affine scorer scores each segmentation gaps which makes our decoder is as simple as one layer, using a threshold to directly and greedily predict every word boundaries of the input. + +# 3.1 Gaussian-Masked Directional Transformer + +The standard Transformer encoder consists of a stack of $\mathbf{N}$ identical layers and each has one multihead self-attention layer and one position-wise fully connected feed-forward layer. One residual connection is around two sub-layers and followed by layer normalization (Vaswani et al., 2017). + +The proposed Gaussian-masked Directional (GD) Transformer encoder adopts two key architecture revisions over the standard Transformer. (1) + +Our encoder includes three parallel directional encoding pipelines instead of only one bidirectional encoder in the original Transformer. (2) By replacing the standard multi-head self-attention with the proposed Gaussian-masked Directional (GD) multi-head self-attention which captures representations from different directions, the resulted encoder may gain better ability of capturing the localness information and position information for the importance of adjacent characters. + +Encoder Stacks In CWS task, word boundary forms a gap between two adjacent characters and divides one sequence into two parts, one part in front of the gap and one part in the rear of it. The forward encoder and backward encoder are proposed to capture information of two directions which correspond to two parts divided by the gap. Assuming that one unidirectional encoder can capture information from one particular direction, we stack three parallel encoding modules, forward, backward and center encoders as shown in Figure 1. + +The central encoder is to capture information from both directions, which is with the same architecture as the original Transformer. Standard scaled dot-product attention matrix is calculated by dotting query $Q$ with all keys $K$ . For the forward encoder, we forcibly set all values inside the attention matrix representing the character pair relation after the concerned character as 0 so that the encoder can focus on the forward characters. For the backward encoder, we take the similar matrix value setting operations. + +The encoder respectively outputs one forward and one backward representations for each position, and then both are fused with the representation given by the center encoder to form the updated forward and backward representations, respectively. + +$$ +v ^ {b} = r ^ {b} + r ^ {c}, v ^ {f} = r ^ {f} + r ^ {c}, +$$ + +where $v^b$ and $v^f$ represent the backward and forward representation, respectively, $r^b$ , $r^c$ and $r^f$ are representations from backward encoder, center encoder and forward encoder, respectively. + +Gaussian-Masked Directional Multi-Head Attention Similar as scaled dot-product attention in the original Transformer (Vaswani et al., 2017), our proposed Gaussian-masked directional attention can be described as a function to map queries and key-value pairs to the representation of input. Here queries, keys and values are all vectors. Standard scaled dot-product attention is calculated by + +dotting query $Q$ with all keys $K$ , dividing each values by $\sqrt{d_k}$ , where $\sqrt{d_k}$ is the dimension of keys, and apply a softmax function to generate the weights in the attention: + +$$ +\operatorname {A t t e n t i o n} (Q, K, V) = \operatorname {s o f t m a x} \left(\frac {Q K ^ {T}}{\sqrt {d _ {k}}}\right) V \tag {1} +$$ + +Different from scaled dot-product attention, Gaussian-masked directional attention expects to pay attention to the adjacent characters of each positions and cast the localness relationship between characters as a fix Gaussian weight for attention. We assume that the Gaussian weight only relies on the distance between characters. + +Firstly we introduce the Gaussian weight matrix $G = (g_{ij})$ which presents the localness relationship between each two characters: + +$$ +g _ {i j} = \Phi (d i s _ {i j}) = \sqrt {\frac {2}{\sigma^ {2} \pi}} \int_ {- \infty} ^ {- d i s _ {i j}} e x p \left(- \frac {x ^ {2}}{2 \sigma^ {2}}\right) d x \tag {2} +$$ + +where $g_{ij}$ is the Gaussian weight between character $i$ and $j$ , $\text{dis}_{ij}$ is the distance between character $i$ and $j$ , $\Phi(x)$ is the cumulative distribution function of Gaussian, $\sigma$ is the standard deviation of Gaussian function and it is a hyperparameter in our method. Eq. (2) ensures the Gaussian weight equals 1 when $\text{dis}_{ij}$ is 0. The larger distance between characteristics, the smaller the weight is, which lets one character affect its neighbors more than those non-neighbors. + +To combine the Gaussian weight to the selfattention, we produce the Hadamard product of Gaussian weight matrix $G$ and the score matrix produced by $QK^T$ + +$$ +A G (Q, K, V) = \operatorname {s o f t m a x} \left(\frac {Q K ^ {T} * G}{\sqrt {d _ {k}}}\right) V \tag {3} +$$ + +where $AG$ as the Gaussian-masked attention ensures that adjacent characters have a stronger relationship than those non-neighborhood ones. + +The scaled dot-product attention models the relationship between two characters without regard to their distances in one sequence. For CWS task, the weight between adjacent characters should be more important while it is hard for self-attention to achieve the effect explicitly because the self-attention cannot get the order of sentences directly. The Gaussian-masked attention adjusts the weight between characters and their adjacent character to a + +![](images/b077ff2b6edb82644c263ed62f0db584b14223fab7be6ffd51687afb76c5134e.jpg) +(a) The architecture of Gaussian-masked directional multi-head attention. +(b) The Gaussian-masked directional attention. +Figure 2: Illustration of Gaussian-masked directional multi-head attention. + +larger value which stands for the effect of adjacent characters. + +For forward and backward encoder, the self-attention sub-layer needs to use a triangular matrix mask to let the self-attention focus on different weights: + +$$ +g _ {i j} ^ {f} = \left\{ \begin{array}{c c} g _ {i j}, & p o s _ {j} \leq p o s _ {i}, \\ - \infty , & o t h e r s. \end{array} \right. \tag {4} +$$ + +$$ +g _ {i j} ^ {b} = \left\{ \begin{array}{c c} g _ {i j}, & p o s _ {i} \leq p o s _ {j}, \\ - \infty , & o t h e r s. \end{array} \right. +$$ + +where $pos_{i}$ is the position of character $c_{i}$ . The triangular matrix for forward and backward encode + +are: $\begin{bmatrix} 1 & 0 & \dots & 0 \\ 1 & 1 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 1 & 1 & \dots & 1 \end{bmatrix}$ $\begin{bmatrix} 1 & 1 & \dots & 1 \\ 0 & 1 & \dots & 1 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & 1 \end{bmatrix}$ + +Similar as (Vaswani et al., 2017), we use multihead attention to capture information from different dimension positions as Figure 2(a) and get Gaussian-masked directional multi-head attention $GMH$ as follows, + +$$ +G M H (Q, K, V) = C o n c a t \left(\text {h e a d} _ {1}, \dots , \text {h e a d} _ {h}\right) W _ {m}, +$$ + +$$ +h e a d _ {i} = A G \left(Q W _ {i} ^ {q}, K W _ {i} ^ {k}, V W _ {i} ^ {v}\right) \tag {5} +$$ + +where $W_{i}^{q}, W_{i}^{k}, W_{i}^{v} \in \mathbb{R}^{d_{k} \times d_{h}}$ is the parameter matrices to generate heads, $W_{m}$ is a parameter matrices of $\mathbb{R}^{d_k \times d_k}$ to generate the attention, $d_{k}$ and + +$d_h$ are dimensions of model and one head, respectively. + +# 3.2 Biaffine Attention Scorer + +Our model straightforwardly predicts gap between two adjacent characters as word boundary or not. In detail, we set a label value 1 to indicate word boundary, and 0 means no word boundary. Such a gap labeling task thus requires information of the two adjacent characters. In the meantime, the relationship between adjacent characters can be represented as the gap label. + +Biaffine attention scorer is used to label the gap (Dozat and Manning, 2017; Li et al., 2018; Cai et al., 2018; Zhou and Zhao, 2019; He et al., 2019). The distribution of labels in a labeling task is often uneven. Biaffine attention uses bias terms to alleviate the burden of the fixed bias term and get the prior probability which makes it different from bilinear attention. The distribution of the gap is uneven that is similar as other labeling task, which makes biaffine available for our task. + +Biaffine attention scorer labels the target depending on information of independent unit and the joint information of two units. In biaffine attention, the score $s_{ij}$ of characters $c_i$ and $c_j$ ( $i < j$ ) is calculated by: + +$$ +\begin{array}{l} s _ {i j} = \text {B i a f f i n a l S c o r e r} \left(v _ {i} ^ {f}, v _ {j} ^ {b}\right) \\ = \left(v _ {i} ^ {f}\right) ^ {T} W v _ {j} ^ {b} + U \left(v _ {i} ^ {f} \oplus v _ {j} ^ {b}\right) + b \tag {6} \\ \end{array} +$$ + +where $v_{i}^{f}$ and $v_{i}^{b}$ represent respectively the forward and backward information of $c_{j}$ , $W$ , $U$ and $b$ are all learnable parameters. $W$ is a matrix with shape $(d_{i} \times N \times d_{j})$ and $U$ is a $(N \times (d_{i} + d_{j}))$ matrix where $d_{i}$ is the dimension of vector $v_{i}^{f}$ and $N$ is the number of labels. + +In our model, the biaffine scorer uses both the forward and backward character information on either side of the gap to distinguish the position of characters. Figure 3 is an example of gap labeling. The bidirectional scoring ensures that the boundaries of words can be determined by adjacent characters with different directional information. The score vector of the gap is formed by the probability of being a boundary of word. Further, the model generates all boundaries using activation function in a greedy decoding way. + +# 3.3 Highway Connections via Hidden Layer + +To smooth the training and fully exploit representations from hidden states, we additionally introduce + +![](images/fba70d2df54f9212f802bfadb4b36c7e49cc761b14fc9b9c74af9464072d6b99.jpg) +Figure 3: An example of biaffine scorer labeling the gap. The biaffine attention scorer only uses the forward information of front character and the backward information of character to label the gap. + +two Highway connections (Srivastava et al., 2015) via a virtual hidden layer which is called Hidden Representations for Early Decoding (HiRED) in the middle of the Transformer encoder. In our model design, we always put the HiRED layer in the central position among all layers of the encoder, thus the HiRED layer divides each directional encoder (forward, backward or center) pipelines into two parts (front and rear) as shown in Figure 1. + +For the highway connection specifications, the first connection (called Highway-I) respectively feeds the input embedding to the rear pipelines of the three directional encoders by adding into the embeddings from HiRED layer. Suppose that three front directional encoders respectively give encoding output, $r^{f'}$ , $r^{c'}$ and $r^{b'}$ . Then the corresponding three rear directional encoders will receive input as $e + r^{f'}$ , $e + r^{c'}$ and $e + r^{b'}$ . To feed the second connection (called Highway-O), we perform the same summing as the main encoder output, + +$$ +v ^ {b ^ {\prime}} = r ^ {b ^ {\prime}} + r ^ {c ^ {\prime}}, v ^ {f ^ {\prime}} = r ^ {f ^ {\prime}} + r ^ {c ^ {\prime}}, +$$ + +then let $v^{f'}$ and $v^{b'}$ as the HiRED output go through another same biaffine scorer and a decoder as that of the main encoder. The two decoder layers together give a sum loss for the entire model. + +Biaffine attentin scorer makes it possible to generate a segmentation by using output of HiRED with little cost during training. With this segmentation, we add representation of characters which belong to the same word together and get a new vector, which plays a similar role as a word embedding. This vector will be fed to encoder layer behind HiRED directly. The operations in HiRED layer can also be viewed as one attention. It makes the model focus on adjacent characters which may + +be likely in one word. + +# 3.4 Training Objective + +The training target of our model is to let the biaffine attention scorer approach the gold score vector according to the gold segmentation. We adopt cross entropy (CE) loss for training, + +$$ +q _ {i} ^ {j} = - s _ {i, i + 1} ^ {j} + \log (\exp (s _ {i, i + 1} ^ {0}) + \exp (s _ {i, i + 1} ^ {1})), +$$ + +$$ +C E = \frac {1}{l} \sum_ {i = 1} ^ {l} \left(q _ {i} ^ {1} p + q _ {i} ^ {0} (1 - p)\right) +$$ + +where $q_{i}^{j}$ is the log-probability of the $i$ -th gap labeled as $j \in \{1,0\}$ . Here 1 indicates word boundary and 0 means not. $s_{i,i+1}^{j}$ is the biaffine score of $i$ -th gap labeled as $j$ . $p$ is the ground-truth probability which can only be 0 or 1. $l$ is the number of gaps in one input sentence. + +
PKUMSR
Sentences19,05686,924
Max length (Character)1019581
Max length (Word)659338
Word Types55,30388,119
Words1,109,9472,368,391
Character Types4,6985,167
Characters1,826,4484,050,469
ASCITYU
Sentences708,95353,019
Max length (Character)188350
Max length (Word)21185
Word Types141,34069,085
Words5,449,6981,455,629
Character Types6,1174,923
Characters8,368,0502,403,355
+ +Table 3: Statistics of SIGHAN Bakeoff 2005 datasets. + +
Parameters
dimension of hidden vector256
number of layer6
dimension of FF1024
dropout0.1
warmup8000
number of head4
batch size4096
+ +Table 4: Hyperparameters. + +# 4 Experiments + +# 4.1 Experimental Settings + +Data Our models are trained and evaluated on benchmark datasets from SIGHAN Bakeoff 2005 (Emerson, 2005) which has four datasets, PKU, MSR, AS and CITYU. Table 3 shows the statistics of train data. F-score is to evaluate the performance. + +Embedding Initialization Our model only adopts unigram features, so we only train character embeddings. On closed test, we use embeddings initialized randomly. On open test, our character embeddings are pre-trained on Chinese Wikipedia corpus by word2vec (Mikolov et al., 2013) toolkit. The corpus for pre-training is converted to simplified Chinese1 and trivially segmented into characters. + +Hyperparameters Our hyperparameter settings are in Table 4. All the settings are tuned on development sets2. We set the standard deviation of Gaussian function in Eq. (2) to 2. Each training batch contains sentences with at most 4096 tokens. + +Optimizer To train our model, we use the Adam (Kingma and Ba, 2015) optimizer with $\beta_{1} = 0.9$ , $\beta_{2} = 0.98$ and $\epsilon = 10^{-9}$ . The learning rate schedule is the same as (Vaswani et al., 2017): + +$lr = d^{-0.5} \cdot \min (step^{-0.5}, step \cdot \text{warmup}_{\text{step}}^{-1.5})$ where $d$ is the dimension of embeddings, $step$ is the step number of training and $\text{warmup}_{\text{step}}$ is the step number of warmup. When the number of steps is smaller than the step of warmup, the learning rate increases linearly and then decreases. + +Hardware and Implements Our models are trained on a single CPU (Intel i7-5960X) and an nVidia 1080 Ti GPU, in terms of an implementation using Pytorch $1.0^{3}$ . + +# 4.2 Results + +Tables 5 compares recent models and ours in terms of closed test setting, showing that our model achieves new state-of-the-art and outperforms all the other models in MSR and AS. In the meantime, our model can achieve state-of-the-art efficiency. + +Our models are also compared to the latest neural models in terms of open test setting in which any external resources, especially pre-trained embeddings or language models are allowedly used. Table 6 shows that our models get comparable results in AS and MSR though unremarkable ones in CITYU and PKU. + +However, it is well known that comparing models accurately is hard for open test setting. Though + +
ModelsPKUMSRASCITYU
F1Tr. (hours)Test (sec.)F1Tr. (hours)Test (sec.)F1Tr. (hours)Test (sec.)F1Tr. (hours)Test (sec.)
(Chen et al., 2015)95.75810596.4117120------
(Cai and Zhao, 2016)95.2489596.496105------
(Cai et al., 2017)95.432597.063095.2--95.4--
(Zhou et al., 2017)95.0--97.2--------
(Ma et al., 2018)95.4--97.5--95.5--95.7--
(Wang et al., 2019a)95.7--97.4--95.6--95.9--
Our results95.533497.615495.7671095.4171.5
+ +external strengths like pre-trained embeddings or models can indeed improve the performance, it is difficult to determine which factor exactly makes such a contribution, the model itself, the resource or the better using of the resource. In terms of closed test setting, that is also the reason why this work keeps focusing on improvement of the model design itself. + +Table 5: Results on SIGHAN Bakeoff datasets in closed test. - indicates there is no reported result in the corresponding paper. (Tr.: Training). + +
PKUMSRASCITYU
(Cai et al., 2017)95.897.195.395.6
(Chen et al., 2017)94.396.094.695.6
(Wang and Xu, 2017)95.797.3--
(Zhou et al., 2017)96.097.8--
(Ma et al., 2018)96.198.196.297.2
(Wang et al., 2019a)96.197.5--
(Huang et al., 2019)96.697.996.697.6
Our Method95.597.795.796.4
+ +Compared with other LSTM models, our model performs better in AS and MSR than in CITYU and PKU. We attribute the performance difference to the impact of dataset sizes. Namely, the larger size is, the better model performs. For small corpus, the model tends to be overfitting. + +Table 5 also shows the decoding time in different datasets. Our model finishes the segmentation with the least decoding time in all four datasets, thanks to the architecture of model which only takes attention mechanism as basic block, only adopts unigram features and a greedy decoding strategy from the very beginning. + +# 4.3 Ablation Studies + +This subsection presents ablation studies on MSR and PKU datasets to verify the benefits of each individual component in our model4. + +Gaussian-masked Directional Transformer. Table 7 gives the result of model with different Gaussian-masked directional self-attention. The third column and the fifth column are the difference of performance between GD-Transformer and other models. The results show that our full model GD-Transformer significantly outperforms the original Transformer by a large performance margin. Removing either Gaussian mask or directional mask will put negative impact over the performance of our model, which shows that both masks are indispensably necessary for our model performance. + +Table 6: F1 scores in open test. + +
PKUMSR
GD-Transformer95.497.6
-Gaussian mask94.6-0.897.1-0.5
-Directional mask95.1-0.397.4-0.2
Transformer94.1-1.396.5-1.1
+ +Table 7: F1 scores on models removing different components from GD-Transformer. + +Highway Connections. Table 8 gives the results of our model respectively removing the highway connections and the related HiRED layer part, which shows that each highway takes its contribution to the overall performance. However, the comparison shows that introducing all the components makes our model training much faster. + +Directional Encoder. Table 9 gives the results of our models respectively removing the forward, center and backward encoders, which impacts performance of our model and shows that directional encoder and undirectional encoders are all indispensable for our model. The third column and the fifth column are the difference of performance between our full model and our models removing one encoder. + +
ModelsPKUMSR
F1Training (hours)F1Training (hours)
Our full model95.53397.615
-Highway-I95.26097.596
-Highway-O95.34597.4102
-both highways95.18097.5105
+ +Table 8: F1 scores and training time on models related to highway connections and HiRED layer. + +
PKUMSR
Our full model95.597.6
-Forward encoder95.3-0.2
-Center encoder95.3-0.2
-Backward encoder95.4-0.1
+ +Table 9: F1 scores of results on model removing different encoder from model. + +# 5 Conclusion + +For Chinese word segmentation, upholding the belief that a better representation is all we need and thus taking a greedy decoder for fast segmentation as the basis, we only focus on the encoder design and propose an attention mechanism only based CWS model. Our model uses the proposed GD-Transformer encoder to take sequence input and biaffine attention scorer to directly predict the word boundaries. To improve the ability of capturing the localness and directional information, Gaussian-masked directional multi-head attention in the GD-Transformer replaces the standard self-attention in the original Transformer. With powerful enough encoding ability, our model only needs unigram features for scoring instead of various $n$ -gram features in previous work. Our model is evaluated on standard benchmark SIGHAN Bakeoff datasets, which shows not only our model performs segmentation faster than any previous models but also gives new higher or comparable segmentation performance against previous state-of-the-art models. + +# References + +Galen Andrew. 2006. A hybrid Markov/semi-Markov conditional random field for sequence segmentation. In Proceedings of the 2006 Conference on Empirical Methods in Natural Language Processing, pages 465-472, Sydney, Australia. Association for Computational Linguistics. + +Deng Cai and Hai Zhao. 2016. Neural word segmentation learning for Chinese. In Proceedings of the + +54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 409-420, Berlin, Germany. Association for Computational Linguistics. + +Deng Cai, Hai Zhao, Zhisong Zhang, Yuan Xin, Yongjian Wu, and Feiyue Huang. 2017. Fast and accurate neural word segmentation for Chinese. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 608-615, Vancouver, Canada. Association for Computational Linguistics. + +Jiaxun Cai, Shexia He, Zuchao Li, and Hai Zhao. 2018. A full end-to-end semantic role labeler, syntactic-agnostic over syntactic-aware? In Proceedings of the 27th International Conference on Computational Linguistics, pages 2753-2765, Santa Fe, New Mexico, USA. Association for Computational Linguistics. + +Xinchi Chen, Xipeng Qiu, Chenxi Zhu, Pengfei Liu, and Xuanjing Huang. 2015. Long short-term memory neural networks for Chinese word segmentation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1197-1206, Lisbon, Portugal. Association for Computational Linguistics. + +Xinchi Chen, Zhan Shi, Xipeng Qiu, and Xuanjing Huang. 2017. Adversarial multi-criteria learning for Chinese word segmentation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1193-1203, Vancouver, Canada. Association for Computational Linguistics. + +Timothy Dozat and Christopher D. Manning. 2017. Deep bioaffine attention for neural dependency parsing. In 5th International Conference on Learning Representations, ICLR 2017, Toulouse, France, April 24-26, 2017, Conference Track Proceedings. + +Thomas Emerson. 2005. The second international Chinese word segmentation bakeoff. In Proceedings of the Fourth SIGHAN Workshop on Chinese Language Processing. + +Shexia He, Zuchao Li, and Hai Zhao. 2019. Syntax-aware multilingual semantic role labeling. 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 5350-5359, Hong Kong, China. Association for Computational Linguistics. + +Weipeng Huang, Xingyi Cheng, Kunlong Chen, Taifeng Wang, and Wei Chu. 2019. Toward Fast and Accurate Neural Chinese Word Segmentation with Multi-Criteria Learning. CoRR, abs/1903.04190. + +Jaeyoung Kim, Mostafa El-Khamy, and Jungwon Lee. 2020. T-GSA: transformer with gaussian-weighted self-attention for speech enhancement. In + +2020 IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP 2020, Barcelona, Spain, May 4-8, 2020, pages 6649-6653. IEEE. +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. +Zuchao Li, Shexia He, Zhuosheng Zhang, and Hai Zhao. 2018. Joint learning of POS and dependencies for multilingual Universal Dependency parsing. In Proceedings of the CoNLL 2018 Shared Task: Multilingual Parsing from Raw Text to Universal Dependencies, pages 65-73, Brussels, Belgium. Association for Computational Linguistics. +Jin Kiat Low, Hwee Tou Ng, and Wenyuan Guo. 2005. A maximum entropy approach to Chinese word segmentation. In Proceedings of the Fourth SIGHAN Workshop on Chinese Language Processing. +Chen Lyu, Yue Zhang, and Donghong Ji. 2016. Joint word segmentation, pos-tagging and syntactic chunking. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA., pages 3007-3014. +Ji Ma, Kuzman Ganchev, and David Weiss. 2018. State-of-the-art Chinese word segmentation with biLSTMs. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4902-4908, Brussels, Belgium. Association for Computational Linguistics. +Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. 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. +Hwee Tou Ng and Jin Kiat Low. 2004. Chinese part-of-speech tagging: One-at-a-time or all-at-once? word-based or character-based? In Proceedings of the 2004 Conference on Empirical Methods in Natural Language Processing, pages 277-284, Barcelona, Spain. Association for Computational Linguistics. +Wenzhe Pei, Tao Ge, and Baobao Chang. 2014. Max-margin tensor neural network for Chinese word segmentation. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 293-303, Baltimore, Maryland. Association for Computational Linguistics. +Fuchun Peng, Fangfang Feng, and Andrew McCallum. 2004. Chinese segmentation and new word detection using conditional random fields. In COLING 2004: Proceedings of the 20th International Conference on Computational Linguistics, pages 562-568, Geneva, Switzerland. COLING. + +Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 464-468, New Orleans, Louisiana. Association for Computational Linguistics. +Richard Sproat and Thomas Emerson. 2003. The first international Chinese word segmentation Bakeoff. In The Second SIGHAN Workshop on Chinese Language Processing, page 133-143. +Rupesh Kumar Srivastava, Klaus Greff, and Jürgen Schmidhuber. 2015. Highway networks. arXiv preprint arXiv:1505.00387. +Xu Sun, Yaozhong Zhang, Takuya Matsuzaki, Yoshimasa Tsuruoka, and Jun'ichi Tsujii. 2009. A discriminative latent variable Chinese segmenter with hybrid word/character information. In Proceedings of Human Language Technologies: The 2009 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pages 56-64, Boulder, Colorado. 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, 4-9 December 2017, Long Beach, CA, USA, pages 5998-6008. +Chunqi Wang and Bo Xu. 2017. Convolutional neural network with word embeddings for Chinese word segmentation. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 163-172, Taipei, Taiwan. Asian Federation of Natural Language Processing. +Xiaobin Wang, Deng Cai, Linlin Li, Guangwei Xu, Hai Zhao, and Luo Si. 2019a. Unsupervised learning helps supervised neural word segmentation. 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 7200-7207. +Xiaobin Wang, Deng Cai, Linlin Li, Guangwei Xu, Hai Zhao, and Luo Si. 2019b. Unsupervised learning helps supervised neural word segmentation. In AAAI. +Nianwen Xue. 2003. Chinese word segmentation as character tagging. In International Journal of Computational Linguistics & Chinese Language Processing, Volume 8, Number 1, February 2003: Special Issue on Word Formation and Chinese Language Processing, pages 29-48. + +Baosong Yang, Zhaopeng Tu, Derek F. Wong, Fandong Meng, Lidia S. Chao, and Tong Zhang. 2018. Modeling localness for self-attention networks. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4449-4458, Brussels, Belgium. Association for Computational Linguistics. +Jie Yang, Yue Zhang, and Fei Dong. 2017. Neural word segmentation with rich pretraining. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 839-849, Vancouver, Canada. Association for Computational Linguistics. +Meishan Zhang, Guohong Fu, and Nan Yu. 2017. Segmenting Chinese microtext: Joint informal-word detection and segmentation with neural networks. In Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, IJCAI 2017, Melbourne, Australia, August 19-25, 2017, pages 4228-4234. +Yue Zhang and Stephen Clark. 2007. Chinese segmentation with a word-based perceptron algorithm. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pages 840-847, Prague, Czech Republic. Association for Computational Linguistics. +Zhuosheng Zhang, Yuwei Wu, Hai Zhao, Zuchao Li, Shuailiang Zhang, Xi Zhou, and Xiang Zhou. 2020a. Semantics-aware BERT for language understanding. 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 9628-9635. AAAI Press. +Zhuosheng Zhang, Yuwei Wu, Junru Zhou, Sufeng Duan, Hai Zhao, and Rui Wang. 2020b. Sg-net: Syntax-guided machine reading comprehension. 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 9636-9643. AAAI Press. +Hai Zhao, Deng Cai, Huang Changning, and Chunyu Kit. 2017. Chinese word segmentation, another decade review (2007-2017). In The Frontier of Empirical and Corpus Linguistics. China Social Sciences Press. +Hai Zhao, Chang-Ning Huang, and Mu Li. 2006a. An improved Chinese word segmentation system with conditional random field. In Proceedings of the Fifth SIGHAN Workshop on Chinese Language Processing, pages 162-165, Sydney, Australia. Association for Computational Linguistics. + +Hai Zhao, Chang-Ning Huang, Mu Li, and Bao-Liang Lu. 2006b. Effective tag set selection in Chinese word segmentation via conditional random field modeling. In Proceedings of the 20th Pacific Asia Conference on Language, Information and Computation, pages 87-94, Huazhong Normal University, Wuhan, China. Tsinghua University Press. +Hai Zhao and Chunyu Kit. 2007. Incorporating global information into supervised learning for Chinese word segmentation. In In 10th Conference of the Pacific Association for Computational Linguistics, pages 66-74. +Xiaoqing Zheng, Hanyang Chen, and Tianyu Xu. 2013. Deep learning for Chinese word segmentation and POS tagging. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 647-657, Seattle, Washington, USA. Association for Computational Linguistics. +Hao Zhou, Zhenting Yu, Yue Zhang, Shujian Huang, Xinyu Dai, and Jiajun Chen. 2017. Word-context character embeddings for Chinese word segmentation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 760-766, Copenhagen, Denmark. Association for Computational Linguistics. +Junru Zhou and Hai Zhao. 2019. Head-Driven Phrase Structure Grammar parsing on Penn Treebank. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2396-2408, Florence, Italy. Association for Computational Linguistics. \ No newline at end of file diff --git a/attentionisallyouneedforchinesewordsegmentation/images.zip b/attentionisallyouneedforchinesewordsegmentation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..a12e5dc81472ce1985f946405150b039b4a06423 --- /dev/null +++ b/attentionisallyouneedforchinesewordsegmentation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8db7e7f0c8e6be2533fe2e13c586f3583698671f3e4e9520cd3199da15ce3060 +size 489145 diff --git a/attentionisallyouneedforchinesewordsegmentation/layout.json b/attentionisallyouneedforchinesewordsegmentation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..5787b40bcd892c2924ec17af92199ced7c1d6261 --- /dev/null +++ b/attentionisallyouneedforchinesewordsegmentation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e4813315753ef1cc3729a0e36da1c4c7786a2423c5ba6183a1ecc3de1569027 +size 388584 diff --git a/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_content_list.json b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7dda15e0766f4a9b3575f6b55697135f5bc01b4d --- /dev/null +++ b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:277328baa0a59bbe4023d604e78bcb779387bb77c20d99e12e328dff2ef767cc +size 139445 diff --git a/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_model.json b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f7203f7ee060ac3196809a9bcdcdd840eae98ffc --- /dev/null +++ b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84be9810f4c82725aabe1a29a32436d9b7cc44810edea6f37d1af591e36f809b +size 171256 diff --git a/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_origin.pdf b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..918b01f631bf2fdcc16d0a401e3c3a0950247fa3 --- /dev/null +++ b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/77f68562-a384-4ace-915f-8b5bb7ec3968_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3dacced5fc0b87ffdb6a4491d2a3f7348ab4c5fc523a09c3a87d4fd232da759 +size 9124897 diff --git a/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/full.md b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/full.md new file mode 100644 index 0000000000000000000000000000000000000000..6d44cd41134eab8442a732fcc3eadaa4532cadfe --- /dev/null +++ b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/full.md @@ -0,0 +1,699 @@ +# Attention is Not Only a Weight: Analyzing Transformers with Vector Norms + +Goro Kobayashi $^{1}$ Tatsuki Kuribayashi $^{1,2}$ Sho Yokoi $^{1,3}$ Kentaro Inui $^{1,3}$ + +$^{1}$ Tohoku University $^{2}$ Langsmith Inc. $^{3}$ RIKEN $\{\text{goro.koba, kuribayashi, yokoi, inui}\} @$ ecei.tohoku.ac.jp + +# Abstract + +Attention is a key component of Transformers, which have recently achieved considerable success in natural language processing. Hence, attention is being extensively studied to investigate various linguistic capabilities of Transformers, focusing on analyzing the parallels between attention weights and specific linguistic phenomena. This paper shows that attention weights alone are only one of the two factors that determine the output of attention and proposes a norm-based analysis that incorporates the second factor, the norm of the transformed input vectors. The findings of our norm-based analyses of BERT and a Transformer-based neural machine translation system include the following: (i) contrary to previous studies, BERT pays poor attention to special tokens, and (ii) reasonable word alignment can be extracted from attention mechanisms of Transformer. These findings provide insights into the inner workings of Transformers. + +# 1 Introduction + +Transformers (Vaswani et al., 2017; Devlin et al., 2019; Yang et al., 2019; Liu et al., 2019; Lan et al., 2020) have improved the state-of-the-art in a wide range of natural language processing tasks. The success of the models has not yet been sufficiently explained; hence, substantial research has focused on assessing the linguistic capabilities of these models (Rogers et al., 2020; Clark et al., 2019). + +One of the main features of Transformers is that they utilize an attention mechanism without the use of recurrent or convolutional layers. The attention mechanism computes an output vector by accumulating relevant information from a sequence of input vectors. Specifically, it assigns attention weights (i.e., relevance) to each input, and sums up input vectors based on their weights. The analysis of correlations between attention weights and + +various linguistic phenomena (i.e., weight-based analysis) is a prominent research area (Clark et al., 2019; Kovaleva et al., 2019; Reif et al., 2019; Lin et al., 2019; Mareček and Rosa, 2019; Htut et al., 2019; Raganato and Tiedemann, 2018; Tang et al., 2018). + +This paper first shows that weight-based analysis is insufficient to analyze the attention mechanism. Weight-based analysis is a common approach to analyze the attention mechanism by simply tracking attention weights. The attention mechanism can be expressed as a weighted sum of linearly transformed vectors (Section 2.2); however, the effect of transformed vectors in weight-based analysis is ignored. We propose a norm-based analysis that considers the previously ignored factors (Section 3). In this analysis, we measure the norms (lengths) of the vectors that were summed to compute the output vector of the attention mechanism. + +Using the norm-based analysis of BERT (Section 4), we interpreted the internal workings of the model in more detail than when weight-based analysis was used. For example, the weight-based analysis (Clark et al., 2019; Kovaleva et al., 2019) reports that specific tokens, such as periods, commas, and special tokens (e.g., separator token; [SEP]), tend to have high attention weights. However, our norm-based analysis found that the information collected from vectors corresponding to special tokens was considerably lesser than that reported in the weight-based analysis, and the large attention weights of these vectors were canceled by other factors. Additionally, we found that BERT controlled the levels of contribution from frequent, less informative words by controlling the norms of their vectors. + +In the analysis of a Transformer-based NMT system (Section 5), we reinvestigated how accurate word alignment can be extracted from the + +source-target attention. The weight-based results of Li et al. (2019), Ding et al. (2019), and Zenkel et al. (2019) have empirically shown that word alignments induced by the source-target attention of the Transformer-based NMT systems are noisy. Our experiments show that more accurate alignments can be extracted by focusing on the vector norms. + +The contributions of this study are as follows: + +- We propose a novel method of analyzing an attention mechanism based on vector norms (norm-based analysis). The method considers attention weights and previously ignored factors, i.e., the norm of the transformed vector. +- Our norm-based analysis of BERT reveals that (i) the attention mechanisms pay considerably lesser attention to special tokens than to observations that are solely based on attention weights (weight-based analysis), and (ii) the attention mechanisms tend to discount frequent words. +- Our norm-based analysis of a Transformer-based NMT system reveals that reasonable word alignment can be extracted from source-target attention, in contrast to the previous results of the weight-based analysis. + +The codes of our experiments are publicly available. + +# 2 Background + +# 2.1 Attention mechanism + +Attention is a core component of Transformers, which consist of several layers, each containing multiple attentions ("heads"). We focused on analyzing the inner workings of these heads. + +As illustrated in Figure 1, each attention head gathers relevant information from the input vectors. A vector is updated by vector transformations, attention weights, and a summation of vectors. Mathematically, attention computes each output vector $\pmb{y}_i\in \mathbb{R}^d$ from the corresponding pre-update vector $\widetilde{\pmb{y}}_i\in \mathbb{R}^d$ and a sequence of input vectors $\mathcal{X} = \{\pmb{x}_1,\dots ,\pmb{x}_n\} \subseteq \mathbb{R}^d$ : + +$$ +\boldsymbol {y} _ {i} = \left(\sum_ {j = 1} ^ {n} \alpha_ {i, j} \boldsymbol {v} \left(\boldsymbol {x} _ {j}\right)\right) \boldsymbol {W} ^ {O} \tag {1} +$$ + +$$ +\alpha_ {i, j} := \operatorname {s o f t m a x} _ {\boldsymbol {x} _ {j} \in \mathcal {X}} \left(\frac {\boldsymbol {q} (\widetilde {\boldsymbol {y}} _ {i}) \boldsymbol {k} \left(\boldsymbol {x} _ {j}\right) ^ {\top}}{\sqrt {d ^ {\prime}}}\right) \in \mathbb {R}, \tag {2} +$$ + +where $\alpha_{i,j}$ is the attention weight assigned to the token $x_{j}$ for computing $y_{i}$ , and $\pmb{q}(\cdot),\pmb{k}(\cdot)$ , and $\pmb{v}(\cdot)$ + +![](images/386a20e191a18668f62b26716e463d9af3853b1e67bd9df3c423168b68c5c353.jpg) +Figure 1: Overview of attention mechanism in Transformers. Sizes of the colored circles illustrate the value of the scalar or the norm of the corresponding vector. + +are the query, key, and value transformations, respectively. + +$$ +\boldsymbol {q} (\widetilde {\boldsymbol {y}} _ {i}) := \widetilde {\boldsymbol {y}} _ {i} \boldsymbol {W} ^ {Q} + \boldsymbol {b} ^ {Q} \quad \left(\boldsymbol {W} ^ {Q} \in \mathbb {R} ^ {d \times d ^ {\prime}}, \boldsymbol {b} ^ {Q} \in \mathbb {R} ^ {d ^ {\prime}}\right) +$$ + +$$ +\boldsymbol {k} (\boldsymbol {x} _ {j}) := \boldsymbol {x} _ {j} \boldsymbol {W} ^ {K} + \boldsymbol {b} ^ {K} \quad \left(\boldsymbol {W} ^ {K} \in \mathbb {R} ^ {d \times d ^ {\prime}}, \boldsymbol {b} ^ {K} \in \mathbb {R} ^ {d ^ {\prime}}\right) +$$ + +$$ +\boldsymbol {v} (\boldsymbol {x} _ {j}) := \boldsymbol {x} _ {j} \boldsymbol {W} ^ {V} + \boldsymbol {b} ^ {V} \quad \left(\boldsymbol {W} ^ {V} \in \mathbb {R} ^ {d \times d ^ {\prime}}, \boldsymbol {b} ^ {V} \in \mathbb {R} ^ {d ^ {\prime}}\right). +$$ + +Attention gathers value vectors $\pmb{v}(\pmb{x}_j)$ based on attention weights and then, applies matrix multiplication $\pmb{W}^O \in \mathbb{R}^{d' \times d}$ (Figure 1). Boldface letters such as $\pmb{x}$ denote row (not column) vectors, following the notations in Vaswani et al. (2017). + +In self-attention, the input vectors $\mathcal{X}$ and the pre-update vector $\widetilde{\pmb{y}}_i$ are previous layer's output representations. In source-target attention, $\mathcal{X}$ corresponds to the representations of the encoder, and vector $\widetilde{\pmb{y}}_i$ (and updated vector $\pmb{y}_i$ ) corresponds to the vector of the $i$ -th input token of the decoder. + +# 2.2 Attention is a weighted sum of vectors + +With a simple reformulation, one can observe that the attention mechanism computes the weighted sum of the transformed input vectors. Because of the linearity of the matrix product, we can rewrite Equation 1 as + +$$ +\boldsymbol {y} _ {i} = \sum_ {j = 1} ^ {n} \left[ \begin{array}{l l} \alpha_ {i, j} & f (\boldsymbol {x} _ {j}) \end{array} \right] \tag {3} +$$ + +![](images/6d56ddcd8b71eb7554842e453cedf900500ba5c3f735353842b8c5128e2f1f27.jpg) +Figure 2: Overview of attention mechanism based on Equation 3. It computes the output vector by summing the weighted vectors; vectors with larger norms have higher contributions. Sizes of the colored circles illustrate the value of the scalar or the norm of the corresponding vector. + +$$ +f (\boldsymbol {x}) := \left(\boldsymbol {x} \boldsymbol {W} ^ {V} + \boldsymbol {b} ^ {V}\right) \boldsymbol {W} ^ {O}. \tag {4} +$$ + +Equation 3 shows that the attention mechanism first transforms each input vector $\pmb{x}$ to generate $f(x)$ ; computes attention weights $\alpha$ ; and then compute the sum $\alpha f(x)$ (see Figure 2). + +# 2.3 Problems encountered in weight-based analysis + +The attention mechanism has been designed to update representations by gathering relevant information from the input vectors. Prior studies have analyzed attention, focusing on attention weights, to ascertain which input vectors contribute (weight-based analysis) (Clark et al., 2019; Kovaleva et al., 2019; Reif et al., 2019; Lin et al., 2019; Mareček and Rosa, 2019; Htut et al., 2019; Raganato and Tiedemann, 2018; Tang et al., 2018). + +Analyses solely based on attention weight are based on the assumption that the larger the attention weight of an input vector, the higher its contribution to the output. However, this assumption disregards the magnitudes of the transformed vectors. The problem encountered when neglecting the effect of $f(\pmb{x}_j)$ is illustrated in Figure 2. The transformed vector $f(\pmb{x}_1)$ for input $\pmb{x}_1$ is assumed to be very small $(\|f(\pmb{x}_1)\| \approx 0)$ , while its attention weight $\alpha_{i,1}$ is considerably large. Note that the small $\alpha_{i,1}f(\pmb{x}_1)$ contributes a little to the output vector $\pmb{y}_i$ because $\pmb{y}_i$ is the sum of $\alpha f(\pmb{x})$ , where a + +larger vector contributes more to the output. Conversely, the large $\alpha_{i,3}f(\pmb{x}_3)$ dominates the output $\pmb{y}_i$ . Therefore, in this case, only considering the attention weight may lead to a wrong interpretation of the high contribution of input vector $\pmb{x}_1$ to output $\pmb{y}_i$ . Nevertheless, $\pmb{x}_1$ hardly has any effect on $\pmb{y}_i$ . + +Analyses based on attention weights have not provided clear results in some cases. For example, Clark et al. (2019) reported that input vectors for separator tokens [SEP] tend to receive remarkably large attention weights in BERT, while changing the magnitudes of these weights does not affect the masked-token prediction of BERT. Such results can be attributed to the aforementioned issue of focusing only on attention weights. + +# 3 Proposal: norm as a degree of attention + +As described in Section 2.3, analyzing the attention mechanism with only attention weights neglects the effect of the transformed vector $f(\pmb{x}_j)$ , which has a significant impact as we discussed later. + +Herein, we propose the measurement of the norm of the weighted transformed vector $\| \alpha f(x)\|$ , given by Equation 3, to analyze the attention mechanism behavior. Unlike in previous studies, we analyzed the behaviors of the norms, $\| \alpha f(x)\|$ and $\| f(x)\|$ , and $\alpha$ to gain more in-depth insights into the functioning of attention. The proposed method of analyzing the attention mechanism is called norm-based analysis and the method that solely analyzes the attention weights is called weight-based analysis. + +In Sections 4 and 5, we provide insights into the working of Transformers using norm-based analysis. Appendix A explains that our norm-based analysis can also be effectively applied to an entire multi-head attention mechanism. + +# 4 Experiments: BERT + +First, we show that the previously ignored transformed-vector norm affects the analysis of attention in BERT (Section 4.1). Applying our norm-based analysis, we re-examine the previous reports on BERT obtained by weight-based analysis (Section 4.2). Next, we demonstrate the previously overlooked properties of BERT (Section 4.3). + +
HeadμσCVMaxMin
Layer 2-Head 4 (max CV)4.261.590.3712.660.96
Layer 2-Head 7 (min CV)4.000.500.126.151.35
Average5.151.170.22--
+ +Table 1: Mean $(\mu)$ , standard deviation $(\sigma)$ , coefficient of variance (CV), and maximum and minimum values of $\|f(\boldsymbol{x})\|$ . In the last row, the former three are averaged over all the heads. + +General settings: Following the previous studies (Clark et al., 2019; Kovaleva et al., 2019; Reif et al., 2019; Lin et al., 2019; Htut et al., 2019), we used the pre-trained BERT-base4, with 12 layers, each containing 12 attention heads. We used the data provided by Clark et al. (2019) for the analysis.5 The data contains 992 sequences extracted from Wikipedia, where each sequence consists of two consecutive paragraphs, in the form of: [CLS] paragraph1 [SEP] paragraph2 [SEP]. Each sequence consists of up to 128 tokens, with an average of 122 tokens. + +# 4.1 Does $f(x)$ have an impact? + +We analyzed the coefficient of variation $(\mathrm{CV})^6$ of previously ignored effect— $\|f(\pmb{x})\|$ to first demonstrate the degree to which $\|\alpha f(\pmb{x})\|$ differs from weight $\alpha$ . We computed the CV of $\|f(\pmb{x})\|$ of all the example data for each head. Table 1 shows that the average CV is 0.22. Typically, the value of the norm $\|f(\pmb{x})\|$ varies from 0.78 to 1.22 times the average value of the $\|f(\pmb{x})\|$ . Thus, there is a difference between the weight $\alpha$ and $\|\alpha f(\pmb{x})\|$ due to the dispersion of $\|f(\pmb{x})\|$ , which motivated us to consider $\|f(\pmb{x})\|$ in the attention analysis. Appendix B presents the detailed results. + +# 4.2 Re-examining previous observation + +In this section, with the application of our norm-based analysis, we reinvestigate the previous observation of Clark et al. (2019); they analyzed BERT using the weight-based analysis. + +Settings: First, all the data were fed into BERT. Then, the weight $\alpha$ and $\| \alpha f(\pmb {x})\|$ were collected from each head. Following Clark et al. (2019), we report the results of the following categories: (i) + +![](images/9e6c12469d207f5474aca184759a3b19ac5f8a864b2bc64b0d1c97d75c4201cf.jpg) + +![](images/effe9ee3f4d01ace34b376f7b27b605636c4cc2989ce3d318efac66e9b8f5c02.jpg) +(a) Weight-based analysis. +(b) Norm-based analysis. +Figure 3: Each point corresponds to averaged $\alpha$ or $\| \alpha f(\pmb {x})\|$ on a word category in a given layer. Note that, in each layer, the sum of $\alpha$ among all the categories is 1. The $x$ -axis denotes the index of the layers. + +
Token categoryNumber of vectorsSpearman's ρ
[CLS]17,443,296-0.34
[SEP]34,886,592-0.69
comma & period182,838,528-0.25
Others1,944,928,224-0.06
+ +Table 2: Spearman rank correlation coefficient between $\alpha$ and $\| f(\pmb {x})\|$ in each token category. + +[CLS], (ii) [SEP], (iii) periods and commas, and (iv) the other tokens. More specific descriptions of the experiments are provided in Appendix D. + +Results: The weight-based and norm-based analyses exhibited entirely different trends (Figure 3). The vectors for specific tokens—[CLS], [SEP], and punctuations—have remarkably large attention weights, which is consistent with the report of Clark et al. (2019). In contrast, our norm-based analysis demonstrated that the contributions of vectors corresponding to these tokens were generally small (Figure 3b). The result demonstrates that the size of the transformed vector $f(\boldsymbol{x})$ plays a considerable role in controlling the amount of information obtained from the specific tokens. + +Clark et al. (2019) hypothesized that if the necessary information is not present in the input vectors, BERT assigns large weights to [SEP], which appears in every input sequence, to avoid the incorporation of any additional information via at + +tention.7 Clark et al. (2019) called this operation no-operation (no-op). However, it is unclear whether assigning large attention weights to [SEP] realizes the operation of collecting little information from the input sequence. + +Our norm-based analysis demonstrates that the amount of information from the vectors corresponding to [SEP] is small (Figure 3b). This result supports the interpretation that BERT conducts "no-op," in which attention to [SEP] is considered a signal that does not collect anything. Additionally, we hope that our norm-based analysis can provide a better interpretation of other existing findings. + +Analysis—The relationship between $\alpha$ and $\|f(x)\|$ : It remains unclear how attention collects only a little information while assigning a high attention weight to a specific token, [SEP]. Here, we demonstrate an interesting trend of $\alpha$ and $\|f(x)\|$ cancelling each other out on the tokens. Table 2 shows the Spearman rank correlation coefficient between $\alpha$ and $\|f(x)\|$ , corresponding to the vectors in each category. The weight $\alpha$ and the norm $\|f(x)\|$ have a negative correlation in terms of [CLS], [SEP], periods, and commas. This cancellation manages to collect a little information even with large weights. + +Figure 4 illustrates the contrast between $\alpha$ and $\| f(\pmb {x})\|$ corresponding to [SEP] in each head. For most of the heads, $\alpha$ and $\| f(\pmb {x})\|$ clearly negate the magnitudes of each other. A similar trend was observed in [CLS], periods, and commas. Conversely, no significant trend was observed in the other tokens (see Appendix D.3). + +Figure 5 shows $1\%$ randomly selected pairs of $\alpha$ and $\| f(\pmb {x})\|$ in each word category. Even when the same weight $\alpha$ is assigned, $\| f(\pmb {x})\|$ can vary, suggesting that $\alpha$ and $\| f(\pmb {x})\|$ play a different roles in attention. + +# 4.3 Relation between frequency and $\| f(x)\|$ + +In the previous section, we demonstrated that $\| f(\pmb {x})\|$ corresponding to the specific tokens (e.g., [SEP]) is small. Based on the high frequencies of + +![](images/7d1c64c0aef320cb9a3bb9bd128cff77c295d22c274355e4b5c24f239e292fa7.jpg) +(a) $\alpha$ + +![](images/e3e557d64e66f45c19a0efb93c1d5f338b050e596eb7e4e927aef382b5d7b2bc.jpg) +(b) $\| f(\pmb {x})\|$ + +![](images/3bcc133f4968dbaf851875a31b011f3f7d37f269b3165f3bdfc62c6dd4e48d79.jpg) +Figure 4: The higher value of averaged $\alpha$ or $\| f(\pmb {x})\|$ for [SEP] tokens in a given head, the darker its cell. +Figure 5: Relationship between $\alpha$ and $\|f(\pmb{x})\|$ . Each plot corresponds to a pair of $\alpha_{i,j}$ and $\|f(\pmb{x}_j)\|$ in one of the attention heads. Each plot is colored by the word category corresponding to $\pmb{x}_j$ . Visualizations by category are shown in Appendix D.3. + +these word types $^{10}$ , we hypothesized that BERT controlled contributions of highly frequent, less informative words by adjusting the norm of $f(\pmb{x})$ . + +Settings: First, all the data were fed into the model. Then, for each input token $t$ , we collected the weight $\alpha$ and $\| f(\boldsymbol{x})\|$ . We averaged $\alpha$ and $\| f(\boldsymbol{x})\|$ for all the heads for each $t$ to analyze the trend of the entire model. Let $r(\cdot)$ be a function that returns the frequency rank of a given word.[11] We analyzed the relationship of $r(t)$ with $\alpha$ and $\| f(\boldsymbol{x})\|$ . + +Results: The Spearman rank correlation coefficient between the frequency rank $r(t)$ and $\| f(\pmb{x})\|$ was 0.75, indicating a strong positive correlation. In contrast, the Spearman rank correlation coefficient did not show any correlation $(\rho = 0.06)$ between $r(t)$ and $\alpha$ . The visualizations of their relationships are shown in Appendix D.4. + +These results demonstrate that the self- + +attentions in BERT reduce the information from highly frequent words by adjusting $\| f(x)\|$ and not $\alpha$ . This frequency-based effect is consistent with the intuition that highly frequent words, such as stop words, are unlikely to play an important role in solving the pre-training tasks (masked-token prediction and next-sentence prediction). + +# 5 Experiments: Transformer for NMT + +Additionally, we analyzed the source-target attention in a Transformer-based NMT system. One major research topic in the NMT field is whether NMT systems internally capture word alignment between source and target texts, and if so, how word alignment can be extracted from black-box NMT systems. Li et al. (2019), Ding et al. (2019), and Zenkel et al. (2019) empirically showed, using the weight-based method, that word alignment induced by the attention of the Transformer is noisy. In this section, we show the analysis of source-target attention using vector norms $\| \alpha f(\pmb{x})\|$ and demonstrate that clean alignments can be extracted from the source-target attention. Word alignment can be used to provide rich information for the users of NMT systems (Ding et al., 2019). + +Experimental procedure: Following Zenkel et al. (2019) and Ding et al. (2019), we trained a Transformer-based NMT system for German-to-English translation on the Europarl v7 corpus13. Next, we extracted word alignments from $\alpha$ and $\| \alpha f(\pmb{x})\|$ under the force decoding setup. Finally, we evaluated the derived alignment using the alignment error rate (AER) (Och and Ney, 2000). A low AER score indicates that the extracted word alignments are close to the reference. We used the gold alignment dataset provided by Vilar et al. (2006)14. Experiments were performed on five random seeds, and the average AER scores were reported. The experimental settings are detailed in Appendix E. + +# 5.1 Alignment extraction from attention + +Weights or norms: A typical alignment extraction method uses attention weights (Li et al., 2019; Ding et al., 2019; Zenkel et al., 2019). Specifically, given a source-target sentence pair, + +![](images/f1bebfd62eefe8333224a3494a0e4e86144358c33d3a89746fa264977f1454c9.jpg) +Figure 6: An example of behavior of the source-target attentions in an NMT system (German-to-English). At- tentions in the earlier layers focus the source word "ein" aligned with the input word "a," while those in the latter layers focus the source word "Schuler" aligned with the output word "student." + +$\{s_1,\ldots ,s_J\}$ and $\{t_1,\dots ,t_I\}$ , word alignment is estimated by calculating a source word $s_j$ that has the highest weight when generating a target word $t_i$ . We call this method the weight-based alignment extraction. In contrast, we propose a norm-based alignment extraction method that extracts word alignments based on $\| \alpha f(\pmb {x})\|$ instead of $\alpha$ . Formally, in these methods, the source word $s_j$ with the highest attention weight or norm during the generating of target word $t_i$ is extracted as the word that is aligned with $t_i$ : + +$$ +\underset {s _ {j}} {\operatorname {a r g m a x}} \alpha_ {i, j} \quad \text {o r} \quad \underset {s _ {j}} {\operatorname {a r g m a x}} \| \alpha_ {i, j} f (\boldsymbol {x} _ {j}) \|. \tag {5} +$$ + +In Section 5.2, following Li et al. (2019), we analyze the word alignments that we obtained from each layer by integrating $H$ heads within the same layer: + +$$ +\operatorname * {a r g m a x} _ {s _ {j}} \sum_ {h = 1} ^ {H} \alpha_ {i, j} ^ {h} \quad \text {o r} \quad \operatorname * {a r g m a x} _ {s _ {j}} \| \sum_ {h = 1} ^ {H} \alpha_ {i, j} ^ {h} f ^ {h} (\boldsymbol {x} _ {j}) \|, +$$ + +where $f^{h}(\pmb{x}_{j})$ and $\alpha_{i,j}^{h}$ are the transformed vector and the attention weight at the $h$ -th head, respectively. + +Alignment with input or output word: In our preliminary experiments (Appendix E.3), we observed that the behavior of the source-target attention of the decoder differs between the earlier and later layers. As shown in Figure 6, at the time decoding the word $t_{i+1}$ with the input $t_i$ , attention heads in the earlier layers assign large weights or norms to $s_j$ corresponding to the input $t_i$ "a," whereas those in the latter layers assign large values to $s_j$ corresponding to the output word $t_{i+1}$ "student." + +Based on this observation, we explored two settings for investigating alignment extraction methods: alignment with output (AWO) and alignment with input (AWI). The AWO setting refers to the approach introduced in Equation 5. Specifically, alignments $(s_j, t_i)$ were extracted by considering a source word $s_j$ that gained the highest weight (norm) when outputting a particular target word $t_i$ . + +In the AWI setting, alignments $(s_j,t_i)$ were extracted by considering a source word $s_j$ that gained the highest weight (norm) when inputting the word $t_i$ (i.e., predicting a word $t_{i + 1}$ ). Formally, alignment with the AWI setting is calculated as follows: + +$$ +\underset {s _ {j}} {\operatorname {a r g m a x}} \alpha_ {i + 1, j} \quad \text {o r} \quad \underset {s _ {j}} {\operatorname {a r g m a x}} \| \alpha_ {i + 1, j} f (\boldsymbol {x} _ {j}) \|. \tag {6} +$$ + +# 5.2 Comparative experiments + +We compared the quality of the alignments that were obtained by the following six methods: + +- norm-based extraction with the AWO/AWI settings +- weight-based extraction with the AWO/AWI settings (Li et al., 2019; Zenkel et al., 2019; Ding et al., 2019) +- gradient-based extraction (Ding et al., 2019) +- existing word aligners (Och and Ney, 2003; Dyer et al., 2013) + +We report the best and averaged AER scores across the layers. In addition, we report on the AER score at the head and the layer with the highest average $\| \alpha f(\pmb{x}) \|$ in the norm-based extraction. The settings are detailed in Appendix E.2. + +The AER scores of each method are listed in Table 3. The results show that word alignments extracted using the proposed norm-based approach are more reasonable than those extracted using the weight-based approach. Additionally, better word alignments were extracted in the AWI setting than in the AWO setting. The alignment extracted using the layer with the highest average $\| \alpha f(\boldsymbol{x}) \|$ in the AWI setting is better than the gradient-based method, and competitive with one of the existing word aligners—fast_align.[16] These results + +
MethodsAER±SD
Transformer - Attention-based Approach — Alignment with output setting —
Weight-based
layer mean68.41.0
best layer (layer 4 or 5)47.71.7
Norm-based (ours)
layer mean62.90.7
best layer (layer 5)41.41.4
layer with the highest average ||αf(x)||83.01.1
head with the highest average ||αf(x)||87.12.3
— Alignment with input setting —
Weight-based
layer mean68.51.9
best layer (layer 2)29.83.7
Norm-based (ours)
layer mean60.41.3
best layer (layer 2)25.01.5
layer with the highest average ||αf(x)||25.01.5
head with the highest average ||αf(x)||35.521.0
Transformer - Gradient-based Approach SmoothGrad from Ding et al. (2019)36.4-
Word Aligner
fast_align from Zenkel et al. (2019)28.4-
GIZA++ from Zenkel et al. (2019)21.0-
+ +Table 3: AER scores with different methods for German-to-English translation. The closer the extracted word alignment is to the reference, the lower the AER score. The "layer mean" denotes the average of AER scores across all layers. Each value is the average of five random seeds. + +show that much clearer word alignments can be extracted from a Transformer-based NMT system than the results reported by existing research. + +The primary reason behind the differences between the results of the weight- and norm-based methods was analogous to the finding discussed in Section 4.2, while some specific tokens, such as $\langle /s\rangle$ , the special token for the end of the sentence, tended to obtain heavy attention weights; their transformed vectors were adjusted to be smaller, as shown in Figure 7. + +# 5.3 Relationship between norms and alignment quality + +We further analyze the relationship between $\| \alpha f(\pmb {x})\|$ and AER scores in the head-level. Figures 8a and 8b show the AER scores of the alignments obtained by the norm based extraction at each head in the AWO and AWI settings. Figure 8c shows the average of $\| \alpha f(\pmb {x})\|$ at each head. The small $\| \alpha f(\pmb {x})\|$ implies that $\alpha$ and $\| f(\pmb {x})\|$ tend to cancel out in the head. + +Comparing Figures 8a and 8c, the average $\| \alpha f(\pmb {x})\|$ and AER scores in the AWI setting + +![](images/3bf2b6561905a345e60b56ac0091a1d6a1bf99469c92672c88cd5bb713cd05e1.jpg) +(a) Reference. + +![](images/f4c8f995069db90ee157835fdd5a7825dac80de94ac149d55c9868a36ff109dd.jpg) +(b) $\alpha$ +Figure 7: Examples of the reference and extracted alignments using each method in layer 2 (best layer) in the AWI setting on one out of five seeds. Two misalignments in the weight-based extraction were resolved in the norm-based analysis—alignments with the green frame. Examples of the extracted alignments in all the layers are shown in Appendix E.4. + +![](images/30b4de860e27a2bc8f97310c3e568fc53d482b5a4552b9b72fa58a271adf1ced.jpg) +(c) $\| \alpha f(\pmb {x})\|$ + +are inversely correlated (the Spearman rank and Pearson correlation coefficients are $-0.44$ and $-0.52$ , respectively). This result is consistent with Table 3, where the head or the layer with the highest average $\|\alpha f(\pmb{x})\|$ provides clean alignments in the AWI setting. This result suggests that Transformer-based NMT systems may rely on specific heads that align source and target tokens. This result is also consistent with the existing reports that pruning some attention heads in Transformers does not change its performance; on the contrary, it improves the performance (Michel et al., 2019; Kovaleva et al., 2019). + +In contrast, in the AWO setting (Figures 8b and 8c), such a negative correlation is not observed; rather, a positive correlation is observed (Spearman's $\rho$ is 0.56, and the Pearson's $r$ is 0.55). Actually, in the AWO setting, the alignments extracted from the head/layer with the highest $\| \alpha f(\pmb{x})\|$ is considerably worse than those from the other settings in Table 3. Investigating the reason for these contrasting results would be our future work. In Appendix F, we also present the results of a model with a different number of heads. + +# 6 Related work + +# 6.1 Probing of Transformers + +Transformers are used for many NLP tasks. Many studies have probed their inner workings to understand the mechanisms underlying their success (Rogers et al., 2020; Clark et al., 2019). + +There are mainly two probing perspectives to investigate these models; they differ based on whether the target of the analysis is per-token level or it considers token-to-token interactions. The + +first category assesses a single word or phrase-level linguistic capabilities of BERT, such as its performance on part-of-speech tagging and word sense disambiguation performance (Tenney et al., 2019; Jawahar et al., 2019; Reif et al., 2019; Lin et al., 2019; Wallace et al., 2019). + +The latter category explores the ability of Transformers to capture token-to-token interactions, such as syntactic relations and word alignment in the translation (Clark et al., 2019; Kovaleva et al., 2019; Htut et al., 2019; Reif et al., 2019; Lin et al., 2019; Goldberg, 2019; Ding et al., 2019; Zenkel et al., 2019; Li et al., 2019; Raganato and Tiedemann, 2018). The present study is closely related to the latter group; we have provided insights into the token-to-token attention in Transformer-based systems. + +# 6.2 Analyzing the token-to-token interaction + +Two types of methods are mainly considered to analyze the token-to-token interactions in Transformers. One is to track the attention weights, and the other is to check the gradient of the output with respect to the input of attention mechanisms. + +Weight-based analysis: Many studies have analyzed the linguistic capabilities of Transformers by tracking attention weights. This type of analysis has covered a wide range of subjects, including syntactic and semantic relationships (Tang et al., 2018; Raganato and Tiedemann, 2018; Clark et al., 2019; Reif et al., 2019; Jawahar et al., 2019; Htut et al., 2019; Kovaleva et al., 2019; Mareček and Rosa, 2019). However, as outlined in Section 2.3, these studies have ignored the effect of $f(x)$ . It has been actively discussed so far whether the attention weights can be interpreted to explain + +![](images/5f1003c9d86719363f949aa9155db2a33fe97426aeca93c75f8383f09170c5ba.jpg) +(a) AER in the AWI setting. + +![](images/a686e8fe801bb929bc219c5490bd6c10d87ea7ad580316b0b256ab492c284df6.jpg) +(b) AER in the AWO setting. +Figure 8: AER scores and averaged $\| \alpha f(\pmb{x})\|$ in each head on one out of five seeds. The closer the extracted word alignment is to the reference, the lower the AER score—the lighter the color. The larger the averaged $\| \alpha f(\pmb{x})\|$ , the darker the color. + +![](images/19c7ac9c70eda3d5d24dc0322c687dea0bdc3776447a1b7cb114a5b4f7e6faf9.jpg) +(c) Averaged $\| \alpha f(\pmb {x})\|$ + +the models (Jain and Wallace, 2019; Serrano and Smith, 2019; Wiegreffe and Pinter, 2019; Pruthi et al., 2020; Vashisth et al., 2019). + +Brunner et al. (2020) have introduced "effective attention," which has upgraded the weight-based analysis. Their proposal is similar to ours; they exclude attention weights that do not affect the output owing to the application of transformation $f$ and input $x$ in the analysis. However, our proposal differs from theirs in some aspects. Specifically, we aim to analyze the behavior of the whole attention mechanism more accurately, whereas they aim to make the attention weights more accurate. Furthermore, the effectiveness of their approach depends on the length of an input sequence; however, ours approach does not have such a limitation (see Appendix G). Additionally, we incorporate the scaling effects of $f$ and $x$ , whereas Brunner et al. (2020) have considered only the binary effect—either the weight is canceled or not. + +Gradient-based analysis: In the gradient analysis, the contribution of the input with respect to the output of the attention mechanism is calculated using the norm of a gradient matrix between the input and the output vector (Pascual et al., 2020). Intuitively, such gradient-based methods measure the change in the output vector with respect to the perturbations in the input vector. Estimating the contribution of $\mathbf{a}$ to $\mathbf{b} = \sum k\mathbf{a}$ by computing the gradient $\partial \mathbf{b} / \partial \mathbf{a}$ ( $= k$ ) is analogous to estimating the contribution of $\mathbf{x}$ to $\mathbf{y} = \sum \alpha f(\mathbf{x})$ by observing only an attention weight $\alpha$ . The two ap + +proaches have the same kind of problems; that is, both ignore the magnitude of the input, $\pmb{a}$ or $f(\pmb{x})$ . + +# 7 Conclusions and future work + +This paper showed that attention weights alone are only one of two factors that determine the output of attention. We proposed the incorporation of another factor, the transformed input vectors. Using our norm-based method, we provided a more detailed interpretation of the inner workings of Transformers, compared to the studies using the weight-based analysis. We hope that this paper will inspire researchers to have a broader view of the possible methodological choices for analyzing the behavior of Transformer-based models. + +We believe that these findings can provide insights not only into the interpretation of the behaviors of Blackbox NLP systems but also into developing a more sophisticated Transformer-based system. One possible direction is to design an attention mechanism that can collect almost no information from an input sequence as the current systems achieve it by exploiting the [SEP] token. + +In future work, we plan to apply our norm-based analysis to attention in other models, such as finetuned BERT, RoBERTa (Liu et al., 2019), and ALBERT (Lan et al., 2020). Furthermore, we expect to extend the scope of analysis from the attention to an entire Transformer architecture to better understand the inner workings and linguistic capabilities of the current powerful systems in NLP. + +# Acknowledgments + +We would like to thank the anonymous reviewers of the EMNLP 2020 and the ACL 2020 Student Research Workshop (SRW), and the SRW mentor Junjie Hu for their insightful comments. We also thank the members of Tohoku NLP Laboratory for helpful comments. This work was supported by JSPS KAKENHI Grant Number JP19H04162. This work was also partially supported by a Bilateral Joint Research Program between RIKEN AIP Center and Tohoku University. + +# References + +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. 2016. Layer Normalization. arXiv preprint arXiv:1607.06450. +Gino Brunner, Yang Liu, Damian Pascual, Oliver Richter, Massimiliano Ciaramita, and Roger Wattenhofer. 2020. On Identifiability in Transformers. In 8th International Conference on Learning Representations (ICLR). +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. +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), pages 4171-4186. +Shuoyang Ding, Hainan Xu, and Philipp Koehn. 2019. Saliency-driven Word Alignment Interpretation for Neural Machine Translation. In Proceedings of the 4th Conference on Machine Translation (WMT), pages 1-12. +Chris Dyer, Victor Chahuneau, and Noah A Smith. 2013. A Simple, Fast, and Effective Reparameterization of IBM Model 2. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NACCL-HLT), pages 644-648. +Yoav Goldberg. 2019. Assessing BERT's Syntactic Abilities. arXiv preprint arXiv:1901.05287. +Phu Mon Htut, Jason Phang, Shikha Bordia, and Samuel R. Bowman. 2019. Do Attention Heads in BERT Track Syntactic Dependencies? arXiv preprint arXiv:1911.12246. + +Sarthak Jain and Byron C Wallace. 2019. Attention is not Explanation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), pages 3543-3556. +Ganesh Jawahar, Benoit Sagot, and Djamé Seddah. 2019. What Does BERT Learn about the Structure of Language? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL), pages 3651-3657. +Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. 2019. Revealing the Dark Secrets of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4364-4373. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. In 8th International Conference on Learning Representations (ICLR). +Xintong Li, Guanlin Li, Lemao Liu, Max Meng, and Shuming Shi. 2019. On the Word Alignment from Neural Machine Translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL), pages 1293-1303. +Yongjie Lin, Yi Chern Tan, and Robert Frank. 2019. Open Sesame: Getting Inside BERT's Linguistic Knowledge. Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 241-253. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv preprint arXiv:1907.11692. +David Mareček and Rudolf Rosa. 2019. From Balustrades to Pierre Vinken: Looking for Syntax in Transformer Self-Attentions. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 263-275. +Paul Michel, Omer Levy, and Graham Neubig. 2019. Are Sixteen Heads Really Better than One? In Advances in Neural Information Processing Systems 32 (NIPS), pages 14014-14024. +Franz Josef Och and Hermann Ney. 2000. Improved Statistical Alignment Models. In Proceedings of the 38th Annual Meeting of the Association for Computational Linguistics (ACL), pages 440-447. +Franz Josef Och and Hermann Ney. 2003. A Systematic Comparison of Various Statistical Alignment Models. Computational Linguistics, 29(1):19-51. + +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. +Damian Pascual, Gino Brunner, and Roger Wattenhofer. 2020. Telling BERT's full story: from Local Attention to Global Aggregation. arXiv preprint arXiv:2004.05916. +Danish Pruthi, Mansi Gupta, Bhuwan Dhingra, Graham Neubig, and Zachary C Lipton. 2020. Learning to Deceive with Attention-Based Explanations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (ACL). +Alessandro Raganato and Jörg Tiedemann. 2018. An Analysis of Encoder Representations in Transformer-Based Machine Translation. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 287-297. +Emily Reif, Ann Yuan, Martin Wattenberg, Fernanda B Viegas, Andy Coenen, Adam Pearce, and Been Kim. 2019. Visualizing and Measuring the Geometry of BERT. Advances in Neural Information Processing Systems 32 (NIPS), pages 8594-8603. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2020. A Primer in BERTology: What we know about how BERT works. arXiv preprint arXiv:2002.12327. +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 (ACL), pages 1715-1725. +Sofia Serrano and Noah A Smith. 2019. Is Attention Interpretable? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL), pages 2931-2951. +Gongbo Tang, Rico Sennrich, and Joakim Nivre. 2018. An Analysis of Attention Mechanisms: The Case of Word Sense Disambiguation in Neural Machine Translation. In Proceedings of the 3rd Conference on Machine Translation (WMT): Research Papers, pages 26-35. +Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R Thomas McCoy, Najoung Kim, Benjamin Van Durme, Samuel R Bowman, Dipanjan Das, and Ellie Pavlick. 2019. What do you learn from context? Probing for sentence structure in contextualized word representations. In 7th International Conference on Learning Representations (ICLR). + +Shikhar Vashishth, Shyam Upadhyay, Gaurav Singh Tomar, and Manaal Faruqui. 2019. Attention Interpretability Across NLP Tasks. arXiv preprint arXiv:1909.11218. +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is All you Need. In Advances in Neural Information Processing Systems 30 (NIPS), pages 5998-6008. +David Vilar, Maja Popovic, and Hermann Ney. 2006. AER: Do we need to "improve" our alignments? In International Workshop on Spoken Language Translation (IWSLT) 2006, pages 205-212. +Eric Wallace, Yizhong Wang, Sujian Li, Sameer Singh, and Matt Gardner. 2019. Do NLP Models Know Numbers? Probing Numeracy in Embeddings. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5307-5315. +Sarah Wiegrefe and Yuval Pinter. 2019. Attention is not not Explanation. 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 11-20. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. XLNet: Generalized Autoregressive Pretraining for Language Understanding. In Advances in Neural Information Processing Systems 32 (NIPS), pages 1-18. +Thomas Zenkel, Joern Wuebker, and John DeNero. 2019. Adding Interpretable Attention to Neural Translation Models Improves Word Alignment. arXiv preprint arXiv:1901.11359. + +# A Multi-head attention and the norm-based analysis + +Our norm-based analysis is applicable to the analysis of the multi-head attention mechanism implemented in Transformers. The $i$ -th output of the multi-head attention mechanism $\pmb{y}_i^{\mathrm{integrated}}$ is calculated as follows: + +$$ +\boldsymbol {y} _ {i} ^ {\text {i n t e g r a t e d}} = \sum_ {h} \boldsymbol {y} _ {i} ^ {h} \tag {7} +$$ + +$$ +\boldsymbol {y} _ {i} ^ {h} = \sum_ {j = 1} ^ {n} \alpha_ {i, j} ^ {h} f ^ {h} (\boldsymbol {x} _ {j}) \tag {8} +$$ + +$$ +f ^ {h} (\boldsymbol {x}) := \left(\boldsymbol {x} \boldsymbol {W} ^ {V, h} + \boldsymbol {b} ^ {V, h}\right) \boldsymbol {W} ^ {O, h}, \tag {9} +$$ + +where $\alpha_{i,j}^{h}, W^{V,h}, b^{V,h}$ , and $W^{O,h}$ are the same as $\alpha_{i,j}, W^{V}, b^{V}$ , and $W^{O}$ in Equations 3 and 4 for each head $h$ , respectively. $n$ is the number of tokens in the input vectors. Equation 7 can be rewritten as follows: + +$$ +\boldsymbol {y} _ {i} ^ {\text {i n t e g r a t e d}} = \sum_ {j = 1} ^ {n} \left[ \sum_ {h} \alpha_ {i, j} ^ {h} f ^ {h} (\boldsymbol {x} _ {j}) \right. \tag {10} +$$ + +As shown in Equation 10, the multi-head attention mechanism is also linearly decomposable, and one can analyze the flaw of the information from the $j$ -th vector to the $i$ -th vector by measuring $\| \sum_{h} \alpha_{i,j}^{h} f^{h}(\boldsymbol{x}_{j})\|$ . In Section 5, we actually used $\| \sum_{h} \alpha_{i,j}^{h} f^{h}(\boldsymbol{x}_{j})\|$ to extract the alignment from each layer's multi-head attention. + +The output of the multi-head attention mechanism is calculated via the sum of the outputs of all the heads and a bias $\pmb{b}^{O} \in \mathbb{R}^{d}$ . Because adding a fixed vector is irrelevant to the token-to-token interaction that we aim to investigate, we omitted $\pmb{b}^{O}$ in our analysis. + +# B The source of the dispersion of $\| f(x)\|$ + +As described in Section 4.1, $\| f(\boldsymbol{x}) \|$ exhibits dispersion; however, it remains unclear whether this dispersion is attributed to $\| \boldsymbol{x} \|$ or $f$ . Hence, we checked the dispersion of $\| \boldsymbol{x} \|$ and the scaling effects of the transformation $f$ . + +Dispersion of $\| x\|$ : First, we checked the coefficient of variation (CV) of $\| x\|$ . Table 4 shows that the average CV is 0.12, which is less than that of $\| f(x)\|$ (0.22). The value of $\| x\|$ typically varies + +between 0.88 and 1.12 times the average value of $\| \pmb{x}\|$ . The layer normalization (Ba et al., 2016) that applied at the end of the previous layer should have a large impact on the variance of $\| \pmb{x}\|$ . + +Scaling effects of $f$ : Second, we investigated the scaling effect of the transformation $f$ on the norm of the input. Because the affine transformation $f \colon \mathbb{R}^d \to \mathbb{R}^d$ can be considered a linear transformation $\mathbb{R}^{d+1} \to \mathbb{R}^{d+1}$ (Appendix C), the singular values of $f$ can be regarded as its scaling effect. Figure 9 shows the singular values of $f$ in randomly selected heads in BERT. The singular values are displayed in descending order from left to right. In each head, there is a difference of at least 1.8 times between the maximum and minimum singular values. This difference is larger than that of $\| x \|$ , where $\| x \|$ typically varies between 0.88 and 1.12 times the average value. These results suggest that the dispersion of $\| f(x) \|$ is primarily attributed to the scaling effect of $f$ . + +# C Affine transformation as linear transformation + +The affine transformation $f\colon \mathbb{R}^d\to \mathbb{R}^d$ in Equation 4 can be viewed as a linear transformation $\widetilde{f}\colon \mathbb{R}^{d + 1}\to \mathbb{R}^{d + 1}$ . Given $\widetilde{\pmb{x}} := \left[ \begin{array}{cc}\pmb {x} & 1 \end{array} \right]\in$ $\mathbb{R}^{d + 1}$ , where 1 is concatenated to the end of each input vector $\pmb {x}\in \mathbb{R}^{d}$ , the affine transformation $f$ can be viewed as: + +$$ +\widetilde {f} (\widetilde {\boldsymbol {x}}) = \widetilde {\boldsymbol {x}} \widetilde {\boldsymbol {W}} ^ {V} \widetilde {\boldsymbol {W}} ^ {O} \tag {11} +$$ + +$$ +\widetilde {\boldsymbol {W}} ^ {V} := \left[ \begin{array}{c c c} & & 0 \\ \boldsymbol {W} ^ {V} & & \vdots \\ & & 0 \\ \boldsymbol {b} ^ {V} & & 1 \end{array} \right] \in \mathbb {R} ^ {(d + 1) \times \left(d ^ {\prime} + 1\right)} \tag {12} +$$ + +$$ +\widetilde {\boldsymbol {W}} ^ {O} := \left[ \begin{array}{c c c c} & & & 0 \\ & \boldsymbol {W} ^ {O} & & \vdots \\ & & & 0 \\ 0 & \dots & 0 & 1 \end{array} \right] \in \mathbb {R} ^ {(d ^ {\prime} + 1) \times (d + 1)}. \tag {13} +$$ + +# D Details on Sections 4.2 and 4.3 + +We describe the detailed experimental setup presented in Sections 4.2 and 4.3. + +# D.1 Notations + +The dataset consists of several sequences; Data = $(s_1, \dots, s_{|Data|})$ . Each sequence consists of sev- + +
LayerμσCVMaxMin
12 (max CV)20.494.620.2332.844.13
7 (min CV)21.641.400.0623.0311.87
Average19.932.390.12--
+ +Table 4: Mean $(\mu)$ , standard deviation $(\sigma)$ , coefficient of variance (CV), and maximum and minimum values of $\| \mathbf{x}\|$ ; the former three are averaged on all the layers. + +![](images/6807fbb9cba00814cc8aadedb4afb7bf3204fa50f6f9591308fb8364490cdf5d.jpg) +Figure 9: Singular values of $f$ at randomly selected heads in each layer. We use $\langle \text{layer} \rangle - \langle \text{head number} \rangle$ to denote a particular attention head. The singular values are + +eral tokens, $s_p = (t_1^p,\dots ,t_{|s_p|}^p)$ , where $t_q^p$ is the $q$ -th token in the $p$ -th sequence. For simplicity, we define the following functions: + +$$ +\operatorname {W e i g h t} (p, q, \ell , h) = \frac {1}{| s _ {p} |} \sum_ {i = 1} ^ {| s _ {p} |} \alpha_ {p, i, q} ^ {\ell , h} +$$ + +$$ +\operatorname {N o r m} (p, q, \ell , h) = \| f ^ {\ell , h} \left(\boldsymbol {x} _ {p, q} ^ {\ell}\right) \| +$$ + +$$ +\mathrm {W N o r m} (p, q, \ell , h) = \frac {1}{| s _ {p} |} \sum_ {i = 1} ^ {| s _ {p} |} \| \alpha_ {p, i, q} ^ {\ell , h} f ^ {\ell , h} (\boldsymbol {x} _ {p, q} ^ {\ell}) \|, +$$ + +where $\alpha_{p,i,q}^{\ell,h}$ is the attention weight assigned from the $i$ -th pre-update vector to the $q$ -th input vector in the $p$ -th sequence. $h$ and $\ell$ denote that the score is obtained from the $h$ -th head of the $\ell$ -th layer. $\boldsymbol{x}_{p,q}^{\ell}$ denotes the input vector for token $t_q^p$ in the $\ell$ -th layer. $f^{\ell,h}(\boldsymbol{x}_{p,q}^{\ell})$ is the transformed vector for $\boldsymbol{x}_{p,q}^{\ell}$ in the $h$ -th head of the $\ell$ -th layer. + +Next, the vocabulary $\mathcal{V}$ of BERT is divided into the following four categories: + +$$ +A = \{\left[ \mathrm {C L S} \right] \} +$$ + +$$ +B = \{\left[ \mathrm {S E P} \right] \} +$$ + +$$ +C = \{\text {" "} , \text {" "} \} +$$ + +$$ +D = \mathcal {V} \backslash (A \cup B \cup C). \tag {14} +$$ + +Let $T(p,Z)$ be a function that returns all tokens $t_q^p$ belonging to the category $Z$ in the $p$ -th sequence. To formally describe our experiments, + +several functions are defined as follows. Note that we analyzed a model with 12 heads in each layer. + +$$ +\operatorname {MeanN}(Z,\ell ,h,p) = \frac{1}{|T(Z,p)|}\sum_{t_{q}^{p}\in T(Z,p)}\operatorname {Norm}(p,q,\ell ,h) +$$ + +$$ +\operatorname {S u m W} (Z, \ell , h, p) = \sum_ {t _ {q} ^ {p} \in T (Z, p)} \operatorname {W e i g h t} (p, q, \ell , h) +$$ + +$$ +\operatorname {S u m W N} (Z, \ell , h, p) = \sum_ {t _ {q} ^ {p} \in T (Z, p)} \operatorname {W N o r m} (p, q, \ell , h) +$$ + +$$ +\operatorname {H e a d N} (Z, \ell , h) = \frac {1}{| \mathrm {D a t a} |} \sum_ {s _ {p} \in \mathrm {D a t a}} \operatorname {M e a n N} (Z, \ell , h, p) +$$ + +$$ +\operatorname {H e a d W} (Z, \ell , h) = \frac {1}{| \mathrm {D a t a} |} \sum_ {s _ {p} \in \mathrm {D a t a}} \operatorname {S u m W} (Z, \ell , h, p) +$$ + +$$ +\operatorname {H e a d W N} (Z, \ell , h) = \frac {1}{| \mathrm {D a t a} |} \sum_ {s _ {p} \in \mathrm {D a t a}} \operatorname {S u m W N} (Z, \ell , h, p) +$$ + +$$ +\operatorname {L a y e r W} (Z, \ell) = \frac {1}{1 2} \sum_ {h = 1} ^ {1 2} \operatorname {H e a d W} (Z, \ell , h) +$$ + +$$ +\operatorname {L a y e r W N} (Z, \ell) = \frac {1}{1 2} \sum_ {h = 1} ^ {1 2} \operatorname {H e a d W N} (Z, \ell , h). +$$ + +The LayerW(\cdot) and LayerWN(\cdot) functions are used to analyze the average behavior of the heads in a layer. + +# D.2 Experimental setup for Section 4.2 + +In Figure 3, the results of each layer are reported for each category. In Figures 3a and 3b, the values for each category $Z$ were calculated using LayerW( $Z, \ell$ ) and LayerWN( $Z, \ell$ ), respectively. + +In Figure 4, $\alpha$ and $\| f(\pmb{x})\|$ in the $h$ -th head of the $\ell$ -th layer were calculated using $\mathrm{HeadW}(Z,\ell,h)$ and $\mathrm{HeadN}(Z,\ell,h)$ , respectively. The scores reported in Table 2 are the Spearman rank correlation coefficient $r$ between $\mathrm{Weight}(p,q,\ell,h)$ and $\mathrm{WNorm}(p,q,\ell,h)$ . We calculated the $r$ using all the pairs of $\mathrm{Weight}(p,q,\ell,h)$ and $\mathrm{WNorm}(p,q,\ell,h)$ for the possible values of $p,q,\ell$ , and $h$ . In Figure 5, each plot corresponds to the pair of $\mathrm{Weight}(p,q,\ell,h)$ and $\mathrm{WNorm}(p,q,\ell,h)$ , where the combination of $(p,q,\ell,h)$ was randomly determined. + +# D.3 Visualizations of $\alpha$ and $\|f(x)\|$ for each word category + +As described in Section 4.2, $\alpha$ and $\| f(\pmb {x})\|$ for the [SEP] token were canceled out in almost all heads (Figure 4). Here, we show the trends for the other categories— $B$ , $C$ , and $D$ in Equation 14. Figures 10, 11, and 12 show the trends of $\alpha$ and $\| f(\pmb {x})\|$ for category $B$ (the [CLS] token), $C$ (periods and commas), and $D$ (other tokens), respec + +![](images/7a1d8cd3a2c14c6dffd6cff71a9fce0cc70252e13993c53893507f46b0ca15c3.jpg) +(a) $\alpha$ + +![](images/947147a4dcf78227745f515a869a7c746ce2b4c4abee8c46a6c48c88bc90d04d.jpg) +(b) $\| f(\pmb {x})\|$ + +![](images/c111e9d0f1bbb330abc426a2a4552f7d6b597d2355c83c347def7d2b84e00dfa.jpg) +Figure 10: $\alpha$ and $\| f(\pmb {x})\|$ corresponding to [CLS] token, averaged on all the input text. +(a) $\alpha$ + +![](images/a5de36ae7973be347eb0e136fa336ba0f8697cde44ffe4f820cc3b143408bc49.jpg) +(b) $\| f(\pmb {x})\|$ + +tively. The values in these figures were calculated as described in Appendix D.2. Figures 10 and 11 show that the trends for categories $B$ and $C$ were analogous to those for the [SEP] token; the large $\alpha$ was canceled by the small $\| f(\pmb{x})\|$ . However, the trends for category $D$ do not exhibit the trends of the negative correlation between $\alpha$ and $\| f(\pmb{x})\|$ . In each heatmap of $\| f(\pmb{x})\|$ , the color scale is determined by the maximum value of $\| f(\pmb{x})\|$ in each category. + +We also reported the relationship between $\alpha$ and $\| f(\pmb {x})\|$ in Section 4.2 (Figure 5). Figure 13 shows the results for each word category to provide a clearer display of the results. + +# D.4 Experimental setup and visualizations for Section 4.3 + +In Section 4.3, we analyzed the relationship between the word frequency and $\| f(\pmb {x})\|$ . To formally describe our experiments, we further define the functions as follows: + +$$ +\operatorname {A v g W} (p, q) = \frac {1}{1 2 \cdot 1 2} \sum_ {\ell = 1} ^ {1 2} \sum_ {h = 1} ^ {1 2} \operatorname {W e i g h t} (p, q, \ell , h) +$$ + +$$ +\operatorname {A v g N} (p, q) = \frac {1}{1 2 \cdot 1 2} \sum_ {\ell = 1} ^ {1 2} \sum_ {h = 1} ^ {1 2} \operatorname {N o r m} (p, q, \ell , h). +$$ + +Note that we analyzed a model comprising 12 layers; each layer has 12 attention heads. Let + +![](images/33bd166387981a14b2af75941b8896c0d68e0ed167c78dad16e2f2bf76f9e255.jpg) +(a) $\alpha$ + +![](images/0c4fa1e021670f66a26a5a7e6a95c7507a805446ecbdff9a0011dd4cd2bedbd4.jpg) +(b) $\| f(\pmb {x})\|$ + +![](images/73f624a5c612f2c7991219d124bd4852fc163979557c799d95ab89d89c484b5f.jpg) +Figure 12: $\alpha$ and $\| f(\pmb {x})\|$ corresponding to other tokens, averaged on all the input text. + +![](images/709915596c3f34bdcce4cf1eed0c3ce6cf659584216918b04beae35741eaa7a2.jpg) + +![](images/309ddcd3095b29344571178c74cfb3154c03c70ef4e91e27d6f683a41ecfcc7f.jpg) +Figure 11: $\alpha$ and $\| f(\pmb{x})\|$ corresponding to periods and commas, averaged on all the input text. +(a) [CLS]. +(c) Periods and commas. +Figure 13: Relationship between $\alpha$ and $\| f(\pmb {x})\|$ for each category. + +![](images/7cca173f5d30bd5f98a3b99cea06890161c641ff8112d4fd1460d94f7006fa32.jpg) +(b) [SEP]. +(d) Other tokens. + +$r(\cdot)$ be a function that returns the frequency rank of a given word. We first calculated the Spearman rank correlation coefficient between $r(t_q^p)$ and $\mathrm{AvgW}(p,q)$ . The score was 0.06, which suggests that there is no relationship between $\alpha$ and the frequency rank of the word. Then, we calculated the Spearman rank correlation coefficient between $r(t_q^p)$ and $\mathrm{AvgN}(p,q)$ . The score was 0.75, which suggests a strong correlation between $\| f(x)\|$ and the frequency rank of the word; Figure 14 shows these results. + +In addition, the results for the word frequency, instead of the frequency rank, are shown in Figure 15. $c(\cdot)$ denotes a function that returns the frequency of a given word in the training dataset of BERT. We reproduced the dataset because it is not released. + +# E Details on Section 5 + +# E.1 Hyperparameters and training settings + +We used the Transformer (Vaswani et al., 2017) NMT model implemented in fairseq (Ott et al., 2019) for the experiments. Table 5 shows the hyperparameters of the model, which were the same + +![](images/3082d84a1c60853e7bc51e444627a853f775218bd3c75f97e836c54c17816efc.jpg) + +![](images/e86ad6824c7f3e92a693a934f949eaa18b0e826b076d53a44600a73e352e06a3.jpg) +(a) Relationship between $r(t)$ and $\mathrm{AvgW}$ . +(b) Relationship between $r(t)$ and $\mathrm{AvgN}$ . +Figure 14: Relationship between frequency rank $r(t_q^p)$ and $\operatorname{AvgW}(p, q)$ , and that between $r(t_q^p)$ and $\operatorname{AvgN}(p, q)$ . + +as those used by Ding et al. (2019). We used the model with the highest BLEU score in the development set for our experiments. + +We conducted the data preprocessing $^{18}$ following the method by Zenkel et al. (2019) and Ding et al. (2019). All the words in the training data of the NMT systems were split into subword units using byte-pair encoding (BPE, Sennrich et al. (2016)) with 10k merge operations. Following Ding et al. (2019), the last 1000 instances of the training data were used as the development data. + +# E.2 Settings of the word alignment extraction + +First, we applied BPE, which was used to split the training data of the NMT systems to create the evaluation data used for calculating the AER scores. Next, we extracted the scores of $\alpha$ and $\| \alpha f(\pmb {x})\|$ for each subword in the evaluation data for the force decoding setup. The gold alignments are annotated at the word-level, not the subword-level. To calculate the word-level alignment scores, $\alpha$ and $\| \alpha f(\pmb {x})\|$ for the subwords were merged along with the target token in the gold data by averaging, then merged along with the source tokens in the gold data by summation. These operations were the same as Li et al. (2019). + +![](images/b73a948a12dc6104e49429d9abb30c76c4eaf4a161a3df66d392bd2fd2c7261c.jpg) + +![](images/cbdd784b098bf4ee892187cdb6eaacbef18681102db0626c8c2dd8a48eb5d85c.jpg) +(a) Relationship between $c(t)$ and AvgW. +(b) Relationship between $c(t)$ and AvgN. +Figure 15: Relationship between frequency count $c(t_q^p)$ and $\operatorname{AvgW}(p, q)$ , and that between $c(t_q^p)$ and $\operatorname{AvgN}(p, q)$ . + +In existing studies, $\langle /s\rangle$ , the special token for the end of the sentence, was probably removed in calculating word alignments. We included $\langle /s\rangle$ as the alignment targets and we considered the alignments to $\langle /s\rangle$ as no alignment. In other words, if the model aligns a certain word with $\langle /s\rangle$ , we assume that the model decides that the word is not aligned to any word. + +# E.3 Layer-wise analysis + +We preliminarily investigated how the source-target attentions in a Transformer-based NMT system behave depending on the layer. Tang et al. (2018) have reported that they behave differently depending on the layer. The AER scores in the AWI and AWO settings were calculated for each layer (Figure 16). In the AWO setting, AER scores tend to be better in the latter layers than in the earlier layers (Figure 16a). In contrast, the AER scores tend to be better in the earlier layers than in the latter layers in the AWI setting (Figure 16b). + +These results suggest that the earlier and latter layers focus on the source word that is aligned with the input and output target word, respectively (as shown in Figure 6). Furthermore, we believe that it is a convincing result to extract cleaner word alignments from the AWI setting than the AWO setting (Figure 16), because the AWI setting is + +
Fairseq modelarchitecturetransformer_iwslt_de_en
encoder embed dim.512
decoder embed dim.512
encoder ffn embed dim.1024
decoder ffn embed dim.1024
encoder attention heads4
decoder attention heads4
encoder layers6
decoder layers6
ActivationfunctionRelu
Losstypelabel smoothed cross entropy
label smoothing0.1
OptimizeralgorithmAdam
learning rates0.001
β10.9
β20.98
weight decay0.0
clip norm0.0
Learning rate schedulertypeinverse_sqrt
warmup updates4,000
warmup init lranning rate1e-07
Trainingbatch size80
max tokens4000
max epoch100
update freq8
drop out0.1
seed2
number of GPUs used2
+ +Table 5: Hyperparameters of the NMT model. + +![](images/6aab0b7b20e939c3885cda164cd99976f62fbbc6a2822da474ed9d74e5f2639a.jpg) + +![](images/87db68e2e17a4720963a9f1abb47914edd0dd0eced6258ea9a3a2459ec260a0e.jpg) +(a) AWO setting. +(b) AWI setting. +Figure 16: Layer-wise AER scores. Each value is the average of five random seeds. The closer the extracted word alignment is to the reference, the lower the AER score—the lighter the color. + +more advantageous. The main advantage is that while the decoder may fail to predict the correct output words, the input words are perfectly accurate owing to the teacher forcing. + +# E.4 Alignments in different layers + +Figures 17 to 22 show additional examples of the extracted alignments from the different layers of + +the NMT system. Note that the color scale in each heatmap is determined by the maximum value in each figure. One can observe that while the attention weights $\alpha$ are biased towards $\langle /s\rangle$ , the norms $\| \alpha f(x)\|$ corresponding to the token are small. + +# F Word alignment experiments on different settings + +To verify whether the results obtained in the Section 5 are reproducible in different settings, we conducted an additional experiment using the model with a different number of attention heads. Specifically, we used a model with eight attention heads in both the encoder and decoder. Table 6 shows the AER scores of the 8-head model. As with the results obtained by the 4-head model, word alignments extracted using the proposed norm-based approach were more reasonable than those extracted using the weight-based approach, and better word alignments are extracted in the AWI setting than in the AWO setting. Furthermore, the alignments extracted using the head or the layer with the highest average $\| \alpha f(\pmb {x})\|$ in the AWI setting are competitive with one of the existing word aligners—fast_align. With respect to the weight-based extraction, the scores obtained using + +![](images/9294b6024cfdd1ba5357b952f7ae262f484f4c951beee81e59e92ffff10036a6.jpg) +(a) Reference. + +![](images/edd1d33ca95f3fc835905fda0172a5ffd12312d957b55934a56eab57e92dd22c.jpg) +(b) Attention-weights. + +![](images/cd224987b9dd981d61d63eb11277c41191bfd4b416af5ad3782108befcbc3fc9.jpg) +(c) Vector-norms (ours). + +![](images/01831add6b203d3b358d33b5869b8876b0f03726db2d191f7c6393886eae8e6d.jpg) +Figure 17: Examples of the reference alignment and the extracted patterns by each method in layer 1. Word pairs with a green frame shows the word with the highest weight or norm. The vertical axis represents the input source word in the decoder, and the pairs with a green frame are extracted as alignments in the AWI setting. Note that pairs that contain $\langle /s\rangle$ not extracted. +(a) Attention-weights. + +![](images/46aed01beb27f8a2a467cf229f312438f37eb18b9da5a7bfd0421b8f79355f0c.jpg) +(b) Vector-norms. + +![](images/65a7243577abdf14b45dc5dc6eae0782e8de911bf675433d472e6536300c1bfb.jpg) +(a) Attention-weights. + +![](images/ed2c237e4fe068a6d830c3dfd697630c020be647643952d400472fe6e9168ac8.jpg) +(b) Vector-norms. + +![](images/56cb335075c9b06cbc01d563bebbbe5907802cf87bd91cb5d0ff921faf4dc4bc.jpg) +Figure 18: Examples of the reference alignment and the extracted patterns by each method in layer 2. +(a) Attention-weights. +Figure 19: Examples of the reference alignment and the extracted patterns by each method in layer 3. + +![](images/be329000fcbb3484ed8c079793adbeee2384302fd00f5b5a6f220ab9bbb63bf3.jpg) +(b) Vector-norms. + +![](images/e741134b478dec7f129d6007ba88d505b202c561e8052d5dec71e6eac9c45a39.jpg) +Figure 20: Examples of the reference alignment and the extracted patterns by each method in layer 4. +(a) Attention-weights. +Figure 21: Examples of the reference alignment and the extracted patterns by each method in layer 5. + +![](images/524d7d55cd3e5b0d21a95af3bc40dd4beb2f2500029c959bbeacf9e8a69683ce.jpg) +(b) Vector-norms. + +the 8-head model were worse than those obtained using the 4-head model. This may be owing to the increase in the number of heads that do not capture reasonable alignments. + +Figures 23a and 23b show the AER scores of the alignments obtained by the norm-based extraction at each head on one out of five seeds. Figure 23c shows the average of $\| \alpha f(\pmb{x}) \|$ at each head. As with the results obtained by the 4-head model, the heads with the low (i.e., better) AER score in the AWI setting tended to have the high $\| \alpha f(\pmb{x}) \|$ (the Spearman rank and Pearson correla + +tion coefficients between the AER scores and averaged $\| \alpha f(\pmb {x})\|$ among the $6\times 8$ heads are $-0.26$ and $-0.50)$ . In contrast, in the AWO setting, such a negative correlation is not observed; rather, a positive correlation is observed (the Spearman's $\rho$ is 0.40 and the Pearson's $r$ is 0.40). + +Additionally, following Appendix E.3, the AER scores for both the AWI and AWO settings for each layer were calculated (Figure 24). As with the 4-head model (Appendix E.3), the latter layers correspond to the AWO setting and the earlier layers correspond to the AWI setting in the 8-head + +![](images/cfba8ead3f445deca733ef2a01ee57d3bc9d8643c3d42608976e28be0bbba916.jpg) +(a) Attention-weights. + +![](images/29b2629266c419751a83cc117fdd5f1a258d9bc02380e18ea707f9c34d4b8b3c.jpg) +(b) Vector-norms. + +
MethodsAER±SD
Transformer - Attention-based Approach — Alignment with output setting —
Weight-based
layer mean70.40.6
best layer (layer 4 or 5)49.31.2
Norm-based (ours)
layer mean63.20,7
best layer (layer 5)43.40.8
head with the highest average |αf(x)||87.20.6
layer with the highest average |αf(x)||83.72.2
— Alignment with input setting —
Weight-based
layer mean76.61.7
best layer (layer 2 or 3)38.78.9
Norm-based (ours)
layer mean59.91.0
best layer (layer 2 or 3)26.31.9
head with the highest average |αf(x)||24.91.7
layer with the highest average |αf(x)||26.51.9
Word Aligner
fast align from Zenkel et al. (2019)28.4-
GIZA++ from Zenkel et al. (2019)21.0-
+ +Table 6: Results on a model trained with the same settings as described in Appendix E.1 except that the number of attention heads in the encoder and decoder is 8. Each value is the average of five random seeds. + +model. + +# G Comparison with effective attention (Brunner et al., 2020) + +In this section, we discuss the difference between our approach and "effective attention" (Brunner et al., 2020), which is an enhanced version of the weight-based analysis. The effective attention exclude the components that do not affect the output owing to the application of transformation $f$ and input $x$ from the attention weight matrix $A$ . The output-irrelevant components are derived from the null space of the matrix $T$ , which is the stack of $f(x)$ . Figure 25a shows the Pearson correlation coefficient between the raw attention weight and the effective attention. Since the dimension of the null space of the matrix $T$ depends on the length of + +![](images/4427e883e0bec1fb43a5a5cd91f5e8d68611cfb7f8195d1258c3efd80241f609.jpg) +Figure 22: Examples of the reference alignment and the extracted patterns by each method in layer 6. + +![](images/5fcf5bf8dc3e7be0469a7238b0d3625dbff6e391c7626639b88da134797063bf.jpg) +(a) AER in the AWO setting. + +![](images/c5250c1bed01ee6629f4b6bdfc6994420bc38b051c1b0611c871b20cc1867b20.jpg) +(b) AER in the AWI setting. +(c) Averaged $\| \alpha f(\pmb {x})\|$ +Figure 23: AER scores and averaged $\| \alpha f(\pmb {x})\|$ for each head in a model with 8 heads. + +the input sequence, as shown in Figure 25a, the effective attention and raw attention weight are identical for short input sequences. Figure 25b shows the Pearson correlation coefficient between the raw attention weight and our norm-based method. Since we incorporate the scaling effects of $f$ and $x$ , which contain canceling, our proposed method $\| \alpha f(x) \|$ differs from the raw attention weight, whether the input sequence is long or short. + +![](images/bfb2e9d96596d9fb2476b7095492f28619360818e6c7f50bcc9234afab1bfad4.jpg) + +![](images/d20ab5a421773dd04e4302c2a772c06f6a39ec48122fc518d1524b9afb4df85f.jpg) +(a) AWO setting. +(b) AWI setting. +Figure 24: Layer-wise AER scores. Each value is the average of five random seeds. The closer the extracted word alignment is to the reference, the lower the AER score—the lighter the color. + +![](images/1c0a31c4d48c5bb568d9b0c9769575e1d56edab3cb49c41b0e67549ad54ba7bf.jpg) + +![](images/693abe2238890f58142d1ba228f58ed4e737e06cf049b582e7a9a04d418653a6.jpg) +(a) Effective attention. +(b) $\| \alpha f(\pmb {x})\|$ +Figure 25: Each point represents the Pearson correlation coefficient of raw attention and each method toward token length. \ No newline at end of file diff --git a/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/images.zip b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..d01d7c6243448e5b3f473c11c30650f4f59ef35d --- /dev/null +++ b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8287237cfa33f4e7e987b60c305ab00394da3eb06506efece004d6fa4099510e +size 1187620 diff --git a/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/layout.json b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ca71ad847473de6db2066ef56a4fd5a5db27ad3b --- /dev/null +++ b/attentionisnotonlyaweightanalyzingtransformerswithvectornorms/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3a68dcd2db268182c7502e37eef6f55e978e1e9f6cbe63b55a0b55a852cbcd1 +size 953493 diff --git a/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_content_list.json b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..7fd837df2701f3b5f3e69162209a8cc4af95bee8 --- /dev/null +++ b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a0e31182230450a80d60537cb9efe8c8beb6379f9342cd7514bd164df6c434d +size 83890 diff --git a/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_model.json b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a5875063cb7713137b6a6dbb156ca999ed54e02b --- /dev/null +++ b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:829a5c68bbae757f773871d149ba5e59f255520420b9cb2acd047d3a3b07426e +size 95309 diff --git a/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_origin.pdf b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0f241ca6d9963a63ca79a08911b9d6a47d843f41 --- /dev/null +++ b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/d3151d7f-2fec-49ef-a309-819711ddb418_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f17d34f6f581b674d085be6002a006437bf55835b24cfe70863edd6824fa5ba +size 1775468 diff --git a/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/full.md b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/full.md new file mode 100644 index 0000000000000000000000000000000000000000..33a80ff97e53478f5180dd44b29498e860ab968e --- /dev/null +++ b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/full.md @@ -0,0 +1,368 @@ +# AttnIO: Knowledge Graph Exploration with In-and-Out Attention Flow for Knowledge-Grounded Dialogue + +Jaehun Jung $^{1,2}$ Bokyung Son $^{1,3*}$ Sungwon Lyu $^{1*}$ + +$^{1}$ Kakao Enterprise Corporation + +$^{2}$ Department of Computer Science, Seoul National University + +$^{3}$ Department of Linguistics, Seoul National University + +sharkmirl1@snu.ac.kr,{meta.mon, james.ryu}@kakaoenterprise.com + +# Abstract + +Retrieving the proper knowledge relevant to conversational context is an important challenge in dialogue systems, to engage users with more informative response. Several recent works propose to formulate this knowledge selection problem as a path traversal over an external knowledge graph (KG), but show only a limited utilization of KG structure, leaving rooms of improvement in performance. To this effect, we present AttnIO, a new dialog-conditioned path traversal model that makes a full use of rich structural information in KG based on two directions of attention flows. Through the attention flows, AttnIO is not only capable of exploring a broad range of multi-hop knowledge paths, but also learns to flexibly adjust the varying range of plausible nodes and edges to attend depending on the dialog context. Empirical evaluations present a marked performance improvement of AttnIO compared to all baselines in OpenDiagonalKG dataset. Also, we find that our model can be trained to generate an adequate knowledge path even when the paths are not available and only the destination nodes are given as label, making it more applicable to real-world dialogue systems. + +# 1 Introduction + +One of the milestone challenges in conversational AI is to engage users with a more informative and knowledgeable response, rather than merely outputting generic sentences. For instance, given a user's utterance saying "I'm a big fan of Steven Spielberg", it would be more engaging to respond "My favorite movie is his science fiction film A.I.", rather than "I like him too". An external source of knowledge such as knowledge graph (KG) can + +play a crucial role here, as it could help the conversational agent with informative paths, such as "Steven Spielberg, directed, A.I., has genre, Science Fiction". + +The above mentioned motivation gave rise to a conspicuous need for path retrieval model on KG, which can learn to traverse a path consisting of proper entities and relations to mention in the next response, given the dialog context. Previous approaches to this knowledge selection problem rely on either an RL-based agent (Liu et al., 2019) or a recurrent decoder (Moon et al., 2019), which greedily selects the most proper entity to traverse regarding its previous decision. Despite their novelty, we find several rooms of improvement from the previous works, to move toward a more fine-grained modeling of knowledge path retrieval for dialogue systems. + +First, a model could make use of the rich relational information residing at the neighborhood of each node on KG. Typically, the number of entities in KG is large, while the numbers of each entity's usage in actual dialogues are small. Thus leveraging the neighborhood information of each entity in knowledge graph could be crucial, to overcome the sparsity of entity usage and learn proper representation of entities and relations. + +Also, we find that the range of knowledge paths plausible for a response to a given dialog may vary, depending on the dialog context and user intent. In response to a closed question such as "Who directed the movie A.I.?", there could be only one or two knowledge paths valid as answer. On the contrary, in response to an open question such as "Do you know Steven Spielberg?", there could be a variety of knowledge paths natural enough to carry on the conversation. Therefore, a model should be able to choose the range of entities to attend, depending on the characteristics of a given dialog. + +Lastly, one should note that it is practically hard + +![](images/879491102767ab3ae4437d5f006740f6f9b90b3ab916f413b20d1af22924b247.jpg) +Figure 1: Path decoding process of AttnIO. By propagating attention values at each step rather than selecting one node to traverse, AttnIO can choose between focusing on small number of entities or attending to multiple relevant neighbors, depending on the dialog context. + +to gather a large-scale dialog-KG path parallel corpus, fully annotated with all entities and relations comprising each path. Retrieving the initial, and final entities of the KG path is relatively easier, as it only requires post-processing the {query, response} pairs in dialog. Therefore, it would be more desirable if a model could be trained to traverse a proper knowledge path, only with the destination nodes provided as label. + +To this end, we propose AttnIO (Attention Inflow and Out-flow), a novel KG path traversal model that overcomes all challenges stated above. Aside to the conventional textual encoder which encodes dialog history and user utterance, AttnIO models the KG traversal mechanism into two sub-processes: incoming attention flow, and outgoing attention flow. Inspired by Attention Flow (Xu et al., 2018), the two attention flows explore KG by propagating the attention value at each node to its reachable neighbor nodes, as shown in Figure 1. The attention propagation mechanism enables our model to start exploring KG from multiple entities (A.I., and The Truman Show), then find out an intermediate node Drama relevant to both movies, and end the multi-hop reasoning by arriving at Catch me if you can. Such a complex interaction between entities cannot be modeled by a greedy decoder, limited to consider only an optimal node at each decoding step. In addition, our model provides better interpretation of its path reasoning process, by visualizing the attention distribution of nodes and edges at each step. Lastly, we consider our model in a more challenging, but more realistic setting of path retrieval task, where no ground-truth path is available for supervision, but only the final desti + +nation nodes are given. Even in this setting, we find that AttnIO can be trained to infer a proper knowledge path for the input dialog. + +In summary, our contributions are as follows: (1) We suggest a novel path traversal model AttnIO, achieving state-of-the-art performance in dialog-conditioned knowledge path retrieval task on the OpenDialKG dataset. (2) We demonstrate that AttnIO can be trained even in a challenging setting where only the destination nodes are given, and show through both qualitative and quantitative analysis that the quality of paths generated from this setting does not fall behind that of the all-path supervision setting. (3) Through visualizing the attention distribution at each decoding step, we show that our model possesses better interpretability over the path reasoning process. + +# 2 Related Works + +Recently, lots of research effort have been devoted to grounding dialogue systems on structured knowledge embedded in knowledge graphs. These works can be broadly classified into two categories, depending on the range of exploration over candidate knowledge. The first line of works, namely breadth-centric approaches, tend to focus on augmenting dialog context with entity representations, by aggregating their shallow (i.e., 1-hop or 2-hop) neighborhood information from an external knowledge graph (Young et al., 2018; Liu et al., 2018; Parthasarathi and Pineau, 2018; Chen et al., 2019). Zhou et al. (2018) suggest to encode an auxiliary knowledge vector by attentively reading all 1-hop relations of each initial entity that appears in user's utterance. Zhang et al. (2019) extends the previous + +work's knowledge encoding scheme to 2-hop relations, encoding all initial entities and their 1-hop neighbors with two independent attention mechanisms. While these works are successful in contextualizing each entity with various relations in KG, they lack in retrieving small set of focused knowledge paths relevant to the dialog, or generalizing to multi-hop relations. We extend these approaches by suggesting a new framework that can be generalized to an arbitrary length of traversal, and dynamically updating entity features at each decoding step to facilitate multi-hop relational inference. + +On the other hand, the second line of works resort to depth-centric search over candidate knowledge paths. Rather than augmenting entity representation with shallow but wide range of knowledge, they concentrate on traversing only a specific range of entities and relations directly usable for response generation. Liu et al. (2019) formulate the knowledge selection problem as Partially Observed Markov Decision Process, employing a policy network to traverse KG. Meanwhile, Moon et al. (2019) suggest a recurrent path decoder that relies on a hidden state vector to choose the next entity among reachable nodes. Although these models are competent at inferring multi-hop relations, their discrete selection mechanism neglects rich relational information of nodes and edges they did not explicitly choose to traverse. To complement the weakness, AttnIO does not select an optimal node in advance; rather, it first propagates attention to all reachable entities, and then decode an optimal path from the output attention distribution. + +Our work is also closely motivated from recent techniques suggested in the domain of knowledge graph completion tasks. To compensate for weak representation power of translative embedding (Bordes et al., 2013; Trouillon et al., 2016) and convolution-based embedding (Dettmers et al., 2018; Nguyen et al., 2018), several models have adopted graph neural networks (GNN), encoding structural information into entity embedding (Shang et al., 2019; Nathani et al., 2019). Other works perform traversal-based inference in node-prediction tasks based on reinforcement learning (Das et al., 2018; Lin et al., 2018), or attention propagation (Xu et al., 2018). We extend these previous works by adopting graph neural network and attention propagation for the dialog-conditioned path generation problem. + +![](images/d05e11a85de1ca543d2adb7f4480221823a30871a6df6b85bc9b7675b012cfbb.jpg) +Figure 2: AttnIO Model Overview + +# 3 Proposed method + +# 3.1 Overview + +We denote the external knowledge graph as $G_{KG} = V_{KG} \times R_{KG}$ , with nodes as entities and edges as relations between a pair of entities. We denote $G_{v,n} \subseteq G_{KG}$ as a subgraph containing all nodes and edges reachable in less than or equal to $n$ -hops, starting from vertex $v$ . Also, we define $\overleftrightarrow{N}_i$ as a set of incoming neighbor nodes of $v_i$ , i.e. nodes possessing edges toward $v_i$ , and $\overleftarrow{N}_i$ as a set of outgoing neighbor nodes of $v_i$ . + +Figure 2 illustrates the overview of AttnIO's path generation process. Given the input multi-turn dialog sequence $\{s_1, \dots, s_n\}$ and the set of entities $V_{init} = \{e_1, \dots, e_m\}$ appearing in the user's last utterance $s_n$ , AttnIO starts from encoding the input dialog into a fixed-size context vector. It also constructs the dialog-relevant subgraph $G_{input} = \bigcup_{i} G_{e_i,T}$ , where $T$ is a hyperparameter indicating the maximal length of path to traverse. + +At each decoding step $t = 1,\dots ,T$ the incoming attention flow iteratively updates the KG entity features by attentively aggregating rich relational features from their incoming neighbor nodes. Then, the outgoing attention flow propagates the attention value of each node to its outgoing neighbor nodes, yielding the node attention + +distribution $a_{i}^{t}$ and edge attention distribution $a_{ij}^{t}$ as step $t$ 's output. We show that each candidate entity path $P_{v} = \{P_{v}^{(0)},\dots ,P_{v}^{(T)}\}$ and the relation path $P_{r} = \{P_{r}^{(1)},\dots ,P_{r}^{(T)}\}$ can easily be ranked from these output attention distributions, in Section 3.4.1. + +# 3.2 Dialog Encoder + +AttnIO encodes the input multi-turn dialog into a fixed-size contextual representation. Specifically, we employ state-of-the-art textual representation from ALBERT (Lan et al., 2019), to effectively capture the context and intent of the user's utterance. We concatenate maximum of 3 last utterances in the dialog, and put it as input to the pretrained ALBERT. We use the final layer's hidden representation of [CLS] token, as it is typically considered to be an approximation of the sequence context. We denote this context vector as $\mathbf{C}$ , in the following section. + +Note that our architecture does not require a specific type of textual encoder, and ALBERT can be replaced with any sequence encoder such as bidirectional RNN. For a fair comparison with previous work, we conduct an ablation study on ALBERT by replacing it with bidirectional GRU (Section 4.1). + +# 3.3 Incoming Attention Flow + +In order to find better entity representation, the Incoming Attention Flow iteratively updates each entity feature $\mathbf{h}_j$ for all $v_j \in G_{input}$ , by aggregating $v_j$ 's neighbor information. Recently suggested message-passing mechanism of graph attention networks (GAT) from Velicković et al. (2018) is suitable for this, as it learns to encode each node by selectively attending over its neighbors. Since GAT does not take account of edge features and hence may lose useful relational information integral in KG, we extend the attention-based message passing scheme of GAT into relational graphs. At each decoding step $t$ , the Incoming Attention Flow computes message from entity $v_i$ to $v_j$ as follows: + +$$ +\mathbf {m} _ {i j} = \mathbf {W} _ {m} \left[ \mathbf {h} _ {i} + \mathbf {r} _ {i j} \right] \qquad (1) +$$ + +where $\mathbf{h}_i$ denotes the feature of $v_{i}$ at step $t$ , and $\mathbf{r}_{ij}$ denotes the relation feature assigned to the edge between $v_{i}$ and $v_{j}$ . Then, the new node feature $\widetilde{\mathbf{h}}_j^{\prime}$ for the next time step $t + 1$ is computed as an attention-based weighted sum of messages from all + +incoming neighbor nodes of $v_{j}$ : + +$$ +\widetilde {\mathbf {h}} _ {j} ^ {\prime} = \sum_ {i \in N _ {j} ^ {\rightarrow}} a _ {i j} \mathbf {m} _ {i j} \tag {2} +$$ + +The attention $a_{ij}$ is computed by applying softmax over $v_j$ 's all incoming neighbor nodes: + +$$ +a _ {i j} = \underset {i \in \overrightarrow {N _ {j}}} {\operatorname {s o f t m a x}} \left(\alpha_ {i j}\right), \tag {3} +$$ + +$$ +\alpha_ {i j} = \sigma \left((\mathbf {W} _ {Q} \mathbf {h} _ {j}) ^ {T} (\mathbf {W} _ {k} (\mathbf {h} _ {i} + \mathbf {r} _ {i j}))\right) +$$ + +where $\sigma$ denotes LeakyReLU non-linearity. + +In addition, we extend our attentive aggregation scheme to multi-headed attention, which helps to jointly attend to information from different representation subspaces of incoming messages (Vaswani et al., 2017). Thus our message aggregation mechanism in Eq.2 is transformed into: + +$$ +\widetilde {\mathbf {h}} _ {j} ^ {\prime} = \left\| \sum_ {k = 1} ^ {K} a _ {i j} ^ {k} \mathbf {m} _ {i j} ^ {k} \right. \tag {4} +$$ + +where $\mathbf{K}$ denotes the number of attention heads. The attention heads perform independent self-attention over neighborhood features, then are concatenated to form the new node feature $\widetilde{\mathbf{h}}_j^{\prime}$ . + +Another crucial step in Incoming Attention Flow is to fuse entity features with dialog context, such that even if a same set of initial entities are given, the decoder could traverse possibly different paths according to the dialog context. We achieve this fusion by concatenating the dialog context vector with entity feature computed from Eq.4 and then linear-transforming back to the entity embedding dimension: + +$$ +\mathbf {h} _ {j} ^ {\prime} = \mathbf {W} _ {h} \left[ \widetilde {\mathbf {h}} _ {j} ^ {\prime} \| \mathbf {C} \right] \tag {5} +$$ + +# 3.4 Outgoing Attention Flow + +At the core of AttnIO lies the Outgoing Attention Flow, which defines path traversal on KG as an attention propagation mechanism. In the beginning of the decoding step, it starts from computing the initial attention value $a_{i}^{0}$ of nodes in $V_{init}$ , i.e. the set of entities appearing in the user's last utterance. + +$$ +a _ {i} ^ {0} = \underset {i \in V _ {\text {i n i t}}} {\operatorname {s o f t m a x}} \left(\left(\mathbf {W} _ {\text {i n i t}} \mathbf {C}\right) ^ {T} \mathbf {h} _ {i}\right) \tag {6} +$$ + +The relevance of each candidate node is scored as the dot-product with the dialog context vector. In case of entities not in $V_{init}$ , we initialize the node attention value to zero. + +Hereafter, the decoder iterates for step 1 to $T$ , where $T$ denotes the maximal possible path length. We add self-loops to each node in $G_{input}$ , in order to indicate that a traversal ended before step $T$ . Given the context-fused entity feature $\mathbf{h}_i^t$ for all $v_i \in G_{input}$ at each step $t$ , Outgoing Attention Flow essentially computes how much attention value to propagate from $v_i$ to its outgoing neighbor $v_j$ , as follows: + +$$ +\widetilde {a} _ {i j} ^ {t + 1} = \mathcal {T} _ {i j} ^ {t + 1} a _ {i} ^ {t}, a _ {j} ^ {t + 1} = \sum_ {i \in \overrightarrow {N _ {j}}} \widetilde {a} _ {i j} ^ {t + 1} \tag {7} +$$ + +$$ +s. t. \sum_ {i} a _ {i} ^ {t + 1} = 1, \sum_ {i j} \widetilde {a} _ {i j} ^ {t + 1} = 1 +$$ + +A key here is the transition probability $\mathcal{T}_{ij}$ , which can be derived from a function of two relevant node features, $\mathbf{h}_i$ and $\mathbf{h}_j$ . In this work, we formulate the process as averaging the multi-headed attentions computed over all outgoing neighbor nodes: + +$$ +\mathcal {T} _ {i j} = \frac {1}{K} \sum_ {k = 1} ^ {K} \underset {j \in \overleftarrow {N _ {i}}} {\operatorname {s o f t m a x}} \left(\tau_ {i j} ^ {k}\right), \tag {8} +$$ + +$$ +\tau_ {i j} ^ {k} = \sigma \left(\left(\mathbf {W} _ {Q} \mathbf {h} _ {i} ^ {k}\right) ^ {T} \left(\mathbf {W} _ {k} \left(\mathbf {h} _ {j} ^ {k} + \mathbf {r} _ {i j} ^ {k}\right)\right)\right) +$$ + +# 3.4.1 Scoring candidate paths + +Given the output of Outgoing Attention Flow at each decoding step i.e. the node attention distribution $a_{i}^{0},\dots a_{i}^{T}$ and the edge attention distribution $\widetilde{a}_{ij}^{1},\dots \widetilde{a}_{ij}^{T}$ , we can score each candidate entity paths with the product of respective node attention value at each step: + +$$ +\operatorname {s c o r e} \left(P _ {v}\right) = \prod_ {t = 0} ^ {T} a _ {P _ {v} ^ {(t)}} ^ {t} \tag {9} +$$ + +Likewise, the score of the relation path $P_r$ associated with $P_v$ can be retrieved by the product of respective edge attention value at each step: + +$$ +\operatorname {s c o r e} \left(P _ {r}\right) = \prod_ {t = 1} ^ {T} \widetilde {a} _ {P _ {r} ^ {(t)}} ^ {t} \tag {10} +$$ + +# 3.4.2 Training Objective + +We train the whole model in an end-to-end manner by directly supervising on the attention distribution at each step. In a default setting where the whole ground-truth paths are available, we use a negative log-likelihood loss on each step's attention distribution (left), and in the target-supervision setting + +where only the final entity labels are given, we supervise with the same loss only at the final step's attention distribution (right): + +$$ +\mathcal {L} = \sum_ {t} - \log a _ {\text {l a b e l}} ^ {t}, \text {o r} - \log a _ {\text {l a b e l}} ^ {T} \tag {11} +$$ + +# 3.4.3 Dialog-KG Alignment by Initialization + +AttnIO's training phase tends to be unstable in the beginning, as the model has to deal with two completely different modalities: KG entities, and the dialog. In order to align the two different features, we find that initializing each entity feature as the representation from pretrained ALBERT helps. Just as the dialogue context representation, we put each entity phrase as input with [CLS] token. We then take the hidden representation of [CLS] token from the last layer of ALBERT, and linear-transform it to create initial entity feature $\mathbf{h}_i^0$ . Note that we do not fine-tune ALBERT, but back-propagate to $\mathbf{h}_i^0$ during training. This additional process not only narrows down the gap between feature space of entities and dialog contexts, but also helps better understand each entity in several cases, as some entities span a lengthy phrase of natural language tokens (e.g. Grammy Award for Best Pop Collaboration with Vocals). + +# 4 Experiments and Results + +Dataset We evaluate our proposed method on OpenDialKG (Moon et al., 2019), a dialog - KG parallel corpus designed for knowledge path retrieval task. The dataset consists of 91k multi-turn conversations in form of either task-oriented (recommendation) dialog, or chit-chat on a given topic. Each pair of utterances in the conversations is annotated with a KG path, where its initial entity is mentioned in the former turn, and its destination entity is mentioned in the latter turn. As the train-valid/test partitions of OpenDialKG are not publicly available, we create our own split by randomly partitioning into train $(70\%)$ , valid $(15\%)$ , and test set $(15\%)$ . + +Baselines We take 4 models suggested by Moon et al. (2019) as baselines. These models include DialKG Walker, a state-of-the-art model designed to traverse a dialogue conditioned knowledge path. Other 3 models are Seq2Seq (Sutskever et al., 2014), Extended Encoder-Decoder (Parthasarathi and Pineau, 2018), Tri-LSTM (Young et al., 2018) all modified to fit the entity path retrieval task. + +
ModelRecall@k
path@1path@3path@5path@10path@25tgt@1tgt@3tgt@5tgt@10tgt@25
Seq2Seq3.118.329.744.160.2-----
Tri-LSTM3.214.222.636.356.2-----
EXT-ED1.95.89.013.319.0-----
DialKG Walker13.226.135.347.962.2-----
Seq2Path14.9224.9531.138.6848.1515.6527.0433.8642.5253.28
AttnFlow17.3724.8430.6839.4851.418.9736.2345.4858.8471.35
AttnIO (GRU)22.3636.7242.9851.2261.9123.4542.3151.7164.3377.64
AttnIO (no context)7.2725.1231.0340.3954.7214.3333.343.2658.3276.49
AttnIO (no alignment)21.8435.1941.1948.8559.0822.9941.350.6364.0178.02
AttnIO-AS23.7237.5343.5752.1762.8624.9843.7853.4965.4878.79
AttnIO-TS12.0923.6530.539.4851.6822.8240.0149.8661.0474.49
+ +Table 1: Performance of AttnIO in OpenDialKG, in comparison with baselines and ablation models. Results of the above 4 baselines (from Seq2Seq to DialKG Walker) are directly taken from Moon et al. (2019), as their code or implementation details are not available. Our model trained with all path supervision (AttnIO-AS) significantly outperforms all baselines. + +Also, we implement another baseline model named Seq2Path, by modifying attention based Seq2Seq model to decode entity paths. On the contrary with Seq2Seq baseline in Moon et al. (2019) which added zero-shot learning layer on KG embedding as decoder, Seq2Path explicitly traverses along the graph structure by masking unreachable nodes at each decoding step. Lastly, in order to find the importance of neighbor node encoding over each entity, we suggest AttnFlow, where Incoming Attention Flow is excluded (hence node features are not updated at each step) and the Outgoing Attention Flow directly generates knowledge path from dialog context and initial entity features. + +Implementation Details Our model depends heavily on message passing scheme of graph neural networks, which may lead to excessive memory usage when $G_{input}$ is large. To further scale AttnIO to larger graphs, we reduce the size of the input graph through edge-sampling on $G_{input}$ during training. Detailed explanation on this edge-sampling is presented in Appendix A. + +As all ground-truth paths in OpenDialKG are either 1-hop or 2-hop, we set the maximal path length $T = 2$ . We search for the best set of hyperparameters using grid-based search, choosing value with the best path accuracy with all other hyperparameters fixed. We implemented our model using PyTorch (Paszke et al., 2019) and DGL (Wang et al., 2019). Additional implementation details including hyperparameter search bounds and the best configuration are provided in Appendix E. + +# 4.1 Results + +Table 1 presents the overall evaluation results of AttnIO, and its comparison to baseline models. In addition to the recall@k of ground-truth paths (path@k), we report recall@k on the target nodes (tgt@k), as the destination node can be considered as the most important component in knowledge path to generate response. + +As can be seen in the table, our model outperforms all baselines in both path@k and tgt@k, when supervised with all entities in each path as label (AttnIO-AS). Especially, AttnIO-AS shows significantly better performance in metrics with small k. We also report our model in a more challenging setting of target supervision, assuming that only the destination node of each path is available (AttnIO-TS). In this case, our model shows a comparable target prediction performance $(tgt@k)$ to AttnIO-AS, while its path@k is relatively poor in small ks. + +Recurrent decoder based models, such as DialKG Walker and Seq2Path, relies only on a single state vector to model the transition between each decoding step. Therefore, once the model chooses to traverse a sub-optimal entity, it is hard to get back onto the right track without help of an aggressive beam search. In our method, on the contrary, the state of the decoder is essentially distributed into all the walkable entities' feature vectors; therefore, the transition is modeled alongside all the entities with nonzero attention value at each step, making the model more robust to 'misleading' hops. Also, note that AttnFlow shows consistent performance drop of about $30\%$ then AttnIO-AS in all metrics, indicating the importance of neighborhood encod + +
DialogA: Fiona Stafford wrote Emma. It's a romance novel. Are you into that genre? +B: Any other books that might fall under comedy? I'm in the mood for something light. +A: [RESPONSE]
AttnIO-ASComedy ⇒ subject of ⇒ The War of the Worlds ⇒ written by ⇒ Arthur. C. Clarke
AttnIO-TSComedy ⇒ subject of ⇒ The War of the Worlds ⇒ subject ⇒ Comedy
AttnFlowComedy ⇒ parent genre ⇒ Slapstick
GTComedy ⇒ subject of ⇒ One Crazy Summer
+ +Table 2: Sample paths generated from each model, along with the ground-truth path. More examples are provided in Appendix D. + +
ModelRelation Path Accuracy
AttnIO-AS0.403
AttnIO-TS0.365
+ +ing step for knowledge path retrieval. + +Ablation Study We conduct ablation study with three different configurations. First, we put GRU (Cho et al., 2014) as dialog encoder in replace of ALBERT, for a fairer comparison with baseline models. As shown in Table 1, we find that although the performance of AttnIO with GRU slightly degrades from that with ALBERT, it still outperforms all existing models. Next, in order to find out the value of dialog context in the traversal, we train our model with only the initial entities given as input (with uniform attention prior assigned to each initial entity), but not the dialog context. Recall@1 significantly drops in this case, while metrics with large $k$ relatively stays moderately. This implies that although information on initial nodes appearing in last utterance might be sufficient to prune improbable paths, the dialog context is essential in finding an optimal path among probable ones. We also find in the third ablation model where no dialog-KG alignment is applied (Section 3.4.3), that ALBERT initialization of node embedding helps, leading to performance gain of about $2\%$ in path@1. + +# 4.2 Analysis + +Relation Accuracy The poor entity path accuracy of AttnIO-TS may seem natural, as the initial node and intermediate node (in case of multi-hop) are not given as label in target supervision setting. However, one should note that there can be a vari- + +Table 3: Relation Path Accuracy at all path supervision (AttnIO-AS), and target supervision setting (AttnIO-TS). + +
ModelWinvs. GT
TieLose
AttnIO-AS11.2%55.2%33.6%
AttnIO-TS17.6%55%27.4%
+ +Table 4: Pairwise human evaluation results between model-generated paths, and ground-truth paths. + +ety of entity paths that match human sense in naturalness and coherence for a specific dialog. For an example shown in Table 2, any film of comedy genre shall replace One Crazy Summer in GT-path, without loss of naturalness. The generated path from AttnIO-AS could even be an answer, giving more information on the chosen film. The inherent one-to-many relationship between dialog context and probable knowledge, makes it hard to correctly assess the performance of knowledge retrieval models. Relation path accuracy could be one way to relieve this problem, as relations represent important attributes shared by similar entities. + +The relation path accuracy of AttnIO in both supervision setting is as shown in Table 3. The relation path accuracy under both settings is clearly higher than the entity path accuracy, implying the generalization capability of our model based on reasoning over relations, rather than depending on specific entities. Notably, AttnIO-TS shows only about $10\%$ relative difference from AttnIO-AS, unlike in entity path@1 in Table 1. This indicates that our model can learn to competently perform relational reasoning, even in this in-the-wild setting of target supervision. + +Human Evaluation In order to further examine the quality of paths from the two supervision setting, we conduct a human evaluation. We randomly sample 100 dialogues from test set, then generate knowledge paths for half of the dialogues from AttnIO-AS, and half of the dialogues from AttnIO-TS. We then perform a pairwise comparison between the path generated from AttnIO, and the ground-truth path actually used in the dataset. For each dialogue, we ask 5 crowd-source workers to evaluate which knowledge path is more suitable for response generation among the two. + +We report the win/tie/lose statistics of the model generated paths against ground-truth paths in Table 4. In both all-path supervision and target supervision setting, more than half of the paths from our model tied with the actual paths. The result attests to the quality of the generated paths, even including those marked as wrong in quantitative measures. + +![](images/c6cb278f45bc201bcfa1ee79274bc5fd0c7b41eda70740a8a73de874ec1b2ff2.jpg) + +![](images/5c8e7ec2aaf6346940e68dba412e94cb91ffada3d06a5615aaa70dfed0b2959f.jpg) + +![](images/5ec5f93c789148ccf4035cc75470b55783a349e1134d4a045db181ca94410710.jpg) + +![](images/19400bcd0b5f979d32854568f7460cfbf9b49741394ba11bc9c0bd2d1f226ebf.jpg) + +![](images/ca5dfa5ad4bd472fd0afea829ffa3f56fd9cf59ee1f04eca0b693650d5cb18c5.jpg) +Figure 3: Node attention visualization from the case study. Each figure represents the node attention at the initial state (Top), after the first decoding step (Center), and after the second decoding step (Bottom). We omit the edge attention to avoid visual cluttering. Best viewed in color. + +![](images/74747616b4fa274ddc2b95fb4aac194c0487ac33bcea2404ce51e84013ba3fd9.jpg) + +AttnIO-TS especially performs much more comparably to AttnIO-AS than in Table 1, indicating that the destination nodes can function as an adequate guidance to our model, in replace of the whole path label. + +Case Study We resort to a case study, for a clear presentation of AttnIO's path reasoning process. Figure 3 presents the visualization of output attention distribution from our model, when the dialog context is given as follows: + +A: Can you recommend some films by Dan Scanlon? + +B: [RESPONSE] + +Note that there are hundreds of neighbor nodes connected to each entity in the external KG, but for the sake of clarity, we pruned most of them in the visualization leaving only entities relevant to the dialog. Intuitively, there could be diverse knowledge paths as response to the user's question. Before the initial step, AttnIO starts from assigning an attention value of 1.0 to the only entity mentioned in the utterance, Dan Scanlon. In the first propagation step, our model finds from the dialog context, that the most relevant relation in this case is wrote, + +propagating most attention in Dan Scanlon to two movie entities, Monster's University and Cars. In the second step, AttnIO understands that most of the entities directly connected to these two movies, can be a good option for the destination node. As a consequence, AttnIO chooses to propagate a fair amount of attention value evenly to all reachable entities, resulting in the distribution visualized at the third figure. Finally, an optimal path can be retrieved as Dan Scanlon $\Rightarrow$ wrote $\Rightarrow$ Monster's University $\Rightarrow$ starred actor $\Rightarrow$ Steve Buscemi. + +Through the case study, we find that AttnIO directly reflects human intuition regarding an open question. It learns to perform relation-centric reasoning, and assign even amount of attention to equally likely reachable entities. In contrast, given a closed question such as "Who directed movie Cars?", AttnIO focuses on a small set of relevant entities and relations. A detailed analysis on the contrasting example is provided in Appendix C. + +# 5 Conclusion + +In this work, we suggest AttnIO, a novel path traversal model that reasons over KG based on two directions of attention flows. The empirical evaluations + +on OpenDialKG dataset show the strength of AttnIO in knowledge retrieval compared to baselines. AttnIO can also be trained to generate proper paths even in a more affordable setting of target supervision. Lastly, we show through case study that our model enjoys from transparent interpretation of path reasoning process, and is capable of intuitively modeling knowledge exploration depending on the dialog characteristics. + +# References + +Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In Advances in neural information processing systems, pages 2787-2795. +Qibin Chen, Junyang Lin, Yichang Zhang, Ming Ding, Yukuo Cen, Hongxia Yang, and Jie Tang. 2019. Towards knowledge-based recommender dialog system. 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 1803-1813. +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. arXiv preprint arXiv:1406.1078. +Rajarshi Das, Shehzaad Dhuliawala, Manzil Zaheer, Luke Vilnis, Ishan Durugkar, Akshay Krishnamurthy, Alex Smola, and Andrew McCallum. 2018. Go for a walk and arrive at the answer: Reasoning over paths in knowledge bases using reinforcement learning. In 6th International Conference on Learning Representations, ICLR 2018. +Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. 2018. Convolutional 2d knowledge graph embeddings. In Thirty-Second AAAI Conference on Artificial Intelligence. +Jesse Dodge, Suchin Gururangan, Dallas Card, Roy Schwartz, and Noah A Smith. 2019. Show your work: Improved reporting of experimental results. arXiv preprint arXiv:1909.03004. +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. +Xi Victoria Lin, Richard Socher, and Caiming Xiong. 2018. Multi-hop knowledge graph reasoning with reward shaping. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language + +Processing, pages 3243-3253, Brussels, Belgium. +Association for Computational Linguistics. +Shuman Liu, Hongshen Chen, Zhaochun Ren, Yang Feng, Qun Liu, and Dawei Yin. 2018. Knowledge diffusion for neural dialogue generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1489-1498. Association for Computational Linguistics. +Zhibin Liu, Zheng-Yu Niu, Hua Wu, and Haifeng Wang. 2019. Knowledge aware conversation generation with explainable reasoning over augmented graphs. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 1782-1792, Hong Kong, China. Association for Computational Linguistics. +Seungwhan Moon, Pararth Shah, Anuj Kumar, and Rajen Subba. 2019. Opendialkg: Explainable conversational reasoning with attention-based walks over knowledge graphs. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 845-854. +Deepak Nathani, Jatin Chauhan, Charu Sharma, and Manohar Kaul. 2019. Learning attention-based embeddings for relation prediction in knowledge graphs. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4710-4723. +Tu Dinh Nguyen, Dat Quoc Nguyen, Dinh Phung, et al. 2018. A novel embedding model for knowledge base completion based on convolutional neural network. 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 327-333. +Prasanna Parthasarathi and Joelle Pineau. 2018. Extending neural generative conversational model using external knowledge sources. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 690-695, 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, et al. 2019. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, pages 8024-8035. +Chao Shang, Yun Tang, Jing Huang, Jinbo Bi, Xiaodong He, and Bowen Zhou. 2019. End-to-end structure-aware convolutional networks for knowledge base completion. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3060-3067. + +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. +Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. 2016. Complex embeddings for simple link prediction. In International Conference on Machine Learning (ICML). International Conference on Machine Learning (ICML). +Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information processing systems, pages 5998-6008. +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2018. Graph attention networks. In International Conference on Learning Representations. +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. 2019. Deep graph library: Towards efficient and scalable deep learning on graphs. ICLR Workshop on Representation Learning on Graphs and Manifolds. +Xiaoran Xu, Songpeng Zu, Chengliang Gao, Yuan Zhang, and Wei Feng. 2018. Modeling attention flow on graphs. arXiv preprint arXiv:1811.00497. +Tom Young, Erik Cambria, Iti Chaturvedi, Hao Zhou, Subham Biswas, and Minlie Huang. 2018. Aug-mentation end-to-end dialogue systems with commonsense knowledge. In Thirty-Second AAAI Conference on Artificial Intelligence. +Houyu Zhang, Zhenghao Liu, Chenyan Xiong, and Zhiyuan Liu. 2019. Conversation generation with concept flow. arXiv preprint arXiv:1911.02707. +Hao Zhou, Tom Young, Minlie Huang, Haizhou Zhao, Jingfang Xu, and Xiaoyan Zhu. 2018. Commonsense knowledge aware conversation generation with graph attention. In *IJCAI*, pages 4623-4629. + +![](images/2a2c251f57fa46ffdd0fc0688a90344bf3212e90d9f6dcc9b8a91ef3830d1de8.jpg) +Figure 4: Out-degree distribution of all nodes in $G_{KG}$ . Both axis are in log scale. + +# A Subgraph Sampling + +We explain in more detail the subgraph sampling method adopted by AttnIO, as mentioned in Section 4. + +As shown in Figure 4, the out-degree distribution of $G_{KG}$ follows an extreme power-law distribution, which is typical in relational graphs. Among 100K nodes in $G_{KG}$ , about 31K nodes possess only one incoming neighbor node, making the graph extremely sparse. Meanwhile, a node with the highest in-degree has more than 21K incoming neighbor nodes, connecting the node to about $20\%$ of all entities in the whole graph. + +We find that the small number of hub nodes with high in/out degrees are the major factor that increases the size of input graph $G_{input}$ . Therefore, we choose to limit the maximal number of neighbors to sample from each entity, while constructing $G_{input}$ in the training time. We denote this limit as $N_{max}$ . + +The effect of subgraph sampling with different $N_{max}$ is shown in Figure 5. Setting $N_{max}$ to 100, subgraph sampling effectively reduces down the number of edges in the input graph to only $5.67\%$ of the original $G_{input}$ on average, while losing only about 1.0 absolute performance in path@1. In all our experiments, we set $N_{max} = 1000$ , leaving only $32.4\%$ of the edges originally in $G_{input}$ , while not compromising for the retrieval accuracy. + +![](images/5f754135f9559d1b1152d9005c10ae5c3f993480eb4e61929bd52f306466c8c1.jpg) +Figure 5: Effect of subgraph sampling. Blue bar denotes path@1 for each $N_{max}$ , while red bar denotes the average relative size of the sampled subgraph compared to the original $G_{input}$ . + +# B Dataset Statistics + +
DialogKG
# of dialogues:15,673|V|:100,813
# of turns:91,209|E|:1,190,658
+ +Table 5: Dataset Statistics of OpenDialKG. + +The statistics of OpenDialKG dataset is as shown in Table 5. There are 1358 distinct types of relations comprising $1\mathrm{M}+$ edges. + +![](images/d73b3855b0200366eafd74a8b4b06075b6ce24608c0834d3a4ba3ce1148d5ef7.jpg) + +![](images/63936ae24bd3d8d48447f6e9c399ff571cf423370f80e734131a43fe9039ecf3.jpg) + +![](images/3114e7d3f4dec8cbd08c438c45a176bc0ca3ef3a2ba99b8eae7376bd734da025.jpg) +Figure 6: Node attention visualization for the additional case study. Each figure represents the node attention at the initial state (Top), after the first decoding step (Center), and after the second decoding step (Bottom). The center and bottom figure might look similar, due to the slight difference of node attention distribution between the two steps. The attention is focused on small number of entities, on the contrary with the even distribution at the former case study. + +![](images/4165354f8496a5d9ecad9a9de55255353fd87ff0942222991d2375232fb633ee.jpg) + +# C Additional Case Study + +We provide an additional visualization of node attention distribution for a given dialogue in Figure 6. This time, the model is given a dialogue context as following: + +A: Someone suggested the Northanger Abbey book to me. Do you know who the author is? + +B: [RESPONSE] + +The dialogue is of a similar topic with the case study provided in Section 4.2, but the query in this case is a closed question that specifically asks for the author of a book. + +AttnIO first starts from the only initial entity Northanger Abbey, and finds from the context that the most relevant relation here is written by. Therefore in the first decoding step, AttnIO propagates more than half of the attention value (0.63) from Northanger Abbey to its writer, Jane Austen. In the second propagation step, AttnIO chooses not to propagate much attention to any of Jane Austen's + +neighbor nodes, preserving most of the attention value (0.59) by traversing a self-loop. (We omitted self-loops in the visualization for clarity.) + +Note that there are a variety of neighbor nodes walkable from Jane Austen, just as in the former case study. However, AttnIO understands the intent of user's utterance requiring for a specific answer, concentrating most of the attention to the nodes and edges directly related to the dialogue context. + +# D Generation Examples + +In Table 6, we present more path generation examples along with ground-truth paths for the given dialogues. Note that we only sampled cases where the paths generated from our model are different from the ground-truth paths. Dialogs are partially shown to meet the spatial constraints. + +
DialogA: I'm not sure who else was in it, but Ralph Fuentes also starred in Wrath of the Titans. +B: Wrath of the Titans, I didn't know Ralph Fuentes was in that movie. Tell me more about that movie and the stars in it. +A: [RESPONSE]
MODEL-ASWrath of the Titans ⇒ starred ⇒ Liam Neeson
MODEL-TSWrath of the Titans ⇒ starred ⇒ Liam Neeson
AttnFlowRalph Fuentes ⇒ starred ⇒ The hurt Locker
GTRalph Fuentes ⇒ starred ⇒ Wrath of the Titans ⇒ written by ⇒ Greg Berlanti
+ +
DialogA: I think Tiger Woods is a good golf player, but is he retired right now? +B: No he is actually still playing. Is he half asian? +A: [RESPONSE]
MODEL-ASAsian ⇒ ethnicity of ⇒ Tiger Woods
MODEL-TSAsian ⇒ ethnicity of ⇒ Tiger Woods
AttnFlowAsian ⇒ language ⇒ Vietnamese Lan-guage
GTAsian ⇒ includes ⇒ Vietnamese Ameri-can
+ +
DialogA: Could you recommend books written by Aldous Huxley? +B: [RESPONSE]
MODEL-ASAldous Huxley ⇒ wrote ⇒ The doors of perception & heaven and hell
MODEL-TSAldous Huxley ⇒ wrote ⇒ Brave new world
AttnFlowAldous Huxley ⇒ cause of death ⇒ La- rnyngeal Cancer
GTAldous Huxley ⇒ wrote ⇒ Island
+ +
DialogA: Drew Brees is a quarterback for the new orleans saints. I don’t follow football but I hear he is pretty good. +B: I like movies more than football. I actually liked the american football movies. +A: [RESPONSE]
MODEL-ASAmerican Football ⇒ subject of ⇒ Wild Cats ⇒ starred actor ⇒ Goldie Hawn
MODEL-TSAmerican Football ⇒ subject of ⇒ Wild Cats ⇒ has genre ⇒ Football
AttnFlowAmerican Football ⇒ sports played ⇒ Troy Aikman
GTAmerican Football ⇒ subject of ⇒ Rudy ⇒ has genre ⇒ Football
+ +Table 6: Generated path examples, along with the ground-truth paths. + +# E Additional Implementation Detail + +
Computing InfrastructureTesla V100 GPU
Search StrategyManual Tuning
Best Validation path@123.72 (AS), 12.18 (TS)
Training Time (per epoch)≈64min
+ +
HyperparameterSearch BoundBest Setting
max path length T22
subgraph sampling limit Nmaxchoice[100, 500, 1000, 5000, 10000]1000
max dialog historychoice[3, 4, 5, 6]3
entity feature dimensionchoice[60, 80, 100, 120]80
number of attention headschoice[3, 4, 5, 6]5
number of epochs2020
batch sizechoice[4, 8, 16]8
optimizerAdamAdam
learning rateloguniform(float[5e-2, 5e-5])5e-4
lr schedulerreduce_on_platoonreduce_on_platoon
lr reduction factor0.10.1
gradient clip normuniform-integer[3, 10]5
+ +Table 7: Additional implementation detail of AttnIO. We follow the specification from Dodge et al. (2019) by reporting hyperparameter search spaces and experimental details. \ No newline at end of file diff --git a/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/images.zip b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..c6e9f43295b502b050643b258338aa28a266f5af --- /dev/null +++ b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46173a0ba249c3b91d150be775b5d747643f6a16377a2ca3376f706207924bf4 +size 795636 diff --git a/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/layout.json b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..b924ea82a3480ac3d60cf936542fea796e6b0b79 --- /dev/null +++ b/attnioknowledgegraphexplorationwithinandoutattentionflowforknowledgegroundeddialogue/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:687face615a801c7b8c2c849a4621b41d43a0683ad06e003505b60f4e3da9306 +size 389539 diff --git a/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_content_list.json b/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c4cbbded253a06c7e73f67aaabd323b1858c432d --- /dev/null +++ b/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f098ed1d7a3cd3831600dafef8c9b176cfa114ecf5eaca442a8ad5b81e3396d6 +size 73311 diff --git a/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_model.json b/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3e88bb69cc6565afe31d8a202876f69aa520c2e8 --- /dev/null +++ b/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f7bfc5221dc53e539fdbe68c5e3b11ea5454683043f2e31a537771dca3b6801 +size 90231 diff --git a/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_origin.pdf b/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7274ac31f84ea191bc3cd9617eb3a0c1e6fa9382 --- /dev/null +++ b/augmentednaturallanguageforgenerativesequencelabeling/839b9fcf-c60c-441c-b222-9b32c6b6371f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f305d7769c77de0903dd436e46e7fff5cd3a6c4b3c68f31eaefabd9f9cf5ef5 +size 440712 diff --git a/augmentednaturallanguageforgenerativesequencelabeling/full.md b/augmentednaturallanguageforgenerativesequencelabeling/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d44e1b798c12c0d0e6613521a2a4e4489a8d2b38 --- /dev/null +++ b/augmentednaturallanguageforgenerativesequencelabeling/full.md @@ -0,0 +1,273 @@ +# Augmented Natural Language for Generative Sequence Labeling + +Ben Athiwaratkun + +AWS AI + +benathi@amazon.com + +Jason Krone + +AWS AI + +kronej@amazon.com + +Cicero Nogueira dos Santos + +AWS AI + +cicnog@amazon.com + +Bing Xiang + +AWS AI + +bxiang@amazon.com + +# Abstract + +We propose a generative framework for joint sequence labeling and sentence-level classification. Our model performs multiple sequence labeling tasks at once using a single, shared natural language output space. Unlike prior discriminative methods, our model naturally incorporates label semantics and shares knowledge across tasks. Our framework is general purpose, performing well on few-shot, low-resource, and high-resource tasks. We demonstrate these advantages on popular named entity recognition, slot labeling, and intent classification benchmarks. We set a new state-of-the-art for few-shot slot labeling, improving substantially upon the previous 5-shot $(75.0\% \rightarrow 90.9\%)$ and 1-shot $(70.4\% \rightarrow 81.0\%)$ state-of-the-art results. Furthermore, our model generates large improvements $(46.27\% \rightarrow 63.83\%)$ in low-resource slot labeling over a BERT baseline by incorporating label semantics. We also maintain competitive results on high-resource tasks, performing within two points of the state-of-the-art on all tasks and setting a new state-of-the-art on the SNIPS dataset. + +# 1 Introduction + +Transfer learning has been the pinnacle of recent successes in natural language processing. Large pre-trained language models are powerful backbones that can be fine-tuned for different tasks to achieve state-of-the-art performance in wide-raging applications (Peters et al., 2018; Devlin et al., 2019; Radford et al., 2019; Lewis et al., 2019; Yang et al., 2019; Liu et al., 2019). + +While these models can be adapted to perform many tasks, each task is often associated to its own output space, which limits the ability to perform multiple tasks at the same time. For instance, a sentiment analysis model is normally a binary classifier that decides between class labels "positive" + +and "negative", while a multi-class entailment system classifies each input as "entail", "contradict", or "neither". This approach presents difficulty in knowledge sharing among tasks. That is, to train the model for a new task, the top-layer classifier is replaced with a new one that corresponds to novel classes. The class types are specified implicitly through different indices in the new classifier, which contain no prior information about the label meanings. This discriminative approach does not incorporate label name semantics and often requires a non-trivial amount of examples to train (Lee et al., 2020). While this transfer learning approach has been immensely successful, a more efficient approach should incorporate prior knowledge when possible. + +Conditional generative modeling is a natural way to incorporate prior information and encode the output of multiple tasks in a shared predictive space. Recent work by Raffel et al. (2019) built a model called T5 to perform multiple tasks at once using natural language as its output. The model differentiates tasks by using prefixes in its input such as "classify sentiment:","summarize:", or "translate from English to German:" and classify each input by generating natural words such as "positive" for sentiment classification or "This article describes ..." for summarization. + +However, the appropriate output format for important sequence labeling applications in NLP, such as named entity recognition (NER) and slot labeling (SL) is not immediately clear. In this work, we propose an augmented natural language format for sequence labeling tasks. Our format locally tags words within the sentence (Figure 1) and is easily extensible to sentence-level classification tasks, such as intent classification (IC). + +Our highlighted contributions and main findings are as follows: + +![](images/888156998845fc60eb93003617c800dec11d6b201a54ac4bdd28afbe40c0556c.jpg) +Figure 1: The conversion between the canonical BIO tagging format and our augmented natural language format. + +1) We propose an effective new output format to perform joint sequence labeling and sentence classification through a generation framework. +2) We demonstrate the ability to perform multiple tasks such as named entity recognition, slot labeling and intent classification within a single model. +3) Our approach is highly effective in low-resource settings. Even without incorporating label type semantics as priors, the generative framework learns more efficiently than a token-level classification baseline. The model improves further given natural word labels, indicating the benefits of rich semantic information. +4) We show that supervised training on related sequence labeling tasks acts as an effective meta-learner that prepares the model to generate the appropriate output format. Learning each new task becomes much easier and results in significant performance gains. +5) We set a new state-of-the-art for few-shot slot labeling, outperforming the prior state-of-the-art by a large margin. +6) We plan to open source our implementation. Please visit https://arxiv.org/abs/2009.13272 for the release updates. + +# 2 Model + +# Sequence Labeling as Generation + +Most work on sequence labeling uses token-level classification frameworks. That is, given a list of tokens $\ell = \{\ell_i\}_{i=1}^n$ , we perform a prediction on every token $\ell_i$ to obtain $y' = \{y_i'\}_{i=1}^n = \{f(\ell_i; \ell)\}_{i=1}^n$ where $f(\cdot)$ is a token-level prediction function. The prediction is accurate if it matches the original sequence label $y = \{y_i\}_{i=1}^n$ . + +In contrast to this convention, we frame sequence labeling as a conditional sequence generation problem where given the token list $\ell$ , we generate an output list $o = g(\ell)$ where $g$ is a sequence-to-sequence + +model. A "naive" formulation for this task would be to directly generate $o = y$ given $\ell$ . However, this approach is prone to errors such as word misalignment and length mismatch (see supplementary materials Section A.2 for discussion). + +We propose a new formulation for this generation task such that, given the input sequence $\ell$ , our method generates output $o$ in augmented natural language. The augmented output $o$ repeats the original input sequence $\ell$ with additional markers that indicate the token-spans and their associated labels. More specifically, we use the format $[\ell_j,\dots,\ell_{j + t}|L]$ to indicate that the token sequence $\ell_j,\dots,\ell_{j + t}$ is labeled as $L$ . + +Fig. 1 depicts the proposed format and its equivalent canonical BIO format for the same input sentence. The conversion between the BIO format and our augmented natural language format is invertible without any information loss. This is crucial so that the generated output from model prediction can be converted back for comparison without uncertainty. + +There are other formats which can encapsulate all the tagging information but are not invertible. For instance, outputting only the token spans of interest with tagging patterns $\lfloor \ell_{j},\dots ,\ell_{j + t}\mid L\rfloor$ without repeating the entire sentence results in the invertibility breaking down when there are duplicate token spans with different labels. We discuss this further in the appendix Section A.3. + +# Joint Sequence Classification and Labeling + +Our sequence to sequence approach also supports joint sentence classification and sequence labeling by incorporating the sentence-level label in the augmented natural language format. In practice, we use the pattern (( sentence-level label )) in the beginning of the generated sentence, as shown in Fig. 1. The use of double parentheses is to prevent confusion with a single parenthesis that can occur in the original word sequence $\ell$ . + +# Training and Evaluation + +We train our model by adapting the pre-trained T5 with the sequence to sequence framework. Additionally, we prefix the input with task descriptors in order to simultaneously perform multiple classification and labeling tasks, similar to the approach by Raffel et al. (2019). This results in a seamless multi-task framework, as illustrated in the top part of Fig. 2. To evaluate, we convert the generated output back to the canonical BIO format and calcu + +![](images/b2a425714ab1a68311e537c5385a0c842794a658423da9a08dc51138f4f53103.jpg) +Figure 2: Comparison between our generative-style sequence labeling model (top) and the conventional token-level classification model (bottom). + +late the F1 score for sequence labeling or accuracy for sentence classification. + +# Natural Labels + +Labels are associated to real-world concepts that can be described through natural words. These words have rich information, but are often ignored in traditional discriminative approaches. In contrast, our model naturally incorporate label semantics directly through the generation-as-classification approach. + +We perform label mapping in order to match the labels to its natural descriptions and use the natural labels in the augmented natural language output. Our motivation is as follows: (1) Pre-trained conditional generation models which we adapt on have richer semantics embedded in natural words, rather than dataset-specific label names. For instance, "country city state" contains more semantic information compared to "GPE", which is an original label in named entity recognition tasks. Using natural labels should allow the model to learn the association between word tokens and labels more efficiently, without requiring many examples. (2) Label knowledge can be shared among different tasks. For instance, after learning how to label names as "person", given a new task in another domain which requires labeling "artist", the model can more easily associate names with "artist" due to the proximity of "person" and "artist" in embeddings. This is not the case if the concept of "person" was learned with other uninformative words. + +# 3 Related Work + +Sequence to sequence learning has various applications including machine translation (Sutskever et al., 2014; Bahdanau et al., 2015), language modeling (Radford et al., 2018; Raffel et al., 2019), + +abstractive summarization (Rush et al., 2015), generative question answering (Dong et al., 2019), to name a few. However, the sequence-to-sequence framework is often not a method of choice when it comes to sequence labeling. Most models for sequence labeling use the token-level classification framework, where the model predicts a label for each element in the input sequence (Baevski et al., 2019; Li et al., 2019b; Chen et al., 2019). While select prior work adopts the sequence-to-sequence method for sequence labeling (Chen and Moschitti, 2018), this approach is not widely in use due to the difficulty of fixing the output length, output space, and alignment with the original sequence. + +Multi-task and multi-domain learning often benefit sequence labeling performance (Changpinyo et al., 2018). The archetypal multi-task setup jointly trains on a target dataset and one or more auxiliary datasets. In the cross lingual setting, these auxiliary datasets typically represent high-resource languages (Schuster et al., 2018; Cotterell and Duh, 2017). While in a monolingual scenario, the auxiliary datasets commonly represent similar, high-resource tasks. Examples of similar multi-task pairs include NER and slot labeling (Louvan and Magnini, 2019) as well as dialogue state tracking and language understanding (Rastogi et al., 2018). + +A recent series of works frame natural language processing tasks, such as translation, question answering, and sentence classification, as conditional sequence generation problems (Raffel et al., 2019; Radford et al., 2019; Brown et al., 2020). By unifying the model output space across tasks to consist of natural language symbols, these approaches reduce the gap between language model pre-training tasks and downstream tasks. Moreover, this framework allows acquisition of new tasks without any architectural change. The GPT-3 model (Brown + +
Task & DatasetIntent Clas.Slot Labeling
SNIPSATISSNIPSATISCoNLLOnto
SL/ICBi-Model (Wang et al., 2018)98.9996.89
Joint BERT (Chen et al., 2019)98.6097.5097.0096.10
ELMO+BiLSTM (Siddhant et al., 2019)99.2997.4293.9095.62
NERCloze-CNN (Baevski et al., 2019)93.50
BERT-MRC (Li et al., 2019a)93.0491.11
BERT-MRC + DSC (Li et al., 2019b)93.3392.07
BERT Base (Devlin et al., 2019)92.4088.95
Ours: Individual99.0096.8697.4396.1390.7090.24
Ours: SNIPS+ATIS99.2997.2097.2195.83
Ours: CoNLL+Ontonotes91.4889.52
Ours: SNIPS+ATIS+CoNLL+Ontonotes99.1497.0896.8296.6591.4889.67
+ +Table 1: Results of our models trained on combinations of datasets. Results for Ours: individual are from models trained on a single respective dataset. We underline scores of our models that exceed previous state-of-the-art results in each domain. Scores in boldface are the best overall scores among our models, or among the baselines. We use the boldface and underline notation for the rest of the paper. + +et al., 2020) demonstrates the promise of this framework for few-shot learning. Among other successes, GPT-3 outperforms BERT-Large on the SuperGLUE benchmark using only 32 examples per task. To the best of our knowledge, we are the first to apply this multi-task conditional sequence generation framework to sequence labeling. + +The conditional sequence generation framework makes it easy to incorporate label semantics, in the form of label names such as departure city, example values like San Francisco, and descriptions like "the city from which the user would like to depart on the airline". Label semantics provide contextual signals that can improve model performance in multi-task and low-resource scenarios. Multiple works show that conditioning input representations on slot description embeddings improves multidomain slot labeling performance (Bapna et al., 2017; Lee and Jha, 2019). Embedding example slot values in addition to slot descriptions yields further improvements in zero-shot slot labeling (Shah et al., 2019). In contrast to our work, these approaches train slot description and slot value embedding matrices, whereas our framework can incorporate these signals as natural language input without changing the network architecture. + +# 4 Experimental Setup and Results + +# 4.1 Data + +Datasets We use popular benchmark data SNIPS (Coucke et al., 2018) and ATIS (Hemphill et al., + +1990) for slot labeling and intent classification. SNIPS is an SLU benchmark with 7 intents and 39 distinct types of slots, while ATIS is a benchmark for the air travel domain (see appendix A.4 for details). We also evaluate our approach on two named entity recognition datasets, Ontonotes (Pradhan et al., 2013) and CoNLL-2003 (Sang and Meulder, 2003). + +Construction of Natural Labels We preprocess the original labels to natural words as follows. For Ontonotes and CoNLL datasets, we transform the original labels via mappings detailed in Table 9 and 5 in the appendix. For instance, we map “PER” to “person” and “GPE” to “country city state”. For SNIPS and ATIS, we use the following rules to convert intent and slot labels: (1) we split words based on “:”, “-”, “/”, and capitalized letters. For instance, we convert “object_type” to “object type” and “AddTo Playlist” to “add to playlist”. These rules result in better tokenization and enrich the label semantics. We refer to these as the natural label setting and use is as our default. + +# 4.2 Multi-Task Sequence Classification and Slot Labeling + +We first demonstrate that our model can perform multiple tasks in our generative framework and achieve highly competitive or state-of-the-art performance. We consider 4 sequence labeling tasks and 2 classification tasks: NER on Ontonotes and CoNLL datasets; and slot labeling (SL) and in + +tent classification (IC) on SNIPS and ATIS dialog datasets. For comparison, we provide baseline results from the following models: + +SL and IC: Bi-Model (Wang et al., 2018) uses two correlated bidirectional LSTMs to perform both IC and SL. Joint BERT (Chen et al., 2019) performs joint IC and SL with a sequential classifier on top of BERT, where the classification for the start-of-sentence token corresponds to intent class. ELMO+Bi-LSTM (Siddhant et al., 2019) uses a Bi-LSTM with CRF as a classifier on top of pre-trained ELMO (Peters et al., 2018). + +NER: Cloze-CNN (Baevski et al., 2019) finetunes a Bi-LSTM with CRF model Peters et al. (2018) on a pre-trained model with a cloze-style word reconstruction task. BERT MRC (Li et al., 2019a) performs sequence labeling in a question answering model to predict the slot label span. BERT MRC + Dice Loss (Li et al., 2019b) improves upon BERT MRC with a dice loss shown to be suitable for data with imbalanced labels. BERT (Devlin et al., 2019) refers to a token-level classification with BERT pre-trained model. Note that the results for BERT with Ontonotes are from our own implementation. + +In Table 1, we report a summary of the results for our method and the baselines. Our proposed model achieves highly competitive results for ATIS, Ontonotes, and CoNLL datasets, as well as state-of-the-art slot labeling and intent classification performance on the SNIPS dataset. Unlike all the baseline models, which can perform a single task on a specific dataset, our model can perform all the tasks considered at once (last row of Table 1). For the multi-task models, our results show that different sequence labeling task can help mutually benefit each other, where ATIS slot labeling result improves from 96.13 to 96.65 and CoNLL improves from 90.70 to 91.48. While there are other approaches that perform better than our models in some tasks, we highlight the simplicity of our generation framework which performs multiple tasks seamlessly. This ability helps the models transfer knowledge among tasks with limited data, which are demonstrated through the rest of the paper. + +# 4.3 Limited Resource Scenarios and Importance of Label Semantics + +In this section, we show that our model can use the semantics of labels to learn efficiently, which is crucial for scenarios with limited labeled data. To + +demonstrate this effect, we use our model with the following variants of labels which differ semantic quality: (1) natural label, (2) original label and (3) numeric label. + +The natural label version is our default setting where we use labels expressed in natural words. The original label case uses labels provided by the datasets, and the numeric label case uses numbers 0, 1, 2, ... as label types. In the numeric version, the model does not have pre-trained semantics of the label types and has to learn the associations between the labels and the relevant words from scratch. We also compare with the BERT token-level classification model. Similar to the numeric label case, the label types for BERT do not initially have associated semantics and are implicit through indices in the classifier weights. We use the SNIPS dataset to conduct our experiments due to its balanced domains (see Table 7 in Appendix). We experiment with very limited resource scenarios where we use as low as $0.25\%$ of training data, corresponding to roughly one training sentence per label type on average. + +Figure 3a shows the sequence labeling performance for varying amount of training data (see Table 10 in the appendix for numeric results). We observe that label semantics play a crucial role in the model's ability to learn effectively for limited resource scenarios. Our model with natural labels outperforms all other models, achieving an F1 score of $60.4 \pm 2.7\%$ with $0.25\%$ training data, and giving a slight boost over using original labels ( $57.5 \pm 2.4\%$ ). We believe that the improvement can be more dramatic in other datasets where the original labels have no meanings (such as in the numeric case), are heavily abbreviated, or contain rare words. With the numeric model, the performance suffers significantly in low-resource settings, achieving only $50.1 \pm 5.3\%$ , or $10.3\%$ lower than the natural label model, with $0.25\%$ data. This result further supports the importance of label semantics in our generation approach. Interestingly, we also observe that the numeric model still outperforms BERT token-level classification ( $44.7 \pm 6.4\%$ ), where neither model contains prior label semantics. This result indicates that even in the absence of label meanings, the generation approach seems more suitable than the token-level framework. + +![](images/c54f5a3f3b279ba7ec8e4661d0fd9f60ff2719da54b8020ee58103be183ee1fa.jpg) +(a) + +![](images/68b2a1addbdf0589ec5bf2a8fc7bb7d0994c40c8fb885862338ccd13c038e8c8.jpg) +(b) +Figure 3: Model performance on limited amount of training data. The error bars indicate the standard deviation over 4 random trials. Ours-o is our model with its original labels. Ours-n is our model with numeric labels. + +![](images/e0a95236fbef54ef66b6fe7a59fae5fa1fffbf591fbbd70f20352abfd24ec184.jpg) +(c) + +# 4.4 Teaching Model to Generate via Supervised Transfer Learning + +While we train our model in limited data scenarios, we are asking the model to generate a new format of output given small amount of data. This is challenging since a sequence generation framework typically requires large amount of training (Sutskever et al., 2014). Despite this challenge, our model is able to outperform the classical token-level framework with ease. This section explores a clear untapped potential – by teaching our model how to generate the augmented natural language format before adapting to new tasks, we show that the performance on limited data significantly improves. This result contrasts with the BERT token-level model where supervised transfer learning hurts overall performance compared to BERT's initial pre-training due to possible overfitting. + +To conduct this experiment, we train our model with the Ontonotes NER task in order to teach it the expected output format. Then, we adapt it on another task (SNIPS) with limited data, as in Section 4.3. We compare the results with the token-level BERT model, which also uses the BERT model trained on Ontonotes for supervised pre-training. We demonstrate the results in Figure 3b as well as highlight the improvement due to supervised pretraining in Figure 3c. We also provide full numeric results in the appendix Table 11 for reference. + +Our model demonstrates consistent improvement, achieving an F1 score of $63.8 \pm 2.6\%$ using $0.25\%$ of the training dataset, compared to $60.4 \pm 0.27\%$ without supervised transfer learning. The improvement trend also continues for other data settings, as shown in Figure 3c. The benefits from transfer learning is particularly strong for the numeric label model, achieving $57.4 \pm 2.9\%$ compared to $50.1 \pm 5.3\%$ for $0.25\%$ data. This results suggests that the initial knowledge from supervised pre-training helps the model associate its labels + +(without prior semantics) to the associated words more easily. + +The supervised transfer learning can also be seen as a meta-learner, which teaches the model how to perform sequence labeling in the generative style. In fact, when we investigate the model output without adapting to the SNIPS dataset, in addition to the output having the correct format, it already contains relevant tagging information for new tasks. + +For instance, a phrase "Onto jerry's Classical Moments in Movies" from the SNIPS dataset results in the model output "Onto jerry's [ Classical Moments in Movies | work of art]". This prediction closely matches the true label "Onto [ jerry's | playlist owner ] [ Classical Moments in Movies | playlist ]" where the true class of "Classical Moments in Movies" is playlist. Intuitively, the classification as work of art is in agreement with the true label playlist, but simply needs to be refined to match the allowed labels for the new task. + +In contrast to our framework where the supervised transfer learning helps teach the model an output style, the transfer learning for the token-level classification simply adapts its weights and retains the same token-level structure (albeit with a new classifier). We observe no significant improvement from supervised pre-training for the BERT token-level model, which obtains an F1 score of $46.3 \pm 3.6\%$ compared to $44.7 \pm 6.4\%$ without supervised pre-training (with $0.25\%$ SNIPS data). The improvements are also close to zero or negative for higher data settings (Figure 3c), suggesting that the pre-training of the token-level classification might overfit to the supervised data, and results in lower generalization on other downstream tasks. Overall, the final result on the BERT model lags far behind our framework, performing $17.5\%$ lower than our model's score for $0.25\%$ training data. + +In addition, our model with numeric labels performs much better than the BERT token-level + +model and further highlights the suitability of our generative output format for sequence labeling, regardless to the label semantics. Possible explanations are that the sequence to sequence label is less prone to overfitting compared to the classification framework. It could also be the case that locally tagging words with labels in the word sequence helps improve attention within the transformers model, and improve robustness to limited data. + +# 4.5 Few-Shot Sequence Labeling + +# 4.5.1 Few-Shot Learning + +In few-shot learning, we seek to train models such that given a new task, the models are able to learn efficiently from few labels. Different tasks are sampled from various data domains which differ in terms of allowed labels and other nuances such as input styles. + +We define a data domain $\mathcal{D}$ as a set of labeled examples $\mathcal{D} = \{(x_i, y_i)\}_{i=1}^{N_{\mathcal{D}}}$ which has its set of allowed label types $\mathcal{Y}_{\mathcal{D}} \ni y_i$ . Few-shot learning approaches are evaluated over many episodes of data, which represent a variety of novel tasks. Each episode $(S, \mathcal{Q})$ consists of a support set $S$ containing $K$ -shot labeled samples, as well as a query set $\mathcal{Q}$ used for evaluation. Data from the evaluation episodes are drawn from the target domains $\{\mathcal{D}_1^T, \mathcal{D}_2^T, \ldots\}$ , which the model has not previously seen. + +To learn such models, we typically have access to another set of domains called the source domains $\{\mathcal{D}_1^S,\mathcal{D}_2^S,\ldots \}$ , which can be used as the training resources. In order to train the model to learn multiple tasks well, many few-shot learning approaches use meta-learning, or a learning to learn approach, where the model is trained with many episodes drawn from the source domains in order to mimic the evaluation (Vinyals et al., 2016; Snell et al., 2017; Sung et al., 2018; Finn et al., 2017). We refer to this as the episodic training. + +Another approach, called fine-tuning, trains the model on a regular training set from the source domains: $\cup_{m}\mathcal{D}_{m}^{S}$ . Given an episode $(\mathcal{S},\mathcal{Q})$ at evaluation time, the model fine-tunes it on the support $\mathcal{S}$ , typically with a new classifier constructed for the new task, and evaluates on $\mathcal{Q}$ . + +# 4.5.2 Few-Shot Baselines + +TransferBERT trains a token-level classification model by fine-tuning. Matching Net (MN) + BERT Vinyals et al. (2016) Given a word $x_{i}$ , the model classifies by finding the most similar word + +$x_{j}^{S}$ in the support set and predicts $y_{j}^{S}$ as the label of $x_{i}$ . The model also adapts the backbone model with episodic training. Warm Proto Zero (WPZ) + BERT Fritzler et al. (2019) uses token-level prototypical network (Snell et al., 2017), which classifies by comparing a word $x_{i}$ to each class centroid rather than individual sample embeddings. L-TapNet + CDT Hou et al. (2020) uses a CRF framework and leverages label semantics in representing labels to calculate emission scores and a collapsed dependency transfer method to calculate transition scores. We note that all baselines except for TransferBERT uses episodic meta-training whereas TransferBERT uses fine-tuning. All baseline results are taken from Hou et al. (2020). + +Our model performs fine-tuning with the generation framework. The major difference between our model and a token-level classification model such as TransferBERT is that we do not require a new classifier for every novel task during the fine-tuning on the support set. The sequence generation approach allows us to use the entire model and adapt it to new tasks, where the initial embeddings contain high quality semantics and help the model transfer knowledge efficiently. + +# 4.5.3 K-shot Episode Construction + +Traditionally, the support set $S$ is often constructed in $K$ -shot formats where we use only $K$ instances of each label type. In sequence labeling problems, this definition is challenging due to the presence of multiple occurrences or multiple label types in a single sentence. We follow Hou et al. (2020) by using the following definition of a K-shot setting: All labels within the task appears at least $K$ times in $S$ and would appear less than $K$ times if any sentence is removed. We sample 100 episodes from each domain according to this definition. Note that Hou et al. (2020)'s episodes are similar to ours, but preprocess the sentences by lowercasing and removing extra tokens such as commas (see details in Section A.6). Our model is flexible and can handle raw sentences; we therefore use the episodes from the original SNIPS dataset without any modifications. + +# 4.5.4 Data + +We perform few-shot experiments on the 7 domains $\{\mathcal{D}_1,\dots ,\mathcal{D}_7\}$ of the SNIPS dataset, namely, Weather (We), Music (Mu), Playlist (Pl), Book (Bo), ScreeningEvent (Se), Restaurant (Re), CreativeWork (Cr). To evaluate a model on domain $\mathcal{D}_i$ we meta-train the model on $\mathcal{D}_i^{\prime} = \{\mathcal{D}_1,\ldots ,\mathcal{D}_7\} -$ + +
WeMuPlBoSeReCrAve.
1-shotTransferBERT55.8238.0145.6531.6321.9641.7938.53
MN + BERT21.7410.6839.7158.1524.2132.8869.66
WPZ + BERT46.7240.0750.7868.7360.8155.5867.67
L-TapNet+CDT71.5360.5666.2784.5476.2770.7962.89
Ours + SNIPS82.6277.4671.3385.4983.2284.2382.92
Ours + Onto56.3967.1053.4971.9466.2169.0428.80
Ours + No Meta46.4259.0247.4763.7949.4264.4517.60
5-shotTransferBERT59.4142.0046.7020.7428.2067.7558.61
MN + BERT36.6733.6752.6060.0938.4233.2872.10
WPZ + BERT67.8255.9946.0272.1773.5960.1866.89
L-TapNet+CDT71.6467.1675.8884.3882.5870.0573.41
Ours + SNIPS91.3586.7387.2095.8592.7191.2391.55
Ours + Onto83.1586.1580.3690.2784.8785.8968.08
Ours + No Meta73.1482.0278.8284.8683.1486.6352.56
+ +Table 2: Our few-shot slot labeling results on 7 domains of SNIPS dataset. Ours + SNIPS perform meta-training on the leave-one-out SNIPS data, similar to other baselines. Ours + Onto is our model trained on Ontonotes. Ours + No Meta involves no meta-training. + +$\mathcal{D}_i$ . We refer to this as the leave-one-out metatraining sets. All other baselines also use this metatraining data setup. + +We note that the training set $\mathcal{D}_i^\prime$ has data distributions that closely match $\mathcal{D}_i$ since they are both drawn from the SNIPS dataset. We investigate more challenging scenarios where we use an alternative source as a meta-training set, as well as no meta-training. In particular, we choose Ontonotes NER task as the alternative source domain. The benefits of using this setup is such that it establishes a single meta-trained model that works across all evaluation domains, which we offer as a challenging benchmark for future research. + +# 4.5.5 Few-Shot Results + +Table 2 demonstrates the results for few-shot experiments. Our model outperforms previous state-of-the-art on every domain evaluated. In the 5-shot case, our model achieves an average F1 score of $90.9\%$ , exceeding the strongest baseline by $15.9\%$ . Even without meta-training, the model is able to perform on par with state-of-the-art models, achieving an F1 score of $77.3\%$ versus $75.0\%$ for the baseline. Training on an alternative source (NER task) also proves to be an effective meta-learning strategy, performing better than the best baseline by $7.7\%$ . These results indicate that our model is robust in its ability to learn sequence tagging on target domains that differ from sources. In the 1- + +shot case, our model achieves an average F1 score of $81.0\%$ , outperforming the best baseline significantly (10.6% improvement). + +We note that the average support sizes are around 5 to 40 sentences for the 5-shot case, and one to 8 sentences for the 1-shot case (see Table 12 and 13 for details). The results are particularly impressive given that we adapt a large transformer model based on such limited number of samples. In comparison to other fine-tuning approaches such as TransferBERT, our model performs substantially better, indicating that our generative framework is a more data-efficient approach for sequence labeling. + +# 5 Discussion and Future Work + +Our experiments consistently show that the generation framework is suitable for sequence labeling and sets a new record for few-shot learning. Our model adapts to new tasks efficiently with limited samples, while incorporating the label semantics expressed in natural words. This is akin to how humans learn. For instance, we do not learn the concept of "person" from scratch in a new task, but have prior knowledge that "person" likely corresponds to names, and refine this concept through observations. The natural language output space allows us to retain the knowledge from previous tasks through shared embeddings, unlike the token-level model which needs new classifiers for novel + +tasks, resulting in a broken chain of knowledge. + +Our approach naturally lends itself to life-long learning. The unified input-output format allows the model to incorporate new data from any domain. Moreover, it has the characteristics of a single, life-long learning model that works well on many levels of data, unlike other approaches that only perform well on few-shot or high-resource tasks. Our simple yet effective approach is also easily extensible to other applications such as multi-label classification, or structured prediction via nested tagging patterns. + +# References + +Alexei Baevski, Sergey Edunov, Yinhan Liu, Luke Zettlemoyer, and Michael Auli. 2019. Cloze-driven pretraining of self-attention 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 5359-5368. Association for Computational Linguistics. +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. +Ankur Bapna, Gokhan Tur, Dilek Hakkani-Tur, and Larry Heck. 2017. Towards zero-shot frame semantic parsing for domain scaling. arXiv preprint arXiv:1707.02363. +Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020. Language models are few-shot learners. +Soravit Changpinyo, Hexiang Hu, and Fei Sha. 2018. Multi-task learning for sequence tagging: An empirical study. In Proceedings of the 27th International Conference on Computational Linguistics, pages 2965-2977, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Lingzhen Chen and Alessandro Moschitti. 2018. Learning to progressively recognize new named entities with sequence to sequence models. In Proceedings of the 27th International Conference on Computational Linguistics, pages 2181-2191, Santa Fe, + +New Mexico, USA. Association for Computational Linguistics. +Qian Chen, Zhu Zhuo, and Wen Wang. 2019. BERT for joint intent classification and slot filling. CoRR, abs/1902.10909. +Ryan Cotterell and Kevin Duh. 2017. Low-resource named entity recognition with cross-lingual, character-level neural conditional random fields. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 91–96, Taipei, Taiwan. Asian Federation of Natural Language Processing. +Alice Coucke, Alaa Saade, Adrien Ball, Théodore Bluche, Alexandre Caulier, David Leroy, Clément Doumouro, Thibault Gisselbrecht, Francesco Caltagirone, Thibaut Lavril, Maël Primet, and Joseph Dureau. 2018. Snips voice platform: an embedded spoken language understanding system for private-by-design voice interfaces. CoRR, abs/1805.10190. +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. +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 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, 8-14 December 2019, Vancouver, BC, Canada, pages 13042-13054. +Chelsea Finn, Pieter Abbeel, and Sergey Levine. 2017. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pages 1126-1135. PMLR. +Alexander Fritzler, Varvara Logacheva, and Maksim Kretov. 2019. Few-shot classification in named entity recognition task. In Proceedings of the 34th ACM/SIGAPP Symposium on Applied Computing, SAC 2019, Limassol, Cyprus, April 8-12, 2019, pages 993-1000. ACM. +Charles T. Hemphill, John J. Godfrey, and George R. Doddington. 1990. The ATIS spoken language systems pilot corpus. In Speech and Natural Language: Proceedings of a Workshop Held at Hidden Valley, Pennsylvania, USA, June 24-27, 1990. Morgan Kaufmann. + +Yutai Hou, Wanxiang Che, Yongkui Lai, Zhihan Zhou, Yijia Liu, Han Liu, and Ting Liu. 2020. Few-shot slot tagging with collapsed dependency transfer and label-enhanced task-adaptive projection network. In ACL. +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. +Cheolhyoung Lee, Kyunghyun Cho, and Wanmo Kang. 2020. Mixout: Effective regularization to finetune large-scale pretrained language models. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. +Sungjin Lee and Rahul Jha. 2019. Zero-shot adaptive transfer for conversational language understanding. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6642-6649. +Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2019. BART: denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. CoRR, abs/1910.13461. +Xiaoya Li, Jingrong Feng, Yuxian Meng, Qinghong Han, Fei Wu, and Jiwei Li. 2019a. A unified MRC framework for named entity recognition. CoRR, abs/1910.11476. +Xiaoya Li, Xiaofei Sun, Yuxian Meng, Junjun Liang, Fei Wu, and Jiwei Li. 2019b. Dice loss for data-imbalanced NLP tasks. CoRR, abs/1911.02855. +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. +Ilya Loshchilov and Frank Hutter. 2019. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net. +Samuel Louvan and Bernardo Magnini. 2019. Leveraging non-conversational tasks for low resource slot filling: Does it help? In Proceedings of the 20th Annual SIGdial Meeting on Discourse and Dialogue, pages 85–91, Stockholm, Sweden. Association for Computational Linguistics. +Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2018, New Orleans, Louisiana, USA, June 1-6, 2018, Volume 1 + +(Long Papers), pages 2227-2237. Association for Computational Linguistics. +Sameer Pradhan, Alessandro Moschitti, Nianwen Xue, Hwee Tou Ng, Anders Björkelund, Olga Uryupina, Yuchen Zhang, and Zhi Zhong. 2013. Towards robust linguistic analysis using ontonotes. In Proceedings of the Seventeenth Conference on Computational Natural Language Learning, CoNLL 2013, Sofia, Bulgaria, August 8-9, 2013, pages 143-152. ACL. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openai-assets/researchcovers/languageunsupervised/language understanding paper.pdf. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. CoRR, abs/1910.10683. +Abhinav Rastogi, Raghav Gupta, and Dilek Hakkani-Tur. 2018. Multi-task learning for joint language understanding and dialogue state tracking. In Proceedings of the 19th Annual SIGdial Meeting on Discourse and Dialogue, pages 376-384, Melbourne, Australia. Association for Computational Linguistics. +Alexander M. Rush, Sumit Chopra, and Jason Weston. 2015. A neural attention model for abstractive sentence summarization. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 379-389, Lisbon, Portugal. Association for Computational Linguistics. +Erik F. Tjong Kim Sang and Fien De Meulder. 2003. Introduction to the conll-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning, CoNLL 2003, Held in cooperation with HLT-NAACL 2003, Edmonton, Canada, May 31 - June 1, 2003, pages 142-147. ACL. +Sebastian Schuster, Sonal Gupta, Rushin Shah, and Mike Lewis. 2018. Cross-lingual transfer learning for multilingual task oriented dialog. arXiv preprint arXiv:1810.13327. +Darsh Shah, Raghav Gupta, Amir Fayazi, and Dilek Hakkani-Tur. 2019. Robust zero-shot cross-domain slot filling with example values. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5484-5490, Florence, Italy. Association for Computational Linguistics. + +Aditya Siddhant, Anuj Kumar Goyal, and Angeliki Metallinou. 2019. Unsupervised transfer learning for spoken language understanding in intelligent agents. 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 4959-4966. AAAI Press. +Jake Snell, Kevin Swersky, and Richard S. Zemel. 2017. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pages 4077-4087. +Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip H. S. Torr, and Timothy M. Hospedales. 2018. Learning to compare: Relation network for few-shot learning. In 2018 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2018, Salt Lake City, UT, USA, June 18-22, 2018, pages 1199-1208. IEEE Computer Society. +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. +Oriol Vinyals, Charles Blundell, Tim Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. 2016. Matching networks for one shot learning. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pages 3630-3638. +Yu Wang, Yilin Shen, and Hongxia Jin. 2018. A bi-model based RNN semantic frame parsing model for intent detection and slot filling. 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 309-314. Association for Computational Linguistics. +Ralph Weischedel, Sameer Pradhan, Lance Ramshaw, Jeff Kaufman, Michelle Franchini, Mohammed El-Bachouti, Nianwen Xue, Martha Palmer, Jena D. Hwang, Claire Bonial, Jinho Choi, Aous Mansouri, Maha Foster, Abdel aati Hawwary, Mitchell Marcus, Ann Taylor, Craig Greenberg Eduard Hovy, Robert Belvin, and Ann Houston. 2012. Ontonotes release 5.0. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in Neural + +Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, 8-14 December 2019, Vancouver, BC, Canada, pages 5754-5764. \ No newline at end of file diff --git a/augmentednaturallanguageforgenerativesequencelabeling/images.zip b/augmentednaturallanguageforgenerativesequencelabeling/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0975ebf0d628e9bd39a2ca431d7f59a8e2d9fcb2 --- /dev/null +++ b/augmentednaturallanguageforgenerativesequencelabeling/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9b65a279a16b86250782e2afb7c83d421ef417070132509dcaf5a57101a9709 +size 329515 diff --git a/augmentednaturallanguageforgenerativesequencelabeling/layout.json b/augmentednaturallanguageforgenerativesequencelabeling/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fae61d1e437eab7c6eabd08c845846d1e4c66030 --- /dev/null +++ b/augmentednaturallanguageforgenerativesequencelabeling/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19349384e19b9e2e70ccab2b6575c2601818a58eb78dcc45c594d111cc814d09 +size 335885 diff --git a/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_content_list.json b/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f22487a219b763fdf67ef81e83c9bfb3f6866886 --- /dev/null +++ b/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da9b69de2ec404530bebe587115fea8b59e2fbfcef5035e1b9d5c07e2f4dcb74 +size 85804 diff --git a/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_model.json b/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9c23c74e13606b0da9b53ea5037090c5c8689340 --- /dev/null +++ b/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d55153250cd02023a2cdb95d376fd2566f035c367b249bc14d54eb4f2de0fa19 +size 106895 diff --git a/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_origin.pdf b/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7e1d020d3046c3fa10bd73f5f4934459c8e2ee7a --- /dev/null +++ b/authorshipattributionforneuraltextgeneration/c305c161-2016-455d-9312-2c153dae90d2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6968fac6289061e4a3f99f8a3a2d0725b0a73b06fcb6eb473e7a520cd5cf3ca9 +size 457847 diff --git a/authorshipattributionforneuraltextgeneration/full.md b/authorshipattributionforneuraltextgeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..07ba003028fc8c7a0cc6745cd21c1b2e05e006e1 --- /dev/null +++ b/authorshipattributionforneuraltextgeneration/full.md @@ -0,0 +1,298 @@ +# Authorship Attribution for Neural Text Generation + +Adaku Uchendu Thai Le Kai Shu Dongwon Lee + +The Pennsylvania State University, University Park, PA, USA + +{azu5030,thaile,dongwon}@psu.edu + +Illinois Institute of Technology, Chicago, IL, USA† + +kshu@iit.edu + +# Abstract + +In recent years, the task of generating realistic short and long texts have made tremendous advancements. In particular, several recently proposed neural network-based language models have demonstrated their astonishing capabilities to generate texts that are challenging to distinguish from human-written texts with the naked eye. Despite many benefits and utilities of such neural methods, in some applications, being able to tell the "author" of a text in question becomes critically important. In this work, in the context of this Turing Test, we investigate the so-called authorship attribution problem in three versions: (1) given two texts $T_{1}$ and $T_{2}$ , are both generated by the same method or not? (2) is the given text $T$ written by a human or machine? (3) given a text $T$ and $k$ candidate neural methods, can we single out the method (among $k$ alternatives) that generated $T$ ? Against one human-written and eight machine-generated texts (i.e., CTRL, GPT, GPT2, GROVER, XLM, XLNET, PPLM, FAIR), we empirically experiment with the performance of various models in three problems. By and large, we find that most generators still generate texts significantly different from human-written ones, thereby making three problems easier to solve. However, the qualities of texts generated by GPT2, GROVER, and FAIR are better, often confusing machine classifiers in solving three problems. All codes and datasets of our experiments are available at: https://bit.ly/302zWdz + +# 1 Introduction + +Recent rapid advancements in deep learning technologies have enabled the generation of realistic artifacts (e.g., Deepfakes) that are difficult to distinguish from genuine human-generated artifacts. In the text domain, which is the main focus of this work, similarly, the advancement of Natural Lan + +guage Generation (NLG), especially those based on neural language models, has led to the inundation of realistic text generation. + +As novel NLG techniques become more sophisticated and prevalent, corresponding pitfalls and risks of such technologies also increase. Adversaries may use such technologies to generate realistic artifacts to trick naive users in fraudulent activities (e.g., machine-generated chatbot conversation in a phishing scam or deepfake-based disinformation campaign). Therefore, the need to distinguish machine-generated texts from human-written ones, so-called the Turing Test, naturally arises. Furthermore, in some security applications, merely being able to identify machine-generated text may not be sufficient. Instead, a more critical solution would be to tell which NLG method among many candidates has generated a given text in question—so-called the Authorship Attribution (AA) problem. To improve our understanding of this newly-emerging problem, we empirically investigate three versions of the AA problem in this paper. For all three versions, we assume that there are $k$ different NLG methods1. + +Problem 1 (Same Method or Not) Given two texts $T_{1}$ and $T_{2}$ , determine if both $T_{1}$ and $T_{2}$ are generated by the same NLG method (or human) or not. + +Problem 2 (Human vs. Machine) Given a text $T_{1}$ , determine if $T_{1}$ is written by human or generated by any $k$ NLG methods. + +Problem 3 (Authorship Attribution) Given a text $T_{1}$ , single out one NLG method (among $k$ alternatives) that generated $T_{1}$ . + +We model P1 and P2 as the binary classification problem, while P3 as the multi-class classification + +problem. All three problems are related, with several motivations as follows. + +First, solutions to P1 may be useful when one needs to determine the plagiarism or identity theft issue of an NLG method. For instance, suppose GPT2 becomes very powerful in the near future so that other NLG methods may even try to mimic the characteristic features in the GPT2-generated texts. Then, a solution to P1 can determine if two texts in question are both generated by GPT2 or not. Second, as NLG methods become ubiquitous, the threat of generating misinformation at scale increases naturally. Thus, using solutions to P2, being able to accurately distinguish between machine- and human-generated texts is required to mitigate such security risks that NLG methods could pose. Finally, as to P3, as the number of state-of-the-art NLG methods increases, it will be beneficial not only just to separate them into two camps but also find out which generators are used. Furthermore, knowing each generator's writing signature or style moves us closer to quenching the security threats that they may introduce. + +# 2 Related Work + +# 2.1 Features for Authorship Attribution + +Predicting an author based on their writing signature is called Authorship Attribution (AA). This AA problem has been previously and even recently solved with n-grams (Sharma et al., 2018; Sari et al., 2017; Shrestha et al., 2017; Proisl et al., 2018; Kestemont, 2014; Zečević, 2011; Li et al., 2014). Next, as complex datasets emerge, other techniques such as POS-tags (Ferracane et al., 2017; Sundararajan and Woodard, 2018; Hitschler et al., 2017), topic modeling (i.e. LDA, AT and DADT) (Seroussi et al., 2014, 2012, 2011), POS-Noise (Halvani et al., 2020) and LIWC (Uchendu et al., 2019; Li et al., 2014) are explored and used to solve the AA problem. However, Ferracane et al. claim that n-grams and POS-tags are not sufficient for solving the AA problem, and sometimes negatively impact classifiers' performance. Therefore, they recommend using discourse embedding features. + +Furthermore, Zheng et al. attempt to solve the AA problem with online messages by investigating four types of writing-style features (i.e., lexical, syntactic, structural, and content-specific features). Structural and content-specific features were the best to assign authorship (Zheng et al., 2006). + +Next, Kestemont examines the use of content and function words as relevant features for AA. Van Cranenburg focuses on content words and so parse phrase-structures. Consequently, Hoenen and Schenk claim that word pairs could make strong features and extract function words, content words, similarity and relatedness. They find function words to be the most robust feature (Hoenen and Schenk, 2018). To establish distinct writing styles further, Solorio et al. extract lexical, syntactic, and stylistic features using bag-of-words (freq. of unigrams), POS-tags, Dependency relations, andChunks (unigram freq.), respectively for the AA problem. With the new wave of nuanced techniques to solve the AA problem, Tschuggnall and Specht use syntax tree for each sentence to analyze grammar. Finally, Shao et al. use readability scores to distinguish human-written texts from machine texts, another form of AA. The results suggest that readability is a vital feature for distinguishing authors. + +# 2.2 Classifiers for Authorship Attribution + +Several well-established classical machine learning classifiers have been applied to the AA problem, including Naive Bayes (Howedi and Mohd, 2014; Baron, 2014), SVM (Solorio et al., 2011; Hou and Huang, 2017; Shao et al., 2019), Conditional Tree (Sharma et al., 2018), Random Forest (Hou and Huang, 2017; Alshaher and Xu, 2020; Sharma et al., 2018), and KNN (Alshaher and Xu, 2020). However, due to improvements in neural networks, recently, CNN (Convolution Neural Network) is said to be even more suited for the AA problem (Ferracane et al., 2017; Hitschler et al., 2017; Boumer et al., 2018). CNN architecture is better suited to represent the characteristics of each author. Consequently, Ferracane et al. improve the CNN's use with discourse features (i.e., n-grams and POS-tags). Ren and Ji further improve upon CNNs with the use of word embeddings to represent texts. Lastly, RNNs have also been shown to be well-suited for representing the authors' distinct writing styles (Alsulami et al., 2017). + +# 2.3 Applications of Authorship Attribution + +The applications of AA are vast and include: assigning authorship to literature/text, and ascertaining the demography of an author (e.g., age, gender, native language) (López-Monroy et al., 2020). AA can also be applied to predicting author(s) of source code (Simko et al., 2018), chatbot detec + +tion (Uchendu et al., 2019), and even detecting authors intentionally trying to mask their writing style (Juola, 2012; Sánchez-Junquera et al., 2020). Finally, our work bears similarity to (Manjavacas et al., 2017), which investigates the stylistic properties of different neural text generation techniques (i.e., Ngram-based and RNN-based). + +# 3 Generation of Texts + +We have nine text generators-i.e., one human writer and eight neural machine generators. All eight neural generators require a short prompt to begin their generation and the number of words to generate. These eight generators were chosen because we found that they had the best pre-trained models for our task. We used the titles of news articles (written by human journalists) as the prompt and set 500 as the number of words. + +1. Human. We collected recently-published news titles and contents in mostly Politics-819 from CNN, 132 from Washington Post, and 113 from the New York Times. As professional reporters write these news articles, they represent human-written texts. Then, we used the news titles as the prompts for other neural methods. +2. CTRL. Also known as "Conditional Transformer Language Model For Controllable Generation," $\mathrm{CTRL}^2$ is a huge language model with 1.63 billion parameters (Keskar et al., 2019). The model was trained on control codes to guide the styles and contents of generated texts. Among the 50 control codes available, we used the News control code to generate long articles. +3. GPT. The OpenAI GPT is built with Transformers. It was trained and modeled after a simple concept - to predict the next token, given the previous token (Radford et al., 2018). We used the medium GPT model with 345 million parameters since it was computationally less expensive while still being able to generate comparable results. We used the Transformer text generation setup by huggingface3. +4. GPT2. We also used the GPT2 model with 774 million parameters. We used the gpt2 + +wrapper to generate texts. + +5. GROVER. Grover is another large language model, explicitly trained to generate political news (Zellers et al., 2019). It uses the same template as news outlets such as CNN and the New York Times. Grover uses the same architecture as GPT2 and the same concept of predicting the next token, given previous tokens. We used code from repo5 to generate texts. +6. XLM. The Cross-lingual Language Model (XLM) is another generative language model (Lample and Conneau, 2019). Unlike other language models, XLM is trained for the task of cross-lingual classification. We generated texts from the English language model, using the same setup in huggingface as GPT. +7. XLNET. XLNET (Yang et al., 2019) improves language modeling by introducing bidirectional contexts. This technique involves a generalized auto-regressive pre-training method and adopts the Transformer-XL framework into pre-training. XLNET achieved state-of-the-art results, outperforming BERT on 20 tasks. We also used the huggingface Github repo to generate texts. +8. PPLM. The "Plug and Play Language Models (PPLM)" is another language model that improves upon GPT2 by fusing the medium model with bag of words models (Dathathri et al., 2019). We used the Politics bag of words model to generate texts', using the code, and used the perturbed version. +9. FAIR. Facebook's FAIR has three language models of English, Russian, and German (Ng et al., 2019). For our task, we used the English language model built with FAIRSEQ sequence modeling toolkit7. + +Table 1 shows the snippets of nine texts for the identical prompt message-i.e., one written by news reporters and eight by different neural language models. Table 2 shows the summary statistics of nine generated texts. Note that CTRL tends to generate the longest texts (in terms of the number of + +
PROMPTPutin and Xi are using the coronavirus crisis to extend their control. Across the world, Trump is struggling to keep up
Human... Donald Trump's shock announcement shutting down travel from much of Europe came with the customary back-pedaling common to many of his hastily announced initiatives. +At first, Trump said trade and travel would be targeted, in his latest attempt to stem the spread ...
CTRL.... President Vladimir Putin, meanwhile, says there was no reason why Moscow would spread such diseases. But both leaders have been unable so far to ... [read more] what do you think about this story? do we need another Ebola scare or two? ...
GPT... with them in a war that has been going on for decades now - but he's still not strong enough. ” i'm sorry about your family. it must be hard being so far away from home. ” she said softly. ” yes, we're all very lonely here. there wasn't much time before ...
GPT2... Putin's paranoia over the contagion of Ebola is a common theme. As his recent visit to Washington shows, he's playing a dangerous game. And here's what Putin wants Putin wants to use Ebola as a pretext for imposing further Russian sanctions on the West. ...
GROVER... hours after world cup workers hand-picked by Putin to fix problems faced by workers in turkey and Venezuela, a new threat to trump is receding. According to Wikileaks, the Coronavirus outbreak is receding and the Russian leader, Putin,...
XLM... with Russia alone ruling over Europe while china under Mao Zedong rules +Asia in turn which makes it difficult for him politically but financially as well being president / CEO of America first bank & chairman's nominee at CIA ...
XLNET... with china or Russia in his efforts at de-structuring America from the financial crisis that has taken place over the past two years of this century as well a global economic downturn that will continue for many more months into next year ...
PPLM... the latest developments in Syria, Ukraine, Russia's intervention in the middle east and china's rise to global power. In Moscow, a group of Russian diplomats, who did not want their real names to be reported on the record ...
FAIR... He has ordered his federal agencies to step up efforts to combat it and to warn of new threats. in Washington, Trump's national security adviser, h.r. mcmaster, said on Monday the U.S. government had seen signs of the bug and that countries in the Middle East were on high alert. ...
+ +Table 1: Snippets of nine texts using the titles of human-written articles as the prompt to neural methods. + +words), while GPT2 tends to generate the shortest texts. Both XML and XLNET generated the texts with very long sentences. + +# 4 Linguistic Analysis + +We first conduct a psycholinguistics study to analyze different linguistic features of generated texts. The result is summarized in Table 3. + +First, we use Flesch Reading Ease and Flesh-Kincaid Grade to gauge generated texts' readability. Flesch Reading Ease generates a score between 0 and 100, such that post-college level yields a score between 0-30, college-level yields 31-50, high-school level yields 51-70, middle school yields 71-90, and 5-th grade level of reading and below yields 91-100. These seven reading levels also go from a scale of very-difficult-to-understand due to the level of sophistication to very-easy because it is the grade level of readability. Therefore, obtaining a post-college level (i.e., low score) is uncommon and impressive if a machine generates such texts. + +On the other hand, the Flesh-Kincaid Grade generates a score representing the U.S. grade level of education (the higher, the more sophisticated). For instance, text given a 10.8 score suggests that its author can be in the 11-th grade and about 16-17 years old. + +Next, we use Linguistic Inquiry and Word Count (LIWC) (Pennebaker et al., 2001) to capture the psycholinguistics features. LIWC has 93 features, of which 69 are categorized into: Standard Linguistic Dimensions (e.g., pronouns, past tense), Psychological Processes (e.g., social processes), Personal concerns (e.g., money, achievement), and Spoken Categories (e.g., assent, nonfluencies) (Uchendu et al., 2019). Table 3 includes top-3 distinguished LIWC features among all generation methods. A high LIWC-Authentic score means that the author of the text is honest or less evasive. We can observe that GPT and XLNET generates more personal content than GPT2 and FAIR. LIWC-Analytic reflects the formality, and logical nature of the text. GPT2, + +
MeasureHumanMachine
CTRLGPTGPT2GROVERXLMXLNETPPLMFAIR
# of samples1,0661,0661,0661,0661,0661,0661,0661,0661,066
AVG word count432.31530.03345.03199356.76441.32452.58228.89250.42
SD word count270.8273.5110.7974.15114.9634.6732.5964.1339.94
AVG sentence count26.8733.0232.6415.6821.643.975.0213.5317.53
SD sentence count19.4921.185.556.999.651.711.974.614.88
+ +Table 2: Summary statistics of nine generated texts (one by human and eight by neural methods). + +
MeasureHumanMachineAVG
CTRLGPTGPT2GROVERXLMXLNETPPLMFAIR
Flesch Reading Ease37.9760.9768.6854.4946.6346.4048.9444.9751.8551.21
Flesch-Kincaid Grade12.799.588.4810.2711.5311.6411.2811.6610.7610.89
LIWC-Authentic25.354.2861.6615.123.7648.0680.6934.2718.7740.21
LIWC-Analytic89.8151.9940.9392.5989.9878.6150.4673.1892.8973.38
LIWC-Article7.981.473.1811.878.690.592.032.610.055.38
Entropy7.818.988.016.527.798.998.917.777.418.02
+ +Table 3: Linguistic features of nine generated texts. + +GROVER, and FAIR scores are as high Human, suggesting that they all generate sophisticated texts. LIWC-Article shows the usage of $a$ , $an$ , $the$ , which are crucial in any formal writing. Similar to LIWC-Analytic, GPT2, GROVER, and FAIR score similar to Human. Overall, the patterns among these LIWC features follow our observations that GPT2, GROVER and FAIR generally have higher news generation quality than other machine algorithms. Finally, we also measure the entropy scores of generated texts (Schürmann and Grassberger, 1996). Figure 1 shows the 2-dimensional distribution of generated texts using Principal Component Analysis (PCA) on all psycholinguistic features, with about $70\%$ explained variation. As we can observe a large overlapped portion among generated texts. We expect a non-linear machine learning model (e.g., Random Forest) would perform better than a linear method such as Naive Bayes in classifying the texts according to their generators using these features. + +# 5 Model Architecture + +In solving three problems, we compare various relatively-simple neural models' performances, employing different architectures to encode generated texts into representation vectors, which then feed into a fully connected network followed by a softmax layer for prediction. Note that our goal is not to develop sophisticated neural models to solve three problems. Rather, we want to empirically evaluate how these simple neural models (as base + +![](images/9bba9072e15656bec4fd67b5e1c1a0055820ac6e0e0ef9756b41d2cca510c8cc.jpg) +Figure 1: Distribution of generated texts on 2-dimensions using PCA. + +lines) perform in solving three problems. + +1. **Embedding:** This model maps each word in the generated texts to a vector of 300 dimensions, then sums up all resulting vectors as the final representation. +2. RNN: This model uses a variant of recurrent neural network (RNN) with a GRU (Cho et al., 2014) layer to model the sequential dependency among words within each of the generated texts. +3. Stacked_CNN: This model is inspired by (Zhang et al., 2015), where each of generated texts is encoded by a sequence of six 1D convolutional layers of different kernel sizes. We reduced learning rates from 0.001 to 0.01/0.1. + +4. Parallel_CNN: Similar to Stacked_CNN, but instead of using a stack of convolutional layers, we adopt (Kim, 2014) and use four parallel 1D convolutional layers of different kernel sizes, followed by a max pooling and concatenation operation. +5. CNN-RNN: This is a combination of StackedCNN and RNN where each word of a text is first encoded by a stack of two 1D convolutional layers before being input into each step of a GRU layer to model the sequential dependency of the whole text. + +Experimenting with these neural models, we split the dataset into the training, validation, and testing parts in 7:1:2 ratio. + +# 6 P1: Same Method or Not + +The first version of the problem is to determine whether two given texts are generated by the same method (including human writers) or not. Even if one cannot pinpoint whom the author is for a given text, one may still notice similarities between texts. Therefore, P1 tests the varying capabilities of models to detect such similarities between the two texts. + +We prepare two datasets of a similar size. In the balanced set, half of text pairs are generated by the same method (e.g., Human-Human or CTRL-CTRL), and the other half are random pairs of the two different methods (e.g., Human-CTRL or GROVER-FAIR). In the imbalanced set, $11\%$ of text pairs are generated by the same method, while the remaining $89\%$ are by different methods (1:8 ratio). Model-wise, we utilize the Siamese neural network (Koch et al., 2015) with one of the text encoders in Section 5 to predict whether the two input texts are generated by the same method. Table 4 summarizes the performances. Both RNN and CNN-RNN methods perform the best in the balanced and imbalanced settings, respectively. Recall that the imbalanced setting is more challenging than the balanced as # of positive samples is much smaller. Overall, neural models can identify two texts generated by the same method very well for the balanced setting $(\mathrm{F}1 = 0.9813)$ and reasonably well for the imbalanced setting $(\mathrm{F}1 = 0.7869)$ . + +# 7 P2: Human vs. Machine + +The second version of the problem determines whether a given text is generated by human or ma + +chine (i.e., one of the neural methods). P2 is a type of the Turing Test. Despite the recent advancements in neural NLG methods, we hypothesize that there may still be latent differentiating characteristics between human-written and machine-generated texts. Therefore, P2 tests the varying capabilities of different models to detect such differences between human and machine writings. + +For P2, in addition to five neural models introduced in Section 5, we also tested three known Turing Test models including RoBERTa (Liu et al., 2019) using a similar implementation of GPT2 Output Detector $^{8}$ , GROVER-DETECT (Zellers et al., 2019) $^{9}$ , and RoBERTa-tuned, which is the RoBERTa that we fine-tuned using $20\%$ of our data. RoBERTa is fine-tuned by adding a classification layer on top of it. Next, the weight of the classification layer is randomly initialized and then trained on the GPT2 output and human written text $^{10}$ . Further, we utilize the $20\%$ of the target data we collected to fine-tune the RoBERTa classification model. Note that GROVER-DETECT used in our experiment was trained using only 5K training samples, while its improved version trained with 100K samples is not publicly available. Additionally, GLTR is another state-of-the-art Turing tester used to distinguish machine-generated texts from human-generated texts (Gehrmann et al., 2019), although not used in these experiments. + +Furthermore, in this setting, we tested both individual case (i.e., one neural method at a time) and collective case (i.e., eight neural methods combined). First, we prepare eight test sets for the individual case, each of which is the balanced test set between human $(50\%)$ vs. one neural generator $(50\%)$ . Table 5 summarizes the performances in those eight individual test sets. For the collective case, on the other hand, we prepare two test sets. In the balanced set, the half of tests are written by human and the other eight neural methods generates the other half. In the imbalanced set, $11\%$ of test texts are written by human, while the remaining $89\%$ are generated by any of the eight neural methods (1:8 ratio). Table 6 summarizes the performances in both balanced and imbalanced settings. + +In Table 5, we find that GPT2 generates texts that are almost indistinguishable from human-written + +
ModelBalanced (1:1)Imbalanced (1:8)
PRF1PRF1
Embedding0.90060.86830.88410.51480.75310.6116
RNN0.97480.98790.98130.54390.86950.6692
StackedCNN0.95090.97470.96260.62690.92690.7479
ParallelCNN0.95450.98520.96960.60040.83190.6974
CNN-RNN0.95720.97500.96600.68470.92480.7869
+ +Table 4: P1: Binary classification performance of "Same Method or Not" on two collective test sets. + +
ModelCTRLGPTGPT2GROVERXLMXLNETPPLMFAIRAVG
Embedding0.97680.98380.40440.66280.65350.65510.84490.51780.7124
RNN1.00.99300.63290.99770.99771.00.94660.88120.9311
Stacked_CNN0.97920.98150.63470.99770.99070.91860.64570.63160.8475
Parallel_CNN1.00.99770.60750.95361.01.00.95130.92820.9298
CNN-RNN1.00.98610.66260.99770.96990.99070.79490.70180.8880
RoBERTa0.64480.64040.64070.64480.64900.71850.64040.64040.6524
RoBERTa-tuned0.97300.98810.97920.88940.99210.98500.97960.97530.9702
GROVER-DETECT0.77530.73190.69760.81350.69290.75360.77610.76160.7503
AVG0.91860.91280.65740.86960.86820.87770.82360.7547
+ +Table 5: P2: Binary classification performance in F1 score of "Human vs. Machine" on eight individual test sets. Each column name X indicates an individual balanced test set of HUMAN (50%) and X (50%). + +texts (having the lowest average $\mathrm{F1} = 0.6574$ across eight models). FAIR is the second $(\mathrm{F1} = 0.7547)$ . Interestingly, we find that RoBERTa-tuned can still differentiate human-written texts from GPT2-generated ones with a high F1 score (0.9792) and has the highest average F1 (0.9702) across all eight datasets. This is likely so because RoBERTa-tuned is fine-tuned on two doses of GPT2 texts (i.e., RoBERTa was already fine-tuned on GPT2 dataset to begin with). + +For the performance of collective cases shown in Table 6, RoBERTa-tuned is again the overall winner. It can differentiate human-written vs. machine-generated texts with $\mathrm{F1} = 0.9152$ for the balanced setting and $\mathrm{F1} = 0.8489$ for the imbalanced setting. Two existing Turing Test models (i.e. GROVER-DETECT and RoBERTa) significantly underperform, although RoBERTa aces in Recall. + +# 8 P3: Authorship Attribution + +The third version of the problem is to single out the real author of a given text, among many alternatives (e.g., one human and $k$ neural methods). Therefore, P3 tests different models' varying capabilities to exploit both similarities within and differences across human and machine writings. + +For P3, in addition to five neural models introduced in Section 5, we also tested four classical machine learning models (i.e., Naive Bayes, + +Decision Tree, SVM, and Random Forest) using psycholinguistic features discussed in Section 4 and four state-of-the-art AA solutions, including POS+CNN-LSTM and POS+LSTM-LSTM (Jafari-akinabad et al., 2019), 3-grams + SVM (Sari et al., 2018) and Character n-gram + SVM (Stamatatos, 2017). Neural methods such as Embedding, RNN, and CNN-RNN used GloVe word embedding (Pennington et al., 2014), but Stacked_CNN and Parallel_CNN did not use GloVe due to its negative impact on performance. + +Table 7 summarizes the performance results. Surprisingly, the overall winner is Random Forest, outperforming all five neural models and four existing AA methods. As to per-class F1 scores, Random Forest, a robust non-linear model, accurately solved the AA problem across all nine test sets (one human and eight neural generators). Most generated texts were relatively easy to identify their authorship, giving up high F1 scores (especially the generators such as CTRL, GPT, XLM, XLNET, and PPLM). + +The most challenging test set turns out to be both Human and GROVER that yields relatively low average F1 scores across all of classical, neural, and existing AA models (0.5423 and 0.5542, respectively). Also, interestingly, neural classifiers are able to classify FAIR very accurately unlike classical or existing AA models, while classical + +
ModelBalanced (1:1)Imbalanced (1:8)
PRF1PRF1
Embedding0.49220.48770.48990.45550.52740.4770
RNN0.76250.76110.76110.82420.69560.7390
StackedCNN0.75920.75920.75920.65850.72520.6816
ParallelCNN0.91250.91180.91200.83700.84580.8413
CNN-RNN0.73140.73150.73140.81980.71620.7546
RoBERTa0.49490.95400.65170.10900.95400.1957
RoBERTa-tuned0.91960.91090.91520.92290.78590.8489
GROVER-DETECT0.81000.55900.66100.33370.55910.4180
+ +Table 6: P2: Binary classification performance of "Human vs. Machine" on two collective test sets. + +
ModelHumanMachineAVG
CTRLGPTGPT2GROVERXLMXLNETPPLMFAIR
Naive Bayes0.46680.98120.98350.48300.19010.98580.98100.94480.18120.6886
Decision Tree0.73760.98350.96960.72390.66820.98370.98580.96260.57700.8435
SVM0.80380.99530.99530.80480.74260.99530.99760.97420.67920.8876
Random Forest0.81221.00.99530.78500.81691.00.99060.98600.74650.9042
Embedding0.57270.95810.96880.77850.10800.95890.90260.74240.99000.7756
RNN0.41900.99320.99060.76590.62950.99530.99290.82381.00.8456
StackedCNN0.34150.95180.96380.75110.66030.96620.91040.80090.99500.8157
ParallelCNN0.50200.97900.96380.75790.64990.99760.99530.75821.00.8448
CNN-RNN0.63660.97301.00.80380.56640.98130.97390.79421.00.8589
POS+CNN-LSTM0.58680.67770.91090.71320.47980.89100.68450.84670.56890.7066
POS+LSTM-LSTM0.23780.67460.86540.65120.46280.75720.65050.75200.58760.6266
3-grams + SVM0.69921.01.00.68210.65791.00.99290.81650.64830.8330
Character n-gram + SVM0.70081.01.00.68350.65341.00.99290.81140.64100.8314
AVG0.54230.93600.96980.72180.55420.96330.92700.83660.7396
+ +Table 7: P3: multi-class classification performance with per-class macro F1 (for each column) and overall average F1 scores of models (for each row). + +models, especially Random Forest and SVM, perform better for tough test sets such as GROVER and Human. + +# 9 Discussion + +# 9.1 P1: Same Method or Not + +As expected, we find that the balanced setting yields significantly higher F1 scores across five neural models than the imbalanced setting. However, P1 is still nontrivial to solve, especially in the imbalanced setting, as can be seen in Figure 1, where many machine-generated texts are shown to be linearly inseparable. Furthermore, from Table 3 and Section 4, we can see that while some generators generate similar texts, all generated texts still possess distinct qualities that are leveraged in P1, achieving $\mathrm{F}1 = 0.9813$ in the balanced setting. It is harder to grasp these distinct characteristics when looking at a single piece of text. As such, the comparison of two texts in the setting of P1 offers an advantage to the task. + +# 9.2 P2: Human vs. Machine + +We find that RoBERTa-tuned often outperforms neural classifiers in the individual human vs. machine setting, except for the case of GROVER (Table 5). RoBERTa-tuned outperforms all competing models in distinguishing machine texts from human texts, incredibly well on GPT2 texts (achieving F1=0.9792), probably due to sufficient training on GPT2 data. Next, we find that GROVER-DETECT underperforms in classifying the other machine-generated texts in Table 5, but performs well on Human vs. GROVER achieving the F1 score of 0.8135. This is because it was trained to detect GROVER-generated texts. For the collective settings, however, both RoBERTa and Parallel_CNN have similar F1 scores, while outperforming the rest by significant margins. + +# 9.3 P3: Authorship Attribution + +For this setting, in Table 7, we compare different settings, including (1) the use of GloVe word embedding with Embedding, RNN, and CNN-RNN; (2) no word embedding with Parallel_CNN and Stacked_CNN; (3) the use of linguistic features + +with classical learning algorithms; and (4) n-grams and POS-tags with state-of-the-art AA methods. In this task, we learn that the more accessible generators to classify are CTRL, XLM, and XLNET, while the harder ones are Human, GROVER, FAIR, and GPT2. This can be seen in Tables 5 and 3, where the more demanding generators underperform, and score highly in LIWC-Analytic and LIWC-Article, respectively. This is vice versa for the more accessible generator. We also find that the linguistic features effectively solve P3, slightly better than state-of-the-art AA solutions, and (simple) neural classifiers. The top stylistic features are word count, article, period, word-per-sentence count, auxiliary verb, preposition, comma. We expect this result will change in the future when: (1) the quality of machine-generated texts improve, losing revealing linguistic cues, and (2) neural models are trained better with an enormous amount of data and more powerful architectures. + +One may wonder if some results with high F1 scores to solve P3 in Table 7 are simply due to the fact that different generators tend to generate texts on different topics (with non-overlapping word usage, thereby affecting embedding to neural models). In addition, while we only attempt to collect our articles from the domain of "politics," some other domains may have been added unintentionally. However, when we solve P3 using the combination of bigram and trigram models with top-20 LDA-extracted topics, we achieve only 0.38 as the overall average F1 score. Therefore, we believe that simple topical analysis of generated texts cannot solve P3 well. + +# 10 Conclusion + +We have conducted comprehensive experiments on three versions of the Authorship Attribution (AA) problem: (1) the same method or not, (2) human vs. machine (Turing Test), and (3) who is the author. Notable findings from our empirical evaluation include: (1) not all neural text generation methods generate high-quality human-mimicking texts-in particular, GPT2, GROVER, and FAIR generated better-quality texts and (2) using specific linguistic features and simple neural architectures, we can solve three problems reasonably well, except GPT2 and FAIR in P2 and GROVER in P3. + +# 11 Acknowledgement + +This work was in part supported by NSF awards #1742702, #1820609, #1909702, #1915801, and #1934782. + +# References + +Hanan Alshaher and Jinsheng Xu. 2020. A new term weight scheme and ensemble technique for authorship identification. In Proceedings of the 2020 the 4th International Conference on Compute and Data Analysis, pages 123-130. +Bander Alsulami, Edwin Dauber, Richard Harang, Spiros Mancoridis, and Rachel Greenstadt. 2017. Source code authorship attribution using long short-term memory based networks. In European Symposium on Research in Computer Security, pages 65-82. Springer. +Grzegorz Baron. 2014. Influence of data discretization on efficiency of bayesian classifier for authorship attribution. Procedia Computer Science, 35:1112-1121. +Dainis Boumber, Yifan Zhang, and Arjun Mukherjee. 2018. Experiments with convolutional neural networks for multi-label authorship attribution. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +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. arXiv preprint arXiv:1406.1078. +Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. 2019. Plug and play language models: a simple approach to controlled text generation. arXiv preprint arXiv:1912.02164. +Elisa Ferracane, Su Wang, and Raymond Mooney. 2017. Leveraging discourse information effectively for authorship attribution. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 584-593. +Sebastian Gehrmann, Hendrik Strobelt, and Alexander M Rush. 2019. Gltr: Statistical detection and visualization of generated text. arXiv preprint arXiv:1906.04043. +Oren Halvani, Lukas Graner, Roey Regev, and Philipp Marquardt. 2020. An improved topic masking technique for authorship analysis. arXiv preprint arXiv:2005.06605. + +Julian Hitschler, Esther van den Berg, and Ines Rehbein. 2017. Authorship attribution with convolutional neural networks and pos-eliciting. In Proceedings of the Workshop on Stylistic Variation, pages 53-58. +Armin Hoenen and Niko Schenk. 2018. Knowing the author by the company his words keep. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +Renkui Hou and Chu-Ren Huang. 2017. Stylometric studies based on tone and word length motifs. In Proceedings of the 31st Pacific Asia Conference on Language, Information and Computation, pages 56-63. +Fatma Howedi and Masnizah Mohd. 2014. Text classification for authorship attribution using naive bayes classifier with limited training data. Computer Engineering and Intelligent Systems, 5(4):48-56. +Fereshteh Jafariakinabad, Sansiri Tarnpradab, and Kien A Hua. 2019. Syntactic recurrent neural network for authorship attribution. arXiv preprint arXiv:1902.09723. +Patrick Juola. 2012. Detecting stylistic deception. In Proceedings of the Workshop on Computational Approaches to Deception Detection, pages 91-96. Association for Computational Linguistics. +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. +Mike Kestemont. 2014. Function words in authorship attribution. from black magic to theory? In Proceedings of the 3rd Workshop on Computational Linguistics for Literature (CLFL), pages 59-66. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. 2015. Siamese neural networks for one-shot image recognition. In ICML deep learning workshop, volume 2. Lille. +Guillaume Lample and Alexis Conneau. 2019. Crosslingual language model pretraining. arXiv preprint arXiv:1901.07291. +Jiwei Li, Myle Ott, Claire Cardie, and Eduard Hovy. 2014. Towards a general rule for identifying deceptive opinion spam. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1566-1576. + +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. +A. Pastor López-Monroy, Fabio A Gonzalez, and Thamar Solorio. 2020. Early author profiling on twitter using profile features with multi-resolution. Expert Systems with Applications, 140:112909. +Enrique Manjavacas, Jeroen De Gussem, Walter Daelemans, and Mike Kestemont. 2017. Assessing the stylistic properties of neurally generated text in authorship attribution. In Conference on Empirical Methods in Natural Language Processing (EMNLP 2017), pages 116-125. +Nathan Ng, Kyra Yee, Alexei Baevski, Myle Ott, Michael Auli, and Sergey Edunov. 2019. *Facebook fair's wmt19 news translation task submission*. arXiv preprint arXiv:1907.06616. +James W Pennebaker, Martha E Francis, and Roger J Booth. 2001. Linguistic inquiry and word count: Liwc 2001. *Mahway: Lawrence Erlbaum Associates*, 71(2001):2001. +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 (EMNLP), pages 1532-1543. +Thomas Proisl, Stefan Evert, Fotis Jannidis, Christof Schöch, Leonard Konle, and Steffen Pielström. 2018. Delta vs. n-gram tracing: Evaluating the robustness of authorship attribution methods. In Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openai-assets/researchcovers/languageunsupervised/language understanding paper.pdf. +Yafeng Ren and Donghong Ji. 2017. Neural networks for deceptive opinion spam detection: An empirical study. Information Sciences, 385:213-224. +Javier Sánchez-Junquera, Luis Villaseñor-Pineda, Manuel Montes-y Gómez, Paolo Rosso, and Efstathios Stamatatos. 2020. Masking domain-specific information for cross-domain deception detection. Pattern Recognition Letters, 135:122-130. +Yunita Sari, Mark Stevenson, and Andreas Vlachos. 2018. Topic or style? exploring the most useful features for authorship attribution. In Proceedings of the 27th International Conference on Computational Linguistics, pages 343-353. + +Yunita Sari, Andreas Vlachos, and Mark Stevenson. 2017. Continuous n-gram representations for authorship attribution. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 267-273. +Thomas Schürmann and Peter Grassberger. 1996. Entropy estimation of symbol sequences. Chaos: An Interdisciplinary Journal of Nonlinear Science, 6(3):414-427. +Yanir Seroussi, Fabian Bohnert, and Ingrid Zukerman. 2012. Authorship attribution with author-aware topic models. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics: Short Papers-Volume 2, pages 264-269. Association for Computational Linguistics. +Yanir Seroussi, Ingrid Zukerman, and Fabian Bohnert. 2011. Authorship attribution with latent dirichlet allocation. In Proceedings of the fifteenth conference on computational natural language learning, pages 181-189. Association for Computational Linguistics. +Yanir Seroussi, Ingrid Zukerman, and Fabian Bohnert. 2014. Authorship attribution with topic models. Computational Linguistics, 40(2):269-310. +Jialin Shao, Adaku Uchendu, and Dongwon Lee. 2019. A reverse turing test for detecting machine-made texts. In Proceedings of the 10th ACM Conference on Web Science, pages 275-279. +Abhay Sharma, Ananya Nandan, and Reetika Ralhan. 2018. An investigation of supervised learning methods for authorship attribution in short hinglish texts using char & word n-grams. arXiv preprint arXiv:1812.10281. +Prasha Shrestha, Sebastian Sierra, Fabio A González, Manuel Montes, Paolo Rosso, and Thamar Solorio. 2017. Convolutional neural networks for authorship attribution of short texts. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 669-674. +Lucy Simko, Luke Zettlemoyer, and Tadayoshi Kohno. 2018. Recognizing and imitating programmer style: Adversaries in program authorship attribution. Proceedings on Privacy Enhancing Technologies, 2018(1):127-144. +Thamar Solorio, Sangita Pillay, Sindhu Raghavan, and Manuel Montes. 2011. Modality specific meta features for authorship attribution in web forum posts. In Proceedings of 5th International Joint Conference on Natural Language Processing, pages 156-164. +Efstathios Stamatatos. 2017. Authorship attribution using text distortion. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pages 1138-1149. + +Kalaivani Sundararajan and Damon Woodard. 2018. What represents "style" in authorship attribution? In Proceedings of the 27th International Conference on Computational Linguistics, pages 2814-2822. +Michael Tschuggnall and Günther Specht. 2014. Enhancing authorship attribution by utilizing syntax tree profiles. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, volume 2: Short Papers, pages 195-199. +Adaku Uchendu, Jeffery Cao, Qiaozhi Wang, Bo Luo, and Dongwon Lee. 2019. Characterizing man-made vs. machine-made chatbot dialogs. In Proceedings of the Int'l Conf. on Truth and Trust Online (TTO). +Andreas Van Cranenburg. 2012. Literary authorship attribution with phrase-structure fragments. In Proceedings of the NAACL-HLT 2012 Workshop on Computational Linguistics for Literature, pages 59-63. +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 5754-5764. +Anelka Zečević. 2011. N-gram based text classification according to authorship. In Proceedings of the Second Student Research Workshop associated with RANLP 2011, pages 145–149. +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 9051-9062. +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. +Rong Zheng, Jiexun Li, Hsinchun Chen, and Zan Huang. 2006. A framework for authorship identification of online messages: Writing-style features and classification techniques. Journal of the American Society for information science and technology, 57(3):378-393. + +
Balanced#train#valid#test
P168,8967,65619,139
P22,985426853
P36,8258811,888
+ +
Imbalanced#train#valid#test
P162,1576,90717,266
P26,8258811,888
+ +# A Reproducibility + +# A.1 Implementation, Infrastructure, Software, and Data + +We run all experiments using either P100 or Titan Xp GPU card on a standard server machine with 16GB of RAM. We utilize deep learning platform Ludwig (v.0.2.1) with Tensorflow (v.1.15.0) backend to develop and evaluate all text classification models in the paper. For classical ML, we utilize scikit-learn (v.0.22.1) library. All implementations are done using python language (v.3.0). For generating text, we adopt various models implementation provided by huggingface $^{11}$ , $PPLM^{12}$ , grover $^{13}$ , and Fairseq $^{14}$ Github repo. To extract LIWC features, we utilize the LIWC2015 software (v.1.6.0) $^{15}$ . + +# A.2 Data and Preprocessing + +We generate all the text following the description in Section 3. Since the generated text of some machine algorithms includes artificial tokens such as $<\mathrm{eos}>$ and $<\mathrm{sos}>$ , we remove these tokens from the results. We also ensure that the prompts (i.e., article titles) are appended to every generated article. For P3, we use all the generated text by 9 methods (human and eight machine algorithms), resulted in a dataset with balanced label distribution. For P1, creating datasets generators' pairs is a combinatorial problem, which will create a very large dataset. Instead, we sample from each possible pairs of generators K samples while maintaining the relative distribution among them, resulting in the imbalanced dataset. Then, we adjust K and under-sample negative samples with 1:8 ratio to create the balanced dataset for P1. For P2, we curated the imbalanced dataset from P3, with 1 human and 8 machine generators. Then, we under-sample negative sample with 1:8 ratio to create a balanced + +dataset for P2. For each task P1, P2 and P3, we then split to train, validation and test set with 7:1:2 ratio. Table 8 summarizes statistics of datasets used for each task in balanced and imbalanced scenario, respectively. Also, using language_check, a python package for detecting and correcting grammatical errors, we found that most generators had less than a $3\%$ grammatical error rate, except for XLM that had a $14\%$ error rate. + +# A.3 Running Time + +All experiments take an average running time of around 2 minutes for each training epoch. Depending on the text encoders being utilized, and one training epoch can take as low as 10 seconds (Embedding model) to as long as 8 minutes (CNN-RNN model). + +# A.4 Training and Model's Parameters + +For each of neural network models tested in the paper, we use various text encoders to learn vector representations of input texts (Section 5), results of which are then input into a fully connected network (FCN) with Dropout followed by a softmax layer to make prediction. Table 9 describes the training hyper-parameters and various models' architectures. We train all neural network models using Adam optimizer (Kingma and Ba, 2014) with default parameters. + +Table 8: Details on Train, Validation and Test Set Splits + +
ParameterValue
Max Words500
Vocabulary Size20,000
Early Stop2
Batch Size256
Learning Rate0.01
Adam Optimizerβ1: 0.9, β2: 0.999, ε: 1e-08
Embedding Size300
Stacked CNN Kernel Sizes7, 7, 3, 3, 3 and 3
Stacked CNN Pool Sizes3, 3, 3, 3, 3, and 3
Parallel CNN Kernel Sizes2, 3, 4 and 5
RNN Hidden Size256
FCN Layers (before Softmax)256 - 256
Dropout0.5
+ +Table 9: Model's Parameters and Training's Hyper-Parameters + +# A.5 Evaluation Metrics + +We use standard Precision $(P)$ , Recall $(R)$ , and $F1$ score as the main evaluation metrics throughout the paper. We first construct a confusion matrix and calculate those scores as follows. + +$$ +P = \frac {T P}{T P + F P}, R = \frac {T P}{T P + F N}, F 1 = 2 \frac {P * R}{P + R} +$$ + +where TP is True Positive, FP is False Positive, FP is False Positive and FN is False Negative predictions. \ No newline at end of file diff --git a/authorshipattributionforneuraltextgeneration/images.zip b/authorshipattributionforneuraltextgeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..be0e8332609945b93641268ecbd6878247af1283 --- /dev/null +++ b/authorshipattributionforneuraltextgeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb8f2c49dd39c9553a6872da5e357d868eddd0a98e85289c78d8185742963eb5 +size 818602 diff --git a/authorshipattributionforneuraltextgeneration/layout.json b/authorshipattributionforneuraltextgeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..df33ecf5498d0ea95d02f8cd93a181b1c8ccd8e7 --- /dev/null +++ b/authorshipattributionforneuraltextgeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41e86e7556fbdf5cbd90d035e785297c0efb4327c39128bbb1609cd76613633e +size 372194 diff --git a/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_content_list.json b/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..75dd63a03c0ab24a09bcc457768e9d195b8e333b --- /dev/null +++ b/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a64ae3ba8dc9888cfcde6ae2c674be8d30907c7cfa4ed93b91d96408b196f6c7 +size 144184 diff --git a/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_model.json b/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..acf0a09f65dd0b8c0c97e6817675cd50a5720bd0 --- /dev/null +++ b/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6339c7b8d18e4c5dc11a2afbeab9c147e4eff5d6dbe61a793e8fec03d03861f3 +size 163499 diff --git a/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_origin.pdf b/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c98430934057b864224741f0678c65742a79f06e --- /dev/null +++ b/automaticextractionofrulesgoverningmorphologicalagreement/3c334d72-ffbd-4855-b740-45bedbc051b1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:990293477ab610310ca8d18ef6bd0de9bb87ca547fea84b722f1ebcb69afa63f +size 1300649 diff --git a/automaticextractionofrulesgoverningmorphologicalagreement/full.md b/automaticextractionofrulesgoverningmorphologicalagreement/full.md new file mode 100644 index 0000000000000000000000000000000000000000..99b529c1fccdb724e1120a2d5aecc80a6636e3ca --- /dev/null +++ b/automaticextractionofrulesgoverningmorphologicalagreement/full.md @@ -0,0 +1,429 @@ +# Automatic Extraction of Rules Governing Morphological Agreement + +Aditi Chaudhary $^{1}$ , Antonios Anastasopoulos $^{2,\dagger}$ , Adithya Pratapa $^{1}$ , David R. Mortensen $^{1}$ , Zaid Sheikh $^{1}$ , Yulia Tsvetkov $^{1}$ , Graham Neubig $^{1}$ + +$^{1}$ Language Technologies Institute, Carnegie Mellon University + +$^{2}$ Department of Computer Science, George Mason University + +{aschaudh,vpratapa,dmortens,zsheikh,ytsvetko,gneubig}@cs.cmu.edu antonis@gmu.edu + +# Abstract + +Creating a descriptive grammar of a language is an indispensable step for language documentation and preservation. However, at the same time it is a tedious, time-consuming task. In this paper, we take steps towards automating this process by devising an automated framework for extracting a first-pass grammatical specification from raw text in a concise, human- and machine-readable format. We focus on extracting rules describing agreement, a morphosyntactic phenomenon at the core of the grammars of many of the world's languages. We apply our framework to all languages included in the Universal Dependencies project, with promising results. Using cross-lingual transfer, even with no expert annotations in the language of interest, our framework extracts a grammatical specification which is nearly equivalent to those created with large amounts of gold-standard annotated data. We confirm this finding with human expert evaluations of the rules that our framework produces, which have an average accuracy of $78\%$ . We release an interface demonstrating the extracted rules at https://neulab.github.io/lase/. The code is publicly available here.1 + +# 1 Introduction + +While the languages of the world are amazingly diverse, one thing they share in common is their adherence to grammars — sets of morpho-syntactic rules specifying how to create sentences in the language. Hence, an important step in the understanding and documentation of languages is the creation of a grammar sketch, a concise and human-readable description of the unique characteristics of that particular language (e.g. Huddleston (2002) for En + +glish, or Brown and Ogilvie (2010) for the world's languages). + +One aspect of morphosyntax that is widely described in such grammatical specifications is agreement, the process wherein a word or morpheme selects morphemes in correspondence with another word or phrase in the sentence (Corbett, 2009). Languages have varying degrees of agreement ranging from none (e.g. Japanese, Malay) to a large amount (e.g. Hindi, Russian, Chichewa). Patterns of agreement also vary across syntactic subcategories. For instance, regular verbs in English agree with their subject in number and person but modal verbs such as "will" show no agreement. + +Having a concise description of these rules is of obvious use not only to linguists but also language teachers and learners. Furthermore, having such descriptions in machine-readable format will further enable applications in natural language processing (NLP) such as identifying and mitigating gender stereotypes in morphologically rich languages (Zmigrod et al., 2019). + +The notion of describing a language "in its own terms" based solely on raw data has an established tradition in descriptive linguistics (e.g. Harris (1951)). In this work we present a framework (outlined in Figure 1) that automatically creates a first-pass specification of morphological agreement rules for various morphological features (Gender, Number, Person, etc.) from a raw text corpus for the language in question. First, we perform syntactic analysis, predicting part-of-speech (POS) tags, morphological features, and dependency trees. Using this analyzed data, we then learn an agreement prediction model that contains the desired rules. Specifically, we devise a binary classification problem of identifying whether agreement will be observed between a head and its dependent token on a given morphological property. We use decision trees as our classification model because + +![](images/3f1bfbdcaba64bf8c2d6ad6b05f3dbdf38a0720562270448dbd4d16d779783dc.jpg) +Figure 1: An overview of our method's workflow for gender agreement in Greek. The example sentence translates to "The port of Igoumenitsa is connected to many ports in Italy and Albania." First, we dependency parse and morphologically analyze raw text to create training data for our binary agreement classification task. Next, we learn a decision tree to extract the rule set governing gender agreement, and label the extracted leaves as either representing required or chance agreement. Finally these rules are presented to a linguist for perusal. + +they are easy to interpret and we can easily extract the classification rules from the tree leaves to get an initial set of potential agreement rules. Finally, we perform rule labeling of the extracted rules, identifying which tree leaves correspond to probable agreement. This is required because not all agreeing head/dependent token pairs are necessarily due to some underlying rule. For instance, in Figure 1's example of Greek gender agreement, both the head and its dependent token $\mathrm{I}\tau \alpha \lambda \dot{\iota} \alpha \varsigma \rightarrow \mathrm{A}\lambda \beta \alpha \nu \dot{\iota} \alpha \varsigma$ have feminine gender, but this agreement is purely by chance, as correctly identified by our framework. + +The quality of the learnt rules depends crucially on the quality and quantity of dependency parsed data, which is often not readily available for low-resource languages. Therefore, we experiment with not only gold-standard treebanks, but also trees generated automatically using models trained using cross-lingual transfer learning. This assesses the applicability of the proposed method in a situation where a linguist may want to explore the characteristics of agreement in a language that does not have a large annotated dependency treebank. + +We evaluate the correctness of the extracted rules conducting human evaluation with linguists for Greek, Russian, and Catalan. In addition to the manual verification, we also devise a new metric for automatic evaluation of the rules over unseen test data. Our contributions can be summarized to: 1. We propose a framework to automatically extract agreement rules from raw text, and release these rules for 55 languages as part of an interface2 which visualizes the rules in detail along + +with examples and counter-examples. + +2. We design a human evaluation interface to allow linguists to easily verify the extracted rules. Our framework produces a decent first-pass grammatical specification with the extracted rules having an average accuracy of $78\%$ . We also devise an automated metric to evaluate our framework when human evaluation is infeasible. +3. We evaluate the quality of extracted rules under real zero-shot conditions (on Breton, Buryat, Faroese, Tagalog, and Welsh) as well as low-resource conditions (with simulation experiments on Spanish, Greek, Belarusian and Lithuanian) varying the amount of training data. Using cross-lingual transfer, rules extracted with as few as 50 sentences with gold-standard syntactic analysis are nearly equivalent to the rules extracted when we have hundreds/thousands of gold-standard data available. + +# 2 Problem Formulation + +For a head $h$ and a dependent $d$ that are in a dependency relation $r$ , we will say that they agree on a morphological property $f$ if they share the same value for that particular property i.e. $f_{h} = f_{d}$ . Some agreements that we observe in parsed data can be attributed to an underlying grammatical rule. For example, in Figure 2 the Spanish A.1 shows an example of where subject (enigmas) and verb (son) need to agree on number. We will refer to such rules as required-agreement. Such a required agreement rule dictates that an example like A.2 is ungrammatical and would not appear in well-formed Spanish sentences, since the subject and + +
A.1Los DET.PLenigmas riddle.PLson be.PLfáciles easy.PL
‘The riddles are easy.’
A.2*Los DET.PLenigmas riddle.PLes be.SGfácil easy.SG
wrong
B.1Mi My brother.SGhermano brother.SGtiene has.SGun ART.SG chance dog.SG
‘My brother has a dog.’
B.2Mi My brother.SGhermano brother.SGtiene has.SGmuchos many.PL dog.PL correct
‘My brother has many dogs.’
+ +Figure 2: Subject-verb number agreement is required in Spanish, as in example A.1, which renders example A.2 ungrammatical. Object-verb agreement is not required, so both B.1 and B.2 are grammatical. The object and the verb in B.1 only agree by chance. + +the verb do not have the same number marking. However, not all word pairs that agree do so because of some underlying rule, and we will refer to such cases as chance-agreement. For example, in Figure 2 the object (perro) and verb (tiene) in B.1 only agree in number by chance, and example B.2 (where the object of a singular verb is plural) is perfectly acceptable. + +Our goal is to extract, from textual examples, the set of rules $\mathcal{R}_l^f$ that concisely describe the agreement process for language $l$ . Concretely, this will indicate for which head-dependent pairs the language displays required-agreement and for which we will observe at most chance-agreement. Canonically, agreement rules are defined over syntactic features of a language as seen in Figure 2 where we have the following rule for Spanish: "subjects agree with their verbs on number".3 To formalize this notion, we define a rule to be a set of features which are defined over the dependency relation, head and dependent token types. In this paper, we make the simplifying assumption that head and dependent tokens are represented by only part-of-speech features, as we would like our extracted rules to be concise and easily interpretable downstream, although this assumption could be relaxed in future work. + +The rule discovery process consists of two major steps: a rule extraction step followed by a rule labeling and merging step (also see Figure 1). + +# 2.1 Rule Extraction + +To create our training data for rule extraction, we first annotate raw text with part-of-speech (POS) tags, morphological analyses, and dependency trees. We then base our training data on these annotations by converting each dependency relation into a triple $\langle h,d,r\rangle$ , indicating the head token, dependent/child token, and dependency relation between $h$ and $d$ respectively. From the whole treebank, we now have input features $X_{f} = \{\langle h_{1},d_{1},r_{1}\rangle ,\ldots ,\langle h_{n},d_{n},r_{n}\rangle \}$ and binary output labels $Y = y_{1},\dots,y_{n}$ , where if the head and the dependent token agree on feature $f$ (such that $f_{h} = f_{d}$ ) we set $y = 1$ , otherwise $y = 0$ . We filter out the tuples where either of the linked tokens does not display the morphological feature $f$ . + +We train a model for $p(Y|X)$ using decision trees (Quinlan, 1986) using the CART algorithm (Breiman et al., 1984). A major advantage of decision trees is that they are easy to interpret and we can visualize the exact features used by the decision tree to split nodes. The decision tree induces a distribution of agreement over training samples in each leaf, e.g. $99\%$ agree, $1\%$ not agree in Leaf-3 for gender agreement in Spanish (Figure 3(a)). + +# 2.2 Rule Labeling + +Now that we have constructed a decision tree where each tree leaf corresponds to a salient partition of the possible syntactic structures in the language, we then label these tree leaves as required-agreement or chance-agreement. For this we apply a threshold on the ratio of agreeing training samples within a leaf – if the ratio exceeds a certain number the leaf will be judged as required-agreement. We experiment with two types of thresholds: + +Hard Threshold: We set a hard threshold on the ratio that is identical for all leaves. In all experiments, we set this threshold to $90\%$ based on manually inspecting some resulting trees to find a threshold that limited the number of non-agreeing syntactic structures being labeled as required-agreement. + +Statistical Threshold: Leaves with very few examples may exceed the hard threshold purely by chance. In order to better determine whether the agreements are indeed due to a true pattern of required agreement, we devise a thresholding strategy based on significance testing. For all agreement-majority leaves, we apply a chi-squared goodness of fit test to compare the observed output distri + +![](images/fa7bc2918ab23477993a8f9916f2274f6aca10254736bfa9f21dc16f65f0840c.jpg) +(a) Rule Extraction + +![](images/0d514fe20e395f12b317265287d9fa74a2933751d5a1e29f650dc9b1e2d117d8.jpg) +(b) Rule Labeling +(c) Rule Merging +Figure 3: Extracting gender agreement rules in Spanish. (a) A decision tree is learned over dependency link triples, inducing a distribution of agreement over examples in each leaf. However, simple majority voting leads to false positives: Leaf-1 includes more agreeing data points, but in reality this agreement is purely by chance. (b) With a statistically-inspired threshold to label the leaves, Leaf-1 gets correctly labeled as chance-agreement. (c) We merge leaves with the same label to get a concise representation. Every dependency link triple receives the label of the unique leaf it falls under. + +bution with an expected probability distribution specified by a null hypothesis. Our null hypothesis $H_0$ will be that any agreement we observe is due to chance. If we reject the null hypothesis, we will conclude from the alternate hypothesis $H_1$ that there exists a grammatical rule requiring agreement for this leaf's cases: + +$H_0$ : The leaf has chance-agreement. + +$H_{1}$ : The leaf has required-agreement. + +If there is no rule requiring agreement, we assume that the morphological properties of the head and the dependent token are independent and identically distributed discrete random variables following a categorical distribution. We compute the probability of chance agreement based on the number of values that the specific morphological property $f$ can take. Since morphological feature values are not equally probable, we use a probability proportional to the observed value counts. For a binary number property where 90% of all observed occurrences are singular and 10% are plural, the probability of chance agreement is equal to $0.82 = 0.9 \times 0.9 + 0.1 \times 0.1$ , which gives the observed output distribution $p = [0.18, 0.82]$ . Using $p$ we compute the expected frequency count $E_{i} = np_{i}$ where $n$ is the total number of samples in the given leaf, $i = [0, 1]$ is the output class of the leaf, and $p_{i}$ is the hypothesized proportion of observations for class $i$ . The chi-squared test calculates the test statistic $\chi^2$ as follows: + +$$ +\chi^ {2} = \sum_ {i \in [ 0, 1 ]} \frac {(O _ {i} - E _ {i}) ^ {2}}{E _ {i}} +$$ + +where $O_{i}$ is the observed frequency count in the given leaf. The test outputs a $p$ -value, which is the + +probability of observing a sample statistic as extreme as the test statistic. If the $p$ -value is smaller than a chosen significance level (we use 0.01) we reject the null hypothesis and label the leaf as required-agreement. + +The chi-squared test especially helps in being cautious with leaves with very few examples. However, for leaves with larger number of examples statistical significance alone is insufficient, because there are a large number of cases where there are small but significant differences from the ratio of agreement expected by chance. Therefore, in addition to comparing the $p$ -value we also compute the effect size which provides a quantitative measure on the magnitude of an effect (Sullivan and Feinn, 2012). Cramér's phi $\phi_c$ (Cramér, 1946) is a commonly used method to measure the effect size: + +$$ +\phi_ {c} = \frac {\chi^ {2}}{N (k - 1)} +$$ + +where $\chi^2$ is the test statistic computed from the chi-squared test, $N$ is the total number of samples within a leaf, and $k$ is the degree of freedom (which in this case is 2 since we have two output classes). Cohen (1988) provides rules of thumb for interpreting these effect size. For instance, $\phi_c > 0.5$ is considered to be a large effect size and a large effect size suggests that the difference between the two hypotheses is important. Therefore, a leaf is labeled as required-agreement when the $p$ -value is less than the significance value and the effect size is greater than 0.5. Now Leaf-1 in Figure 3(b) is correctly identified as chance-agreement. + +Rule Merging: Because we are aiming to have a concise, human-readable representation of agreement rules of a language, after labeling the tree leaves we merge sibling leaves with the same label as shown in Figure 3(c). Further, we collapse tree nodes having all leaves with the same label thereby reducing the apparent depth of the tree. + +# 3 Experimental Settings and Evaluation + +Our experiments aim to answer the following research questions: (1) can our framework extract linguistically plausible agreement rules across diverse languages? and (2) can it do so even if gold-standard syntactic analyses are not available? To answer the first question we evaluate rules extracted from gold-standard syntactic analysis (Sec. §4). For the second question we experiment in low-resource and zero-shot scenarios using crosslingual transfer to obtain parsers on the languages of interest, and evaluate the effect of noisy parsing results on the quality of rules (Sec. §5). + +# 3.1 Settings + +Data We use the Surface-Syntactic Universal Dependencies (SUD) treebanks (Gerdes et al., 2018, 2019) as the gold-standard source of complete syntactic analysis. The SUD treebanks are derived from Universal Dependencies (UD) (Nivre et al., 2016, 2018), but unlike the UD treebanks which favor content words as heads, the SUD ones express dependency labels and links using purely syntactic criteria, which is more conducive to our goal of learning syntactic rules. We use the tool of Gerdes et al. (2019) to convert UD v.2.5 (Nivre et al., 2020) into SUD. We only use the training portion of the treebanks for learning our rules. + +Rule Learning We use sklearn's (Pedregosa et al., 2011) implementation of decision trees and train a separate model for each morphological feature $f$ for a given language. We experiment with six morphological features (Gender, Person, Number, Mood, Case, Tense) which are most frequently present across several languages. We perform a grid search over the decision tree parameters (detailed in Appendix A.1) and select the model performing best on the validation set. We report results with the Statistical Threshold because on manual inspection we find the trees to be more reliable than the ones learnt from the Hard Threshold (see Appendix A.5 for an example). + +# 3.2 Evaluation + +We explore two approaches to evaluate the extracted rules, one based on expert annotations, and an automated proxy evaluation. + +Expert Evaluation Ideally, we would collect annotations for all head-relation-dependent triples in a treebank, but this would involve annotating hundreds of triples, requiring a large time commitment from linguists in each language we wish to evaluate. Instead, for each language/treebank we extract and evaluate the top 20 most frequent "head POS, dependency relation, dependent POS" triples for the six morphological features amounting to 120 sets of triples to be annotated. We then present these triples with 10 randomly selected illustrative examples and ask a linguist to annotate whether there is a rule in this language governing agreement between the head-dependent pair for this relation. The allowed labels are: Almost always agree if the construction must almost always exhibit agreement on the given feature; Sometimes agree if the linked arguments sometimes must agree, but sometimes do not have to; Need not agree if any agreement on the feature is random. An example of the annotation interface is shown in the Appendix A.2. + +For each of the human annotated triples in feature $f$ , we extract the label assigned to it by the learnt decision tree $\mathcal{T}$ . We find the leaf to which the given triple $t$ belongs and assign that leaf's label to the triple, referred by $l_{\mathrm{tree},f,t}$ . The human evaluation score (HS) for each triple marking feature $f$ is given by: + +$$ +\mathrm {H S} _ {f, t} = \mathbb {1} \left\{ \begin{array}{l l} 1 & l _ {\text {h u m a n}, f, t} = l _ {\text {t r e e}, f, t} \\ 0 & \text {o t h e r w i s e} \end{array} \right. +$$ + +where $l_{\text{human},f,t}$ is the label assigned to the triple $t$ by the human annotator. These scores are then averaged across all annotated triples $T_f$ to get the human evaluation metric (HRM) for feature $f$ + +$$ +\mathrm {H R M} _ {f} = \frac {\sum_ {t \in T _ {f}} \mathrm {H S} _ {f , t}}{| T _ {f} |}. +$$ + +Automated Evaluation As an alternative to the infeasible manual evaluation of all rules in every language, we propose an automated rule metric (ARM) that evaluates how well the rules extracted from decision tree $\mathcal{T}$ fit to unseen gold-annotated test data. For each triple $t$ marking feature $f$ , we + +![](images/f27687ec622f88d5e7c753361987f7a81163d4620e7d2250f2442558dca3eb4c.jpg) +Figure 4: Difference in the ARM scores of decision trees over gold-standard syntactic analysis with baseline trees where all leaves predict chance-agreement. + +first retrieve all examples from the test data corresponding to that triple. Next, we calculate the empirical agreement by counting the fraction of test samples that exhibit agreement, referred by $q_{f,t}$ . For a required-agreement leaf, we expect most test samples satisfying that rule to show agreement. To account for any exceptions to the rule and/or parsing-related errors, we use a threshold that acts as proxy for evaluating whether the given triple denotes required agreement. We use a threshold of 0.95, and if $q_{f,t} > 0.95$ then we assign the test label $l_{\mathrm{test},f,t}$ for that triple as required-agreement, and otherwise choose chance-agreement. Similar to the human evaluation, we compute a score for each triple $t$ marking feature $f$ + +$$ +\mathrm {A S} _ {t} = \mathbb {1} \left\{ \begin{array}{l l} 1 & l _ {\text {t e s t}, f, t} = l _ {\text {t r e e}, f, t} \\ 0 & \text {o t h e r w i s e} \end{array} \right. +$$ + +then average scores across all annotated triples in $T_{f}$ to get the ARM score for each feature $f$ : + +$$ +\operatorname {A R M} _ {f} = \frac {\sum_ {t \in T _ {f}} \operatorname {A S} _ {t}}{| T _ {f} |} +$$ + +# 4 Experiments with Gold-Standard Data + +In this section, we evaluate the quality of the rules induced by our framework, using gold-standard syntactic analyses and learning the decision trees over triples obtained from the training portion of all SUD treebanks. As baseline, we compare with trees predicting all leaves as chance-agreement. + +![](images/34897952734b5ea4b2bc5e615b90bfac216b1ee6a9ad7eb2d9f8ad327cb4cfbb.jpg) +Figure 5: Our approach (shaded bars) outperforms the chance-agreement baseline (solid bars) in all cases where there exist agreement rules. Features not present in the language are marked with $\times$ . + +The extracted rules have an 0.574 ARM score (averaged across all treebanks and features), outperforming the baseline scores by 0.074 ARM points. $^{8}$ Of all the 451 decision trees across all treebanks and features, we find $78\%$ trees outperforming the baseline trees. In Figure 4, we show the improvements over the baseline averaged across language families/genera. In families with extensive agreement systems such as Slavic and Baltic our models clearly outperform the baseline discovering correct rules, as they do for the other Indo-European genera, Indo-Aryan and Germanic. For mood and tense, the chance-agreement baseline performs on par with our method. This is not surprising because there is little agreement observed for these features given that only verbs and auxiliary verbs mark these features. We find that for both tense and mood in the Indo-Aryan family, our model identifies required-agreement primarily for conjoined verbs, which mostly need to agree only if they share the same subject. However, subsequent analysis revealed that in the treebanks nearly $50\%$ of the agreeing verbs do not share the same subject but do agree by chance. + +Agreement for Indo-European languages like Hindi and Russian is well documented (Comrie, 1984; Crockett, 1976) and is reflected in our large improvements over the baseline (Figure 5). Similarly, Arabic exhibits extensive agreement on noun phrases including determiners and adjectives (Aoun et al., 1994). We find that for Arabic gender the lower ARM scores of our method are an artifact of the small test data. + +North Sami is an interesting test bed: as a Uralic language, case agreement would be somewhat unexpected and indeed our model's predictions are not better than the baseline. Nevertheless, with our interface we find patterns of rare positive paratacetic constructions with required agree + +![](images/58af0ba2bad80f91fa302bc2d21173716c64433af654f3f93730e1dd77130dae.jpg) +Figure 6: Correlation between size of the decision trees constructed by our framework and morphological complexity of languages. + +ment where demonstrative pronouns overwhelmingly agree with their heads. $^{9}$ The case decision tree also uncovers interesting patterns of $100\%$ agreement on Tamil constructions with nominalized verbs (Gerunds) where the markings propagate to the whole phrase. + +Conciseness of Extracted Rules We further analyze the decision trees learnt by our framework for conciseness and find that the trees grow more complex with increasing morphological complexity of languages as seen in Figure 6. To compute the morphological complexity of a language, we use the word entropy measure proposed by Bentz et al. (2016) which measures the average information content of words and is computed as follows: + +$$ +H (D) = - \sum_ {i \in V} p (w _ {i}) \log p (w _ {i}) +$$ + +where $V$ is the vocabulary, $D$ is the monolingual text extracted from the training portion of the respective treebank, $p(w_{i})$ is the word type frequency normalized by the total tokens. Since this entropy doesn't account for unseen word types, Bentz et al. (2016) use the James-Stein shrinkage estimator (Hausser and Strimmer, 2009) to calculate $p(w_{i})$ : + +$$ +p (w _ {i}) = \lambda p ^ {\mathrm {t a r g e t}} (w _ {i}) + (1 - \lambda) p ^ {\mathrm {M L}} (w _ {i}) +$$ + +where $\lambda \in [0,1]$ , $p^{\mathrm{target}}$ denotes the maximum entropy case given by the uniform distribution $\frac{1}{V}$ and $p^{\mathrm{ML}}$ is the maximum likelihood estimator which is given by the normalized word type frequency. Languages with a larger word entropy are considered to be morphologically rich as they pack more information into the words. In Figure 6 we plot the + +morphological richness with the average number of leaves across all features and find these to be highly correlated. + +Manual Evaluation Results We conduct an expert evaluation for Greek (el), Russian (ru) and Catalan (ca) as described in Section §3.2. For a strict setting, we consider both Sometimes agree and Need not agree as chance-agreement and report the human evaluation metric (HRM) in Figure 7. Overall, our method extracts first-pass grammar rules achieving $89\%$ accuracy for Greek, $78\%$ for Russian and $66\%$ for Catalan. + +In most error cases, like person in Russian, our model produces required-agreement labels, which we can attribute to skewed data statistics in the treebanks. In Russian and Greek, for instance, conjoined verbs only need to agree in person and number if they share the same subject (in which case they implicitly agree because they both must agree with the same subject phrase). In the treebanks, though, only $15\%$ of the agreeing verbs do indeed share the same subject – the rest agree by chance. In a reverse example from Catalan, the overwhelming majority $(92\%)$ of 8650 tokens are in the third-person, causing our model to label all leaves as chance agreement despite the fact that person/number agreement is required in such cases. Similarly for tense in Catalan, our framework predicts chance-agreement for auxiliary verbs with verbs as their dependent because of overwhelming majority of disagreeing examples. We believe this is because of both annotation artifact and the way past tense is realized. + +To demonstrate how well the automated evaluation correlates with the human evaluation protocol, we compute the Pearson's correlation $(r)$ between the ARM and HRM for each language under four model settings: simulate-50, simulate-100, baseline and gold. simulate- $x$ is a simulated low-resource setting where the model is trained using $x$ gold-standard syntactically analysed data. The baseline setting is the one where all leaves predict chance-agreement and under the gold setting we train using the entire gold-standard data. We compute the ARM and HRM scores for the rules learnt under each of the four settings and report the Pearson's correlation, averaged across all features. Overall, we observe a moderate correlation for all three languages, with $r = 0.59$ for Greek, $r = 0.41$ for Russian and $r = 0.38$ for Catalan. The correla + +![](images/3cac740f42ec507633ca1194dbfa373a427ec69ca2475ebda381609712d0c177.jpg) +Figure 7: Annotation accuracy for Greek, Russian and Catalan per each morphological feature. + +tions are very strong for some features such as Gender ( $r_{\mathrm{el}} = 0.97$ , $r_{\mathrm{ru}} = 0.82$ , $r_{\mathrm{ca}} = 0.98$ ) and Number ( $r_{\mathrm{el}} = 0.97$ , $r_{\mathrm{ru}} = 0.69$ , $r_{\mathrm{ca}} = 0.96$ ) where we expect to see extensive agreement. + +# 5 Low-Resource Experiments + +# 5.1 Simulated Zero-/Few-Shot Experiments + +It is not always possible to have access to gold-standard syntactic analyses. Therefore, in order to investigate how the quality of rules are affected by the quality of syntactic analysis, we conduct simulation experiments by varying the amount of gold-standard syntactically analysed training data. For each language, we sample $x$ fully parsed sentences from the its treebank out of $L$ training sentences available. For the remaining $L - x$ sentences, we use silver syntactic analysis i.e., we train a syntactic analysis model on $x$ sentences and use the model predictions for the $L - x$ sentences. + +Data and Setup: We experiment with Spanish, Greek, Belarusian and Lithuanian. For transfer learning, we use Portuguese, Ancient Greek, Ukrainian and Latvian treebanks respectively. The data statistics and details are in Appendix A.2. + +We train Udify (Kondratyuk and Straka, 2019), a parser that jointly predict POS tags, morphological features, and dependency trees, using the $x$ gold-standard sentences as our training data. We generate model predictions on the remaining $L - x$ sentences. Finally, we concatenate the $x$ gold data with the $L - x$ automatically parsed data from which we extract the training data for learning the decision tree. We experiment with $x = [50, 100, 500]$ gold-standard sentences. To account of sampling randomness, we repeat the process 5 times and report averages across runs. + +To further improve the quality of the automatically obtained syntactic analysis, we use crosslingual transfer learning where we train the Udify model by concatenating $x$ sentences of the target language with the entire treebank of the related + +![](images/247d2ff3d801a9c0ec008bac0de8279e1744c35f0968f2aeff412a8405074366.jpg) + +![](images/da41a85c356c607bb73873dfb43729286c7828dc6bba0ccf928b321f14da5563.jpg) + +![](images/cf450b191ed00abbc0f691d99f77eeed7a7669e98f2ff772d17fb72c219d1e8d.jpg) +Figure 8: Comparing the (avg.) ARM score for Number agreement with and without cross-lingual transfer learning (transfer language in parenthesis). $x$ -axis in log space. The higher the ARM the better. + +![](images/98ca24f0d15b757188ef82ab6b881a051bcac90332661d07396d7440917b6924.jpg) + +![](images/f5e98ab37caa47d991dbedf479554aee40a86f5bf3c462a16319178522929d15.jpg) + +
[Relation, Head, Dependent]correct labelgoldzero-shot
det, NOUN, DET.almost alwaysrequiredrequired
mod, NOUN, ADJalmost alwaysrequiredrequired
flat, PROPN, PROPNalmost alwaysrequiredchance
mod, PROPN, PROPNalmost alwaysrequiredchance
appos, PROPN, PROPNsometimesrequiredchance
comp:aux@pass, AUX, VERBneed notchancerequired
conj, PROPN, PROPNneed notrequiredchance
ARM score over the test set:0.6440.632
+ +Table 1: The Spanish gender rules extracted in a zero-shot setting are generally similar to the ones extracted from the gold data (93%). We highlight the few mistakes that the zero-shot tree makes. + +language. We also conduct zero-shot experiments under this setting where we directly use the Udify model trained only on the related language and get the model predictions on $L$ sentences. As before, we train five decision trees for each $x$ setting and report the average ARM over the test data. + +Results We report the results for Number agreement in Figure 8. Similar plots for other languages and features can be found in the Appendix A.5. We observe that using cross-lingual transfer learning (CLTL) already leads to high scores across all languages even in zero-shot settings where we do not use any data from the gold-standard treebank. Taking Spanish gender as an example, $93\%$ of the rule-triples extracted from the gold-standard tree (which are overwhelmingly correct) are also extracted by the zero-shot tree. The zero-shot tree only makes a few mistakes (shown in Table 1 and reflected in its overall ARM score) on certain proper noun and auxiliary verb constructions. Interestingly, using CLTL, training with just 50 gold-standard target language sentences is almost equivalent to + +training with 100 or 500 gold-standard sentences. This opens new avenues for language documentation: with as few as 50 expertly-annotated syntactic analysis of a new language and CLTL our framework can produce decent first-pass agreement rules. Needless to say, in most cases the extracted rules improve as we increase the number of gold-standard sentences and CLTL further helps bridge the data availability gap for low-resource settings. + +# 5.2 Real Zero-Shot Experiments + +Some languages like Breton, Buryat, Faroese, Tagalog and Welsh have test data only; there is no gold-standard training data available, which presents a true zero-shot setting. In such cases, we can still extract grammar rules with our framework using zero-shot dependency parsing. + +Data and Setup: We collect raw text for the above languages from the Leipzig corpora (Goldhahn et al., 2012). Data statistics are listed in Appendix A.2. We parse these sentences using the "universal" Udify model that has been pre-trained on all of the UD treebanks, as released by (Kondratyuk and Straka, 2019). As before, we use these automatically parsed syntactic analyses to extract the rules which we evaluate with ARM over the gold standard test data of the corresponding SUD treebanks. + +Results: We report the ARM scores in Figure 9. Averaged over all rules, our approach obtains a ARM of 0.566, while the naive all-chance baseline only achieves 0.506. The difference appears to be small, but we still consider it significant, because these languages do not actually require agreement for many grammatical features. Tagalog and Buryat are the most distant languages that we test on (no Philippine and Mongolic language is present in our training data) and yet we observe our method being at par with the baseline and even outperforming in case of Tagalog. Breton and Welsh, on the other hand, are an interesting test bed: Celtic languages are to some degree outliers among Indo-European languages (Borsley and Roberts, 2005), and we suspect that as a result the parser performs generally worse. Despite that, our approach has an ARM of 0.730 for Welsh gender agreement, as opposed to the mere 0.615 that the baseline achieves. + +![](images/c123f333d8db6a8ef1bcd153afc5cdfbb23873cbb662aaa5ecfc130b5723da5f.jpg) +Figure 9: In most cases our framework (shaded bars) extracts a good first-pass specification for true zero-shot settings. Solid bars indicate the baseline. + +# 6 Related Work + +Bender et al. (2014) use interlinear glossed text (IGT) to extract lexical entities and morphological rules for an endangered language. They experiment with different systems which individually extract lemmas, lexical rules, word order and the case system, some of which use hand-specified rules. Howell et al. (2017) extend this to work to predict case system on additional languages. Zamarava (2016) also infer morphotactics from IGT using $k$ -means clustering. To the best of our knowledge, our work is the first to propose a framework to extract first-pass grammatical agreement rules directly from raw text in a statistically-informed objective way. A parallel line of work (Hellan, 2010) extracts a construction profile of a language by having templates that define how sentences are constructed. + +# 7 Future Work + +While we have demonstrated that our approach is effective in extracting a first-pass set of agreement rules directly from raw text, it focuses only on agreement between a pair of words and hence might fail to capture more complex phenomena that require broader context or operate at the phrase level. Consider this simple English example: "John and Mary love their dog". Under both UD and SUD formalisms, the coordinating conjunction "and" is a dependent, hence the verb will not agree with either of the (singular) nouns ("John" or "Mary"). Also, deciding agreement based on only POS tags is insufficient to capture all phenomena that may influence agreement for e.g. mass nouns such as 'rice' do not follow the standard number agreement rules in English. We leave a more expressive model and evaluation on more languages as future work. We also plan to expand our methodology for extracting grammar rules from raw text to other aspects of morphosyntax, such as argument structure and word order phenomena. + +# Acknowledgments + +The authors are grateful to the anonymous reviewers who took the time to provide many interesting comments that made the paper significantly better, and to Josep Quer, Ekaterina Vylomova and Maria Ryskina, for participating in the human annotation experiments. This work is sponsored by the DARPA grant FA8750-18-2-0018 and by the National Science Foundation under grant 1761548. + +# References + +Joseph Aoun, Elabbas Benmamoun, and Dominique Sportiche. 1994. Agreement, word order, and conjunction in some varieties of arabic. Linguistic inquiry, pages 195-220. +Emily M. Bender, Joshua Crowgey, Michael Wayne Goodman, and Fei Xia. 2014. Learning grammar specifications from IGT: A case study of chintang. In Proceedings of the 2014 Workshop on the Use of Computational Methods in the Study of Endangered Languages, pages 43-53, Baltimore, Maryland, USA. Association for Computational Linguistics. +Christian Bentz, Tatyana Ruzsics, Alexander Koplenig, and Tanja Samardžić. 2016. A comparison between morphological complexity measures: Typological data vs. language corpora. In Proceedings of the Workshop on Computational Linguistics for Linguistic Complexity (CL4LC), pages 142-153, Osaka, Japan. The COLING 2016 Organizing Committee. +Robert D Borsley and Ian Roberts. 2005. The syntax of the Celtic languages: a comparative perspective. Cambridge University Press. +Leo Breiman, Jerome Friedman, Charles J Stone, and Richard A Olshen. 1984. Classification and regression trees. CRC press. +Keith Brown and Sarah Ogilvie. 2010. Concise encyclopedia of languages of the world. Elsevier. +Lars Buitinck, Gilles Louppe, Mathieu Blondel, Fabian Pedregosa, Andreas Mueller, Olivier Grisel, Vlad Niculae, Peter Prettenhofer, Alexandre Gramfort, Jaques Grobler, Robert Layton, Jake VanderPlas, Arnaud Joly, Brian Holt, and Gael Varoquaux. 2013. API design for machine learning software: experiences from the scikit-learn project. In ECML PKDD Workshop: Languages for Data Mining and Machine Learning, pages 108-122. +Robin Cohen. 1988. Book reviews: Reasoning and discourse processes. Computational Linguistics, 14(4). +Bernard Comrie. 1984. Reflections on verb agreement in Hindi and related languages. + +Greville G Corbett. 2009. Agreement. In Die slavischen Sprachen/The Slavic Languages. +Harald Cramér. 1946. Mathematical methods of statistics. Princeton U. Press, Princeton, page 500. +Dina B Crockett. 1976. Agreement in contemporary standard Russian. Slavica Publishers Inc. +Kim Gerdes, Bruno Guillaume, Sylvain Kahane, and Guy Perrier. 2018. SUD or surface-syntactic universal dependencies: An annotation scheme near-isomorphic to UD. In Proceedings of the Second Workshop on Universal Dependencies (UDW 2018), pages 66-74, Brussels, Belgium. Association for Computational Linguistics. +Kim Gerdes, Bruno Guillaume, Sylvain Kahane, and Guy Perrier. 2019. Improving surface-syntactic universal dependencies (SUD): MWEs and deep syntactic features. In Proceedings of the 18th International Workshop on Treebanks and Linguistic Theories (TLT, SyntaxFest 2019), pages 126-132, Paris, France. Association for Computational Linguistics. +Dirk Goldhahn, Thomas Eckart, and Uwe Quasthoff. 2012. Building large monolingual dictionaries at the leipzig corpora collection: From 100 to 200 languages. In LREC, volume 29, pages 31-43. +Zellig S Harris. 1951. Methods in structural linguistics. +Jean Hausser and Korbinian Strimmer. 2009. Entropy inference and the james-stein estimator, with application to nonlinear gene association networks. Journal of Machine Learning Research, 10(7). +Lars Hellan. 2010. From descriptive annotation to grammar specification. In Proceedings of the Fourth Linguistic Annotation Workshop, pages 172-176, Uppsala, Sweden. Association for Computational Linguistics. +Kristen Howell, Emily M Bender, Michel Lockwood, Fei Xia, and Olga Zamaraeva. 2017. Inferring case systems from ict: Enriching the enrichment. In Proceedings of the 2nd Workshop on the Use of Computational Methods in the Study of Endangered Languages, pages 67-75. +Rodney D Huddleston. 2002. The Cambridge grammar of the English language. Cambridge, UK; New York: Cambridge University Press. +Dan Kondratyuk and Milan Straka. 2019. 75 languages, 1 model: Parsing universal dependencies universally. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2779-2795, Hong Kong, China. Association for Computational Linguistics. +Joakim Nivre, Rogier Blokland, Niko Partanen, Michael Rießler, and Jack Rueter. 2018. Universal Dependencies 2.3. + +Joakim Nivre, Marie-Catherine De Marneffe, Filip Ginter, Yoav Goldberg, Jan Hajic, Christopher D Manning, Ryan McDonald, Slav Petrov, Sampo Pyysalo, Natalia Silveira, et al. 2016. Universal dependencies v1: A multilingual treebank collection. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 1659-1666. +Joakim Nivre, Marie-Catherine de Marneffe, Filip Ginter, Jan Hajic, Christopher D. Manning, Sampo Pyysalo, Sebastian Schuster, Francis Tyers, and Daniel Zeman. 2020. Universal dependencies v2: An evergrowing multilingual treebank collection. In Proceedings of The 12th Language Resources and Evaluation Conference, pages 4034-4043, Marseille, France. European Language Resources Association. +F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. 2011. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825-2830. +J. Ross Quinlan. 1986. Induction of decision trees. Machine learning, 1(1):81-106. +Gail M Sullivan and Richard Feinn. 2012. Using effect size—or why the p value is not enough. Journal of graduate medical education, 4(3):279-282. +Olga Zamaraeva. 2016. Inferring morphotactics from interlinear glossed text: Combining clustering and precision grammars. In Proceedings of the 14th SIGMORPHON Workshop on Computational Research in Phonetics, Phonology, and Morphology, pages 141-150, Berlin, Germany. Association for Computational Linguistics. +Ran Zmigrod, Sabrina J. Mielke, Hanna Wallach, and Ryan Cotterell. 2019. Counterfactual data augmentation for mitigating gender stereotypes in languages with rich morphology. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1651-1661, Florence, Italy. Association for Computational Linguistics. + +# A Appendix + +# A.1 Decision Tree Hyperparameters + +We perform a grid search over the following hyperparameters of the decision tree: + +- criterion = [gini, entropy] +- max depth = [6,15] +- min impurity decrease = 1e $^{-3}$ + +The best parameters are selected based on the validation set performance. For some treebanks which have no validation set we use the default cross-validation provided by sklearn (Buitinck et al., 2013). Average model runtime for a treebanks is 5-10mins depending on the size of the treebank. + +# A.2 Dataset Statistics + +For the true low-resource experiments, the dataset details are in Table 2. + +
LANGUAGETRAIN / TEST
Breton-KEB30000 / 888
Buryat-BXR10000 / 908
Faroese-OFT50000/ 1208
Tagalog-TRG30000 / 55
Welsh-CCG30000 / 956
+ +Table 2: Dataset statistics. Training data is obtained by parsing the Liepzig corpora (Goldhahn et al., 2012) and test data is obtained from the respective treebank. Each cell denotes the number of sentences in train/test. + +# A.3 Evaluation + +# A.4 Annotation Interface for Expert Evaluation + +In Figure 10, we show the annotation interface used for verifying Gender agreement rules in Catalan. For each triple, we display 10 randomly selected examples from the training portion of the treebank. + +# A.5 Low-resource Experiment Results + +For the simulation experiments, the dataset details are in Table 3. + +# A.5.1 Udify (Kondratyuk and Straka, 2019) Model Details + +We used the Udify model for automatically annotating the raw text with part-of-speech (POS), dependency links and morphological features. For each of the simulation experiment we report the udify parsing performance on the test data in + +Table 4. We used the same hyperparameters for training with a related languages as specified by the authors.[11]. In the configuration file, we only change the parameters warmup steps= 100 and start-step= 100, as recommended by the authors for low-resource languages. + +# A.5.2 Results and Discussion + +For each language and feature, we plot the ARM score with and without transfer learning in Figure 12-14. Similar to our findings for Gender in Figure 5, we find that cross-lingual transfer leads to a better score across all languages in the zero-shot setting. As we increase the number of gold-standard sentences, the quality of extracted rules improve. Although, for Belarusian we observe the opposite trend for Person agreement. On closer inspection we find that it is because person applies only to non-past finite verb forms (VERB and AUX) as an inflectional feature and to pronouns (PRON) as a lexical feature which means that in many cases person is not explicitly marked, even though it implicitly exists12. + +# A.6 Experiments with Gold-Standard Data + +We present the ARM scores for all treebanks and features in Tables 5-11. We also report the validation results in the same tables for our best setting which uses the Statistical Threshold. In Section 2.2, we proposed using two types of thresholds for retaining the high probability agreement rules. In order to compare which threshold is the best for all treebanks, we manually inspect some of the learnt decision trees. We find that for the trees learnt from the hard threshold often over-fit on the training data causing to produce leaves with very few examples. In Figure 15 we compare the trees constructed for number agreement with the two thresholds for Marathi. One reason why Statistical-Threshold performs better for low-resource languages is because there are more leaves with fewer samples overall causing the Hard Threshold to have more false positives. Whereas the Statistical Threshold uses effect size with the significance test which takes into account the sample size within a leaf leading to better leaves. Therefore, we choose to use Statistical-Threshold for all our simulation experiments. + +In Figure 11, we report that (avg.) number of leaves in the decision trees grouped by language + +relation $\equiv$ subj, head $=$ VERB, dependent $\equiv$ PRON Almost Always Agree Sometimes Agree Need Not Agree [Examples] + +![](images/cd7f59a14224ddbd2d4e9a49515221c50d95396f74dee87ff307a5f90ca5c082.jpg) +Figure 10: Annotation interface for evaluating Gender agreement in Catalan. + +
LANGUAGETRAIN/DEV/TestTRANSFER LANGUAGE
Spanish-GSD14187 / 1400/ 426Portuguese-Bosque
Greek-GDT1662 / 403 / 456Ancient Greek-PROIEL
Belarusian-HSE319 / 65/ 253Ukrainian-IU
Lithuanian-ALKSNIS2341 / 617 / 684Latvian-LVTB
+ +Table 3: Dataset statistics. Train/Dev/Test denote the number of sentences in the respective treebank used for the target language. + +family. Overall, Gender and Case tend to have more complex trees. For Case, it is probably because languages have more number of cases making it harder for the decision tree to model them. + +# A.7 SUD treebanks + +Figure 16 presents a comparison of UD and SUD-style trees for the German sentence, "Ich werde langebücher lessen". The SUD tree has the function word 'werde' as the syntactic head to the content word 'lesen'. + +
LANGUAGE#TRAININGSETTING
W/O TRANSFER+TRANSFER
Greek0-upos:0.661, ufeats:0.392, uas:0.632, las:0.465
50upos:0.507, ufeats:0.330, uas:0.309, las:0.203upos:0.877, ufeats:0.631, uas:0.724, las:0.653
100upos:0.915, ufeats:0.664, uas: 0.755, las: 0.691upos: 0.906, ufeats: 0.719, uas: 0.758, las: 0.703
500upos: 0.970, ufeats: 0.891, uas: 0.891, las: 0.866upos: 0.954, ufeats: 0.860, uas: 0.849, las: 0.817
Spanish0-upos: 0.922, ufeats: 0.764, uas: 0.855, las: 0.776
50upos: 0.529, ufeats: 0.463, uas: 0.289, las: 0.152upos: 0.913, ufeats: 0.792, , uas: 0.844, las: 0.767
100upos: 0.920, ufeats: 0.832, uas: 0.755, las: 0.690upos: 0.916, ufeats: 0.840, uas: 0.849, las: 0.784
500upos: 0.952, ufeats: 0.919, uas: 0.860, las: 0.820upos: 0.949, ufeats: 0.889, uas: 0.859, las: 0.822
Belarusian0-upos: 0.941, ufeats: 0.520, uas: 0.863, las: 0.797
50upos: 0.570, ufeats: 0.323, uas: 0.217, las: 0.141upos: 0.952, ufeats: 0.726, uas: 0.763, las: 0.727
100upos: 0.919, ufeats: 0.446, uas: 0.521, las: 0.482upos: 0.961, ufeats: 0.777, uas: 0.854, las: 0.800
Lithuanian0-upos: 0.869, ufeats: 0.528, uas: 0.752, las: 0.610
50upos: 0.566, ufeats: 0.371, uas: 0.346, las: 0.211upos: 0.874, ufeats: 0.5841, uas: 0.757, las: 0.623
100upos: 0.813, ufeats: 0.453, uas: 0.551, las: 0.421upos: 0.883, ufeats: 0.637, uas: 0.761, las: 0.659
500upos: 0.925, ufeats: 0.744, uas: 0.757, las: 0.697upos: 0.912, ufeats: 0.747, uas: 0.779, las: 0.714
+ +Table 4: udify model performance on the test data for each low-resource setting. The scores are averaged across five runs of each setting. + +![](images/22b55de8d840f6d5b345362834492f68d7f33ddf94bf2b0e26ac60112c0a2df0.jpg) +Figure 11: (Avg.) number of leaves for each feature grouped by language family. + +![](images/cbd21ebc0265d66cff175b236bcbeebf60f1d1c2cdc50c3282811e973a84c2b1.jpg) +(a) + +![](images/77d990f15f68beddebda6fe4de28d3e2fc7f3db0ab1447b450bcb5b55173474d.jpg) +(b) + +![](images/7d132f4f1ff3b5f0c1ace0795393df28717c9930527e8dab15d327af3dd86a78.jpg) +(c) + +![](images/3b9268922b63605504332b23a3c73dce43ef59f7f559c8b785c0ed48280cfed5.jpg) +(d) +Figure 12: Comparing the (avg.) ARM score for Gender agreement with and without cross-lingual transfer learning (transfer language in parenthesis). Note: the higher the ARM the better. + +![](images/04b93b63fee61ab8a3ef8dccf7a9a355e73b4cda445d394c0eb0fa40b40f910d.jpg) +(a) + +![](images/ad7b602fb8227770e19395dfe56a2f088b6060c3936b2af7b61742d8f43d493c.jpg) +(b) + +![](images/14a33c8df89a8435975df3574a5a366574bf41616c5d2092b0473dd2ac16e1c6.jpg) +(c) +Figure 13: Comparing the (avg.) ARM score for Person agreement with and without cross-lingual transfer learning (transfer language in parenthesis). Note: the higher the ARM the better. + +![](images/4dca9745ef4b27b7cb88242908d62bfefc1c4c8d5d218d5f226a146acd054c30.jpg) +(d) + +![](images/2139c970e458c3d3094fae274b19894fbbd7482cc425a738a267b4f7219d17f7.jpg) +(a) + +![](images/4d284ecaa15454d6f988ef2148a7f6b757634058fc746df3a30904365f7ddc74.jpg) +(b) + +![](images/b94471df5467d7e2a27779721cefb63fc23b7773481d1f9dc69c493250412c29.jpg) +(c) +Figure 14: Comparing the (avg.) ARM score for Case agreement with and without cross-lingual transfer learning (transfer language in parenthesis). Note: the higher the ARM the better. For Spanish, there was $< 10$ data points with Case annotated hence we do not report results for it. + +![](images/cde29dde2d1ed94df2f9464450aff3410d35ac00b83b5cb033091515a139beb5.jpg) +(a) + +![](images/6cb1392631f5fd597e5c32f79378b870c54edb51a9cc6de07f82484435139db9.jpg) +(b) +Figure 15: Comparing the learnt trees for Number agreement extracted using (a) Hard Threshold and (b) Statistical Threshold. Hard Threshold overfits on the training data resulting in leaves with very few samples. + +![](images/4baaed7209187824ea6761e37c5b30cc582a05ff920e432f10db367e45178d15.jpg) +Ich werde langebücher lesen. +(a) + +![](images/c4ee6d59c7bdb58200e1b01a3f68f85715548c833116dd6bff4f7505f35a375f.jpg) +Ich wurde langebücherlesen. +(b) +Figure 16: Comparing the UD (a) tree with the SUD (b) tree for the German sentence "Ich werde lange Bücher essen." + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
ru-gsdGender0.678-0.510.623
ru-gsdPerson0.1250.8750.1250.286
ru-gsdNumber0.6280.5120.3840.62
ru-gsdTense0.6670.6670.6670.571
ru-gsdMood0.01.00.00.1
ru-gsdCase0.6490.6140.3950.537
id-gsdNumber0.0470.9610.0470.045
it-isdtGender0.8160.8160.2890.738
it-isdtPerson0.3040.870.3040.619
it-isdtNumber0.6150.6030.410.588
it-isdtTense0.7650.7650.6470.611
it-isdtMood0.250.750.250.273
la-proielGender0.5380.5680.6360.496
la-proielPerson0.560.60.540.653
la-proielNumber0.6480.5740.4520.553
la-proielTense0.8180.8790.8790.824
la-proielMood0.60.520.440.667
la-proielCase0.7590.7820.4660.691
ro-nonstandardGender0.640.570.4070.75
ro-nonstandardPerson0.6360.6060.6060.683
ro-nonstandardNumber0.6260.6260.5860.693
ro-nonstandardTense0.4520.8390.6450.467
ro-nonstandardMood0.6760.7650.6760.4
ro-nonstandardCase0.6940.7020.6360.704
he-htbGender0.7470.7470.6630.629
he-htbPerson0.7370.7890.7890.769
he-htbNumber0.5850.5850.4150.505
he-htbTense0.30.30.10.545
he-htbCase0.50.50.00.5
no-bokmaalGender0.4770.5680.5450.675
no-bokmaalPerson1.01.00.51.0
no-bokmaalNumber0.6550.6730.3640.733
no-bokmaalTense0.550.550.550.55
no-bokmaalMood0.01.00.00.1
no-bokmaalCase0.00.3330.00.0
no-nynorskGender0.4640.5360.5360.514
no-nynorskPerson0.00.00.00.667
no-nynorskNumber0.7020.7020.5110.596
no-nynorskTense0.3680.3680.6840.429
no-nynorskMood0.01.00.00.048
fi-tdtPerson0.3870.6770.6770.607
fi-tdtNumber0.5020.4930.5110.559
fi-tdtTense0.4740.3680.4740.5
fi-tdtMood0.750.750.750.471
fi-tdtCase0.7860.8280.8210.781
pl-lfgGender0.6460.6460.4630.641
pl-lfgPerson0.6880.6880.5620.714
pl-lfgNumber0.6910.680.4120.624
pl-lfgTense0.5560.6670.6670.6
pl-lfgMood0.3330.6670.3330.4
pl-lfgCase0.7440.6670.410.617
grc-perseusGender0.620.7180.5630.699
grc-perseusPerson0.80.80.70.636
grc-perseusNumber0.5310.630.6050.537
grc-perseusTense0.8891.01.00.778
grc-perseusMood0.8330.8330.6670.429
grc-perseusCase0.7080.7920.5560.712
fi-ftbPerson0.560.760.60.63
fi-ftbNumber0.5240.4410.5240.54
fi-ftbTense0.8460.7690.3080.538
fi-ftbMood0.4290.50.4290.529
fi-ftbCase0.7240.8480.7810.748
wo-wtbGender0.50.50.50.0
wo-wtbPerson0.550.450.40.609
wo-wtbNumber0.4860.60.60.632
wo-wtbTense0.50.6250.3750.625
wo-wtbMood0.1430.1430.1430.364
en-partutPerson0.50.50.4170.857
en-partutNumber0.5590.5590.4410.676
en-partutTense0.6670.7330.6670.583
en-partutMood0.0910.8180.0910.1
+ +Table 5: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
fr-ftbGender0.6310.6310.4770.621
fr-ftbPerson0.140.860.140.171
fr-ftbNumber0.6350.6350.5020.634
fr-ftbTense0.7140.8570.8570.833
fr-ftbMood0.4090.5910.4090.6
lv-lvtbGender0.7270.7340.4610.677
lv-lvtbPerson0.50.6320.5790.583
lv-lvtbNumber0.6880.6880.4290.706
lv-lvtbTense0.6670.8150.8890.741
lv-lvtbMood0.4760.6190.4760.333
lv-lvtbCase0.7190.7340.4890.772
ro-rrtGender0.5830.5830.510.591
ro-rrtPerson0.3270.7550.3470.304
ro-rrtNumber0.5350.5850.5280.56
ro-rrtTense0.4210.6840.7890.526
ro-rrtMood0.9311.00.4480.867
ro-rrtCase0.8620.7880.5880.854
it-vitGender0.6720.6720.3750.678
it-vitPerson0.6250.6250.7920.667
it-vitNumber0.7120.7280.5280.61
it-vitTense0.7730.9550.9550.75
it-vitMood0.40.60.40.231
fr-partutGender0.5790.6320.4210.615
fr-partutPerson0.8180.7270.2730.75
fr-partutNumber0.7710.5420.2920.542
fr-partutTense0.8570.8570.7140.6
fr-partutMood0.3330.6670.3330.167
en-ewtPerson0.8120.8120.250.85
en-ewtNumber0.3570.6430.3570.304
en-ewtTense0.5910.7730.7730.593
en-ewtMood0.40.7330.40.333
ru-syntagrusGender0.6970.7470.6240.673
ru-syntagrusPerson0.6250.6670.6670.72
ru-syntagrusNumber0.5910.6610.5620.576
ru-syntagrusTense0.7270.8180.8180.667
ru-syntagrusMood0.40.80.440.407
ru-syntagrusCase0.6490.7070.5750.681
sv-talbankenGender0.7190.7190.4380.643
sv-talbankenNumber0.6590.6340.4630.571
sv-talbankenTense0.5590.5880.50.607
sv-talbankenMood0.0480.9520.0480.056
sv-talbankenCase0.1890.6230.1890.143
olo-kkppPerson0.2860.5710.286-
olo-kkppNumber0.6670.6920.667-
olo-kkppTense0.750.750.75-
olo-kkppMood0.00.750.0-
olo-kkppCase0.70.70.7-
cs-cacGender0.6630.6730.6020.678
cs-cacPerson0.5620.5620.50.583
cs-cacNumber0.6360.5310.4690.575
cs-cacTense0.4670.6670.60.333
cs-cacMood0.20.40.20.111
cs-cacCase0.810.840.460.833
ur-adtbGender0.5670.5670.5360.576
ur-adtbPerson0.1520.9460.0650.195
ur-adtbNumber0.4850.5830.4850.496
ur-adtbTense0.3330.50.50.667
ur-adtbMood0.7140.7140.1430.714
ur-adtbCase0.6850.6960.6960.7
et-ewtPerson0.6090.6960.609-
et-ewtNumber0.5510.5510.48-
et-ewtTense0.4090.6820.636-
et-ewtMood0.5330.40.533-
et-ewtCase0.70.7540.657-
fro-srcmfTense0.51.00.51.0
es-gsdGender0.7180.7180.3660.736
es-gsdPerson0.5910.5450.5910.355
es-gsdNumber0.6440.6440.4240.567
es-gsdTense0.5290.8240.8240.409
es-gsdMood0.5330.4670.5330.474
es-gsdCase0.52311.00.00.0
+ +Table 6: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
sl-ssjGender0.8180.80.5270.772
sl-ssjPerson0.6670.7220.7220.706
sl-ssjNumber0.6830.6830.5640.712
sl-ssjTense0.3330.5830.3330.364
sl-ssjMood0.50.750.50.667
sl-ssjCase0.6070.7210.5570.61
cs-pdtGender0.5640.7880.750.58
cs-pdtPerson0.5910.7050.6140.541
cs-pdtNumber0.4770.640.6290.481
cs-pdtTense0.6670.7860.7860.658
cs-pdtMood0.5380.5380.5380.48
cs-pdtCase0.6460.6750.5450.633
hsb-ufalGender0.8570.7140.786-
hsb-ufalNumber0.6920.5380.692-
hsb-ufalTense0.6670.6670.667-
hsb-ufalCase1.00.8460.462-
ga-idtGender0.640.760.780.647
ga-idtPerson0.6250.8750.51.0
ga-idtNumber0.4680.5710.4680.446
ga-idtTense0.7140.5710.4290.5
ga-idtMood0.8330.8330.6670.714
ga-idtCase0.690.7240.7240.667
gl-treegalGender0.7220.6850.333-
gl-treegalPerson0.5220.5650.522-
gl-treegalNumber0.680.5460.361-
gl-treegalTense0.4620.5380.692-
gl-treegalMood0.4620.6920.462-
fa-serajiPerson0.6670.6670.3810.842
fa-serajiNumber0.5140.5140.5140.556
fa-serajiTense0.4550.5450.6360.545
fa-serajiMood0.3330.6670.3330.0
et-edtPerson0.6130.6130.710.714
et-edtNumber0.6480.6440.5390.676
et-edtTense0.5790.6320.7630.537
et-edtMood0.5240.5710.5710.667
et-edtCase0.5650.7560.7860.614
la-perseusGender0.6920.5850.538-
la-perseusPerson0.50.6670.833-
la-perseusNumber0.5440.6620.603-
la-perseusTense0.751.01.0-
la-perseusMood0.6670.6670.833-
la-perseusCase0.7170.660.528-
ug-udtPerson0.5260.5260.5790.611
ug-udtNumber0.7670.60.5330.697
ug-udtTense0.6250.750.50.778
ug-udtMood0.6920.9230.7690.833
ug-udtCase0.6830.6830.6830.671
es-ancoraGender0.7540.7540.4310.759
es-ancoraPerson0.4290.4290.4290.526
es-ancoraNumber0.6640.6640.5390.651
es-ancoraTense0.6250.8330.8330.63
es-ancoraMood0.6520.3480.6520.5
de-hdtGender0.5410.6070.6070.603
de-hdtPerson0.0710.9290.0710.085
de-hdtNumber0.5610.5950.590.533
de-hdtTense0.80.880.880.692
de-hdtMood0.01.00.00.077
de-hdtCase0.7380.8360.5740.7
kk-ktbPerson0.6360.5450.636-
kk-ktbNumber0.5380.6150.538-
kk-ktbMood1.01.00.6-
de-gsdGender0.6990.7810.3970.641
de-gsdPerson0.5670.4330.5670.667
de-gsdNumber0.6380.6380.350.619
de-gsdTense0.4550.6360.5910.526
de-gsdMood0.50.4550.4550.421
de-gsdCase0.550.5880.3620.603
nl-alpinoGender0.6670.80.80.562
nl-alpinoNumber0.5480.5480.5650.625
nl-alpinoTense0.5620.50.3750.529
af-afriboomsNumber0.6 52320.6670.5330.667
af-afriboomsTense0.8420.8420.588
af-afriboomsCase0.01.00.0
+ +Table 7: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
uk-iuGender0.7010.6930.5590.771
uk-iuPerson0.70.50.350.9
uk-iuNumber0.6470.6590.4790.656
uk-iuTense0.4760.4760.5710.615
uk-iuMood0.3180.4090.3180.357
uk-iuCase0.7410.7410.5040.732
cs-clttGender0.8570.9290.750.806
cs-clttNumber0.6460.6880.4790.576
cs-clttTense0.1670.50.1670.143
cs-clttMood0.01.00.00.0
cs-clttCase0.6970.7580.6360.658
cop-scriptoriumGender0.7140.8570.1430.8
cop-scriptoriumNumber0.40.60.20.714
ru-taigaGender0.6480.7240.6380.667
ru-taigaPerson0.6670.750.5830.786
ru-taigaNumber0.6620.6010.4590.646
ru-taigaTense0.5380.6150.6150.583
ru-taigaMood0.6110.6670.6110.5
ru-taigaCase0.5570.6960.6330.593
hu-szegedPerson0.4440.5560.4440.138
hu-szegedNumber0.3960.640.3960.434
hu-szegedTense0.60.80.80.769
hu-szegedMood0.7140.7140.7140.5
sr-setGender0.8030.8170.4790.622
sr-setPerson0.350.750.350.4
sr-setNumber0.640.640.5090.615
sr-setTense0.4740.6840.6840.444
sr-setMood0.2860.7140.2860.2
sr-setCase0.7040.7650.5310.651
en-linesPerson0.6250.6880.5620.789
en-linesNumber0.3190.7830.3190.325
en-linesTense0.7040.7780.7040.636
en-linesMood0.2110.7890.2110.207
en-linesCase0.7780.7780.4440.833
sk-snkGender0.6920.7760.5330.638
sk-snkPerson0.7780.3330.2220.625
sk-snkNumber0.5580.5580.50.571
sk-snkTense0.6670.5560.4440.8
sk-snkMood1.01.00.250.857
sk-snkCase0.7310.7560.5260.833
pl-pdbGender0.6450.7790.5290.661
pl-pdbPerson0.5560.7780.7040.72
pl-pdbNumber0.6370.6130.4810.644
pl-pdbTense0.50.60.70.6
pl-pdbMood0.250.750.250.05
pl-pdbCase0.720.7480.5140.679
la-ittbGender0.7350.7250.480.805
la-ittbPerson0.190.810.190.273
la-ittbNumber0.5790.5790.3860.562
la-ittbTense0.50.60.60.414
la-ittbMood0.4760.4760.5710.591
la-ittbCase0.7570.7960.4950.792
+ +Table 8: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
da-ddtGender0.8180.8180.3640.889
da-ddtNumber0.6670.6670.2860.725
da-ddtTense0.7370.7370.8420.562
da-ddtMood0.20.80.20.077
it-postwitaGender0.7020.7020.3620.674
it-postwitaPerson0.5950.6760.730.595
it-postwitaNumber0.7440.7440.5580.642
it-postwitaTense0.4810.7040.7040.607
it-postwitaMood0.7920.7920.7920.556
eu-bdtNumber0.5080.60.4150.473
eu-bdtMood0.4210.7370.4210.529
eu-bdtCase0.7950.8030.7260.776
sl-sstGender0.7240.6180.513-
sl-sstPerson0.6880.8120.719-
sl-sstNumber0.6780.6720.483-
sl-sstTense0.480.760.48-
sl-sstMood0.560.60.56-
sl-sstCase0.6150.6370.549-
be-hseGender0.5960.5530.4040.692
be-hsePerson0.50.50.00.75
be-hseNumber0.6460.6460.4310.596
be-hseTense0.4290.4290.5710.333
be-hseMood0.2860.2860.2860.2
be-hseCase0.7250.550.450.733
fr-sequoiaGender0.80.7710.3710.647
fr-sequoiaPerson0.6670.6670.40.857
fr-sequoiaNumber0.560.620.450.68
fr-sequoiaTense0.5290.7650.7650.684
fr-sequoiaMood0.2860.7140.2860.077
sme-giellaNumber0.6530.6530.561-
sme-giellaTense0.4550.5450.455-
sme-giellaMood0.2140.5710.214-
sme-giellaCase0.7410.7040.667-
el-gdtGender0.6380.7450.4470.744
el-gdtPerson0.6670.6670.4580.667
el-gdtNumber0.6270.70.4270.615
el-gdtTense0.61.01.00.462
el-gdtMood0.01.00.00.0
el-gdtCase0.8090.8090.3190.814
orv-torotGender0.6550.6690.5470.679
orv-torotPerson0.60.60.60.594
orv-torotNumber0.6210.6210.5810.618
orv-torotTense0.7310.7310.7690.72
orv-torotMood0.3160.7890.4210.176
orv-torotCase0.7090.7750.6090.691
sv-linesGender0.5380.5380.3080.64
sv-linesNumber0.6430.6430.4520.529
sv-linesTense0.4290.4760.4290.655
sv-linesMood0.2310.7690.2310.161
sv-linesCase0.5830.5830.250.51
ta-ttbGender0.6820.6820.6590.5
ta-ttbPerson0.0910.9550.0910.167
ta-ttbNumber0.5230.5910.5450.533
ta-ttbTense0.6250.50.6250.667
ta-ttbMood0.51.00.50.5
ta-ttbCase0.8460.8460.6921.0
it-partutGender0.7860.7860.250.846
it-partutPerson0.8330.9170.250.615
it-partutNumber0.7140.5080.2860.576
it-partutTense0.90.90.60.583
it-partutMood0.20.40.20.167
ar-padtGender0.5920.5920.5490.712
ar-padtPerson0.00.8330.00.263
ar-padtNumber0.5120.6430.5120.593
ar-padtMood0.5710.5710.5710.6
ar-padtCase0.8710.8710.7530.824
bg-btbGender0.6380.660.4040.585
bg-btbPerson0.6250.6250.6250.625
bg-btbNumber0.6390.6310.5330.679
bg-btbTense0.60.60.60.579
bg-btbMood0.0560.9440.0560.176
+ +Table 9: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
pt-bosqueGender0.6560.7210.410.792
pt-bosquePerson0.250.750.250.455
pt-bosqueNumber0.6690.6690.3780.698
pt-bosqueTense0.50.4380.4380.692
pt-bosqueMood0.3750.50.3750.429
lt-alksnisGender0.7110.711-0.671
lt-alksnisPerson0.6670.80.6670.571
lt-alksnisNumber0.6250.6250.5310.595
lt-alksnisTense0.6670.6670.6670.6
lt-alksnisMood0.6670.3330.6670.375
lt-alksnisCase0.8260.8260.4960.798
ar-nyuadGender0.6060.7180.7180.536
ar-nyuadPerson0.4690.5620.4690.343
ar-nyuadNumber0.5020.5540.5020.468
ar-nyuadMood0.4380.5620.4380.5
ar-nyuadCase0.6270.7470.7470.551
ca-ancoraGender0.8040.7860.4640.77
ca-ancoraPerson0.3890.6110.3890.219
ca-ancoraNumber0.6520.6520.5110.616
ca-ancoraTense0.50.7310.6920.56
ca-ancoraMood0.320.680.320.348
grc-proielGender0.6050.5160.5350.588
grc-proielPerson0.5430.5430.60.737
grc-proielNumber0.5330.610.5380.585
grc-proielTense0.6430.7860.7860.774
grc-proielMood0.5290.5290.5290.65
grc-proielCase0.8090.8540.510.813
it-twittiroGender0.8080.8080.3850.65
it-twittiroPerson0.5910.3180.6820.579
it-twittiroNumber0.5680.5680.4190.634
it-twittiroTense0.250.750.750.462
it-twittiroMood0.50.50.50.364
mr-ufalGender0.6090.6520.5650.52
mr-ufalPerson0.7270.7270.3640.889
mr-ufalNumber0.3940.7940.2420.514
mr-ufalCase0.5830.5830.4170.857
tr-imstPerson0.3590.8180.3590.342
tr-imstNumber0.470.5360.470.485
tr-imstTense0.7620.7620.810.68
tr-imstMood0.7140.7140.7140.68
tr-imstCase0.7170.8040.8040.678
bxr-bdtCase0.8180.5450.818-
hi-hdtbGender0.5860.6170.50.631
hi-hdtbPerson0.0450.9550.0450.052
hi-hdtbNumber0.4160.6150.4160.455
hi-hdtbTense0.3330.3330.3330.2
hi-hdtbMood1.01.00.3330.667
hi-hdtbCase0.6540.7090.630.62
hr-setGender0.7250.7170.5250.643
hr-setPerson0.7690.7690.5770.692
hr-setNumber0.6750.6750.510.658
hr-setTense0.4290.7140.7140.542
hr-setMood0.4120.5880.4120.158
hr-setCase0.6690.7250.5770.659
kmr-mgGender1.00.8181.0-
kmr-mgNumber0.7830.7390.783-
kmr-mgCase0.9090.7270.909-
nl-lassysmallGender0.850.850.90.81
nl-lassysmallNumber0.6460.6460.5230.646
nl-lassysmallTense0.60.60.40.364
fr-gsdGender0.7270.7270.4850.807
fr-gsdPerson0.3750.7190.3750.312
fr-gsdNumber0.6240.6240.4410.593
fr-gsdTense0.7060.7060.7650.81
fr-gsdMood0.2730.7270.2730.25
+ +Table 10: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. + +
TREEBANKFEATURESTATISTICALHARDBASELINEDEV
got-proielGender0.5590.5950.5590.658
got-proielPerson0.5710.7710.6570.614
got-proielNumber0.640.680.5030.591
got-proielTense0.7140.7140.7140.586
got-proielMood0.7220.7220.6110.682
got-proielCase0.820.7840.5050.803
en-gumPerson0.1670.9170.1670.176
en-gumNumber0.3970.7670.3970.259
en-gumTense0.5790.6840.5790.625
en-gumMood0.1760.8240.1760.05
lzh-kyotoMood0.01.00.00.0
lzh-kyotoCase0.01.00.00.125
cs-fictreeGender0.7170.6830.40.691
cs-fictreePerson0.6670.9050.810.625
cs-fictreeNumber0.6490.6490.3640.673
cs-fictreeTense0.8330.8890.7780.565
cs-fictreeMood0.4550.4550.5450.643
cs-fictreeCase0.6970.6520.4610.738
hy-armtdpPerson0.4440.5930.5930.692
hy-armtdpNumber0.5920.6120.5610.676
hy-armtdpTense0.8240.7650.5290.733
hy-armtdpMood0.7890.7890.7370.8
hy-armtdpCase0.8570.8570.8210.772
gd-arcosgGender0.6150.6150.6150.609
gd-arcosgPerson0.60.80.60.75
gd-arcosgNumber0.5620.5620.5620.588
gd-arcosgTense0.8330.3330.50.8
gd-arcosgMood0.6670.6670.3330.714
gd-arcosgCase0.850.850.50.833
lt-hseGender0.6580.5530.4740.6
lt-hsePerson0.7780.4440.4440.8
lt-hseNumber0.6420.5970.4780.667
lt-hseTense0.7140.8570.8570.889
lt-hseMood0.20.60.20.429
lt-hseCase0.5640.6150.6410.816
no-nynorskliaGender0.7270.6970.4550.667
no-nynorskliaPerson1.01.00.01.0
no-nynorskliaNumber0.7430.7430.3430.649
no-nynorskliaTense0.4350.8260.7830.435
no-nynorskliaMood0.01.00.00.043
no-nynorskliaCase0.51.00.50.0
cu-proielGender0.610.660.540.706
cu-proielPerson0.6670.6670.5280.579
cu-proielNumber0.6720.5790.5030.641
cu-proielTense0.5670.5330.60.655
cu-proielMood0.3480.6520.3480.364
cu-proielCase0.8180.8180.4730.793
+ +Table 11: Comparing the ARM scores for SUD treebanks across both Statistical and Hard thresholding. \ No newline at end of file diff --git a/automaticextractionofrulesgoverningmorphologicalagreement/images.zip b/automaticextractionofrulesgoverningmorphologicalagreement/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..5233fd854c2982a8b2923efd591dcd9aa03e355f --- /dev/null +++ b/automaticextractionofrulesgoverningmorphologicalagreement/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6584c84c39a35314ae6a3ce79938d2806e6936d89543b4482a043251af1bc245 +size 2809426 diff --git a/automaticextractionofrulesgoverningmorphologicalagreement/layout.json b/automaticextractionofrulesgoverningmorphologicalagreement/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2c3f757c59ad55be39366fe70b3533c984d45a41 --- /dev/null +++ b/automaticextractionofrulesgoverningmorphologicalagreement/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5041290b6c94bd2650d63ce823c117b35ba772d3a8794f68467fd44be9d8a73 +size 575691 diff --git a/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_content_list.json b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e9588441f9f5d742cd83b2798bd14baf05400aa7 --- /dev/null +++ b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76a673c7d1884ad9b0cd320d1e4baff409576897b5439fe3516619c5366a47be +size 194674 diff --git a/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_model.json b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e22e347fc170a6bf47e6e8b3d0ca7fc235a3680f --- /dev/null +++ b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52e7464d470320a3a577039941a5fbececab51835f6c181b0766a6ae08fbbe3b +size 225816 diff --git a/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_origin.pdf b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cea6e498f7346dc10b11ca87f93cf47f648cdefa --- /dev/null +++ b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/0072d54b-a894-4766-9b68-ae4c13d160c7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7dc971f8f0a041c735cadcbe7882b537c495c01af833022600cfb83b7c4f74e +size 756043 diff --git a/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/full.md b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..c75799cc79dfde6fa337a92b6b1e2e28685270ca --- /dev/null +++ b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/full.md @@ -0,0 +1,499 @@ +# Automatic Machine Translation Evaluation in Many Languages via Zero-Shot Paraphrasing + +Brian Thompson + +Johns Hopkins University + +brian.thompson@jhu.edu + +Matt Post + +Johns Hopkins University + +post@cs.jhu.edu + +# Abstract + +We frame the task of machine translation evaluation as one of scoring machine translation output with a sequence-to-sequence paraphrase, conditioned on a human reference. We propose training the paraphrase as a multilingual NMT system, treating paraphrasing as a zero-shot translation task (e.g., Czech to Czech). This results in the paraphrase's output mode being centered around a copy of the input sequence, which represents the best case scenario where the MT system output matches a human reference. Our method is simple and intuitive, and does not require human judgements for training. Our single model (trained in 39 languages) outperforms or statistically ties with all prior metrics on the WMT 2019 segment-level shared metrics task in all languages (excluding Gujarati where the model had no training data). We also explore using our model for the task of quality estimation as a metric-conditioning on the source instead of the reference—and find that it significantly outperforms every submission to the WMT 2019 shared task on quality estimation in every language pair. + +# 1 Introduction + +Machine Translation (MT) systems have improved dramatically in the past several years. This is largely due to advances in neural MT (NMT) methods, but the pace of improvement would not have been possible without automatic MT metrics, which provide immediate feedback on MT quality without the time and expense associated with obtaining human judgments of MT output. + +However, the improvements that existing automatic metrics helped enable are now causing the correlation between human judgments and automatic metrics to break down (Ma et al., 2019; Mathur et al., 2020) especially for BLEU (Papineni et al., 2002), which has been the de facto standard + +![](images/64ded30024a482b047dc33917e47068c6245aaa36b22aa677696dc30faaa692c.jpg) +Figure 1: Our model is trained on multilingual parallel examples such as "Ciao amico" translated to French is "Salut l'am." At evaluation time, the model is used in zero-shot mode to score MT system outputs conditioned on their corresponding human references. For example, the MT system output "Hi world" conditioned on the human reference "Hello world" is found to have token probabilities [0.3, 0.6]. + +metric since its introduction almost two decades ago. The problem currently appears limited to very strong systems, but as hardware, modeling, and available training data improve, it is likely BLEU will fail more frequently in the future. This could prove extremely detrimental if the MT community fails to adopt an improved metric, as good ideas could quietly be discarded or rejected from publication because they do not correlate with BLEU. In fact, this may already be happening. + +We propose using a sentential, sequence-to-sequence paraphraseer to force-decode and score MT outputs conditioned on their corresponding human references. Our model implicitly represents the entire (exponentially large) set of potential paraphrases of a sentence, both valid and invalid; by "querying" the model with a particular system out + +put, we can use the model score to measure how well the system output paraphrases the human reference translation. Our model is not trained on any human quality judgements, which are not available in many domains and/or language pairs. + +The best possible MT output is one which perfectly matches a human reference; therefore, for evaluation, an ideal paraphraseer would be one with an output distribution centered around a copy of its input sentence. We denote such a model a "lexically/syntactically unbiased paraphraseer" to distinguish it from a standard paraphraseer trained to produce output which conveys the meaning of the input while also being lexically and/or syntactically different from it. For this reason, we propose using a multilingual NMT system as an unbiased paraphraseer by treating paraphrasing as zero-shot "translation" (e.g., Czech to Czech). We show that a multilingual NMT model is much closer to an ideal lexically/syntactically unbiased paraphraseer than a generative paraphraseer trained on synthetic paraphrases. It also allows a single model to work in many languages, and can be applied to the task of "Quality estimation (QE) as a metric" (Fonseca et al., 2019) by conditioning on the source instead of the reference. Figure 1 illustrates our method, which we denote Prism (Probability is the metric). + +We train a single model in 39 languages and show that it: + +- Outperforms or ties with prior metrics and several contrastive neural methods on the segment-level WMT 2019 MT metrics task in every language pair; +- Is able to discriminate between very strong neural systems at the system level, addressing a problem raised at WMT 2019; and +Significantly outperforms all QE metrics submitted to the WMT 2019 QE shared task + +Finally, we contrast the effectiveness of our model when scoring MT output using the source vs the human reference. We observe that human references substantially improve performance, and, crucially, allow our model to rank systems that are substantially better than our model at the task of translation. This is important because it establishes that our method does not require building a state-of-the-art multilingual NMT model in order to produce a state-of-the-art MT metric capable of evaluating state-of-the-art MT systems. + +We release our model, metrics toolkit, and preprocessed training data.2 + +# 2 Related Work + +MT Metrics Early MT metrics like BLEU (Papineni et al., 2002) and NIST (Doddington, 2002) use token-level n-gram overlap between the MT output and the human reference. Overlap can also be measured at the character level (Popovic, 2015, 2017) or using edit distance (Snover et al., 2006). Many metrics use word- and/or sentence-level embeddings, including ReVal (Gupta et al., 2015), RUSE (Shimanaka et al., 2018), WMDO (Chow et al., 2019), and ESIM (Mathur et al., 2019). MEANT (Lo and Wu, 2011) and MEANT 2.0 (Lo, 2017) measure similarity between semantic frames and role fillers. State-of-the-art methods including YiSi (Lo, 2019) and BERTscore (Zhang et al., 2019, 2020) rely on contextualized embeddings (Devlin et al., 2019) trained on large (non-parallel) corpora. BLEURT (Sellam et al., 2020) applies fine tuning of BERT, including training on prior human judgements. In contrast, our work exploits parallel bitext and doesn't require training on human judgements. + +Paraphrase Databases Prior work explored using parallel bitext to identify phrase level paraphrases (Bannard and Callison-Burch, 2005; Ganitkevitch et al., 2013) including bitext in multiple language pairs (Ganitkevitch and Callison-Burch, 2014). Paraphrase tables were, in turn, used in MT metrics to reward systems for paraphrasing words (Banerjee and Lavie, 2005) or phrases (Zhou et al., 2006; Denkowski and Lavie, 2010) from the human reference. Our work can be viewed as extending this idea to the sentence level, without having to enumerate the millions or billions of paraphrases (Dreyer and Marcu, 2012) for each sentence. + +Multilingual NMT Multilingual NMT (Dong et al., 2015) has been shown to rival performance of single language pair models in high-resource languages (Aharoni et al., 2019; Arivazhagan et al., 2019) while also improving low-resource translation via transfer learning from higher-resource languages (Zoph et al., 2016; Nguyen and Chiang, 2017; Neubig and Hu, 2018). An extreme low-resource setting is where the system translates between languages seen during training, but in a language pair where it did not see any training + +
Word-level paraphrase log probabilitiesH(out|in)sBLEULASER
CopyJason went to school at the University of Madrid . -0.08 -0.26 -0.16 -0.16 -0.12 -0.11 -0.14 -0.10 -0.10 -0.11 -0.10-0.13100.01.000
DisfluentJason went school at University of Madrid . -0.08 -0.26 -7.21 -0.12 -4.81 -0.10 -0.11 -0.11 -0.10-1.4335.50.989
InadequateJason will go to school at the University of Madrid . -0.08 -9.77 -0.76 -0.22 -0.19 -0.14 -0.15 -0.16 -0.10 -0.10 -0.12 -0.10-0.9970.80.960
Jason went to school at the University of Berlin . -0.08 -0.26 -0.16 -0.16 -0.12 -0.11 -0.14 -0.10 -10.34 -0.12 -0.10-1.0678.30.957
Fluent & AdequateJason attended the University of Madrid . -0.08 -2.01 -1.63 -0.42 -0.10 -0.09 -0.16 -0.10-0.5741.10.918
+ +Table 1: Example token-level log probabilities from our model for various output sentences, conditioned on input sentence (i.e., human reference) "Jason went to school at the University of Madrid." H(out|in) denotes the average token-level log probability. We observe that our model generally penalizes any deviations (bolded) from the input sentence, but tends to penalize deviations which change the meaning of the sentence or introduce a disfluency more harshly than those which are fluent and adequate. Sentence-level BLEU with smoothing=1 ("sBLEU") and LASER embedding cosine similarity ("LASER") are shown for comparison. We note that LASER appears fairly insensitive to disfluencies, and sentenceBLEU struggles to reward valid paraphrases. + +data, denoted 'zero-shot' translation. Despite evidence that intermediate representations are not truly language-agnostic (Kudugunta et al., 2019), zero-shot translation has been shown successful, especially between related languages (Johnson et al., 2017; Gu et al., 2018; Pham et al., 2019). + +Generative Paraphrasing Sentential paraphrasing can be accomplished by training an MT system on paraphrase examples instead of translation pairs (Quirk et al., 2004). While natural paraphrase datasets do exist (Quirk et al., 2004; Coster and Kauchak, 2011; Fader et al., 2013; Lin et al., 2014; Federmann et al., 2019), they are somewhat limited. An alternative is to start with much more plentiful bitext and back-translate one side into the language of the other to create synthetic paraphrases on which to train (Prakash et al., 2016; Wieting and Gimpel, 2018; Hu et al., 2019a,b,c). Tiedemann and Scherrer (2019) propose using paraphrasing as a way to measure the semantic abstraction of multilingual NMT. They also propose using a multilingual NMT model as a generative paraphrase. + +Semantic Similarity Parallel corpora in many language pairs have been used to produce fixed-size, multilingual sentence representations (Schwenk and Douze, 2017; Wieting et al., 2017; Artetxe and Schwenk, 2018; Wieting et al., 2019; Raganato et al., 2019). LASER (Artetxe and + +Schwenk, 2018), for example, trains a variant of NMT with a fixed-size intermediate representation in 93 languages. Embeddings produced by the encoder can be compared to measure intra- or interlingual semantic similarity. + +# 3 Method + +We propose using a paraphraseer to force-decode and estimate probabilities of MT system outputs, conditioned on their corresponding human references. Let $p(y_{t}|y_{i < t},x)$ be the probability our paraphraseer assigns to the $t^{\text{th}}$ token in output sequence $y$ , given the previous output tokens $y_{i < t}$ and the input sequence $x$ . Table 1 shows an example of how token-level probabilities from our model (described in §4) penalize both fluency and adequacy errors given a human reference. We consider two ways of combining token-level probabilities from the model—sequence-level log probability $(G)$ and average token-level log probability $(H)$ : + +$$ +G (y | x) = \sum_ {t = 1} ^ {| y |} \log p \left(y _ {t} \mid y _ {i < t}, x\right) +$$ + +$$ +H (y | x) = \frac {1}{| y |} G (y | x) +$$ + +Let sys denote an MT system output, ref denote a human reference, and src denote the source. We expect scoring sys conditioned on ref to be most indicative of the quality of sys. However, we also explore scoring ref conditioned on sys as we find qualitatively that output sentences which drop some + +meaning conveyed by the input sentence are penalized less harshly by the model than output sentences which contain extra information not present in the input. Scoring in both directions to penalize the presence of information in one sentence but not the other is similar, in spirit, to methods which use bi-directional textual entailment as an MT metric (Padó et al., 2009; Khobragade et al., 2019).4 + +We postulate that the output sentence that best represents the meaning of an input sentence is, in fact, simply a copy of the input sentence, as precise word order and choice often convey subtle connotations. As such, we seek a model whose output distribution is centered around a copy of the input sentence, which we denote a "lexically/syntactically unbiased paraphraseer." While a standard generative paraphraseer is trained to retain semantic meaning, it does not meet our criteria because it is simultaneously trained to produce output which is lexically/syntactically different than its input, a key element in generative paraphrasing (Bhagat and Hovy, 2013). + +We propose using a multilingual NMT system as a lexically/syntactically unbiased paraphraseer. A multilingual NMT system consists of an encoder which maps a sentence in to an (ideally) language-agnostic semantic representation, and decoder to map that representation back to a sentence. The model has only seen bitext in training, but we propose to treat paraphrasing as a zero-shot "translation" (e.g., Czech to Czech). + +Because our model is multilingual, we can also score MT system output conditioned on the source sentence instead of the human reference. This task is known as "quality estimation (QE) as a metric," and was part of the WMT19 QE shared task (Fonseca et al., 2019). We use "Prism-ref" to denote our reference-based metric and "Prism-src" to denote our system applied as a QE metric. + +Our final metric and QE metric are defined based on results on our development set (see §5.2) as follows: + +$$ +\operatorname {P r i s m - r e f} = \frac {1}{2} H (\text {s y s} | \text {r e f}) + \frac {1}{2} H (\text {r e f} | \text {s y s}) +$$ + +$$ +\operatorname {P r i s m - s r c} = H (\text {s y s} | \text {s r c}) +$$ + +To obtain system-level scores, we average segmentlevel scores over all segments in the test set. + +# 4 Experiments + +We train a multilingual NMT model and explore the extent to which it functions as a lexically/syntactically unbiased paraphraseer. We then conduct several preliminary experiments on the WMT18 MT metrics data (Ma et al., 2018) to determine how to best utilize the token-level probabilities from the paraphraseer, and report results on the WMT19 system- and segment-level metric tasks (Ma et al., 2019) and QE as a metric task (Fonseca et al., 2019). + +# 4.1 Data Preparation + +Our method requires a model, which in turn relies heavily on the data on which it is trained, so we describe here the rationale behind the design decisions made regarding the training data. Full details sufficient for replication are provided in Appendix B. + +Language-Agnostic Representations To encourage our intermediate representation to be as language-agnostic as possible, we choose datasets with as much language pair diversity as possible (i.e., not just en-\* and $*$ -en), as Kudugunta et al. (2019) has shown that encoder representation is affected by both the source language and target language. While it is common to append the target language token to the source sentence, we insteadptides it to the target sentence so that the encoder cannot do anything target-language specific with this tag. At test time, we force-decode the desired language tag prior to scoring. + +Noise NMT systems are known to be sensitive to noise, including sentence alignment errors (Khayrallah and Koehn, 2018), so we perform filtering with LASER (Schwenk, 2018; Chaudhary et al., 2019). We also perform language ID filtering using FastText (Joulin et al., 2016) to avoid training the decoder with incorrect language tags. + +Number of Languages Aharoni et al. (2019) found that performance of zero-shot translation in a related language pair increased substantially when increasing the number of languages from 5 languages and 25, with a performance plateau somewhere between 25 and 50 languages. We view paraphrasing as zero-shot translation between sentences in the same language, so we expect to need a similar number of languages. + +Copies We filter sentence pairs with excessive copies and partial copies, as multiple studies (Ott et al., 2018; Khayrallah and Koehn, 2018) have noted that MT performance degrades substantially when systems are exposed to copies in training. + +# 4.2 Model Training + +We train a Transformer (Vaswani et al., 2017) model with approximately 745M parameters to translate between 39 languages. The full list of languages and data amounts used is provided in Appendix B, and model training details sufficient for replication are given in Appendix C. Training a single large model consumed the majority of our compute budget, thus performing ablations is beyond the scope of this work. + +Our data comes primarily from WikiMatrix (Schwenk et al., 2019), Global Voices, EuroParl (Koehn, 2005), SETimes, and United Nations (Eisele and Chen, 2010). The data processing described above and in Appendix B results in 99.8M sentence pairs in 39 languages. The most common language is English, at $16.7\%$ of our data, while the least common 20 languages account for $21.9\%$ . + +# 4.3 Baselines and Contrastive Methods + +We compare to all systems from the WMT19 shared metrics task, as well as BERTscore (Zhang et al., 2020) and the recent BLEURT method (Sellam et al., 2020). We also explore several contrastive methods. Training details sufficient for replication for each model/baseline are given in Appendix C. + +Generative Sentential Paraphraser We compare scoring with our Prism model vs a standard, English-only paraphraseer trained on the ParaBank 2 dataset (Hu et al., 2019c). ParaBank 2 contains $\sim 50\mathrm{M}$ synthetic paraphrastic pairs derived from back-translating a Czech-English corpus, and the authors report state-of-the-art paraphrasing results. + +Auto-encoder Auto-encoders provide an alternative means of training seq2seq models, without the need for parallel bitext. We compare to scoring with the "multilingual denoising pre-trained model" (mBART) of Liu et al. (2020), as it works in all languages of interest. + +LASER We explore using the cosine distance between LASER embeddings of the MT output and human reference, using the pretrained 93-language model provided by the authors. We are particularly interested in LASER as it, like our model, is trained on parallel bitext in many languages. + +Language Model We find qualitatively that LASER is fairly insensitive to disfluencies (see Table 1), so we also explore augmenting it with language model (LM) scores of the system outputs. We train a multilingual language model (see Appendix C) on the same data as our multilingual NMT system. + +# 4.4 Paraphraser Bias + +We expect that a lexically/syntactically unbiased measure of translation quality should (on average) increase with increased lexical similarity between a translation and reference. To explore the extent to which Prism and the model trained on ParaBank 2 are biased, we consider average $H(\mathrm{sys|ref})$ as a function of binned lexical similarity (approximated by sentBLEU, with smoothing=1) for all (sys, ref) pairs for all systems submitted to WMT19 in all language pairs into English. We also contrast the conditional probabilities of three outputs for the same input: (1) the sequence generated by the model via beam search; (2) a copy of the input; and (3) a human paraphrase of the input. Finally, we generate from the model using beam search and examine the outputs to see how much they differ from the inputs. + +# 4.5 MT Metrics Evaluation + +We report results and statistical significance using scripts released with the WMT19 shared task. Segment-level performance is reported as the Kendall's $\tau$ variant used in the shared task, and system-level performance is reported as Pearson correlation with the mean of the human judgments. Bootstrap resampling (Koehn, 2004; Graham et al., 2014) is used to estimate confidence intervals for each metric, and metrics with non-overlapping $95\%$ confidence intervals are identified as having a statistically significant difference in performance. + +![](images/41758a98ac3db0ccdcc1de059d991ba3c9036e5b9a67784c72a4fd380ee64d14.jpg) +Figure 2: Average $H(\text{sys|ref})$ as a function of average lexical difference (as measured by sentBLEU) for every English (sys, ref) pair submitted to WMT19, for both the Prism and ParaBank 2 paraphraseers. (sys, ref) pairs are split into 10 sentBLEU bins of uniform width. Fraction of total data in each bin is shown on x-axis (in parentheses). + +
en-csen-deen-fien-guen-kken-lten-ruen-zhde-csde-frfr-de
BERTSCORE (Zhang et al., 2020)0.4850.3450.5240.5580.5330.4630.5800.3470.3520.3250.274
EED‡ (Stanchev et al., 2019)0.4310.3150.5080.5680.5180.4250.5460.2570.3450.3010.267
Y1S1-1‡ (Lo, 2019)0.4750.3510.5370.5510.5460.4700.5850.3550.3760.3490.310
Y1S1-1_SRL‡ (Lo, 2019)-0.368-----0.361--0.299
Prism-ref (This Work)0.5820.4270.5910.3130.5310.5580.5840.3760.4580.4530.426
LASER + LM (Contrastive)0.5350.4010.5680.3060.4080.5030.6400.3560.4310.4010.381
mBART (Contrastive)0.3450.3020.4010.5280.4620.3650.4430.2800.2620.2550.236
de-enfi-engu-enkk-enlt-enru-enzh-en
BERTSCORE (Zhang et al., 2020)0.1760.3450.3200.4320.3810.2230.430
BLEURT (Sellam et al., 2020)0.2040.3670.3110.4470.3870.2280.423
ESIM‡ (Chen et al., 2017; Mathur et al., 2019)0.1670.3370.3030.4350.3590.2010.396
Y1S1-1‡ (Lo, 2019)0.1640.3470.3120.4400.3760.2170.426
Y1S1-1_SRL‡ (Lo, 2019)0.1990.3460.3060.4420.3800.2220.431
Prism-ref (This Work)0.2040.3570.3130.4340.3820.2250.438
Prism-ref w/ ParaBank 2 (Contrastive)0.1840.3410.3260.4250.3730.2070.432
LASER + LM (Contrastive)0.1900.3350.3190.4280.3680.2070.416
mBART (Contrastive)0.1360.2550.2460.3770.2980.1620.349
+ +Table 2: WMT19 segment-level human correlation (τ), to non-English (top) and to English (bottom). Bold denotes top scoring method and any other methods with whose 95% confidence interval overlaps with that of a top method. ‡:WMT19 Metric Submission. For brevity, only competitive baselines are shown. For complete results see Appendix E. Our models were not trained on Gujarati (gu). “LASER + LM” denotes the optimal linear combination found on the development set. + +# 5 Results + +# 5.1 Paraphraser Bias Results + +We find $H(\mathrm{sys|ref})$ increases monotonically with sentBLEU for the Prism model, but the model trained on ParaBank 2 has nearly the same scores for output with sentBLEU in the range of 60 to 100; however that range accounts for only about $8.5\%$ of all system outputs (see Figure 2). We find that a copy of the input is almost as probable as beam search output for the Prism model. In contrast, the + +model trained on ParaBank 2 prefers its own beam search output to a copy of the input. Additionally, beam search from our model produces output which is more lexically similar to the input (BLEU of 82.8 with respect to input, vs 31.9 for ParaBank 2). ParaBank 2 tends to change the output in ways which occasionally significantly alter the meaning of the sentence. See Appendix A for more details. All of these findings support our hypothesis that our model is closer to an ideal lexically/syntactically unbiased paraphraseer than the contrastive model trained on synthetic paraphrases. + +# 5.2 Preliminary (Development) Results + +We find that length-normalized log probability $(H)$ slightly outperforms un-normalized log probability $(G)$ . When using the reference, we find an equal weighting of $H(\mathrm{sys}|\mathrm{ref})$ and $H(\mathrm{ref}|\mathrm{sys})$ to be approximately optimal, but we find that when using the source, $H(\mathrm{src}|\mathrm{sys})$ does not appear to add useful information to $H(\mathrm{sys}|\mathrm{src})$ . Full results can be found in Appendix D. These findings were used to select the Prism-ref and Prism-src definitions (§3). + +We find that the probability of sys as estimated by an LM, as well as and the cosine distance between LASER embeddings of sys and ref, both have decent correlation with human judgments and are complementary. However, cosine distance between LASER embeddings of sys and src have only weak correlation. + +# 5.3 Segment-Level Metric Results + +Segment-level metric results are shown in Table 2. On language pairs into non-English, we outperform prior work by a statistically significant margin in 7 of 11 language pairs and are statistically tied for best in the rest, with the exception of Gujarati (gu) where the model had no training data. Into English, our metric is statistically tied with the best prior work in every language pair. Our metric tends to significantly outperform our contrastive LASER + LM and mBART methods, although LASER + LM performs surprisingly well in en-ru. + +# 5.4 System-Level Metric Results + +Table 3 shows system-level metric performance on the top four systems submitted to WMT19 compared to selected metrics. While correlations are not high in all cases for Prism, they are at least all positive. In contrast, BLEU has negative correlation in 5 language pairs, and BERTscore and YiSi-1 variants are each negative in at least two. BLEURT has positive correlations in all language pairs into English, but is English-only. Note that Pearson's correlation coefficient may be unstable in this setting (Mathur et al., 2020). For full top four system-level results see Appendix F. + +We do not find the system-level results computed against all submitted MT systems (see Appendix G) to be particularly interesting; as noted by Ma et al. (2019), a single weak system can result in high + +overall system-level correlation even for a very poor metric. + +# 5.5 QE as a Metric Results + +We find that our reference-less Prism-src outperforms all QE as a metrics systems from the WMT19 shared task by a statistically significant margin, in every language pair at segment-level human correlation (Table 4), and outperforms or statistically ties at system-level human correlation (Appendix G). + +# 6 Analysis and Discussion + +How helpful are human references? The fact that our model is multilingual allows us to explore the extent to which the human reference actually improves our model's ability to judge MT system output, compared to using the source instead. The underlying assumption with any MT metric is that the work done by the human translator makes it easier to automatically judge the quality of MT output. However, if our model or the MT systems being judged were strong enough, we would expect this assumption to break down. + +Comparing the performance of our method with access to the human reference (Prism-ref) vs our method with access to only the source (Prism-src), we find that the reference-based method statistically outperforms the source-based method in all but one language pair. We find the case where they are not statistically different, de-cs, to be particularly interesting: de-cs was the only language pair in WMT19 where the systems were unsupervised (i.e., did not use parallel training data). As a result, it is the only language pair where our model outperformed the best WMT system at translation. In most cases, our model is substantially worse at translation than the best WMT systems. For example, in en-de and zh-en, two language pairs where strong NMT systems were especially problematic for MT metrics, the Prism model is 6.8 and 19.2 BLEU points behind the strongest WMT systems, respectively (see Table 5 for the Prism model compared to the best system submitted in each WMT19 language pair). Thus the performance difference between Prism-ref and Prism-src would suggest that the model needs no help in judging MT systems which are weaker than it is, but the human references are assisting our model in evaluating MT systems which are stronger than it is. This means that we have not simply reduced the task of MT evaluation to that of building a state-of-the-art MT + +
en-csen-deen-fien-guen-kken-lten-ruen-zhde-csde-frfr-de
BERTSCORE (Zhang et al., 2020)0.868-0.7220.8590.9220.2880.9550.9530.9820.9760.7070.973
BLEU† (Papineni et al., 2002)0.930-0.3700.8980.8600.1810.9250.7530.9870.8120.4950.983
Y1SI-1‡ (Lo, 2019)0.847-0.2200.9760.9170.3420.8380.9630.9900.9670.6770.967
Y1SI-1_SRL‡ (Lo, 2019)--0.378-----0.994--0.974
Prism-ref (This Work)0.9520.2780.8860.8630.6930.8620.9750.9660.9680.6480.998
LASER + LM (Contrastive)0.9610.3770.9030.5090.6050.7430.9620.9850.9470.7740.975
mBART (Contrastive)0.936-0.8340.9660.9120.2240.9460.9680.9860.9640.9440.874
+ +
de-enfi-engu-enkk-enlt-enru-enzh-en
BERTSCORE (Zhang et al., 2020)0.2720.6830.9130.8970.7530.456-0.220
BLEU† (Papineni et al., 2002)-0.822-0.2750.9660.9580.625-0.356-0.694
BLEURT (Sellam et al., 2020)0.9530.7140.8810.9290.8410.5220.660
Y1SI-1‡ (Lo, 2019)0.0450.6100.9620.8870.5520.365-0.067
Y1SI-1_SRL‡ (Lo, 2019)0.0810.5800.9590.8740.5600.342-0.069
Prism-ref (This Work)0.4010.7190.8960.7960.8770.4310.523
LASER + LM (Contrastive)0.9570.7680.8670.8700.6150.5960.733
mBART (Contrastive)-0.7390.5590.9130.9020.491-0.103-0.295
+ +Table 3: WMT19 system-level human correlation (Pearson), for top 4 systems only, to non-English (top) and to English (bottom), for selected metrics. Negative correlations with human judgments shown in red for emphasis. †:WMT19 Baseline ‡:WMT19 Metric Submission. “LASER + LM” denotes the optimal linear combination found on the development set. Our models were not trained on Gujarati (gu). + +
en-csen-deen-fien-guen-kken-lten-ruen-zhde-csde-frfr-de
Best WMT19 QE as Metric0.069a0.236b0.351c0.147a0.187a0.003a0.226c0.044a0.199a0.186a0.066a
Prism-src (This work)0.4700.4020.5550.2150.5070.4990.4860.2870.4440.3710.316
de-enfi-engu-enkk-enlt-enru-enzh-en
Best WMT19 QE as Metric0.068a,b0.211d-0.001a0.096a0.075a0.089d0.253a
Prism-src (This work)0.1090.3000.1020.3910.3560.1780.336
+ +Table 4: WMT19 segment-level human correlation $(\tau)$ for QE as Metric systems (which have access to the source only, not the reference). Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. Our models were not trained on Gujarati (gu). For brevity, only the best QE-metric for each language pair is shown—for full results see Appendix G. a:YISI-2 (Lo, 2019) b:YISI-2_SRL (Lo, 2019) c:UNI (Yankovskaya et al., 2019) d:UNI+ (Yankovskaya et al., 2019). + +system. We see that a good (but not state-of-the-art) multilingual NMT system can be a state-of-the-art MT metric and judge state-of-the-art MT systems. + +Finally, with the exception of de-cs discussed above, we see statistically significant improvements for Prism-ref over Prism-src both into English (where human judgments were reference-based) and into non-English (where human judgments were source-based). This suggests that the high correlation of Prism-ref with human judgements is not simply the result of reference bias (Fomicheva and Specia, 2016). + +Does paraphraseer bias matter? Our lexically/syntactically unbiased paraphraseer tends to outperforms the generative English-only ParaBank 2 paraphraseer, but usually not by a statistically significant margin. Analysis indicate the lexi + +cal/syntactic bias is only harmful in somewhat infrequent cases where MT systems match or nearly match the reference, suggesting it would be more detrimental with stronger systems or multiple references. Our multilingual training method is much simpler than the alternative of creating synthetic paraphrases and training individual models in 39 languages, and our model may benefit from transfer learning to lower-resource languages. + +Does fluency matter? Despite NMT being very fluent, our results suggest that fluency is fairly discriminative, especially in non-English: LM scoring outperforms sentenceBLEU at segment-level correlation in 7/10 language pairs to non-English languages (excluding Gujarati), for example. This is consistent with recent findings that LM scores can be used to augment BLEU (Edunov et al., 2020). + +
Lang PairWMT19 BestBLEU MultilingualΔ
de-CS20.1†21.8+1.7
de-en42.835.5-7.3
de-fr37.333.9-3.4
en-CS29.924.2-5.7
en-de44.938.1-6.8
en-fi27.421.9-5.5
en-gu28.20.0‡-28.2
en-kk11.18.6-2.5
en-lt20.115.0-5.1
en-ru36.328.1-8.2
en-zh44.630.1-14.5
fi-en33.026.2-6.8
fr-de35.026.4-8.6
gu-en24.90.4‡-24.5
kk-en30.527.7-2.8
lt-en36.328.5-7.8
ru-en40.136.1-4.0
zh-en39.920.6-19.3
+ +Table 5: BLEU scores for our multilingual NMT system on WMT19 testsets, compared to best system from WMT19. Our multilingual system achieves state-of-the-art performance as an MT metric despite substantially under performing all the best WMT19 MT systems at translation (excluding unsupervised). †: WMT systems were unsupervised (no parallel data). ‡: Multilingual system did not train on Gujarati (gu). Systems are not trained on the same data, so this should not be interpreted as a comparison between multilingual and single-language pair MT. ISO 639-1 language codes. + +Can we measure adequacy and fluency separately? The proposed method significantly outperforms the contrastive LASER-based method in most language pairs, even when LASER is augmented with a language model. This suggests that jointly optimizing a model for adequacy and fluency is better than optimizing them independently and combining after the fact—this is unsurprising given that neural MT has shown significant improvements over statistical MT, where a phrase table and language model were trained separately. + +Can we train on monolingual data instead of bitext? The proposed method significantly outperforms scoring with the mBART auto-encoder, which is trained on large amounts of monolingual data, despite using substantially less compute power (1.3 weeks on 8 V100s for Prism vs 2.5 weeks on 256 V100s for mBART). + +# 7 Conclusion and Future Work + +We show that a multilingual NMT system can be used as a lexically/syntactically unbiased, multilingual paraphraseer, and that the resulting paraphraseer can be used as an MT metric and QE metric. Our method achieves state-of-the-art performance on the most recent WMT shared metrics and QE tasks, without training on prior human judgements. + +We release a single model which supports 39 languages. To the best of our knowledge, we are the first to release a large multilingual NMT system, and we hope others follow suit. We are optimistic our method will improve further as stronger multilingual NMT models become publicly available. + +We compare our method to several contrastive methods and present analysis showing that we have not simply reduced the task of evaluation to that of building a state-of-the-art MT system; the work done by the human translator to create references helps the evaluation model to judge systems that are stronger (at translation) than it is. + +Nothing in our method is specific to sentence-level MT. In future work, we would like to extend Prism to paragraph- or document-level evaluation by training a paragraph- or document-level multilingual NMT system, as there is growing evidence that MT evaluation would be better conducted at the document level, rather than the sentence level (Läubli et al., 2018). + +# Acknowledgments + +Brian Thompson is supported by the National Defense Science and Engineering Graduate (NDSEG) Fellowship. + +# References + +Roee Aharoni, Melvin Johnson, and Orhan First. 2019. Massively multilingual neural machine translation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 3874-3884, Minneapolis, Minnesota. Association for Computational Linguistics. +Naveen Arivazhagan, Ankur Bapna, Orhan First, Dmitry Lepikhin, Melvin Johnson, Maxim Krikun, Mia Xu Chen, Yuan Cao, George Foster, Colin Cherry, Wolfgang Macherey, Zhifeng Chen, and Yonghui Wu. 2019. Massively multilingual neural machine translation in the wild: Findings and challenges. arXiv preprint arXiv:1907.05019. + +Mikel Artetxe and Holger Schwenk. 2018. Massively multilingual sentence embeddings for zero-shot cross-lingual transfer and beyond. arXiv preprint arXiv:1812.10464. +Satanjeev Banerjee and Alon Lavie. 2005. METEOR: An automatic metric for MT evaluation with improved correlation with human judgments. In Proceedings of the ACL Workshop on Intrinsic and Extrinsic Evaluation Measures for Machine Translation and/or Summarization, pages 65-72, Ann Arbor, Michigan. Association for Computational Linguistics. +Colin Bannard and Chris Callison-Burch. 2005. Paraphrasing with bilingual parallel corpora. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL'05), pages 597-604, Ann Arbor, Michigan. Association for Computational Linguistics. +Rahul Bhagat and Eduard Hovy. 2013. Squibs: What is a paraphrase? Computational Linguistics, 39(3):463-472. +Ondrej Bojar, Rajen Chatterjee, Christian Federmann, Yvette Graham, Barry Haddow, Shujian Huang, Matthias Huck, Philipp Koehn, Qun Liu, Varvara Logacheva, Christof Monz, Matteo Negri, Matt Post, Raphael Rubino, Lucia Specia, and Marco Turchi. 2017. Findings of the 2017 conference on machine translation (WMT17). In Proceedings of the Second Conference on Machine Translation, pages 169-214, Copenhagen, Denmark. Association for Computational Linguistics. +Vishrav Chaudhary, Yuqing Tang, Francisco Guzmán, Holger Schwenk, and Philipp Koehn. 2019. Low-resource corpus filtering using multilingual sentence embeddings. In Proceedings of the Fourth Conference on Machine Translation (Volume 3: Shared Task Papers, Day 2), pages 261-266, Florence, Italy. Association for Computational Linguistics. +Qian Chen, Xiaodan Zhu, Zhen-Hua Ling, Si Wei, Hui Jiang, and Diana Inkpen. 2017. Enhanced LSTM for natural language inference. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1657-1668, Vancouver, Canada. Association for Computational Linguistics. +Julian Chow, Lucia Specia, and Pranava Madhyastha. 2019. WMDO: Fluency-based word mover's distance for machine translation evaluation. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 494-500, Florence, Italy. Association for Computational Linguistics. +William Coster and David Kauchak. 2011. Simple English Wikipedia: A new text simplification task. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 665-669, Portland, Ore + +gon, USA. Association for Computational Linguistics. +Michael Denkowski and Alon Lavie. 2010. Extending the METEOR machine translation evaluation metric to the phrase level. In Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pages 250-253, Los Angeles, California. 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. +George Doddington. 2002. Automatic evaluation of machine translation quality using n-gram cooccurrence statistics. In Proceedings of the second international conference on Human Language Technology Research, pages 138-145. +Daxiang Dong, Hua Wu, Wei He, Dianhai Yu, and Haifeng Wang. 2015. Multi-task learning for multiple language translation. 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 1723-1732, Beijing, China. Association for Computational Linguistics. +Markus Dreyer and Daniel Marcu. 2012. HyTER: Meaning-equivalent semantics for translation evaluation. In Proceedings of the 2012 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 162-171, Montréal, Canada. Association for Computational Linguistics. +Melania Duma and Wolfgang Menzel. 2017. UHH submission to the WMT17 metrics shared task. In Proceedings of the Second Conference on Machine Translation, pages 582-588, Copenhagen, Denmark. Association for Computational Linguistics. +Sergey Edunov, Myle Ott, Marc'Aurelio Ranzato, and Michael Auli. 2020. On the evaluation of machine translation systems trained with back-translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2836-2846, Online. Association for Computational Linguistics. +Andreas Eisele and Yu Chen. 2010. Multiun: A multilingual corpus from united nation documents. In LREC. +Anthony Fader, Luke Zettlemoyer, and Oren Etzioni. 2013. Paraphrase-driven learning for open question + +answering. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1608-1618, Sofia, Bulgaria. Association for Computational Linguistics. +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. +Marina Fomicheva and Lucia Specia. 2016. Reference bias in monolingual machine translation evaluation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 77-82, Berlin, Germany. Association for Computational Linguistics. +Erick Fonseca, Lisa Yankovskaya, André F. T. Martins, Mark Fishel, and Christian Federmann. 2019. Findings of the WMT 2019 shared tasks on quality estimation. In Proceedings of the Fourth Conference on Machine Translation (Volume 3: Shared Task Papers, Day 2), pages 1-10, Florence, Italy. Association for Computational Linguistics. +Juri Ganitkevitch and Chris Callison-Burch. 2014. The multilingual paraphrase database. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC-2014), pages 4276-4283, Reykjavik, Iceland. European Languages Resources Association (ELRA). +Juri Ganitkevitch, Benjamin Van Durme, and Chris Callison-Burch. 2013. PPDB: The paraphrase database. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 758-764, Atlanta, Georgia. Association for Computational Linguistics. +Yvette Graham, Nitika Mathur, and Timothy Baldwin. 2014. Randomized significance tests in machine translation. In Proceedings of the Ninth Workshop on Statistical Machine Translation, pages 266-274, Baltimore, Maryland, USA. Association for Computational Linguistics. +Jiatao Gu, Hany Hassan, Jacob Devlin, and Victor O.K. Li. 2018. Universal neural machine translation for extremely low resource languages. 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 344-354, New Orleans, Louisiana. Association for Computational Linguistics. +Yinuo Guo and Junfeng Hu. 2019. Meteor++ 2.0: Adopt syntactic level paraphrase knowledge into machine translation evaluation. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 501-506, Florence, Italy. Association for Computational Linguistics. + +Rohit Gupta, Constantin Orasan, and Josef van Genabith. 2015. ReVal: A simple and effective machine translation evaluation metric based on recurrent neural networks. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1066-1072, Lisbon, Portugal. Association for Computational Linguistics. +Aaron L.-F Han, Derek Wong, Lidia Chao, Liangye He, Yi Lu, Junwen Xing, and Xiaodong Zeng. 2013. Mt summit13.language-independent model for machine translation evaluation with reinforced factors. +Aaron L. F. Han, Derek F. Wong, and Lidia S. Chao. 2012. LEPOR: A robust evaluation metric for machine translation with augmented factors. In Proceedings of COLING 2012: Posters, pages 441-450, Mumbai, India. The COLING 2012 Organizing Committee. +Hany Hassan, Anthony Aue, Chang Chen, Vishal Chowdhary, Jonathan Clark, Christian Federmann, Xuedong Huang, Marcin Junczys-Dowmunt, William Lewis, Mu Li, Shujie Liu, Tie-Yan Liu, Renqian Luo, Arul Menezes, Tao Qin, Frank Seide, Xu Tan, Fei Tian, Lijun Wu, Shuangzhi Wu, Yingce Xia, Dongdong Zhang, Zhirui Zhang, and Ming Zhou. 2018. Achieving human parity on automatic chinese to english news translation. CoRR, abs/1803.05567. +J. Edward Hu, Huda Khayrallah, Ryan Culkin, Patrick Xia, Tongfei Chen, Matt Post, and Benjamin Van Durme. 2019a. Improved lexically constrained decoding for translation and monolingual rewriting. 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 839-850, Minneapolis, Minnesota. Association for Computational Linguistics. +J. Edward Hu, Rachel Rudinger, Matt Post, and Benjamin Van Durme. 2019b. ParaBank: Monolingual bitext generation and sentential paraphrasing via lexically-constrained neural machine translation. In Proceedings of AAAI. +J. Edward Hu, Abhinav Singh, Nils Holzenberger, Matt Post, and Benjamin Van Durme. 2019c. Large-scale, diverse, paraphrastic bittexts via sampling and clustering. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 44-54, Hong Kong, China. Association for Computational Linguistics. +Yanping Huang, Youlong Cheng, Ankur Bapna, Orhan Firat, Dehao Chen, Mia Chen, HyoukJoong Lee, Ji-quan Ngiam, Quoc V Le, Yonghui Wu, and zhifeng Chen. 2019. Gpipe: Efficient training of giant neural networks using pipeline parallelism. 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 103-112. Curran Associates, Inc. + +Julia Ive, Frédéric Blain, and Lucia Specia. 2018. deepQuest: A framework for neural-based quality estimation. In Proceedings of the 27th International Conference on Computational Linguistics, pages 3146-3157, Santa Fe, New Mexico, USA. Association for Computational Linguistics. +Melvin Johnson, Mike Schuster, Quoc V. Le, Maxim Krikun, Yonghui Wu, Zhifeng Chen, Nikhil Thorat, Fernanda Viégas, Martin Wattenberg, Greg Corrado, Macduff Hughes, and Jeffrey Dean. 2017. Google's multilingual neural machine translation system: Enabling zero-shot translation. Transactions of the Association for Computational Linguistics, 5:339-351. +Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2016. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759. +Marcin Junczys-Dowmunt. 2018. Dual conditional cross-entropy filtering of noisy parallel corpora. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 888-895, Belgium, Brussels. Association for Computational Linguistics. +Huda Khayrallah and Philipp Koehn. 2018. On the impact of various types of noise on neural machine translation. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, pages 74-83, Melbourne, Australia. Association for Computational Linguistics. +Rakesh Khobragade, Heaven Patel, Anand Namdev, Anish Mishra, and Pushpak Bhattacharyya. 2019. Machine translation evaluation using bi-directional entailment. +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. +Philipp Koehn. 2005. Europarl: A parallel corpus for statistical machine translation. In $MT$ summit, volume 5, pages 79-86. Citeseer. +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. +Sneha Kudugunta, Ankur Bapna, Isaac Caswell, and Orhan First. 2019. Investigating multilingual NMT representations at scale. 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 1565-1575, Hong Kong, China. Association for Computational Linguistics. + +Samuel Läubli, Rico Sennrich, and Martin Volk. 2018. Has machine translation achieved human parity? a case for document-level evaluation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4791-4796, Brussels, Belgium. Association for Computational Linguistics. +Gregor Leusch, Nicola Ueffing, and Hermann Ney. 2006. CDER: Efficient MT evaluation using block movements. In 11th Conference of the European Chapter of the Association for Computational Linguistics, Trento, Italy. Association for Computational Linguistics. +Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C. Lawrence Zitnick. 2014. Microsoft COCO: Common objects in context. In Computer Vision - ECCV 2014, pages 740-755, Cham. Springer International Publishing. +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. +Chi-kiu Lo. 2017. MEANT 2.0: Accurate semantic MT evaluation for any output language. In Proceedings of the Second Conference on Machine Translation, pages 589-597, Copenhagen, Denmark. Association for Computational Linguistics. +Chi-kiu Lo. 2019. YiSi - a unified semantic MT quality evaluation and estimation metric for languages with different levels of available resources. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 507-513, Florence, Italy. Association for Computational Linguistics. +Chi-kiu Lo and Dekai Wu. 2011. MEANT: An inexpensive, high-accuracy, semi-automatic metric for evaluating translation utility based on semantic roles. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 220–229, Portland, Oregon, USA. Association for Computational Linguistics. +Qingsong Ma, Ondrej Bojar, and Yvette Graham. 2018. Results of the WMT18 metrics shared task: Both characters and embeddings achieve good performance. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 671-688, Belgium, Brussels. Association for Computational Linguistics. +Qingsong Ma, Yvette Graham, Shugen Wang, and Qun Liu. 2017. Blend: a novel combined MT metric based on direct assessment — CASICT-DCU submission to WMT17 metrics task. In Proceedings of the Second Conference on Machine Translation, pages 598–603, Copenhagen, Denmark. Association for Computational Linguistics. + +Qingsong Ma, Johnny Wei, Ondrej Bojar, and Yvette Graham. 2019. Results of the WMT19 metrics shared task: Segment-level and strong MT systems pose big challenges. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 62-90, Florence, Italy. Association for Computational Linguistics. +Nitika Mathur, Timothy Baldwin, and Trevor Cohn. 2019. Putting evaluation in context: Contextual embeddings improve machine translation evaluation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2799-2808, Florence, Italy. Association for Computational Linguistics. +Nitika Mathur, Timothy Baldwin, and Trevor Cohn. 2020. Tangled up in BLEU: Reevaluating the evaluation of automatic machine translation evaluation metrics. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4984-4997, Online. Association for Computational Linguistics. +Graham Neubig and Junjie Hu. 2018. Rapid adaptation of neural machine translation to new languages. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 875-880, Brussels, Belgium. Association for Computational Linguistics. +Toan Q. Nguyen and David Chiang. 2017. Transfer learning across low-resource, related languages for neural machine translation. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 296-301, Taipei, Taiwan. Asian Federation of Natural Language Processing. +Myle Ott, Michael Auli, David Grangier, and Marc'Aurelio Ranzato. 2018. Analyzing uncertainty in neural machine translation. In International Conference on Machine Learning. +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 NAACL-HLT 2019: Demonstrations. +Sebastian Padó, Michel Galley, Dan Jurafsky, and Christopher D. Manning. 2009. Robust machine translation evaluation with entailment features. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP, pages 297-305, Suntec, Singapore. Association for Computational Linguistics. +Joybrata Panja and Sudip Kumar Naskar. 2018. ITER: Improving translation edit rate through estimizable edit costs. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 746-750, Belgium, Brussels. Association for Computational Linguistics. + +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pages 311-318, Philadelphia, Pennsylvania, USA. Association for Computational Linguistics. +Ngoc-Quan Pham, Jan Niehues, Thanh-Le Ha, and Alexander Waibel. 2019. Improving zero-shot translation with language-independent constraints. In Proceedings of the Fourth Conference on Machine Translation (Volume 1: Research Papers), pages 13-23, Florence, Italy. 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. +Maja Popovic. 2017. $\mathrm{chrF}++$ : words helping character n-grams. In Proceedings of the Second Conference on Machine Translation, pages 612-618, Copenhagen, Denmark. Association for Computational Linguistics. +Maja Popovic, David Vilar, Eleftherios Avramidis, and Aljoscha Burchardt. 2011. Evaluation without references: IBM1 scores as evaluation metrics. In Proceedings of the Sixth Workshop on Statistical Machine Translation, pages 99-103, Edinburgh, Scotland. Association for Computational Linguistics. +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. +Aaditya Prakash, Sadid A. Hasan, Kathy Lee, Vivek Datla, Ashequl Qadir, Joey Liu, and Oladimeji Farri. 2016. Neural paraphrase generation with stacked residual LSTM networks. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 2923-2934, Osaka, Japan. The COLING 2016 Organizing Committee. +Chris Quirk, Chris Brockett, and William Dolan. 2004. Monolingual machine translation for paraphrase generation. In Proceedings of the 2004 Conference on Empirical Methods in Natural Language Processing, pages 142-149, Barcelona, Spain. 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. +Alessandro Raganato, Raul Vázquez, Mathias Creutz, and Jörg Tiedemann. 2019. An evaluation of language-agnostic inner-attention-based representations in machine translation. In Proceedings of the + +4th Workshop on Representation Learning for NLP (RepL4NLP-2019), pages 27-32, Florence, Italy. Association for Computational Linguistics. +Holger Schwenk. 2018. Filtering and mining parallel data in a joint multilingual space. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 228-234, Melbourne, Australia. Association for Computational Linguistics. +Holger Schwenk, Vishrav Chaudhary, Shuo Sun, Hongyu Gong, and Francisco Guzmán. 2019. WikiMatrix: Mining 135m parallel sentences in 1620 language pairs from wikipedia. CoRR, abs/1907.05791. +Holger Schwenk and Matthijs Douze. 2017. Learning joint multilingual sentence representations with neural machine translation. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pages 157-167, 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. +Hiroki Shimanaka, Tomoyuki Kajiwara, and Mamoru Komachi. 2018. RUSE: Regressor using sentence embeddings for automatic machine translation evaluation. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 751-758, Belgium, Brussels. Association for Computational Linguistics. +Matthew Snover, Bonnie Dorr, Richard Schwartz, Linnea Micciulla, and John Makhoul. 2006. A study of translation edit rate with targeted human annotation. In Proceedings of association for machine translation in the Americas, volume 200. +Peter Stanchev, Weiyue Wang, and Hermann Ney. 2019. EED: Extended edit distance measure for machine translation. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 514-520, Florence, Italy. Association for Computational Linguistics. +Milos Stanojevic and Khalil Sima'an. 2015. BEER 1.1: ILLC UvA submission to metrics and tuning task. In Proceedings of the Tenth Workshop on Statistical Machine Translation, pages 396-401, Lisbon, Portugal. Association for Computational Linguistics. +Jörg Tiedemann and Yves Scherrer. 2019. Measuring semantic abstraction of multilingual NMT with paraphrase recognition and generation tasks. In Proceedings of the 3rd Workshop on Evaluating Vector Space Representations for NLP, pages 35-42, Minneapolis, USA. 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, pages 5998-6008. +Weiyue Wang, Jan-Thorsten Peter, Hendrik Rosendahl, and Hermann Ney. 2016. CharacTer: Translation edit rate on character level. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pages 505-510, Berlin, Germany. 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 (Volume 1: Long Papers), pages 451–462, Melbourne, Australia. Association for Computational Linguistics. +John Wieting, Kevin Gimpel, Graham Neubig, and Taylor Berg-Kirkpatrick. 2019. Simple and effective paraphrastic similarity from parallel translations. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4602-4608, Florence, Italy. Association for Computational Linguistics. +John Wieting, Jonathan Mallinson, and Kevin Gimpel. 2017. Learning paraphrastic sentence embeddings from back-translated bitext. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 274-285, Copenhagen, Denmark. Association for Computational Linguistics. +Elizaveta Yankovskaya, Andre Tattar, and Mark Fishel. 2019. Quality estimation and translation metrics via pre-trained word and sentence embeddings. In Proceedings of the Fourth Conference on Machine Translation (Volume 3: Shared Task Papers, Day 2), pages 101-105, Florence, Italy. Association for Computational Linguistics. +Ryoma Yoshimura, Hiroki Shimanaka, Yukio Matsumura, Hayahide Yamagishi, and Mamoru Komachi. 2019. Filtering pseudo-references by paraphrasing for automatic evaluation of machine translation. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 521-525, Florence, Italy. Association for Computational Linguistics. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. 2019. Bertscore: Evaluating text generation with bert. arXiv preprint arXiv:1904.09675. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2020. *Bertscore: Evaluating text generation with bert.* In International Conference on Learning Representations. + +Liang Zhou, Chin-Yew Lin, Dragos Stefan Munteanu, and Eduard Hovy. 2006. ParaEval: Using paraphrases to evaluate summaries automatically. In Proceedings of the Human Language Technology Conference of the NAACL, Main Conference, pages 447-454, New York City, USA. Association for Computational Linguistics. +Barret Zoph, Deniz Yuret, Jonathan May, and Kevin Knight. 2016. Transfer learning for low-resource neural machine translation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1568-1575, Austin, Texas. Association for Computational Linguistics. + +# A Generation Examples + +Figure 3 shows sentences generated from both our model and the model trained on ParaBank 2. + +We also contrast the conditional probabilities of three outputs for the same input: (1) the sequence generated by the model via beam search; (2) a copy of the input; and (3) a human paraphrase of the input. We use the English side of the zh-en newstest17 (Bojar et al., 2017) as input, so that we can use the second human reference released by Hassan et al. (2018) as a human paraphrase. Table 6 shows the results of scoring a copy of the input, a human paraphrase of the input, and a model's beam search output, for both our multilingual paraphraser and the ParaBank 2 model. + +
ParaBank 2This Work
H(BS|r0)-0.501-0.225
H(r0|r0)-1.157-0.303
H(r1|r0)-2.246-2.187
BLEU(BS,r0)31.982.8
+ +Table 6: Average token log probability $(H)$ for a sequence generated via beam search $(BS)$ , a copy of the input $(r0)$ , and a high-quality human paraphrase of the input $(r1)$ , for a generative paraphraser vs our model, conditioned on $r0$ in all cases. BLEU is also computed for the beam search output of each model, with respect to $r0$ . Note that BLEU for $r1$ with respect to $r0$ is 17.1. + +
REFERENCE28-Year-Old Chef Found Dead at San Francisco Mall
THIS WORK28-Year-Old Chef Found Dead at San Francisco Mall
PARABANK 228-year-old chef found dead in a mall in San Francisco
REFERENCEA 28-year-old chef who had recently moved to San Francisco was found dead in the stairwell of a local mall this week.
THIS WORKA 28-year-old chef who had recently moved to San Francisco was found dead in the stairwell of a local mall this week.
PARABANK 2Earlier this week, a 28-year-old chef who had recently moved to San Francisco was found dead on the steps of a local department store.
REFERENCEBut the victim's brother says he can't think of anyone who would want to hurt him, saying, "Things were finally going well for him."
THIS WORKBut the victim's brother says he can't think of anyone who would want to hurt him, saying, "Things were finally going well for him."
PARABANK 2But the victim's brother said he couldn't think of anyone who'd want to hurt him, and he said he was finally okay.
REFERENCEThe body found at the Westfield Mall Wednesday morning was identified as 28-year-old San Francisco resident Frank Galicia, the San Francisco Medical Examiner's Office said.
THIS WORKThe body found at the Westfield Mall Wednesday morning was identified as 28-year-old San Francisco resident Frank Galicia, the San Francisco Medical Examiner's Office said.
PARABANK 2The body found Wednesday morning at the Westfield Mall has been identified by the San Francisco Medical Examiner's Office as 28-year-old San Franscisco-resident Frank Galicia.
REFERENCEThe San Francisco Police Department said the death was ruled a homicide and an investigation is ongoing.
THIS WORKThe San Francisco Police Department said the death was deemed a homicide and an investigation is ongoing.
PARABANK 2The San Francisco P.D. says the death has been ruled a murder and is under investigation.
REFERENCEThe victim's brother, Louis Galicia, told ABC station KGO in San Francisco that Frank, previously a line cook in Boston, had landed his dream job as line chef at San Francisco's Sons & Daughters restaurant six months ago.
THIS WORKThe victim's brother, Louis Galicia, told ABC station KGO in San Francisco that Frank, formerly a line cook in Boston, had landed his dream job as line chef at San Francisco's Sons & Daughters restaurant six months ago.
PARABANK 2The Victim's brother, Louis Galicia, told ABC station KGO in San Francisco that Frank, who used to be a line chef in Boston, quit his dream job six months ago as a line chef at the Sons & Daughters Restaurant in San Francisco.
REFERENCEA spokesperson for Sons & Daughters said they were "shocked and devastated" by his death.
THIS WORKA spokesperson for Sons & Daughters said they were "shocked and devastated" by his death
PARABANK 2A spokesman for Sons & Daughters said that his death "shocked and devastated them."
REFERENCE"We are a small team that operates like a close knit family and he will be dearly missed," the spokesperson said.
THIS WORK"We are a small team that operates like a close-knit family and he will be dearly missed," the spokesman said.
PARABANK 2"We are a small team, operating as a close-knit family, and we will miss him dearly," said the spokesman.
REFERENCEOur thoughts and condolences are with Frank's family and friends at this difficult time.
THIS WORKOur thoughts and condolences are with Frank's family and friends at this difficult time.
PARABANK 2Our thoughts and condolences go out to Frank's family and friends in these difficult times.
REFERENCELouis Galicia said Frank initially stayed in hostels, but recently, "Things were finally going well for him."
THIS WORKLouis Galicia said Frank initially stayed in hostels, but recently, "Things were finally going well for him."
PARABANK 2Louis Galicia said that Frank initially stayed in the dormitory, but lately, "He's finally doing okay."
+ +Figure 3: Sentences generated via beam search (beamwidth 5) for the multilingual model presented in this work vs ParaBank 2. We note that our model tends to produce copies or near copies of the input, which is the desired behavior for our application. Changes are emphasized with bold or strikethrough. The model trained on ParaBank 2 tends to produce output with lexical/syntactic changes, which occasionally also significantly change the meaning of the sentence (denoted in red). References (paraphraser inputs) are the first ten sentences of WMT17 zh-en. + +# B Data Details for Replication + +Much of our data comes from WikiMatrix (Schwenk et al., 2019), a large collection of parallel data extracted from Wikipedia, and for more domain variety, we added Global Voices, $^{10}$ EuroParl (Koehn, 2005) (random subset of to 100k sentence pairs per language pair), SETimes, $^{11}$ United Nations (Eisele and Chen, 2010) (random sample of 1M sentence pairs per language pair). We also included WMT Kazakh-English and Kazakh-Russian data from WMT, to be able to evaluate on Kazakh. + +WMT Kazakh-English and Kazakh-Russian were limited to the best 1M and 200k sentence pairs, respectively, as judged by LASER. We used a margin threshold of 1.05 for WikiMatrix and a threshold of 1.04 for the remaining datasets, as we expect them to be cleaner. We find that FastText classifies many sentences as non-English when they contain mostly English but also contain a few non-English words, especially from lower resource languages. To remedy this, we performed language identification (LID) on 5-grams and filtered out sentences for which LID did not classify at least half of the 5-grams as the expected language. + +We filtered out sentences where there was more than $60\%$ overlap in 3-grams or $40\%$ overlap in 4-grams. Via manual inspection, this seemed to provide a good trade-off between allowing numbers and named entities to be copied, and filtering out sentences that were clearly not translated. We perform tokenization with SentencePiece (Kudo and Richardson, 2018) prior to filtering, using a 200k vocabulary for all language pairs, to account for languages like Chinese which do not denote word boundaries. Note that this vocabulary was used only for filtering, not for training the final model. + +We limited training to languages with at least 1M examples, which resulted in 39 languages. Figure 4 shows the languages and amount of data in each language. + +![](images/8e7fd8a46369fc0dbdc1bde2f2f715053bcb7ff3283c85bf735cc5cb156b23de.jpg) +Figure 4: Distribution of the 39 languages (ISO 639-1 language code) of the 99.8M training sentences. English accounts for $16.7\%$ . Spanish, French, Russian, Portuguese, German, and Italian account for a combined $34.3\%$ . The bottom 20 languages account for only $21.9\%$ combined. + +# C Model Training Details for Replication + +# C.1 Primary Model + +We train a SentencePiece (Kudo and Richardson, 2018) model with a 64k vocabulary size on the concatenation of all data, and filter sentences with length greater than 200 subwords. Multilingual NMT performance has been found to increase significantly with model size – tor example, the best performance of Huang et al. (2019) is with their largest model which has 6 billion parameters. Training such a model is well beyond the scope of this work, but we train a model as large a feasible given our compute budget constraints. We train a Transformer (Vaswani et al., 2017) in fairseq (Ott et al., 2019) with eight encoder layers, eight decoder layers, an embedding size of 1280, feed forward layer size of 12288, 20 attention heads, learning rate of 0.0004, batch size of 1800 tokens with gradient accumulation over 200 batches, gradient clipping of 1.2, and dropout of 0.1. The model has approximately 745M parameters for 39 languages. We train for 6 epochs, which takes approximately 9 days on a p3.16xlarge instance rented from Amazon AWS, which has 8 Volta V100 GPUs with 16 GB of memory each. No hyperparameters were swept, as training a single model used the majority of our compute budget (the total cost for training this model was approximately $13,000 USD). However, we did restart training after discovering that LID was not performing well and adding the 5-gram LID filtering. + +# C.2 ParaBank 2 Model + +We train a contrastive, English-only paraphraseer on the ParaBank 2 dataset (Hu et al., 2019c). We train a Transformer with an 8-layer encoder, 8-layer decoder, 1024 dimensional embeddings, embedding sizes of 1024, feed-forward size of 4096, and 16 attention heads. We use a SentencePiece model with a 16k vocabulary size. Dropout is 0.3, label smoothing is 0.1, and learning rate is 0.0005. The model has approximately 253M parameters for 1 language. Batch size is 31200 tokens, and the model trains for approximately 6 weeks (33 epochs) on 4 Nvidia 2080 GPUs. + +# C.3 Language Model + +We train a multilingual language model on the same data as our multilingual NMT system. + +The model architecture is based on GPT-2 (Radford et al., 2019), and we use the fairseq transformer_lm_gpt2_small implementation. We train for 200k updates (18 epochs) of approximately 131k tokens. The model has 369M parameters for 39 languages. We train with shared embeddings and a learning rate of 0.0005, and we stop gradients at sentence boundaries, using --sample-break-mode eos as the model will be used to evaluate individual sentences. Other parameters match the fairseq defaults. The model trained for approximately 4 weeks on 4 Nvidia Titan RTX GPUs. + +# C.4 Autoencoder + +We use the pretrained "multilingual denoising pre-trained model" (mBART) model of Liu et al. (2020), as it works in all languages of interest. Their model is designed to be fine-tuned to translation tasks, and their fine-tuning introduces subtle changes to the decoder that are required for inference. In order to adapt it to our task, we therefore fine-tune for a single update with a learning rate of 0. We then produce scores with the model in the same manner as Prism-ref. The model has approximately 680M parameters for 25 languages. We did not train this model but note that doing so required substantial compute power - Liu et al. (2020) note that they trained for approximately 2.5 weeks on 256 Nvidia V100 GPUS, each with 32GB of memory. + +# C.5 Baselines + +We compare to BLEURT (Sellam et al., 2020) using the authors' recommended "BLEURT-Base 128"12 We compare to BERTscore F1 (Zhang et al., 2020) using the model and code provided by the authors.13 + +# D WMT 2018 (Development set) Results: System-level, Segment-level, and Sweeps + +Figure 5 shows results on the development set (WMT18) for sweeping various linear combinations. + +Table 7, Table 8, Table 9 and Table 10, show full segment- and system- level results, into and out of English, for the WMT 2018 MT metrics shared task, along with all baselines and submitted systems. + +![](images/9d798570e0139b9ec618f9812affbbd1e6c0d40b31ea025735b334e9a821cf4d.jpg) +Figure 5: Linear combinations of scoring each direction using length-normalized $(H)$ vs un-normalized $(G)$ log probability for our method, and length-normalized language model probabilities $(H)$ vs LASER for our contrastive method. In both cases, we explore scoring using the human reference ref vs the source src. Results are segment-level $\tau$ on our development set (WMT18), averaged across all language pairs. + +```txt +w/ Reference (MT Metric): +(1 - $\alpha$ ) H(ref|sys) + $\alpha$ H(sys|ref) +(1 - $\alpha$ ) G(ref|sys) + $\alpha$ G(sys|ref) +(1 - $\alpha$ ) H(sys) + 10 $\alpha$ LASER(sys, ref) +w/o Reference (QE as Metric): +(1 - $\alpha$ ) H(src|sys) + $\alpha$ H(sys|src) +(1 - $\alpha$ ) G(src|sys) + $\alpha$ G(sys|src) +(1 - $\alpha$ ) H(sys) + 10 $\alpha$ LASER(sys, src) +``` + +
ncs-en 5110de-en 77811et-en 56721fi-en 15648ru-en 10404tr-en 8525zh-en 33357
\( BEER^{\ddagger}\) (Stanojevic and Sima'an, 2015)0.2950.4810.3410.2320.2880.2290.214
BERTSCORE (Zhang et al., 2019, 2020)0.4040.5500.3970.2960.3400.2920.253
\( BLEND^{\ddagger}\) (Ma et al., 2017)0.3220.4920.3540.2260.2900.2320.217
\(CHARACTER^{\ddagger}\) (Wang et al., 2016)0.2560.4500.2860.1850.2440.1720.202
\(CHRF^{\dagger}\) (Popović, 2015)0.2880.4790.3280.2290.2690.2100.208
\(CHRF+^{\dagger}\) (Popović, 2017)0.2880.4790.3320.2340.2790.2180.207
\(ITER^{\ddagger}\) (Panja and Naskar, 2018)0.1980.3960.2350.1280.139-0.0290.144
\(METEOR++^{\ddagger}\) (Shimanaka et al., 2018)0.2700.4570.3290.2070.2530.2040.179
\(RUSE^{\ddagger}\) (Shimanaka et al., 2018)0.3470.4980.3680.2730.3110.2590.218
\(SENTBLEU^{\dagger}\) (Papineni et al., 2002)0.2330.4150.2850.1540.2280.1450.178
\(UHH\_TSKM^{\ddagger}\) (Duma and Menzel, 2017)0.2740.4360.3000.1680.2350.1540.151
\(Y1SI-0^{\ddagger}\) (Lo, 2019)0.3010.4740.3300.2250.2940.2150.205
\(Y1SI-1^{\ddagger}\) (Lo, 2019)0.3190.4880.3510.2310.3000.2340.211
\(Y1SI-1\_SRL^{\ddagger}\) (Lo, 2019)0.3170.4830.3450.2370.3060.2330.209
Prism-ref (This Work)0.4230.5600.4090.3170.3660.3090.263
Prism-ref w/ ParaBank 2 (Contrastive)0.3860.5380.3990.3090.3400.2750.244
LASER + LM (Contrastive)0.3640.5260.3780.2650.3050.2570.243
Prism-src (This work)0.3550.5150.3700.2570.3080.2130.194
LM0.2850.4380.2850.1980.2800.1230.192
LASER0.3100.4940.3640.2320.2570.2480.207
mBART (Contrastive)0.2510.4550.3150.1990.2480.1960.181
+ +Table 7: WMT18 Segment-level results, to English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. We exclude BLEURT (Sellam et al., 2020) as it was directly trained on WMT18 judgements. $\dagger$ :WMT18 Baseline (Ma et al., 2018) $\ddagger$ :WMT18 Metric Submission (Ma et al., 2018) + +
nen-cs 5413en-de 19711en-et 32202en-fi 9809en-ru 22181en-tr 1358en-zh 28602
\( BEER^‡ \) (Stanojević and Sima’an, 2015)0.5180.6860.5580.5110.4030.3740.302
BERTSCORE (Zhang et al., 2019, 2020)0.5590.7270.5840.5380.4240.3890.364
\( BLEND^‡ \) (Ma et al., 2017)----0.394--
\(CHARACTER^‡ \) (Wang et al., 2016)0.4140.6040.4640.4030.3520.4040.313
\(CHRF^† \) (Popović, 2015)0.5160.6770.5720.5200.3830.4090.328
\(CHRF+^† \) (Popović, 2017)0.5130.6800.5730.5250.3920.4050.328
\(ITER^‡ \) (Panja and Naskar, 2018)0.3330.6100.3920.3110.2910.236-
\(SENTBLEU^† \) (Papineni et al., 2002)0.3890.6200.4140.3550.3300.2610.311
\(Y1SI-0^‡ \) (Lo, 2019)0.4710.6610.5310.4640.3940.3760.318
\(Y1SI-1^‡ \) (Lo, 2019)0.4960.6910.5460.5040.4070.4180.323
\(Y1SI-1\_SRL^‡ \) (Lo, 2019)-0.696----0.310
Prism-ref (This Work)0.6670.7990.7050.6670.4690.5740.371
LASER + LM (Contrastive)0.5870.7460.6280.6290.4500.5010.367
Prism-src (This work)0.5520.7320.6360.6260.4090.5050.298
LM0.4590.6550.4080.5110.3750.3310.221
LASER0.4800.6770.5850.5110.4020.4320.338
mBART (Contrastive)0.4040.5940.4050.4100.3560.3030.305
+ +Table 8: WMT18 Segment-level results, from English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. †:WMT18 Baseline (Ma et al., 2018) ‡:WMT18 Metric Submission (Ma et al., 2018) + +
ncs-en 5de-en 16et-en 14fi-en 9ru-en 8tr-en 5zh-en 14
\( BEER^‡ \)(Stanojević and Sima’an, 2015)0.9580.9940.9850.9910.9820.8700.976
\( BERTSCORE \)(Zhang et al., 2019, 2020)0.9900.9990.9900.9980.9350.4990.956
\( BLEND^‡ \)(Ma et al., 2017)0.9730.9910.9850.9940.9930.8010.976
\(BLEU^† \)(Papineni et al., 2002)0.9700.9710.9860.9730.9790.6570.978
\(CDER^† \)(Leusch et al., 2006)0.9720.9800.9900.9840.9800.6640.982
\(CHARACTER^‡ \)(Wang et al., 2016)0.9700.9930.9790.9890.9910.7820.950
\(CHRF^† \)(Popović, 2015)0.9660.9940.9810.9870.9900.4520.960
\(CHRF+^† \)(Popović, 2017)0.9660.9930.9810.9890.9900.1740.964
\(ITER^‡ \)(Panja and Naskar, 2018)0.9750.9900.9750.9960.9370.8610.980
\(METEOR++^‡ \)(Shimanaka et al., 2018)0.9450.9910.9780.9710.9950.8640.962
\(NIST^† \)(Doddington, 2002)0.9540.9840.9830.9750.9730.9700.968
\(PER^† \)0.9700.9850.9830.9930.9670.1590.931
\(RUSE^‡ \)(Shimanaka et al., 2018)0.9810.9970.9900.9910.9880.8530.981
\(TER^† \)(Snover et al., 2006)0.9500.9700.9900.9680.9700.5330.975
\(UHH\_TSKM^‡ \)(Duma and Menzel, 2017)0.9520.9800.9890.9820.9800.5470.981
\(WER^† \)0.9510.9610.9910.9610.9680.0410.975
\(YISI-0^‡ \)(Lo, 2019)0.9560.9940.9750.9780.9880.9540.957
\(YISI-1^‡ \)(Lo, 2019)0.9500.9920.9790.9730.9910.9580.951
\(YISI-1\_SRL^‡ \)(Lo, 2019)0.9650.9950.9810.9770.9920.8690.962
Prism-ref (This Work)0.9880.9950.9710.9980.9950.7300.989
Prism-ref w/ ParaBank 2 (Contrastive)0.9920.9890.9640.9980.9960.8960.986
LASER + LM (Contrastive)0.9880.9910.9650.9940.7450.2970.890
Prism-src (This work)0.9840.9910.9640.9870.9700.8960.958
LM0.9860.9700.9540.8980.9510.8910.972
LASER0.9780.9860.9530.9840.4890.9680.591
mBART (Contrastive)0.9550.9960.9870.9950.9810.7210.980
+ +Table 9: WMT18 System-level results, to English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. We exclude BLEURT (Sellam et al., 2020) as it was directly trained on WMT18 judgements. †:WMT18 Baseline (Ma et al., 2018)‡:WMT18 Metric Submission (Ma et al., 2018) + +
nen-cs 5en-de 16en-et 14en-fi 12en-ru 9en-tr 8en-zh 14
\( BEER^‡ \) (Stanojević and Sima’an, 2015)0.9920.9910.9800.9610.9880.9650.928
BERTSCORE (Zhang et al., 2019, 2020)0.9970.9890.9820.9720.9900.9080.967
\( BLEND^‡ \) (Ma et al., 2017)----0.988--
\(BLEU^† \) (Papineni et al., 2002)0.9950.9810.9750.9620.9830.8260.947
\(CDER^† \) (Leusch et al., 2006)0.9970.9860.9840.9640.9840.8610.961
\(CHARACTER^‡ \) (Wang et al., 2016)0.9930.9890.9560.9740.9830.8330.983
\(CHRF^† \) (Popović, 2015)0.9900.9900.9810.9690.9890.9480.944
\(CHRF+^† \) (Popović, 2017)0.9900.9890.9820.9700.9890.9430.943
\(ITER^‡ \) (Panja and Naskar, 2018)0.9150.9840.9810.9730.9750.865-
\(NIST^† \) (Doddington, 2002)0.9990.9860.9830.9490.9900.9020.950
\(PER^† \)0.9910.9810.9580.9060.9880.8590.964
\(TER^† \) (Snover et al., 2006)0.9970.9880.9810.9420.9870.8670.963
\(WER^† \)0.9970.9860.9810.9450.9850.8530.957
\(Y1SI-0^‡ \) (Lo, 2019)0.9730.9850.9680.9440.9900.9900.957
\(Y1SI-1^‡ \) (Lo, 2019)0.9870.9850.9790.9400.9920.9760.963
\(Y1SI-1\_SRL^‡ \) (Lo, 2019)-0.990----0.952
Prism-ref (This Work)0.9620.9870.9730.9760.9890.8940.977
LASER + LM (Contrastive)0.9530.9840.9800.9760.9840.9270.982
Prism-src (This work)0.8500.9840.9490.9640.9600.8640.940
LM0.8540.9850.8370.9380.9590.8300.859
LASER0.9950.9650.9370.9780.9930.8950.978
mBART (Contrastive)0.9850.9890.9770.9590.9870.9630.689
+ +Table 10: WMT18 System-level results, from English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT18 Baseline (Ma et al., 2018) $\ddagger$ :WMT18 Metric Submission (Ma et al., 2018) + +# E WMT 2019 Metric and QE as Metric Segment-Level Results + +Table 11, Table 12, and Table 13 show segment-level metrics (excluding QE as a metric) results, for language pairs into, out of, and not including English, for the WMT 2019 MT metrics shared task, along with all baselines and submitted systems. + +Table 14, Table 15, and Table 16 show segment-level QE as a metric results, for language pairs into, out of, and not including English, for the WMT 2019 MT metrics shared task, along with all baselines and submitted systems. + +
nde-en 85365fi-en 38307gu-en 31139kk-en 27094lt-en 21862ru-en 46172zh-en 31070
\( BEER^‡ \)(Stanojević and Sima’an, 2015)0.1280.2830.2600.4210.3150.1890.371
\( BERTR^‡ \)(Mathur et al., 2019)0.1420.3310.2910.4210.3530.1950.399
\( BERTSCORE \)(Zhang et al., 2019, 2020)0.1760.3450.3200.4320.3810.2230.430
\( BLEURT \)(Sellam et al., 2020)0.2040.3670.3110.4470.3870.2280.423
\(CHARACTER^‡ \)(Wang et al., 2016)0.1010.2530.1900.3400.2540.1550.337
\(CHRF^† \)(Popović, 2015)0.1220.2860.2560.3890.3010.1800.371
\(CHRF+^† \)(Popović, 2017)0.1250.2890.2570.3940.3030.1820.374
\(EED^‡ \)(Stanchev et al., 2019)0.1200.2810.2640.3920.2980.1760.376
\(ESIM^‡ \)(Chen et al., 2017; Mathur et al., 2019)0.1670.3370.3030.4350.3590.2010.396
\(HLEPORA\_BASELINE^‡ \)(Han et al., 2012, 2013)---0.372--0.339
\(METEOR++_2.0(SYNTAX)^‡ \)(Guo and Hu, 2019)0.0840.2740.2370.3950.2910.1560.370
\(METEOR++_2.0(SYNTAX+COPY)^‡ \)(Guo and Hu, 2019)0.0940.2730.2440.4020.2870.1630.367
\(PREP^‡ \)(Yoshimura et al., 2019)0.0300.1970.1920.3860.1930.1240.267
\(SENTBLEU^† \)(Papineni et al., 2002)0.0560.2330.1880.3770.2620.1250.323
\(WMDO^‡ \)(Chow et al., 2019)0.0960.2810.2600.4200.3000.1620.362
\(YISI-0^‡ \)(Lo, 2019)0.1170.2710.2630.4020.2890.1780.355
\(YISI-1^‡ \)(Lo, 2019)0.1640.3470.3120.4400.3760.2170.426
\(YISI-1\_SRL^‡ \)(Lo, 2019)0.1990.3460.3060.4420.3800.2220.431
Prism-ref (This Work)0.2040.3570.3130.4340.3820.2250.438
Prism-ref w/ ParaBank 2 (Contrastive)0.1840.3410.3260.4250.3730.2070.432
LASER + LM (Contrastive)0.1900.3350.3190.4280.3680.2070.416
LM0.0830.2530.1650.1200.2810.1300.210
LASER0.1510.3010.3050.4200.3250.1930.397
mBART (Contrastive)0.1360.2550.2460.3770.2980.1620.349
+ +Table 11: WMT19 Segment-level results, metrics (excludes QE as metric), to English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. †:WMT19 Baseline (Ma et al., 2019) ‡:WMT19 Metric Submission (Ma et al., 2019) + +
nen-cs 27178en-de 99840en-fi 31820en-gu 11355en-kk 18172en-lt 17401en-ru 24334en-zh 18658
\( BEER^‡ \)(Stanojević and Sima’an, 2015)0.4430.3160.5140.5370.5160.4410.5420.232
BERTSCORE (Zhang et al., 2019, 2020)0.4850.3450.5240.5580.5330.4630.5800.347
\( CHARACTER^‡ \)(Wang et al., 2016)0.3490.2640.4040.5000.3510.3110.4320.094
\( CHRF^† \)(Popović, 2015)0.4550.3260.5140.5340.4790.4460.5390.301
\( CHRF+^† \)(Popović, 2017)0.4580.3270.5140.5380.4910.4480.5430.296
\( EED^‡ \)(Stanchev et al., 2019)0.4310.3150.5080.5680.5180.4250.5460.257
\( ESIM^‡ \)(Chen et al., 2017; Mathur et al., 2019)-0.3290.511-0.5100.4280.5720.339
\( HLEPORA\_BASELINE^‡ \)(Han et al., 2012, 2013)---0.4630.390---
\( SENTBLEU^† \)(Papineni et al., 2002)0.3670.2480.3960.4650.3920.3340.4690.270
\( Y1SI-0^‡ \)(Lo, 2019)0.4060.3040.4830.5390.4940.4020.5350.266
\( Y1SI-1^‡ \)(Lo, 2019)0.4750.3510.5370.5510.5460.4700.5850.355
\( Y1SI-1\_SRL^‡ \)(Lo, 2019)-0.368-----0.361
Prism-ref (This Work)0.5820.4270.5910.3130.5310.5580.5840.376
LASER + LM (Contrastive)0.5350.4010.5680.3060.4080.5030.6400.356
LM0.4390.3290.4770.1810.2840.4300.5860.279
LASER0.4080.3340.5090.3400.3630.3960.5110.284
mBART (Contrastive)0.3450.3020.4010.5280.4620.3650.4430.280
+ +Table 12: WMT19 Segment-level results, metrics (excludes QE as metric results), from English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) + +
nde-cs 35793de-fr 4862fr-de 1369
\( BEER^‡ \) (Stanojevic and Sima’an, 2015)0.3370.2930.265
BERTSCORE (Zhang et al., 2019, 2020)0.3520.3250.274
\( CHARACTER^‡ \) (Wang et al., 2016)0.2320.2510.224
\( CHRF^† \) (Popović, 2015)0.3260.2840.275
\( CHRF+^† \) (Popović, 2017)0.3260.2840.278
\( EED^‡ \) (Stanchev et al., 2019)0.3450.3010.267
\( ESIM^‡ \) (Chen et al., 2017; Mathur et al., 2019)0.3310.2900.289
\( HLEPORA_BASELINE^‡ \) (Han et al., 2012, 2013)0.2070.239-
\( SENTBLEU^† \) (Papineni et al., 2002)0.2030.2350.179
\( YI SI-0^‡ \) (Lo, 2019)0.3310.2960.277
\( YI SI-1^‡ \) (Lo, 2019)0.3760.3490.310
\( YI SI-1\_SRL^‡ \) (Lo, 2019)--0.299
Prism-ref (This Work)0.4580.4530.426
LASER + LM (Contrastive)0.4310.4010.381
LM0.2940.2350.138
LASER0.3970.3520.348
mBART (Contrastive)0.2620.2550.236
+ +Table 13: WMT19 Segment-level results, metrics (excludes QE as metric), non-English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) + +
nde-en 85365fi-en 38307gu-en 31139kk-en 27094lt-en 21862ru-en 46172zh-en 31070
IBM1-MORPHEME* (Popović et al., 2011)-0.0740.009--0.069--
IBM1-POS4GRAM* (Popović et al., 2011)-0.153------
LASIM*-0.024----0.022-
LP*-0.096-----0.035-
UNI* (Yankovskaya et al., 2019)0.0220.202---0.084-
UNI+* (Yankovskaya et al., 2019)0.0150.211---0.089-
Y1SI-2* (Lo, 2019)0.0680.126-0.0010.0960.0750.0530.253
Y1SI-2_SRL* (Lo, 2019)0.068-----0.246
Prism-src (This work)0.1090.3000.1020.3910.3560.1780.336
+ +Table 14: WMT19 Segment-level results, QE as a metric, to English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\ast$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +
nen-cs 27178en-de 99840en-fi 31820en-gu 11355en-kk 18172en-lt 17401en-ru 24334en-zh 18658
IBM1-MORPHEME* (Popović et al., 2011)-0.135-0.003-0.005---0.165--
IBM1-POS4GRAM* (Popović et al., 2011)--0.123------
LASIM*-0.147-----0.240-
LP*--0.119-----0.158-
UNI* (Yankovskaya et al., 2019)0.0600.1290.351---0.226-
UNI+* (Yankovskaya et al., 2019)------0.222-
USFD* (Ive et al., 2018)--0.029----0.136-
USFD-TL* (Ive et al., 2018)--0.037----0.191-
YISI-2* (Lo, 2019)0.0690.2120.2390.1470.1870.003-0.1550.044
YISI-2_SRL* (Lo, 2019)-0.236-----0.034
Prism-src (This work)0.4700.4020.5550.2150.5070.4990.4860.287
+ +Table 15: WMT19 Segment-level results, QE as a metric, from English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\ast$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +
nde-cs 35793de-fr 4862fr-de 1369
IBM1-MORPHEME* (Popović et al., 2011)0.048-0.013-0.053
IBM1-POS4GRAM* (Popović et al., 2011)--0.074-0.097
YİSI-2* (Lo, 2019)0.1990.1860.066
Prism-src (This work)0.4440.3710.316
+ +Table 16: WMT19 Segment-level results, QE as a metric, non-English. n denotes number of pairwise judgments. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\ast$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +# F WMT 2019 System-Level results for Top 4 Systems + +Table 17 Table 18, and Table 19 show system-level results for just the top 4 systems, for language pairs into, out of, and not including English, for WMT 2019. We show statistical significance following the shared task but note it appears extremely noisy. + +
nde-en4fi-en4gu-en4kk-en4lt-en4ru-en4zh-en4
\( BEER^‡ \)(Stanojevic and Sima'an, 2015)-0.7600.0650.9810.9570.423-0.122-0.625
\( BERTR^‡ \)(Mathur et al., 2019)0.2510.4300.9660.8640.5180.5050.402
\( BERTSCORE \)(Zhang et al., 2019, 2020)0.2720.6830.9130.8970.7530.456-0.220
\( BLEU^† \)(Papineni et al., 2002)-0.822-0.2750.9660.9580.625-0.356-0.694
\( BLEURT \)(Sellam et al., 2020)0.9530.7140.8810.9290.8410.5220.660
\(CDER^† \)(Leusch et al., 2006)-0.740-0.2140.9400.9480.389-0.108-0.611
\(CHARACTER^‡ \)(Wang et al., 2016)-0.664-0.0790.9800.9240.3860.052-0.092
\(CHRF^† \)(Popović, 2015)-0.6100.1700.9860.8930.377-0.043-0.147
\(CHRF+^† \)(Popović, 2017)-0.6120.1570.9820.8860.341-0.019-0.093
\(EED^‡ \)(Stanchev et al., 2019)-0.5030.1250.9780.9040.3230.033-0.06
\(ESIM^‡ \)(Chen et al., 2017; Mathur et al., 2019)0.8950.7400.8470.9650.8960.5340.819
\(HLEPORA\_BASELINE^‡ \)(Han et al., 2012, 2013)---0.816--0.312
\(HLEPORB\_BASELINE^‡ \)(Han et al., 2012, 2013)---0.8160.257-0.312
\(METEOR++_2.0(SYNTAX)^‡ \)(Guo and Hu, 2019)-0.5910.3490.9780.9120.4130.024-0.214
\(METEOR++_2.0(SYNTAX+COPY)^‡ \)(Guo and Hu, 2019)-0.5870.3990.9800.8880.4130.051-0.17
\(NIST^† \)(Doddington, 2002)-0.820.1110.9630.9130.746-0.458-0.906
\(PER^† \)-0.7870.2320.9450.7310.086-0.0810.730
\(PREP^‡ \)(Yoshimura et al., 2019)-0.9810.7540.9760.8630.171-0.357-0.927
\(SACREBLEU.BLEU^† \)(Post, 2018)-0.823-0.3330.9660.9580.426-0.217-0.694
\(SACREBLEU.CHRF^† \)(Post, 2018)-0.6330.1130.9540.8750.311-0.0940.347
\(TER^† \)(Snover et al., 2006)-0.7980.0320.9420.9630.585-0.137-0.845
\(WER^† \)-0.816-0.1250.9400.9580.621-0.153-0.859
\(WMDO^‡ \)(Chow et al., 2019)-0.7110.3440.9430.9210.2900.114-0.352
\(Y1SI-0^‡ \)(Lo, 2019)-0.7140.0740.9910.9460.540-0.079-0.663
\(Y1SI-1^‡ \)(Lo, 2019)0.0450.6100.9620.8870.5520.365-0.067
\(Y1SI-1\_SRL^‡ \)(Lo, 2019)0.0810.5800.9590.8740.5600.342-0.069
\(IBM1-MORPHEM^* \)(Popović et al., 2011)-0.6430.065---0.952--
\(IBM1-POS4GRAM^* \)(Popović et al., 2011)-0.831------
\(LASIM^* \)-0.855-----0.353-
\(LP.1^*\)0.777----0.442-
\(UNI^* \)(Yankovskaya et al., 2019)0.7030.830---0.738-
\(UNI+^* \)(Yankovskaya et al., 2019)0.7960.791---0.777-
\(Y1SI-2^* \)(Lo, 2019)-0.8090.780-0.1250.834-0.362-0.325-0.889
\(Y1SI-2\_SRL^* \)(Lo, 2019)-0.749------0.83
Prism-ref (This Work)0.4010.7190.8960.7960.8770.4310.523
Prism-ref w/ ParaBank 2 (Contrastive)0.9570.7880.8710.7590.9390.6250.899
LASER + LM (Contrastive)0.9570.7680.8670.8700.6150.5960.733
Prism-src (This work)0.5020.8020.6080.558-0.3010.4370.958
LM0.9730.7540.6190.498-0.0060.7790.973
LASER-0.4580.7180.9840.9260.6620.262-0.528
mBART (Contrastive)-0.7390.5590.9130.9020.491-0.103-0.295
+ +Table 17: WMT19 System-level results, to English for the top 4 systems (as judged by humans) for each language pair. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) $*$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +
nen-cs 4en-de 4en-fi 4en-gu 4en-kk 4en-lt 4en-ru 4en-zh 4
\( BEER {}^{ \ddagger } \) (Stanojević and Sima'an, 2015)0.872-0.8010.9600.8990.2260.8880.9610.992
BERTSCORE (Zhang et al., 2019, 2020)0.868-0.7220.8590.9220.2880.9550.9530.982
\( BLEU {}^{ \dagger } \) (Papineni et al., 2002)0.930-0.370.8980.8600.1810.9250.7530.987
\(CDER {}^{ \dagger } \) (Leusch et al., 2006)0.946-0.9750.8370.900-0.0110.8800.9170.986
\(CHARACTER {}^{ \ddagger } \) (Wang et al., 2016)0.828-0.7770.8870.9020.2950.6750.9740.997
\(CHRF {}^{ \dagger } \) (Popović, 2015)0.799-0.5900.9360.9260.2770.9010.9540.987
\(CHRF+ {}^{ \ddagger } \) (Popović, 2017)0.816-0.6050.9210.9230.2830.8580.9400.996
\(EED {}^{ \ddagger } \) (Stanchev et al., 2019)0.825-0.5520.9390.9130.2670.9210.9610.997
\(ESIM {}^{ \ddagger } \) (Chen et al., 2017; Mathur et al., 2019)--0.7960.957-0.4180.9970.9860.987
\(HLEPORA\_BASELINE {}^{ \ddagger } \) (Han et al., 2012, 2013)---0.9150.062---
\(HLEPORB\_BASELINE {}^{ \ddagger } \) (Han et al., 2012, 2013)---0.9150.0620.821--
\(NIST {}^{ \dagger } \) (Doddington, 2002)0.946-0.2330.9710.8930.0820.9880.7240.979
\(PER {}^{ \dagger } \)0.916-0.9950.8500.887-0.2600.3900.9110.980
\(SACREBLEU.BLEU {}^{ \dagger } \) (Post, 2018)0.970-0.9760.8450.8590.1810.6380.8780.962
\(SACREBLEU.CHRF {}^{ \dagger } \) (Post, 2018)0.907-0.8160.9210.9020.2390.9800.9700.963
\(TER {}^{ \dagger } \) (Snover et al., 2006)0.969-0.9890.8890.874-0.0600.9880.8950.984
\(WER {}^{ \dagger } \)0.973-0.9930.8760.868-0.0580.9730.8940.987
\(YISI-0 {}^{ \ddagger } \) (Lo, 2019)0.879-0.7960.9750.9200.1960.7870.9400.982
\(YISI-1 {}^{ \ddagger } \) (Lo, 2019)0.847-0.2200.9760.9170.3420.8380.9630.990
\(YISI-1\_SRL {}^{ \ddagger } \) (Lo, 2019)--0.378-----0.994
\(IBM1-MORPHEME {}^{ * } \) (Popović et al., 2011)-0.771-0.4250.430--0.969--
\(IBM1-POS4GRAM {}^{ * } \) (Popović et al., 2011)--0.502------
\(LASIM {}^{ * } \)--0.914----0.223-
LP.1*-0.949-----0.407-
\(UNI {}^{ * } \) (Yankovskaya et al., 2019)0.587-0.960.637---0.655-
\(UNI+ {}^{ * } \) (Yankovskaya et al., 2019)------0.644-
\(USFD {}^{ * } \) (Ive et al., 2018)--0.729----0.985-
\(USFD-TL {}^{ * } \) (Ive et al., 2018)--0.390----0.698-
\(YISI-2 {}^{ * } \) (Lo, 2019)0.793-0.933-0.991-0.3890.851-0.5040.0750.983
\(YISI-2\_SRL {}^{ * } \) (Lo, 2019)--0.915-----0.991
Prism-ref (This Work)0.9520.2780.8860.8630.6930.8620.9750.966
\(LASER + LM \) (Contrastive)0.9610.3770.9030.5090.6050.7430.9620.985
Prism-src (This work)0.973-0.4080.765-0.7030.833-0.0030.7080.863
LM0.8330.4250.763-0.7120.9530.6330.9160.846
LASER0.8510.2460.9830.5680.3280.2630.9950.988
mBART (Contrastive)0.936-0.8340.9660.9120.2240.9460.9680.986
+ +Table 18: WMT19 System-level results, from English for the top 4 systems (as judged by humans) for each language pair. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) $*$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +
nde-cs 4de-fr 4fr-de 4
\( BEER^‡ \)(Stanojević and Sima’an, 2015)0.9610.5900.978
BERTSCORE (Zhang et al., 2019, 2020)0.9760.7070.973
\( BLEU^† \)(Papineni et al., 2002)0.8120.4950.983
\(CDER^† \)(Leusch et al., 2006)0.8600.5440.959
\(CHARACTER^‡ \)(Wang et al., 2016)0.8710.6260.963
\(CHRF^† \)(Popović, 2015)0.9200.5310.952
\(CHRF+^† \)(Popović, 2017)0.9090.5220.946
\(EED^‡ \)(Stanchev et al., 2019)0.8730.5820.945
\(ESIM^‡ \)(Chen et al., 2017; Mathur et al., 2019)0.9770.7020.991
\(HLEPORA\_BASELINE^‡ \)(Han et al., 2012, 2013)0.7710.314
\(HLEPORB\_BASELINE^‡ \)(Han et al., 2012, 2013)0.7540.314
\(NIST^† \)(Doddington, 2002)0.7540.5610.990
\(PER^† \)0.9130.4010.990
\(SACREBLEU.BLEU^† \)(Post, 2018)0.8880.4950.958
\(SACREBLEU.CHRF^† \)(Post, 2018)0.9640.5750.920
\(TER^† \)(Snover et al., 2006)0.9990.5410.989
\(WER^† \)0.9970.5660.991
\(YISI-0^‡ \)(Lo, 2019)0.8380.6550.961
\(YISI-1^‡ \)(Lo, 2019)0.9670.6770.967
\(YISI-1\_SRL^‡ \)(Lo, 2019)--0.974
\(IBM1-MORPHEME^* \)(Popović et al., 2011)0.645-0.885-0.339
\(IBM1-POS4GRAM^* \)(Popović et al., 2011)--0.106-0.33
\(YISI-2^* \)(Lo, 2019)0.3680.209-0.687
Prism-ref (This Work)0.9680.6480.998
LASER + LM (Contrastive)0.9470.7740.975
Prism-src (This work)0.9030.6000.181
LM0.3360.770-0.903
LASER0.5520.7130.953
mBART (Contrastive)0.8060.6150.972
+ +Table 19: WMT19 System-level results, non-English for the top 4 systems (as judged by humans) for each language pair. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) $*$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +# G WMT 2019 Metric and QE as Metric System-Level Results + +Table 20, Table 21, and Table 22, show system-level results, for metrics (excludes QE as metric) for language pairs into, out of, and not including English, for the WMT 2019 MT metrics shared task, along with all baselines and submitted systems. + +Table 23, Table 24, and Table 25, show system-level results, for QE as metric, for language pairs into, out of, and not including English, for the WMT 2019 MT metrics shared task, along with all baselines and submitted systems. + +
nde-en 16fi-en 12gu-en 11kk-en 11lt-en 11ru-en 14zh-en 15
\( BEER^{\ddagger}\) (Stanojević and Sima’an, 2015)0.9060.9930.9520.9860.9470.9150.942
\( BERTR^{\ddagger}\) (Mathur et al., 2019)0.9260.9840.9380.9900.9480.9710.974
\( BERTSCORE \) (Zhang et al., 2019, 2020)0.9490.9870.9810.9800.9620.9210.983
\( BLEU^{\dagger}\) (Papineni et al., 2002)0.8490.9820.8340.9460.9610.8790.899
\( BLEURT \) (Sellam et al., 2020)0.9400.9780.8780.9930.9910.9770.984
\( CDER^{\dagger}\) (Leusch et al., 2006)0.8900.9880.8760.9670.9750.8920.917
\( CHARACTER^{\ddagger}\) (Wang et al., 2016)0.8980.9900.9220.9530.9550.9230.943
\( CHRF^{\dagger}\) (Popović, 2015)0.9170.9920.9550.9780.9400.9450.956
\( CHRF+^{\ddagger}\) (Popović, 2017)0.9160.9920.9470.9760.9400.9450.956
\( EED^{\ddagger}\) (Stanchev et al., 2019)0.9030.9940.9760.9800.9290.9500.949
\( ESIM^{\ddagger}\) (Chen et al., 2017; Mathur et al., 2019)0.9410.9710.8850.9860.9890.9680.988
\( HLEPORA\_BASELINE^{\ddagger}\) (Han et al., 2012, 2013)---0.975--0.947
\( HLEPORB\_BASELINE^{\ddagger}\) (Han et al., 2012, 2013)---0.9750.906-0.947
\( METEOR++_2.0(SYNTAX)^{\ddagger}\) (Guo and Hu, 2019)0.8870.9950.9090.9740.9280.9500.948
\( METEOR++_2.0(SYNTAX+COPY)^{\ddagger}\) (Guo and Hu, 2019)0.8960.9950.9000.9710.9270.9520.952
\( NIST^{\dagger}\) (Doddington, 2002)0.8130.9860.9300.9420.9440.9250.921
\( PER^{\dagger} \)0.8830.9910.9100.7370.9470.9220.952
\( PREP^{\ddagger}\) (Yoshimura et al., 2019)0.5750.6140.7730.7760.4940.7820.592
\( SACREBLEU.BLEU^{\dagger}\) (Post, 2018)0.8130.9850.8340.9460.9550.8730.903
\( SACREBLEU.CHRF^{\dagger}\) (Post, 2018)0.9100.9900.9520.9690.9350.9190.955
\( TER^{\dagger}\) (Snover et al., 2006)0.8740.9840.8900.7990.9600.9170.840
\( WER^{\dagger} \)0.8630.9830.8610.7930.9610.9110.820
\( WMDO^{\ddagger}\) (Chow et al., 2019)0.8720.9870.9830.9980.9000.9420.943
\( Y1SI-0^{\ddagger}\) (Lo, 2019)0.9020.9930.9930.9910.9270.9580.937
\( Y1SI-1^{\ddagger}\) (Lo, 2019)0.9490.9890.9240.9940.9810.9790.979
\( Y1SI-1\_SRL^{\ddagger}\) (Lo, 2019)0.9500.9890.9180.9940.9830.9780.977
Prism-ref (This Work)0.9540.9830.7640.9980.9950.9140.992
Prism-ref w/ ParaBank 2 (Contrastive)0.9490.9790.9250.9930.9810.9480.994
LASER + LM (Contrastive)0.9380.9740.9740.9970.9960.9400.988
mBART (Contrastive)0.9060.9910.9490.9740.9170.8800.956
+ +Table 20: WMT19 System-level results, to English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) + +
nen-cs 11en-de 22en-fi 12en-gu 11en-kk 11en-lt 12en-ru 12en-zh 12
\( BEER^‡ \)(Stanojevic and Sima'an, 2015)0.9900.9830.9890.8290.9710.9820.9770.803
BERTSCORE (Zhang et al., 2019, 2020)0.9810.9900.9700.9220.9810.9780.9890.925
\( BLEU^† \)(Papineni et al., 2002)0.8970.9210.9690.7370.8520.9890.9860.901
\(CDER^† \)(Leusch et al., 2006)0.9850.9730.9780.8400.9270.9850.9930.905
\(CHARACTER^‡ \)(Wang et al., 2016)0.9940.9860.9680.9100.9360.9540.9850.862
\(CHRF^† \)(Popović, 2015)0.9900.9790.9860.8410.9720.9810.9430.880
\(CHRF+^† \)(Popović, 2017)0.9910.9810.9860.8480.9740.9820.9500.879
\(EED^‡ \)(Stanchev et al., 2019)0.9930.9850.9870.8970.9790.9750.9670.856
\(ESIM^‡ \)(Chen et al., 2017; Mathur et al., 2019)-0.9910.957-0.9800.9890.9890.931
\(HLEPORA\_BASELINE^‡ \)(Han et al., 2012, 2013)---0.8410.968---
\(HLEPORB\_BASELINE^‡ \)(Han et al., 2012, 2013)---0.8410.9680.980--
\(NIST^† \)(Doddington, 2002)0.8960.3210.9710.7860.9300.9930.9880.884
\(PER^† \)0.9760.9700.9820.8390.9210.9850.9810.895
\(SACREBLEU.BLEU^† \)(Post, 2018)0.9940.9690.9660.7360.8520.9860.9770.801
\(SACREBLEU.CHRF^† \)(Post, 2018)0.9830.9760.9800.8410.9670.9660.9850.796
\(TER^† \)(Snover et al., 2006)0.9800.9690.9810.8650.9400.9940.9950.856
\(WER^† \)0.9820.9660.9800.8610.9390.9910.9940.875
\(YISI-0^‡ \)(Lo, 2019)0.9920.9850.9870.8630.9740.9740.9530.861
\(YISI-1^‡ \)(Lo, 2019)0.9620.9910.9710.9090.9850.9630.9920.951
\(YISI-1\_SRL^‡ \)(Lo, 2019)-0.991-----0.948
Prism-ref (This Work)0.9580.9880.9490.6240.9780.9370.9180.898
LASER + LM (Contrastive)0.9620.9890.9570.7750.9690.9580.9870.950
mBART (Contrastive)0.9870.9880.9820.9170.9810.9650.9780.866
+ +Table 21: WMT19 System-level results, from English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\dagger$ :WMT19 Baseline (Ma et al., 2019) $\ddagger$ :WMT19 Metric Submission (Ma et al., 2019) + +
nde-cs 11de-fr 11fr-de 10
\( BEER^‡ \)(Stanojević and Sima’an, 2015)0.9780.9410.848
BERTSCORE (Zhang et al., 2019, 2020)0.9690.9710.899
\( BLEU^† \)(Papineni et al., 2002)0.9410.8910.864
\(CDER^† \)(Leusch et al., 2006)0.8640.9490.852
\(CHARACTER^‡ \)(Wang et al., 2016)0.9650.9280.849
\(CHRF^† \)(Popović, 2015)0.9740.9310.864
\(CHRF+^† \)(Popović, 2017)0.9720.9360.848
\(EED^‡ \)(Stanchev et al., 2019)0.9820.9400.851
\(ESIM^‡ \)(Chen et al., 2017; Mathur et al., 2019)0.9800.9500.942
\(HLEPORA\_BASELINE^‡ \)(Han et al., 2012, 2013)0.9410.814-
\(HLEPORB\_BASELINE^‡ \)(Han et al., 2012, 2013)0.9590.8140.862
\(NIST^† \)(Doddington, 2002)0.9540.9160.899
\(PER^† \)0.8750.8570.869
\(SACREBLEU.BLEU^† \)(Post, 2018)0.8690.8910.882
\(SACREBLEU.CHRF^† \)(Post, 2018)0.9750.9520.895
\(TER^† \)(Snover et al., 2006)0.8900.9560.894
\(WER^† \)0.8720.9560.820
\(Y1SI-0^‡ \)(Lo, 2019)0.9780.9520.908
\(Y1SI-1^‡ \)(Lo, 2019)0.9730.9690.912
Prism-ref (This Work)0.9760.9360.911
LASER + LM (Contrastive)0.9900.9350.924
mBART (Contrastive)0.9640.9440.874
+ +Table 22: WMT19 System-level results, non-English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. †:WMT19 Baseline (Ma et al., 2019) ‡:WMT19 Metric Submission (Ma et al., 2019) + +
nde-en 16fi-en 12gu-en 11kk-en 11lt-en 11ru-en 14zh-en 15
IBM1-MORPHEME* (Popović et al., 2011)-0.3450.740--0.487--
IBM1-POS4GRAM* (Popović et al., 2011)-0.339------
LASIM*0.247-----0.310-
LP.1*-0.474-----0.488-
UNI* (Yankovskaya et al., 2019)0.8460.930---0.805-
UNI+* (Yankovskaya et al., 2019)0.8500.924---0.808-
Y1SI-2* (Lo, 2019)0.7960.642-0.566-0.3240.442-0.3390.940
Y1SI-2_SRL* (Lo, 2019)0.804-----0.947
Prism-src (This work)0.8900.9410.1710.9610.9890.8450.971
+ +Table 23: WMT19 System-level results, QE as a metric, to English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\ast$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +
nen-cs 11en-de 22en-fi 12en-gu 11en-kk 11en-lt 12en-ru 12en-zh 12
IBM1-MORPHEME* (Popović et al., 2011)-0.8710.8700.084---0.81--
IBM1-POS4GRAM* (Popović et al., 2011)-0.393------
LASIM*-0.871-----0.823-
LP.1*--0.569-----0.661-
UNI* (Yankovskaya et al., 2019)0.0280.8410.907---0.919-
UNI+* (Yankovskaya et al., 2019)------0.918-
USFD* (Ive et al., 2018)--0.224----0.857-
USFD-TL* (Ive et al., 2018)--0.091----0.771-
YISI-2* (Lo, 2019)0.3240.9240.6960.3140.3390.055-0.766-0.097
YISI-2_SRL* (Lo, 2019)-0.936------0.118
Prism-src (This work)0.8650.9760.9330.4440.9590.9080.8220.793
+ +Table 24: WMT19 System-level results, QE as a metric, from English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\ast$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) + +
nde-cs 11de-fr 11fr-de 10
IBM1-MORPHEME* (Popović et al., 2011)0.355-0.509-0.625
IBM1-POS4GRAM* (Popović et al., 2011)-0.085-0.478
YİSI-2* (Lo, 2019)0.6060.721-0.53
Prism-src (This work)0.9730.8890.739
+ +Table 25: WMT19 System-level results, QE as a metric, non-English. n denotes number of MT systems. Bold denotes top scoring method and any other methods with whose $95\%$ confidence interval overlaps with that of a top method. $\ast$ :WMT19 QE-as-Metric Submission (Fonseca et al., 2019) \ No newline at end of file diff --git a/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/images.zip b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..74b4033a652dd1b122a5766617e9c4f4d024d545 --- /dev/null +++ b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c416952382c501d254849ab48f1d9bc1e9af21f4478c63cc543ead3a0daf7a8 +size 3587227 diff --git a/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/layout.json b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..36b9aa79457b50b6c601636001301062bb9486fd --- /dev/null +++ b/automaticmachinetranslationevaluationinmanylanguagesviazeroshotparaphrasing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5e4a17cf609f7e02b9c5fa95cd83a833560e292156cc6db3e131b4b80e8fe36 +size 687254 diff --git a/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_content_list.json b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f95ad25462927103abb2c807085860d3173c99be --- /dev/null +++ b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c34951381db687b1d14f840738f6469dc3d2531afc19300f30f1cbea79aac90 +size 86998 diff --git a/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_model.json b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2dc2da124975ae999d488c861a4b11d241a9ecb5 --- /dev/null +++ b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f8d9fc31b11f3ae6a996513787554ef7f61239318d37c3ac9cd6a985335bd83 +size 99848 diff --git a/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_origin.pdf b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f952bcc545a65eacdf847416ecfe49aeeaa2f31d --- /dev/null +++ b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/c3be80db-00d7-401d-963a-b7b047a36b89_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d7a87beb61720f69a3849a0d6e0752043d7a809c97018d97182d28c108e34dd +size 654063 diff --git a/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/full.md b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9b225226940bdd38c7a8c09efad6995197292cdc --- /dev/null +++ b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/full.md @@ -0,0 +1,277 @@ +# AUTOPROMPT: Eliciting Knowledge from Language Models with Automatically Generated Prompts + +Taylor Shin* Yasaman Razeghi* Robert L. Logan IV* Eric Wallace* Sameer Singh + +$\diamond$ University of California, Irvine $\clubsuit$ University of California, Berkeley + +{tshin1, yrazeghi, rlogan, sameer}@uci.edu + +ericwallace@berkeley.edu + +# Abstract + +The remarkable success of pretrained language models has motivated the study of what kinds of knowledge these models learn during pretraining. Reformulating tasks as fill-in-the-blanks problems (e.g., cloze tests) is a natural approach for gauging such knowledge, however, its usage is limited by the manual effort and guesswork required to write suitable prompts. To address this, we develop AUTOPROMPT, an automated method to create prompts for a diverse set of tasks, based on a gradient-guided search. Using AUTOPROMPT, we show that masked language models (MLMs) have an inherent capability to perform sentiment analysis and natural language inference without additional parameters or finetuning, sometimes achieving performance on par with recent state-of-the-art supervised models. We also show that our prompts elicit more accurate factual knowledge from MLMs than the manually created prompts on the LAMA benchmark, and that MLMs can be used as relation extractors more effectively than supervised relation extraction models. These results demonstrate that automatically generated prompts are a viable parameter-free alternative to existing probing methods, and as pretrained LMs become more sophisticated and capable, potentially a replacement for finetuning. + +# 1 Introduction + +Pretrained language models (LMs) have had exceptional success when adapted to downstream tasks via finetuning (Peters et al., 2018; Devlin et al., 2019). Although it is clear that pretraining improves accuracy, it is difficult to determine whether the knowledge that finetuned LMs contain is learned during the pretraining or the finetuning process. How can we directly evaluate the knowl + +edge present in pretrained LMs, be it linguistic, factual, commonsense, or task-specific? + +Numerous techniques have been proposed to elicit such knowledge by analyzing pretrained LMs' internal representations. A common strategy is to use probing classifiers—shallow classifiers that predict certain attributes using an LMs' representations as features (Conneau et al., 2018; Liu et al., 2019). However, probing classifiers require additional learned parameters and are thus susceptible to false positives; high probing accuracy is not a sufficient condition to conclude that an LM contains a certain piece of knowledge (Hewitt and Liang, 2019; Voita and Titov, 2020). Attention visualization, another common technique, has a similar failure mode: attention scores may be correlated with, but not caused by the underlying target knowledge, leading to criticism against their use as explanations (Jain and Wallace, 2019; Wegreffe and Pinter, 2019). Both probing and attention visualizations also struggle to evaluate knowledge that cannot be represented as simple token- or sequence-level classification tasks. + +A more direct approach for eliciting knowledge from these models, since they are language models after all, is prompting, i.e. converting tasks into a language model format. For example, Radford et al. (2019) frame summarization as a language modeling task by appending "TL;DR:" to the end of an article and then generating from an LM. Similarly, Petroni et al. (2019) manually reformulate a knowledge base completion task as a cloze test (i.e., a fill-in-the-blank problem). Compared to existing model analysis methods, prompting is noninvasive: it does not introduce large amounts of additional parameters or require direct inspection of a model's representations. Thus prompting provides a lower bound on what the model "knows", and is therefore a more useful analysis tool. However, prompting unfortunately requires manually + +![](images/00c5d6861b6c47a83a9793f4f96f1f4559daba912464db0304cd08474dab921c.jpg) +Figure 1: Illustration of AUTOPROMPT applied to probe a masked language model's (MLM's) ability to perform sentiment analysis. Each input, $\pmb{x}_{\mathrm{inp}}$ , is placed into a natural language prompt, $\pmb{x}_{\mathrm{prompt}}$ , which contains a single [MASK] token. The prompt is created using a template, $\lambda$ , which combines the original input with a set of trigger tokens, $\pmb{x}_{\mathrm{trig}}$ . The trigger tokens are shared across all inputs and determined using a gradient-based search (Section 2.2). Probabilities for each class label, $y$ , are then obtained by marginalizing the MLM predictions, $p([\mathsf{MASK}]\mid \pmb{x}_{\mathrm{prompt}})$ , over sets of automatically detected label tokens (Section 2.3). + +crafting the context to feed into the model. Not only is this time consuming and non-intuitive for many tasks (e.g., textual entailment), more importantly, models are highly sensitive to this context: improperly-constructed contexts cause artificially low performance (Jiang et al., 2020). Overcoming the need to manually specify prompts would make prompting a more widely useful analysis tool. + +In this paper, we introduce AUTOPROMPT—an automated method for generating prompts for any task, illustrated in Figure 1. Given a task, e.g., sentiment analysis, AUTOPROMPT creates a prompt by combining the original task inputs (e.g. reviews) with a collection of trigger tokens according to a template. The same set of trigger tokens is used for all inputs, and is learned using a variant of the gradient-based search strategy proposed in Wallace et al. (2019). The LM predictions for the prompt are converted to class probabilities by marginalizing over a set of associated label tokens, which can either be learned or specified ahead of time, enabling the LM to be evaluated the same as one would any other classifier. + +We validate the effectiveness of AUTOPROMPT in numerous experiments. First, we use AUTOPROMPT to construct prompts that test pretrained masked language models (MLMs) on sentiment analysis and natural language inference (NLI). Our tests reveal that, without any finetuning, MLMs perform well on both of these tasks—a properly-prompted RoBERTa achieves $91\%$ accuracy on SST-2 (better than a finetuned ELMo model (Peters et al., 2018)), and $69\%$ accuracy on a bal + +anced variant of the SICK-E dataset (Marelli et al., 2014). Next, we apply AUTOPROMPT to the fact retrieval tasks of LAMA (Petroni et al., 2019), where we are able to construct prompts that more effectively elicit MLM's factual knowledge than existing prompts generated using manual and corpus-mining methods. Concretely, we achieve $43.3\%$ precision-at-1, compared to the current best single-prompt result of $34.1\%$ (Jiang et al., 2020). We also introduce a variant of this task, similar to relation extraction (RE), that tests whether MLMs can extract knowledge from a given piece of text. We show that MLMs can actually outperform existing RE models when context sentences with real facts are provided, however, they struggle when context sentences are artificially falsified. + +Finally, although the goal of AUTOPROMPT is to analyze models, we find that it provides certain practical advantages over finetuning. First, AUTOPROMPT achieves higher average- and worst-case accuracy than finetuning in low-data regimes. Moreover, unlike finetuning, prompting LMs does not require large amounts of disk space to store model checkpoints; once a prompt is found, it can be used on off-the-shelf pretrained LMs. This is beneficial when serving models for multiple tasks. + +# 2 Overview of AUTOPROMPT + +A natural way to elicit knowledge from pretrained LMs is to pose tasks as fill-in-the-blank problems. However, writing prompts is not only time consuming, but it is not clear that the same phrasing will be effective for every model, nor is it clear what criteria + +ria determine whether a particular phrasing the best to elicit the desired information. In light of this, we introduce AUTOPROMPT, a method that constructs customized prompts for a specific task and MLM of interest, to cause the MLMs to produce the desired knowledge.1 An illustration of AUTOPROMPT is provided in Figure 1. The prompt is constructed by taking the original task inputs—a collection of one or more sequences of tokens (e.g., the review in Figure 1)—and mapping them to a sequence of tokens using a template. In the following sections, we describe how AUTOPROMPT uses labeled training data to construct prompts, and how it uses the output of the MLM as a prediction for the task. + +# 2.1 Background and Notation + +For the purpose of prompt construction, we distinguish the original task inputs $x_{\mathrm{inp}}$ (e.g., the review in Figure 1, "a real joy.") from the prompt $x_{\mathrm{prompt}}$ (e.g., "a real joy. atmosphere alot dialogue Clone totally [MASK].") that is fed into the MLM. The mapping from $x_{\mathrm{inp}}$ to $x_{\mathrm{prompt}}$ is performed using a template, $\lambda$ . This template defines where each input sequence will be placed in the prompt, as well as the placement of any additional tokens. In particular, it must also define the placement of a special [MASK] token for the MLM to fill in (denoted by [P] in the template to distinguish it from other [MASK] tokens that might appear). Feeding the prompt into the MLM produces a probability distribution $p([MASK] | x_{\mathrm{prompt}})$ describing which tokens most likely fill in the blank. + +If class labels naturally correspond to tokens in the vocabulary (e.g., entity names in knowledge base completion tasks), this distribution may be readily interpreted as a distribution over class labels. However, for tasks such as sentiment analysis, there may be a set of label tokens $\mathcal{V}_y$ that correspond to a particular label $y$ . For example, in Figure 1, "Cris", "marvelous", and "philanthrop" all indicate positive sentiment. In this case, the class probability is obtained by marginalizing over the set of label tokens: + +$$ +p (y | \boldsymbol {x} _ {\text {p r o m p t}}) = \sum_ {w \in \mathcal {V} _ {y}} p ([ \text {M A S K} ] = w | \boldsymbol {x} _ {\text {p r o m p t}}) \tag {1} +$$ + +# 2.2 Gradient-Based Prompt Search + +So far, we have shown how to reformulate a classification task as a language modeling task using prompts. Here, we propose a method for automatic prompt construction based on Wallace et al. (2019). The idea is to add a number of "trigger" tokens that are shared across all prompts (denoted by [T] in the example template in Figure 1). These tokens are initialized to [MASK] tokens, and then iteratively updated to maximize the label likelihood (Equation (1)) over batches of examples. + +Formally, at each step, we compute a first-order approximation of the change in the log-likelihood that would be produced by swapping the $j$ th trigger token $x_{\mathrm{trig}}^{(j)}$ with another token $w \in \mathcal{V}$ . Then we identify a candidate set $\nu_{\mathrm{cand}}$ of the top- $k$ tokens estimated to cause the greatest increase: + +$$ +\mathcal {V} _ {\text {c a n d}} = \sup _ {w \in \mathcal {V}} - k \left[ \boldsymbol {w} _ {\text {i n}} ^ {T} \nabla \log p (y | \boldsymbol {x} _ {\text {p r o m p t}}) \right] \tag {2} +$$ + +where $w_{\mathrm{in}}$ is the input embedding of $w$ , and the gradient is taken with respect to the input embedding of $x_{\mathrm{trig}}^{(j)}$ . Note that computing this candidate set is roughly as expensive as a single forward pass and backward pass of the model (the dot-products require the same amount of multiplications as computing the LM output projection). For each candidate in this set, we then re-evaluate Equation (1) on the updated prompt, and retain the prompt with the highest probability in the next step—this requires $k$ forward passes of the model. An example prompt produced by this method for the task of sentiment analysis is shown in Figure 1. + +# 2.3 Automating Label Token Selection + +While in some settings the choice of label tokens is obvious (e.g., when class labels directly correspond to words in the vocabulary), it is less clear what label tokens are appropriate for problems involving more abstract class labels (e.g., NLI). In this section, we develop a general two-step approach to automate the selection of the sets of label tokens $\mathcal{V}_y$ . In the first step, we train a logistic classifier to predict the class label using the contextualized embedding of the [MASK] token as input: + +$$ +\boldsymbol {h} = \operatorname {T r a n s f o r m e r} _ {\mathrm {e n c}} (\tilde {\boldsymbol {x}}) \tag {3} +$$ + +We write the output of this classifier as: + +$$ +p (y \mid \boldsymbol {h} ^ {(i)}) \propto \exp (\boldsymbol {h} ^ {(i)} \cdot \boldsymbol {y} + \beta_ {y}) \tag {4} +$$ + +where $\mathbf{y}$ and $\beta_{y}$ are the learned weight and bias terms for the label $y$ , and $i$ represents the index of the [MASK] token. + +In the second step, we substitute $\pmb{h}^{(i)}$ with the MLM's output word embeddings $\pmb{w}_{\mathrm{out}}$ to obtain a score $s(y,w) = p(y|\pmb{w}_{\mathrm{out}})$ . Intuitively, because $\pmb{w}_{\mathrm{out}} \cdot \pmb{h}$ and $\pmb{y} \cdot \pmb{h}$ are large for words and labels that are relevant to a particular context, $s_w \propto \exp(\pmb{w}_{\mathrm{out}} \cdot \pmb{y} + \beta_y)$ should be large for words that are typically associated with a given label. The sets of label tokens are then constructed from the $k$ -highest scoring words: + +$$ +\mathcal {V} _ {y} = \underset {w \in \mathcal {V}} {\operatorname {t o p} - k} [ s (y, w) ] \tag {5} +$$ + +# 2.4 Relation to Other Prompting Methods + +Our work fits into a body of work that probes language model's knowledge via prompts. Previous works have used manually defined prompts to study an LM's ability to perform: commonsense reasoning (Trinh and Le, 2018; Kwon et al., 2019; Shwartz et al., 2020), question answering (Lewis et al., 2019), fact recall (Petroni et al., 2019; Jiang et al., 2020; Bouraoui et al., 2019), summarization (Radford et al., 2019), and other supervised tasks (Brown et al., 2020). Schick and Schütze (2020) use manually constructed prompts in conjunction with semi-supervised learning for few-shot learning. We instead automatically create prompts for any task, which leads to higher accuracy and opens up new phenomena to analyze. + +# 2.5 Evaluation Setup + +In the following sections, we apply AUTOPROMPT to probe $\mathrm{BERT}_{\mathrm{BASE}}^2$ (110M parameters) and RoBERTaLARGE's (355M parameters) knowledge of the following tasks: sentiment analysis, natural language inference (NLI), fact retrieval, and relation extraction. We use the PyTorch implementations and pretrained weights provided by the transformers Python library (Wolf et al., 2019). For sentiment analysis and NLI, we find label tokens using the logistic-regression-based heuristic described in Section 2.3. For fact retrieval and relation extraction, we skip this step as the labels (entities) directly correspond to tokens in the vocabulary. For all tasks, we perform the prompt search described in Section 2.2 for multiple iterations. In each iteration, we use a batch of training + +data to identify the candidate set $\nu_{\mathrm{cand}}$ of replacement trigger tokens. We then evaluate the label likelihoods of the updated prompts on a separate batch of data, and we retain the best trigger token in the next iteration of the search. At the end of every iteration, we measure the label likelihood on withheld development data, and return the best prompt found during the entire search as the final output. Performance is evaluated using the appropriate task-specific metrics—e.g., accuracy for sentiment analysis and NLI, and precision@k for fact retrieval—on a separate withheld test set. + +Our AUTOPROMPT implementation is publicly available at http://ucinlp.github.io/autoprompt, and supports prompt generation for pretrained models in the HuggingFace transformers library (Wolf et al., 2019) on arbitrary datasets. + +# 3 Sentiment Analysis + +Sentiment analysis is a fundamental task in NLP, both for natural language understanding research and real-world applications. It is also difficult to probe the extent to which MLMs understand sentiment without finetuning. + +Setup We apply our method to convert instances from the binary Stanford Sentiment Treebank (Socher et al., 2013, SST-2) into prompts, using the standard train/test splits. We find label tokens using a prompt based on the template in Table 3. For our gradient-based prompt search, we perform a grid search over the following hyperparameters: $|\mathcal{V}_{\text{cand}}| \in \{10,100\}$ , $|\mathcal{V}_y| \in \{1,3,5\}$ , $|x_{\text{trig}}| \in [3,6]$ . All prompts are initialized with the same template used to find the label set. + +We also construct a prompt manually (before automated prompts are generated, to avoid bias) based on the intuition that SST-2 is comprised of movie reviews. We use “{sentence} this movie was [P].” as the template, and use “terrible” and “fantastic” for the negative and positive label tokens, respectively. + +Results We show results in Table 1, along with reference scores from the GLUE (Wang et al., 2019) SST-2 leaderboard, and scores for a linear probe trained over the elementwise average of the LM token representations. Prompts generated by AUTOPROMPT reveal that both BERT and RoBERTa have a strong knowledge of sentiment analysis: without any finetuning, BERT per + +
ModelDevTest
BiLSTM-82.8†
BiLSTM + ELMo-89.3†
BERT (linear probing)85.283.4
BERT (finetuned)-93.5†
RoBERTa (linear probing)87.988.8
RoBERTa (finetuned)-96.7†
BERT (manual)63.263.2
BERT (AUTOPROMPT)80.982.3
RoBERTa (manual)85.385.2
RoBERTa (AUTOPROMPT)91.291.4
+ +Table 1: Sentiment Analysis performance on the SST-2 test set of supervised classifiers (top) and fill-in-the-blank MLMs (bottom). Scores marked with $\dagger$ are from the GLUE leaderboard: http://gluebenchmark.com/leaderboard. + +forms comparably to a supervised BiLSTM, and RoBERTa achieves an accuracy on-par with finetuned BERT and ELMo models. In addition, we observe that our automatically constructed prompts are more effective than manual prompts, and that they are difficult to construct using human intuition: the best template for RoBERTa is “{sentence} atmosphere alot dialogue Clone totally [P].” We include results on the effect of the AUTOPROMPT hyperparameters in Appendix A. + +Accuracy in Low-Data Settings Although the goal of AUTOPROMPT is to probe a model's knowledge, we also find that it can achieve high accuracy in the low-data regime. In particular, we measure the development set accuracy of AUTOPROMPT prompts when using random subsets of 10, 100, and 1000 instances from the training data. We run our prompt search with $|\pmb{x}_{\mathrm{trig}}| = 10$ , $|\mathcal{V}_y| = 3$ , and $|\mathcal{V}_{\mathrm{cand}}| = 10$ . We compare to the performance of BERT and RoBERTa finetuned on the same data. We repeat this experiment 10 times on different randomly sampled sets of data (and seeds for the finetuned models), and display the best-case, worst-case, and average performance in Figure 2. + +We observe that prompts and finetuning perform comparably on average for BERT, however, in the worst-case, finetuning can fail in the low-data regime (consistent with Dodge et al. 2020). For RoBERTa, AUTOPROMPT performs substantially better than finetuning when there are 100s to 1000s of training examples. This excellence in the low-data regime is an interesting phenomenon, and suggests that there is an initial barrier that MLMs must surmount when they are converted to finetuned classifiers that is not encountered when the task is presented as masked language modeling. + +![](images/4ed0186673759750db0a5d1e048f8e26badf570eca1515d6937e61b63ed1e9d1.jpg) +(a) BERT on SST-2 + +![](images/feb9716682a682b12919e203d5dea313a52dac42220f34ffd78bae48964b94c1.jpg) +(b) RoBERTa on SST-2 + +![](images/a8d0169d737b9a03c6f6e50264c968aee7b31e935657770732f79569fd6f67e8.jpg) +(c) BERT on SICK-E + +![](images/a460c16fec1ca9b3fb883dbff5a0234f2e4689d0a870767cbe02dd2f91cb2037.jpg) +(d) RoBERTa on SICK-E +Figure 2: Effect of Training Data on sentiment analysis and NLI for AUTOPROMPT vs. finetuning. X-axis is the number of data points used during training. Error bars plot the max. and min. accuracies observed over 10 independent runs. In the low data regime, AUTOPROMPT outperforms finetuning for RoBERTa. + +# 4 Natural Language Inference + +To evaluate the semantic understanding of MLMs, we experiment on Natural Language Inference (NLI). NLI is crucial in many tasks such as reading comprehension and commonsense reasoning (Bowman et al., 2015), and it is used as a common benchmark for language understanding. + +Setup We use the entailment task from the SICK dataset (Marelli et al., 2014, SICK-E) which consists of around 10,000 pairs of human-annotated sentences labeled as entailment, contradiction, and neutral. The standard dataset is biased toward the neutral class which represent $56.7\%$ of instances. We also experiment on an unbiased variant with 2-way classification of contradiction vs. entailment (2-way), as well as an unbiased 3-way clas + +
ModelSICK-E Datasets
standard3-way2-way
Majority56.733.350.0
BERT (finetuned)86.784.095.6
BERT (linear probing)68.049.591.9
RoBERTa (linear probing)72.649.491.1
BERT (AUTOPROMPT)62.355.485.7
RoBERTa (AUTOPROMPT)65.069.387.3
+ +Table 2: Natural Language Inference performance on the SICK-E test set and variants. (Top) Baseline classifiers. (Bottom) Fill-in-the-blank MLMs. + +sification variant (3-way). The template used for AUTOPROMPT is provided in Table 3. We search over the following parameters: $|\mathcal{V}_{\text{cand}}| \in \{10,50\}$ , $|\mathcal{V}_y| \in \{1,3,5,10\}$ , $|\pmb{x}_{\text{trig}}| \in [1,5]$ , and choose the best prompt according to development set accuracy. + +Results Table 2 shows that AUTOPROMPT considerably outperforms the majority baseline in all experiments. For example, on the 2-way SICK-E dataset, AUTOPROMPT is comparable to a supervised finetuned BERT. We also test linear probes—linear classifiers trained on top of frozen MLM representations with average pooling—and find AUTOPROMPT has comparable or higher accuracy, despite linear probes being susceptible to false positives. Overall, these results demonstrate that both BERT and RoBERTa have some inherent knowledge of natural language inference. + +We also examine the efficacy of AUTOPROMPT in the low-data regime (using the same procedure as SST-2) on the unbiased 3-way SICK-E data. The results in Figure 2 show that AUTOPROMPT performs on par with finetuned BERT and significantly better than finetuned RoBERTa in low data settings. + +MLMs Excel on Contradiction We find that the label tokens are more interpretable for contradiction compared to entailment or neutral (examples in Table 3). We investigate if this hurts the model performance on entailment and neutral classes. We measure the precision for each label in the 3-way balanced SICK-E dataset. BERT achieves $74.9\%$ , $54.4\%$ , and $36.8\%$ precision for contradiction, entailment, and neutral cases, respectively, while RoBERTa obtains $84.9\%$ , $65.1\%$ , and $57.3\%$ . These results suggest that AUTOPROMPT may be more accurate for concepts that can be easily expressed using natural label tokens. + +# 5 Fact Retrieval + +An important question is whether pretrained MLMs know facts about real-world entities. The LAMA dataset (Petroni et al., 2019) evaluates this using cloze tests that consist of (sub, rel, obj) triples, e.g. (Obama, bornIn, Hawaii), and manually created prompts with missing objects, e.g. "Obama was born in [MASK]". LPAQA (Jiang et al., 2020) extends this idea by systematically creating prompts that are generated by mining Wikipedia, paraphrasing, and crowdsourcing. In this section, we use the same cloze-style setup but automatically generate prompts in order to better evaluate the factual knowledge of MLMs. We compare our approach against LAMA and LPAQA, which are explicitly designed for the task of fact retrieval. + +Setup We reformulate fact retrieval by mapping (sub, rel, obj) triples to a prompt using the template " $\{\text{sub}\} [T] \ldots [T][P]$ ". where the trigger tokens are specific to the relation rel and the correct object obj is the label token. We use the original test set from LAMA (Petroni et al., 2019), henceforth Original. To collect training data for AUTOPROMPT, we gather at most 1000 facts for each of the 41 relations in LAMA from the T-REx dataset (ElSahar et al., 2018). For the relations that still have less than 1000 samples, we gather extra facts straight from Wikidata. We ensure that none of the T-REx triples are present in the test set, and we split the data 80-20 into train and development sets. Moreover, because the collected T-REx data is from a slightly different distribution than the LAMA test set, we also consider a separate evaluation where we split the T-REx triples into a 60-20-20 train/dev/test split and evaluate on the test set. This T-REx dataset is used to measure the performance of our prompts when the train and test data is from the same distribution. + +We use AUTOPROMPT with 5 or 7 tokens, and select the search parameters using the T-REx development set. We prevent proper nouns and tokens that appear as gold objects in the training data from being selected as trigger tokens. This is done to prevent AUTOPROMPT from "cheating" by embedding common answers inside the prompt. To evaluate, we observe the rank of the true object in label token distribution of the MLM, and use standard ranking metrics: mean reciprocal rank (MRR), precision-at-1 $(\mathrm{P@1})$ , and precision-at-10 $(\mathrm{P@10})$ . + +
TaskPrompt TemplatePrompt found by AUTOPROMPTLabel Tokens
Sentiment Analysis{sentence} [T]... [T] [P].unflinchingly bleak and desperate Writing academicswhere overseas will appear [MASK].pos: partnership, extraordinary, ##bla neg: worse, persisted, unconstitutional
NLI{prem}[P][T]... [T]{hyp}Two dogs are wrestling and hugging [MASK] concretephatic workplace There is no dog wrestling and huggingcon: Nobody, nobody, nor ent: ##found, ##ways, Agency neu: ##ponents, ##lary, ##uated
Fact RetrievalX plays Y music {sub}[T]... [T][P].Hall Overton fireplacemade antique son alto [MASK].
Relation ExtractionX is a Y by profession {sent}{sub}[T]... [T][P].Leonard Wood (born February 4, 1942) is a former Canadian politician. Leonard Wood gymnasium brotherdicative himself another [MASK].
+ +Table 3: Example Prompts by AUTOPROMPT for each task. On the left, we show the prompt template, which combines the input, a number of trigger tokens [T], and a prediction token [P]. For classification tasks (sentiment analysis and NLI), we make predictions by summing the model's probability for a number of automatically selected label tokens. For fact retrieval and relation extraction, we take the most likely token predicted by the model. + +
Prompt TypeOriginalT-REx
MRRP@10P@1MRRP@10P@1ModelMRRP@10P@1
LAMA40.2759.4931.1035.7954.2926.38BERT55.2274.0145.23
LPAQA (Top1)43.5762.0334.1039.8657.2731.16RoBERTa49.9068.3440.01
AUTOPROMPT 5 Tokens53.0672.1742.9454.4270.8045.40
AUTOPROMPT 7 Tokens53.8973.9343.3454.8972.0245.57
+ +Table 4: Factual Retrieval: On the left, we evaluate BERT on fact retrieval using the Original LAMA dataset from Petroni et al. (2019). For all three metrics (mean reciprocal rank, mean precision-at-10 $(\mathbb{P}@\mathbb{10})$ , and mean precision-at-1(P@1)), AUTOPROMPT significantly outperforms past prompting methods. We also report results on a T-REx version of the data (see text for details). On the right, we compare BERT versus RoBERTa on a subset of the LAMA data using AUTOPROMPT with 5 tokens. + +Results Table 4 shows the performance of MLMs with different prompting methods, and we show qualitative examples in Table 3 and in Appendix C. Prompts generated using AUTOPROMPT can extract factual knowledge from BERT more effectively than their manual and mined counterparts: we improve P@1 by up to 12 points. Moreover, despite AUTOPROMPT using only one prompt per relation, it still outperforms LPAQA's ensemble method (which averages predictions for up to 30 prompts) by approximately 4 points. Using 7 trigger tokens achieves slightly higher scores than 5 trigger tokens, although the difference is not substantial. This indicates that our approach is stable to the choice of trigger length, which is consistent with our sentiment analysis results. Overall, these results show that AUTOPROMPT can retrieve facts more effectively than past prompting methods, thus demonstrating that BERT contains more factual knowledge than previously estimated. + +Relation Breakdown We also provide a detailed breakdown of the prompts found by Petroni et al. (2019) and AUTOPROMPT, and their associated accuracies in Appendix C, Table 7. Manual prompts are competitive when the prompt is easy to specify, e.g., the prompt "was born in" for the PLACE OF BIRTH relation. On the other hand, AUTOPROMPT performs especially well for relations that are difficult to specify in a natural language prompt. For example, Petroni et al. (2019)'s prompt for the POSITION PLAYED ON TEAM relation is "\{sub\} plays in [MASK] position", which is not as specific as the relation requires. Although the prompt from AUTOPROMPT is not grammatical ("\{sub\} ediacric striker ice baseman defensive \{obj\}") it does contain tokens that are directly related to sports. + +BERT outperforms RoBERTa We finally directly compare BERT and RoBERTa. To do so, we subsample the LAMA test set to consist of examples where the object is a single token for both + +BERT and RoBERTa (Original-RoBERTa).4 BERT actually slightly outperforms RoBERTa, and we find that the prompts generated for RoBERTa tend to contain more irrelevant words (see Appendix C, Table 7). For example, the prompt generated by RoBERTa for the PLAY INSTRUMENT relation contains words such as "Trump" and symbols such as ","(); for the POSITION PLAYED ON TEAM relation. It is surprising that RoBERTa does not perform better than BERT, and it is worthy of investigating this further in future work. Additionally, recall that prompting is a lower bound on a model's knowledge: the lower relative performance does not mean that the model actually knows less. + +# 6 Relation Extraction + +Apart from evaluating whether MLMs know facts, it is also important to evaluate whether they can extract knowledge from text. In this section, we use the task of relation extraction (RE)—to identify how entities are related in a given sentence—an important task in information extraction. We create RE prompts in a similar fashion as fact retrieval: for a given triple (subj, rel, obj) and sentence that expresses this relation, we construct a prompt as “{sent} {sub} [T]... [T][P].”, where the trigger tokens are specific to the relation, and label token is the correct object obj (see Table 3 for an example). + +Setup We use the T-Rex dataset for RE because each T-REx fact comes with context sentences that mention the subject and object surface forms. We compare AUTOPROMPT to LAMA and LPAQA (their prompts are still useful here), as well as a recent supervised relation extraction model (Sorokin and Gurevych, 2017) that was also used by Petroni et al. (2019). To make the evaluation fair for the supervised RE model, we modify the standard RE evaluation. We give the model credit as long as it does not predict a different relation for the subject and object, i.e. we ignore the "no relation" prediction and all other relations. We also drop all sentences from evaluation for which the model's named entity extractor failed to identify the subject and the object as entities. See Appendix B for further details. For the evaluation of all systems, we treat a prediction as correct if it is either the canonical version of the object (e.g., "USA") or the rendered surface form (e.g., "American") for any of the context sentences in a given triple. + +Results Table 5 shows the results for BERT and RoBERTa. MLMs can extract relational information more effectively than the supervised RE model, providing up to a $33\%$ increase on the task when using AUTOPROMPT. RoBERTa also outperforms the supervised RE model, although it is worse than BERT (likely for similar reasons as we outline in Section 5). For both BERT and RoBERTa, we notice that the trigger tokens consist of words related to their corresponding relations (see Appendix D, Table 8 for full list), e.g. RoBERTa selects "defy trademarks of namesake manufacturer" for relation MANUFACTURER/PRODUCER OF PRODUCT. + +Perturbed Sentence Evaluation A possible explanation for the strong results of MLMs in the RE setting is that they may already know many of the relations. Thus, they may directly predict the objects instead of extracting them. To separate this effect, we synthetically perturb the relation extraction dataset by replacing each object in the test data with a random other object and making the same change to the prompt. For example, "Ryo Kase (born November 9, 1974 in Yokohama → Yorkshire) is a Japanese actor" where Ryo Kase is the subject, Yokohama is the original object, and Yorkshire is the new object. We regenerate the prompts using the perturbed version of the data. + +The accuracy of the RE model does not change significantly on the perturbed data (Table 5), however, the accuracy of the MLMs decreases significantly. This indicates that a significant portion of MLM accuracy comes from background information rather than relation extraction. Nevertheless, our prompts for BERT outperform their LAMA and LPAQA counterparts, which provides further evidence that AUTOPROMPT produces better probes. + +# 7 Discussion + +Prompting as an Alternative to Finetuning The goal of prompting a language model is to probe the knowledge that the model acquired from pretraining. Nevertheless, prompting has some practical advantages over finetuning for solving realworld tasks. First, as shown in Section 3, prompts generated using AUTOPROMPT can achieve higher accuracy than finetuning in the low-data regime. Moreover, prompting has advantages over finetuning when trying to solve many different tasks (e.g., the many users of the OpenAI GPT-3 API Brown et al. 2020). In particular, finetuning requires storing large language model checkpoints for each in + +
ModelOriginalPerturbed
Supervised RE LSTM57.9558.81
BERT (LAMA)69.0628.02
BERT (LPAQA)76.5530.79
BERT (AUTOPROMPT)90.7356.43
RoBERTa (AUTOPROMPT)60.3328.95
+ +Table 5: Relation Extraction: We use prompts to test pretrained MLMs on relation extraction. Compared to a state-of-the-art LSTM model from 2017, MLMs have higher mean precision-at-1 (P@1), especially when using prompts from AUTOPROMPT. We also test models on sentences that have been edited to contain incorrect facts. The accuracy of MLMs drops significantly on these sentences, indicating that their high performance stems from their factual knowledge. + +individual task, and, more importantly, it drastically increases system cost and complexity because it requires deploying many different models at the same time. Prompting alleviates both of these issues. We can simply store the prompts for each individual task, and use the same pretrained model for inputs of any of the tasks. + +Limitations of Prompting There are certain phenomena that are difficult to elicit from pretrained language models via prompts. In our preliminary evaluation on datasets such as QQP (Iyer et al., 2017) and RTE (Dagan et al., 2005), prompts generated manually and with AUTOPROMPT did not perform considerably better than chance. However, we cannot conclude that BERT does not know paraphrasing or entailment from these results. In general, different probing methods have different tasks and phenomena they are suitable for: AUTOPROMPT makes prompt-based probes more generally applicable, but, it still remains just one tool in the toolbox of the interpretability researcher. + +Limitations of AUTOPROMPT One downside of AUTOPROMPT is that it requires labeled training data. Although this is also required for other probing techniques (e.g., linear probing classifiers), manual prompts rely on domain/language insights instead of labeled data. Compared to human-designed prompts, AUTOPROMPT generated prompts lack interpretability, which is similar to other probing techniques, such as linear probing classifiers. Another limitation of AUTOPROMPT is that it can sometimes struggle when the training data is highly imbalanced. For example, in Sections 4 and 5 we show that the prompts often just increase the likelihood of the majority label. Re + +balancing the training data can help to mitigate this problem. Finally, due to the greedy search over the large discrete space of phrases, AUTOPROMPT is sometimes brittle; we leave more effective crafting techniques for future directions. + +# 8 Conclusion + +In this paper, we introduce AUTOPROMPT, an approach to develop automatically-constructed prompts that elicit knowledge from pretrained MLMs for a variety of tasks. We show that these prompts outperform manual prompts while requiring less human effort. Furthermore, the results for sentiment analysis and textual entailment suggest that, in some data-scarce settings, it may be more effective to prompt language models than to finetune them for the task. Although we focus only on masked language models in this paper, our method can be trivially extended to standard language models, and thus maybe useful for constructing inputs for models like GPT-3 (Brown et al., 2020). Source code and datasets to reproduce the results in this paper is available at http://ucinlp.github.io/autoprompt. + +# Acknowledgments + +We would like to thank the LAMA and LPAQA teams for answering our questions. We would also like to thank the members of UCI NLP, Matt Gardner, Sebastian Riedel, and Antoine Bosselut for valuable feedback. This material is based upon work sponsored by the DARPA MCS program under Contract No. N660011924033 with the United States Office Of Naval Research. + +# References + +Zied Bouraoui, Jose Camacho-Collados, and Steven Schockaert. 2019. Inducing relational knowledge from BERT. In AAAI. +Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. 2015. A large annotated corpus for learning natural language inference. In EMNLP. +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. +Alexis Conneau, Germán Kruszewski, Guillaume Lample, Loïc Barrault, and Marco Baroni. 2018. What + +you can cram into a single vector: Probing sentence embeddings for linguistic properties. In ACL. +Ido Dagan, Oren Glickman, and Bernardo Magnini. 2005. The PASCAL recognising textual entailment challenge. In *Machine Learning Challenges Workshop*. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL*. +Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah Smith. 2020. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. arXiv preprint arXiv:2002.06305. +Hady ElSahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon S. Hare, Frédérique Laforest, and Elena Simperl. 2018. T-REx: A large scale alignment of natural language with knowledge base triples. In LREC. +John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In EMNLP. +Shankar Iyer, Nikhil Dandekar, and Kornel Csernai. 2017. First quora dataset release: Question pairs. +Sarthak Jain and Byron C Wallace. 2019. Attention is not explanation. In *NAACL*. +Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. 2020. How can we know what language models know? In TACL. +Sunjae Kwon, Cheongwoong Kang, Jiyeon Han, and Jaesik Choi. 2019. Why do masked neural language models still need common sense knowledge? arXiv preprint arXiv:1911.03024. +Patrick Lewis, Ludovic Denoyer, and Sebastian Riedel. 2019. Unsupervised question answering by cloze translation. In ACL. +Nelson F Liu, Matt Gardner, Yonatan Belinkov, Matthew Peters, and Noah A Smith. 2019. Linguistic knowledge and transferability of contextual representations. In NAACL. +Marco Marelli, Stefano Menini, Marco Baroni, Luisa Bentivogli, Raffaella Bernardi, Roberto Zamparelli, et al. 2014. A SICK cure for the evaluation of compositional distributional semantic models. In LREC. +Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In NAACL. +Fabio Petroni, Tim Rocttäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. 2019. Language models as knowledge bases? In EMNLP. + +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. Technical report. +Timo Schick and Hinrich Schütze. 2020. Exploiting cloze questions for few-shot text classification and natural language inference. arXiv preprint arXiv:2001.07676. +Vered Shwartz, Peter West, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2020. Unsupervised commonsense question answering with self-talk. arXiv preprint arXiv:2004.05483. +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 EMNLP. +Daniil Sorokin and Iryna Gurevych. 2017. Context-aware representations for knowledge base relation extraction. In EMNLP. +Trieu H Trinh and Quoc V Le. 2018. A simple method for commonsense reasoning. arXiv preprint arXiv:1806.02847. +Elena Voita and Ivan Titov. 2020. Information-theoretic probing with minimum description length. In EMNLP. +Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. 2019. Universal adversarial triggers for attacking and analyzing NLP. In EMNLP. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. 2019. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR. +Sarah Wiegrefe and Yuval Pinter. 2019. Attention is not not explanation. In EMNLP. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtopicz, 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. 2019. HuggingFace's Transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771. + +# A Effect of Hyperparameters on Sentiment Analysis + +![](images/38ec2a9ef0ea51095c67f72ed007e508ecf0678dee845e61200b0e8de9fed081.jpg) + +![](images/9b886c9e49115e59ff00bf3e268c531ab2dd9e2d9534836dfd621a85fc63e5c8.jpg) +Figure 3: Effect of Label and Trigger Set Sizes on sentiment analysis. The number of candidate replacements is fixed at $|\mathcal{V}_{\mathrm{cand}}| = 100$ . Increasing the label set size improves performance, while changing the trigger length does not have much impact. + +To measure the effects of the AUTOPROMPT search hyperparameters, we plot the validation accuracy as a function of label set size $|\mathcal{V}_y|$ and the number of trigger tokens $|x_{\mathrm{trig}}|$ in Figure 3. We fix the number of candidates at $|\mathcal{V}_{\mathrm{cand}}| = 100$ . We observe similar trends when $|\mathcal{V}_{\mathrm{cand}}| = 10$ . + +Varying the number of trigger tokens generally has little effect. On the other hand, there is a substantial increase in accuracy when increasing the label set size from 1 to 3 (approximately $+5\%$ for BERT, and $+10\%$ for RoBERTa). After analyzing the label sets, we find that our method generally produces intuitive results—"marvelous" and "philanthrop" are associated with positive sentiment, whereas "worse" and "incompetence" are associated with negative sentiment for RoBERTa. + +# B Relation Extraction Details + +Following Petroni et al. (2019), we use the pretrained RE model from Sorokin and Gurevych (2017) as our baseline. To encode the sentence, this model uses a combination of an LSTM-based relation encoder and an attention mechanism. To make predictions, the model constructs a knowledge graph whose edges are the extracted relation triples. The standard RE evaluation measures how well the model predicts the relation types of entity pairs on the sentence level. + +Since our goal is to extract the object of relation triplets, rather than the relation itself, we tweak the standard RE evaluation. We feed the RE model sentences from test facts and we query the resulting graph for all edges that contain the given subject and relation. Then we select the triple with the highest confidence and compare it's object to the gold object. We do this for every fact and take the average across all relations to get the overall precision. The RE model is not trained to predict two of the original T-REx relations. For fair comparison, we exclude these two relations for our evaluation. + +C Additional Fact Retrieval Results + +
RelationManual Prompt (LAMA)#trainLAMALPAQAAUTOPROMPT
P1001[X] is a legal term in [Y]100070.4772.7582.45
P101[X] works in the field of [Y]8649.915.3212.79
P103The native language of [X] is [Y]100072.1672.1682.09
P106[X] is a [Y] by profession10000.630.014.72
P108[X] works for [Y]3766.795.748.62
P127[X] is owned by [Y]54834.7932.4635.95
P1303[X] plays [Y]10007.5918.0215.38
P131[X] is located in [Y]100023.2722.8137.46
P136[X] plays [Y] music10000.7516.7655.42
P1376[X] is the capital of [Y]31073.9359.8340.17
P138[X] is named after [Y]85661.5559.6966.05
P140[X] is affiliated with the [Y] religion4450.6359.8375.26
P1412[X] used to communicate in [Y]100065.0264.7171.21
P159The headquarters of [X] is in [Y]100032.3735.5735.47
P17[X] is located in [Y]100031.2935.4852.15
P176[X] is produced by [Y]100085.6481.6787.78
P178[X] is developed by [Y]56062.8459.1266.72
P19[X] was born in [Y]100021.0820.8719.92
P190[X] and [Y] are twin cities8952.411.912.31
P20[X] died in [Y]100027.9127.9131.16
P264[X] is represented by music label [Y]10009.5610.2643.82
P27[X] is [Y] citizen10000.041.5146.69
P276[X] is located in [Y]100041.541.544.11
P279[X] is a subclass of [Y]100030.7414.7554.93
P30[X] is located in [Y]100025.4418.5670.36
P31[X] is a [Y]100036.6636.6651.95
P36The capital of [X] is [Y]100062.1662.1660.6
P361[X] is part of [Y]100023.6131.4417.7
P364The original language of [X] is [Y]100044.5143.9348.48
P37The official language of [X] is [Y]31154.5556.8362.63
P39[X] has the position of [Y]10007.9616.1430.72
P407[X] was written in [Y]100059.1865.2268.42
P413[X] plays in [Y] position10000.5323.7441.7
P449[X] was originally aired on [Y]100020.899.0834.39
P463[X] is a member of [Y]67967.1157.3354.22
P47[X] shares border with [Y]100013.6713.3419.52
P495[X] was created in [Y]100016.532.2336.63
P527[X] consists of [Y]100011.0710.5525.61
P530[X] maintains diplomatic relations with [Y]9272.813.923.11
P740[X] was founded in [Y]10007.5913.6813.89
P937[X] used to work in [Y]100029.7739.138.36
+ +Table 6: A breakdown of all relations for fact retrieval on the original dataset from Petroni et al. (2019). We compare P@1 of prompts generated by LAMA, LPAQA, and our approach using five prompt tokens. + +
RelationMethodPromptP@1
P101Manual[X] works in the field of [Y]11.52
AUTOPROMPT BERT[X] probability earliest fame totaled studying [Y]15.01
AUTOPROMPT RoBERTa[X] 1830 dissertation applying mathsucci [Y]0.17
P103ManualThe native language of [X] is [Y]74.54
AUTOPROMPT BERT[X]PA communerug speaks proper [Y]84.87
AUTOPROMPT RoBERTa[X]neau optionally fluent!?traditional [Y]81.61
P106Manual[X] is a [Y] by profession0.73
AUTOPROMPT BERT[X] supporters studied politicians musician turned [Y]15.83
AUTOPROMPT RoBERTa[X](), astronomers businessman-former [Y]19.24
P127Manual[X] is owned by [Y]36.67
AUTOPROMPT BERT[X] is hindwings mainline architecture within [Y]47.01
AUTOPROMPT RoBERTa[X] picThom unwillingness officially governs [Y]39.58
P1303Manual[X] plays [Y]18.91
AUTOPROMPT BERT[X] playingdrum concertoative electric [Y]42.69
AUTOPROMPT RoBERTa[X] Trump learned soloKeefe classical [Y]44.44
P136Manual[X] plays [Y] music0.7
AUTOPROMPT BERT[X] freaking genre orchestra fiction acid [Y]59.95
AUTOPROMPT RoBERTa[X] blends postwar hostage drama sax [Y]52.97
P1376Manual[X] is the capital of [Y]81.11
AUTOPROMPT BERT[X] boasts native territory traditionally called [Y]63.33
AUTOPROMPT RoBERTa[X] limestone depositedati boroughDepending [Y]28.33
P178Manual[X] is developed by [Y]62.76
AUTOPROMPT BERT[X] is memory arcade branding by [Y]64.45
AUTOPROMPT RoBERTa[X] 1987 floppy simulator users sued [Y]69.56
P20Manual[X] died in [Y]32.07
AUTOPROMPT BERT[X] reorganizationotype photographic studio in [Y]33.53
AUTOPROMPT RoBERTa[X]. enigmatic twentieth nowadays near [Y]31.33
P27Manual[X] is [Y] citizen0.0
AUTOPROMPT BERT[X] m³ badminton pieces internationally representing [Y]46.13
AUTOPROMPT RoBERTa[X] offic organise forests statutes northwestern [Y]42.07
P276Manual[X] is located in [Y]43.73
AUTOPROMPT BERT[X] consists kilograms centred neighborhoods in [Y]44.64
AUTOPROMPT RoBERTa[X] manoeuv constructs whistleblowers hills near [Y]37.47
P279Manual[X] is a subclass of [Y]31.04
AUTOPROMPT BERT[X] is i adequately termed coated [Y]55.65
AUTOPROMPT RoBERTa[X], formerly prayers unstaceous [Y]52.55
P37ManualThe official language of [X] is [Y]56.89
AUTOPROMPT BERT[X]inen dialects resembled officially exclusively [Y]54.44
AUTOPROMPT RoBERTa[X]onen tribes descending speak mainly [Y]53.67
P407Manual[X] was written in [Y]60.21
AUTOPROMPT BERT[X] playedić every dialect but [Y]69.31
AUTOPROMPT RoBERTa[X] scaven pronunciation.*Wikipedia speaks [Y]72.0
P413Manual[X] plays in [Y] position0.53
AUTOPROMPT BERT[X] played colors skier ↔ defensive [Y]41.71
AUTOPROMPT RoBERTa[X], ex-,Liverpool [Y]23.21
+ +Table 7: Examples of manual prompts (first line, shown with BERT's P@1) and prompts generated via AUTO-PROMPT for Fact Retrieval. + +D Additional Relation Extraction Results + +
RelationModelContext and PromptPrediction
P103 (native language)BERTAlexandra Lamy (born 14 October 1971) is a French actress. Alexandra Lamy speaks airfield dripping % of [MASK].French
P36 (capital)RoBERTaKirk was born in Clinton County, Ohio, and he entered service in Wilmington, Ohio. Clinton County famously includes the zoo influencing [MASK].Wilmington
P530 (diplomatic relation)BERTThe Black Sea forms in an east-west trending elliptical depression which lies between Bulgaria, Georgia, Romania, Russia, Turkey, and Ukraine. Ukraine qualified some immigration actually entered [MASK].Russia
P106 (occupation)RoBERTaSpencer Treat Clark (born September 24, 1987) is an American actor who has appeared in several films, including Gladiator, Mystic River, and Unbreakable. Spencer Treat Clark famously the famously handsome the [MASK].Hulk
P276 (location)BERTThe Immortal Game was a chess game played by Adolf Anderssen and Lionel Kieseritzky on 21 June 1851 in London Seoul, during a break of the first international tournament. The Immortal Game locatedStered regardless streets in [MASK].Seoul
P176 (manufacturer)RoBERTaThe Honda Civic del Sol is a 2-seater front-engined, front wheel drive, targa top car manufactured by Honda Toyota in the 1990s. Honda Civic del Sol defy trademarks of name-sake manufacturer [MASK].Toyota
P279 (subclass of)BERTMizeria is a Polish salad sandwich consisting of thinly sliced or grated cucumbers, often with sour cream though in some cases oil. Mizeria is calls direcend altitude [MASK].food
P463 (member of)RoBERTaRushAerosmith was a Canadian rock band consisting of Geddy Lee (bass, vocals, keyboards), Alex Lifeson (guitars), and Neil Peart (drums, percussion, lyricist). Alex Lifeson affiliatedalach the internationally initials [MASK].Kiss
+ +Table 8: Examples of prompts generated using AUTOPROMPT for relation extraction. Underlined words represent the gold object. The bottom half of the Table shows examples of our augmented evaluation where the original objects (represented by crossed-out words) are replaced by new objects. \ No newline at end of file diff --git a/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/images.zip b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..9610e544e6a57db87822b4adcbcd9f7c0adaa6ae --- /dev/null +++ b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8b083a681e69d4087d5557bec0a22bc5806ceef65d450f555e857795ad38c8d +size 1033770 diff --git a/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/layout.json b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c880e40ac97d6b090a5e8cdc93274bbab6ced1e6 --- /dev/null +++ b/autopromptelicitingknowledgefromlanguagemodelswithautomaticallygeneratedprompts/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdfaaaea038a25246d355cac9b3c564270891136f7130c040f006638a9551073 +size 342574 diff --git a/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_content_list.json b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..273488abd4fb445cc43cf42c4675d78a423a9606 --- /dev/null +++ b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a841630492213c5cbe4240cf716040bf4be13fa39b78b231ffe2d902d2f427fc +size 86376 diff --git a/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_model.json b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7e2be6d8cc6809ac8a70ea1ba81d198e35baf5d1 --- /dev/null +++ b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4b3c9d16f38f71ff2fd24743fd1fdf66fbba9d62989b16ffc2815935350990f +size 107499 diff --git a/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_origin.pdf b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f851e104dc62bd5ae20eb95b7f59c77bffd3c5fb --- /dev/null +++ b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/32e76be9-18a1-4655-a3f6-603db88e042d_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47a8db4de2c43ed95e5a94f7bf75b04527c780d26df02a677bcaf5f8fcc33803 +size 307538 diff --git a/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/full.md b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/full.md new file mode 100644 index 0000000000000000000000000000000000000000..dd35966d50c88fcc3f64318bfdb86d33988a56f8 --- /dev/null +++ b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/full.md @@ -0,0 +1,321 @@ +# AutoQA: From Databases To QA Semantic Parsing With Only Synthetic Training Data + +Silei Xu* Sina J. Semnani* Giovanni Campagna Monica S. Lam + +Computer Science Department + +Stanford University + +Stanford, CA, USA + +{silei,sinaj,gcampaign,lam}@cs.stanford.edu + +# Abstract + +We propose AutoQA, a methodology and toolkit to generate semantic parsers that answer questions on databases, with no manual effort. Given a database schema and its data, AutoQA automatically generates a large set of high-quality questions for training that covers different database operations. It uses automatic paraphrasing combined with template-based parsing to find alternative expressions of an attribute in different parts of speech. It also uses a novel filtered auto-paraphraseer to generate correct paraphrases of entire sentences. + +We apply AutoQA to the Schema2QA dataset and obtain an average logical form accuracy of $62.9\%$ when tested on natural questions, which is only $6.4\%$ lower than a model trained with expert natural language annotations and paraphrase data collected from crowdworkers. To demonstrate the generality of AutoQA, we also apply it to the Overnight dataset. AutoQA achieves $69.8\%$ answer accuracy, $16.4\%$ higher than the state-of-the-art zero-shot models and only $5.2\%$ lower than the same model trained with human data. + +![](images/4d29c3abb9ab3a105f7d843c87ca47be314d05b048a1df3ff9f1b83bd6523523.jpg) +Figure 1: The architecture of the AutoQA toolkit. (a) The auto-annotator extracts annotations from paraphrases. (b) A template-based data synthesizer (Xu et al., 2020) generates data from the annotations to train a semantic parser. (c) An auto-paraphraseer uses self-training to iteratively introduce more paraphrases to train the next version of the semantic parser. The red dotted lines show that generated paraphrases are filtered out unless the current semantic parser can translate them to the logical forms of the original sentences. + +# 1 Introduction + +Semantic parsing is the task of mapping natural language sentences to executable logical forms. It has received significant attention in question answering systems for structured data (Wang et al., 2015; Zhong et al., 2017; Yu et al., 2018b; Xu et al., 2020). However, training a semantic parser with good accuracy requires a large amount of annotated data, which is expensive to acquire. The complexity of logical forms means annotating the data has to be done by an expert. This adds to the cost and hinders extending question answering to new databases and domains. + +To eliminate the need for annotating data with logical forms, SEMPRE (Wang et al., 2015) proposed the new methodology of first synthesizing questions on the database, then manually paraphrasing them. Recently, the Schema2QA toolkit (Xu et al., 2020) demonstrated that it is possible to achieve high accuracy on realistic user inputs using this methodology with a comprehensive set of generic, domain-independent question templates. However, this approach requires a significant manual effort for each domain: the developers must supply how each attribute can be referred to using different parts of speech, and crowdworkers are needed to paraphrase the queries. + +Our objective is to eliminate the need for manual effort in building semantic parsers, while achieving comparable accuracy. We hypothesize that, for common domains, the knowledge of how each attribute would be referred to in natural language is implicitly presented in large text corpora and can be captured by general-purpose paraphrasing models. With that insight, we developed AutoQA, a toolkit that (1) automatically annotates the database attributes using paraphrasing models, (2) uses generic templates to synthesize a large set of complex queries, and (3) uses a novel filtered autoparamphaser to further increase the variety of the synthesized data. The resulting dataset is then used to train a BERT-LSTM model (Xu et al., 2020). The architecture of AutoQA is shown in Fig. 1. + +The contributions of this paper are: + +- AutoQA, a toolkit that automatically creates a semantic parser that answers questions about a given database. As the parser is trained only with automatically generated data, its cost is significantly lower than current approaches. +- A novel algorithm for annotating database attributes with phrases in different parts of speech. The algorithm is based on automatic paraphrasing combined with template-based parsing (Section 4). +- A new automatic paraphrasing model, based on BART (Lewis et al., 2019), that can generate natural paraphrases of sentences, with a filter trained with synthetic data to ensure the preservation of the original meaning expressed in a formal language (Section 5). +- The methodology has been tested on the Overnight dataset (Wang et al., 2015) and Schema.org web data (Xu et al., 2020) (Section 6). On Overnight, AutoQA achieves an average of $55.6\%$ logical form accuracy and $69.8\%$ denotation (answer) accuracy without using the human paraphrases for training, which are $18.6\%$ and $16.4\%$ higher than the state-of-the-art zero-shot models, respectively. On Schema.org, AutoQA achieves an average logical form accuracy of $62.9\%$ , within $6.4\%$ of models trained with manual annotations and human paraphrases. $^{1}$ + +# 2 Related Work + +Bootstrapping Semantic Parsers. Neural semantic parsing for question answering is a well-known research topic (Pasupat and Liang, 2015; Wang et al., 2015; Dong and Lapata, 2016; Jia and Liang, 2016; Krishnamurthy et al., 2017; Zhong et al., 2017; Yu et al., 2018b). State of the art methods use a sequence-to-sequence architecture with attention and copying mechanism (Dong and Lapata, 2016; Jia and Liang, 2016) and rely on large datasets. Acquiring such datasets is expensive, and the work must be replicated in every new domain. + +Prior work proposed bootstrapping semantic parsers using paraphrasing (Wang et al., 2015), where a dataset is synthesized using a grammar of natural language, and then paraphrased by crowd-workers to form the training set. Paraphrasing has been applied to datasets for SQL (Zhong et al., 2017), as well as multi-turn dialogue datasets (Shaw et al., 2018; Rastogi et al., 2019). + +Our previous work with Genie (Campaigna et al., 2019) proposed training with large amounts of synthesized and smaller amounts of paraphrased data. Later, we developed Schema2QA (Xu et al., 2020), a synthesis tool based on a general grammar of English. Schema2QA was found to be effective for the question answering task on the Web. Both works rely on manual paraphrases and hand-tuned annotations on each database attribute. Training with synthetic data has also been explored to complement existed dataset (Weir et al., 2020) and in the few-shot setting (Campaigna et al., 2020; Moradshahi et al., 2020). + +A different line of work proposed training with a large multi-domain dataset, and then using transfer learning to generalize to new datasets, in a completely zero-shot fashion (Herzig and Berant, 2018a; Chang et al., 2019). Yet, such scenario requires acquiring the multi-domain dataset in the first place, and there is a significant gap between the accuracy of training with and without in-domain data (Yu et al., 2018b). Our approach instead is able to synthesize data for the new domain, so the model is exposed to in-domain data while retaining the zero-shot property of no human-annotated data. + +Pre-trained Models for Data Augmentation. Previous work showed that pre-trained models are very effective at generalizing natural language knowledge in a zero- and few-shot fashion (Radford et al., 2019; Brown et al., 2020). These models + +
Question: Show me 5-star restaurants with more than 100 reviews? +ThingTalk: Restaurant, aggregateRating.ratingValue == 5 && aggregateRating.reviewCount >= 100
Question: What's the phone number of the McDonald's on Parker Road? +ThingTalk: [telephone] of (Restaurant, id = "McDonald's" && geo == new Location("Parker Road")
Question: Which is the best Chinese restaurants around here? +ThingTalk: sort aggregateRating.ratingValue desc of (Restaurant, geo == HERE && servesCuisine ==~ "Chinese")
+ +Table 1: Example questions in the restaurant domain with their ThingTalk representations. + +have been used to expand training data for various NLP classification tasks, by fine-tuning the model on a small seed dataset, then using conditioning on the class label to generate more data (Anaby-Tavor et al., 2020; Kumar et al., 2020). Kobayashi (2018) proposed using a bidirectional LSTM-based language model to substitute words that fit the context, conditioning on the class label to prevent augmentation from changing the class label. Wu et al. (2019) used BERT (Devlin et al., 2019) in a similar way, and Hu et al. (2019b) improved upon it by jointly fine-tuning BERT and the classifier. Semnanani et al. (2019) explored data augmentation for domain transfer using BERT. + +These approaches rely on an initial dataset with many examples in each class, and therefore are not suitable for semantic parsing, where each logical form has only a few or even just one example. + +Neural Paraphrasing for Data Augmentation. The performance of many NLP tasks can be improved by adding automatically generated paraphrases to their training set. The general approach is to build a paraphrase generation model, usually a neural model (Prakash et al., 2016, Iyyer et al., 2018, Gupta et al., 2017), using general-purpose datasets of paraphrase sentence pairs. + +Data augmentation through neural paraphrasing models has been applied to various tasks such as sentiment analysis (Iyyer et al., 2018), intent classification (Roy and Grangier, 2019), and span-based question answering (Yu et al., 2018a). Paraphrasing models may generate training examples that do not match the original label. Noisy heuristics, such as those employed by Yu et al. (2018a), are not enough for semantic parsing, where paraphrases need to be semantically equivalent in a very strict and domain-dependent sense. We propose a novel filtering approach, and show its effectiveness in reducing the noise of neural paraphrasing. + +# 3 Schema2QA Data Synthesis Pipeline + +AutoQA is based on Schema2QA (Xu et al., 2020), the state-of-the-art pipeline to generate high-quality training data for database QA at a low cost. Schema2QA first synthesizes utterance and formal representation pairs with a template-based algorithm, and then paraphrases utterances via crowdsourcing. The semantic parser is trained with both synthetic and paraphrased data, and tested on crowdsourced, manually annotated real questions. + +Instead of relying on crowdworkers to paraphrase and create variety from the synthesized canonical questions, Schema2QA uses a comprehensive set of 800 domain-independent templates, along with a few manual annotations for each attribute in each domain, to synthesize high-quality data. About $2\%$ of the synthesized data are manually paraphrased. + +Our previous work (Xu et al., 2020) shows that a parser trained on such dataset achieves $70\%$ accuracy on natural complex questions. Table 1 shows a few questions that Schema2QA can parse and their representation in ThingTalk, which is a query language designed to support translation from natural language. + +Schema2QA answers long-tail questions well because its synthesized data have good coverage of possible questions asked, while showing great linguistic variety. It synthesizes questions using generic question templates, which have placeholders to be substituted with domain-specific annotations that match the expected part-of-speech (POS) type. Table 2 shows how annotations of the 6 POS categories for the "AlumniOf" attribute are used in the example templates to synthesize example utterances. In total, six POS categories are identified: active verb phrase, passive verb phrase, adjective phrase, prepositional phrase, and two noun phrases: is-a noun phrase which describes what the subject is, has-a noun phrase which describes what the subject has. There is a wide variety in annotations for an attribute, and often only a sub + +
POSAnnotationExample templateExample utterance
is-a nounalumni of valuetable that|which|who is|are [noun phrase] valuepeople who are alumni of Stanford
has-a nouna value degreetable with (a|an|the) value [noun phrase]people with a Stanford degree
active verbgraduated from valuetable that|which|who [verb phrase] valuepeople who graduated from Stanford
passive verbeducated at valuetable [passive verb phrase] valuepeople educated at Stanford
adjectivevaluevalue tableStanford people
prepositionalfrom valuetable [prepositional phrase] valuepeople from Stanford
+ +Table 2: Annotations for "alumniOf" attribute with example templates and utterances in six POS categories, where table and value denote the placeholders for table canonical annotations and values, respectively. + +set of POS types is relevant to an attribute. It is thus challenging, often requiring multiple rounds of error analysis, to come up with these different annotations manually. + +# 4 Automatic Annotation + +Our AutoQA toolkit automatically provides unambiguous attribute annotations for all parts of speech, with the help of a neural paraphrasing model. + +# 4.1 Canonical Annotation + +AutoQA first derives a canonical annotation for each table and its attributes. Where necessary, it splits the attribute name into multiple words (e.g. "alumniOf" turns into "alumni of"). It then uses a POS tagger to identify the category of the canonical annotation. + +The canonical annotation is used both for training and as the starting point to identify alternative phrases for each attribute, hence it must be meaningful and unambiguous. When applying AutoQA to an existing ontology, developers can override the table or attribute names if they are not meaningful or they are ambiguous. + +# 4.2 POS-based Annotation Extraction + +As shown in Table 2, an attribute can be described in various ways in different parts of speech. It is not enough to retrieve synonyms of the canonical annotation, as all synonyms will have the same POS. Some synonyms may also be inappropriate for the domain, if generated without context. + +Our goal is to automatically derive all the other POS annotations given a canonical annotation. For example, the canonical annotation for the "alumniOf" attribute is "alumni of value" of POS "is-a-noun", as shown in the first row of Table 2. We wish to derive other "is-a-noun" annotations, as well as those in other POS categories in the table. + +Our solution is to synthesize questions using the templates for the POS of the canonical annotation, + +get paraphrases from a neural model, parse the paraphrases using the templates as grammar rules, and turn successful parses into annotations. + +AutoQA first generates short example sentences for each attribute using its canonical annotation. We generate questions that ask for objects with a given value of the attribute, using the grammar templates for the POS of the canonical annotation for the attribute. We generate up to 10 sentences for each alternative in the grammar template, using a different value for each one. + +Second, AutoQA obtains paraphrases for the generated sentences using a neural paraphraseer based on the BART sequence-to-sequence model (Section 6.1). To get more diverse paraphrases, we run 3 rounds of paraphrasing, where in each round we paraphrase the output of the previous round. All the words are tagged with their POS. For example, with "people who are alumni of Stanford" as an input, we can get paraphrases such as "people with a Stanford degree", as shown in the last column of Table 2. + +Third, AutoQA parses the paraphrases using the templates (third column in Table 2) as grammar rules. A phrase is considered a successful parse only if the "table" and the "value" match exactly and the POS of all placeholders match that of the corresponding words. Correctly parsed phrases are then turned into annotations. + +Note that we generate only sentences that map to selection operations, such as "show me people who are alumni of Stanford". Selection questions include a sample value, "Stanford", for the attribute, which is useful to provide a better context for the paraphraseer. The paraphraseer can generate phrases like "find people from Stanford", which is trivial to parse correctly. In contrast, values are missing in projection questions, such as "what institution are the people alumni of", which makes paraphrasing and subsequent parsing harder. While we only paraphrase selection questions, the annotations identi + +fied will be used for all types of questions. + +# 4.3 Resolving Conflicts + +Neural paraphrasing is imperfect and can generate incorrect annotations. Our priority is to eliminate ambiguity: we do not worry as much about including nonsensical sentences in the training, as such sentences are unlikely to appear at test time. Consider a movie domain with both "director" and "creator" attributes. The paraphrasing model might generate the annotation "creator" for "director". To avoid generating such conflicted annotations within the domain, we detect annotations that appear in two or more attributes of the same type in the database. If such an annotation shares the same stem as one attribute name, it is assigned uniquely to that attribute. Otherwise, it is dropped entirely. As we train with data that is synthesized compositionally, we would rather lose a bit of variety than risk introducing ambiguity. + +# 5 Automatic Paraphrasing + +Synthetic training data is good for providing coverage with a large number of perfectly annotated sentences, and to teach the neural semantic parser compositionality. However, grammar-based synthesis often results in clunky sentences and grammatical errors. In addition, even with 800 generic templates, the synthesized sentences still lack naturalness and variety. In particular, people often compress multiple concepts into simpler constructions (sublexical compositionality (Wang et al., 2015)), e.g. "books with at least 1 award" can be simplified to "award-winning books". + +Capturing these linguistic phenomena in the training data is not possible with a finite set of templates. This is why paraphrasing is critical when training semantic parsers. Here we describe how we approximate manual paraphrases with a neural paraphrasing model. + +# 5.1 Noise in Neural Paraphrasing + +Using automatically generated paraphrases for training is challenging. First, paraphrasing models output noisy sentences, partially due to the noise in the existing paraphrasing datasets2. We cannot + +accept paraphrases that change the meaning of the original sentence, which is represented by the logical form annotation. This noise problem exists even in human paraphrasing; Wang et al. (2015) reports that $17\%$ of the human paraphrases they collected changed the logical form. Second, there is an inherent diversity-noise trade-off when using automatic generation. The more diverse we want to make the outputs, the noisier the model's output will be. Third, the auto-paraphraseer is fed with synthetic sentences, which have a different distribution compared to the paraphrase training set. + +We have empirically found the following ways in which noise is manifested: + +- The output is ungrammatical or meaningless. +- The output changes in meaning to a different but valid logical form, or rare words like numbers and proper nouns are changed. +- The model is "distracted" by the input sentence due to limited world knowledge. "I'm looking for the book the dark forest", is very different from "I'm looking for the book in the dark forest". +- The model outputs sentence pairs that can be used interchangeably in general, but not in the specific application. For example, "restaurants close to my home" and "restaurants near me" have different target logical forms. +- Automatically-generated annotations are not reviewed by a human to ensure their correctness. An example is the word "grade" instead of "stars" in the hotels domain. Further paraphrasing these noisy sentences amplifies the noise. + +# 5.2 Paraphrase Filtering + +How do we produce semantically correct paraphrases and yet obtain enough variety to boost the accuracy of the parser? Our approach is to generate high variety, and then filter out noisy sentences. More specifically, we feed auto-paraphrased sentences to a parser trained on only synthetic sentences. We accept the sentences as correct paraphrases only if this parser outputs a logical form equal to the original logical form. + +Correct paraphrases are then used to train another parser from scratch, which will have a higher accuracy on the natural validation and test sets. The first parser can correctly parse the examples + +present in the synthetic set, e.g. "I am looking for the movies which have Tom Hanks in their actors with the largest count of actors." It also generalizes to paraphrased sentences like "I'm looking for Tom Hanks movies with the most actors in them". Paraphrased sentences like this are added to the training set to generate a second parser. This second parser can generalize to an even more natural sentence like "What is the Tom Hanks movie with the biggest cast?" This iterative process, as shown in Fig. 1, can be repeated multiple times. + +This idea is borrowed from self-training (McClosky et al., 2006; He et al., 2019), where a model is used to label additional unlabeled data. Self-training requires an initial good-enough model to label data with, and optionally a filtering mechanism that is more likely to remove incorrect labels than correct labels (Yarowsky, 1995). We use a parser trained on a synthetic dataset as our initial good-enough model. The following two observations are the intuition behind this decision: + +1. Paraphrases of a synthetic dataset are still relatively similar to that set. Thus, a parser trained on synthetic data, which delivers near perfect accuracy for the synthetic data, has a very high accuracy on the paraphrased data as well. +2. Unlike classification tasks, the set of valid logical forms in semantic parsing is so large that outputting the right logical form by chance is very unlikely. + +Note that this filtering scheme might throw away a portion of correct paraphrases as well, but filtering out noisy examples is more important. The second observation ensures that the number of false positives is low. + +# 5.3 Coupling Auto-Annotator with Auto-Paraphraser + +Since both auto-annotation and auto-paraphrasing use a neural paraphraseer, here we contrast them and show how they complement each other. + +Auto-annotation provides alternative expressions with different POS for a single attribute at a time. The input sentences are simpler, so paraphrases are more likely to be correct, and they are filtered if they cannot be parsed correctly with the grammar rules. This makes it easier to coax more diverse expressions on the attribute from the paraphraseer without having to worry about noisy outputs. + +Annotations extracted by the auto-annotator are amplified as the synthesizer uses them to compose many full sentences, which are used to train the first parser with sufficient accuracy for self-training. + +The auto-paraphrase, on the other hand, is applied on all synthesized data. It not only produces more natural alternative phrases for complex sentences, but also generates domain-specific and value-specific terminology and constructs. These two tasks complement each other, as supported by the empirical results in Section 6.2.2. + +# 6 Experiments + +In this section, we evaluate the effectiveness of our methodology: can a semantic parser created with AutoQA approach the performance of human-written annotations and paraphrases? We evaluate on two different benchmark datasets: the Schema2QA dataset (Xu et al., 2020) and the Overnight dataset (Wang et al., 2015). + +# 6.1 AutoQA Implementation + +Paraphrasing Model. We formulate paraphrasing as a sequence-to-sequence problem and use the pre-trained BART large model (Lewis et al., 2019). BART is a Transformer (Vaswani et al., 2017) neural network trained on a large unlabeled corpus with a sentence reconstruction loss. We fine-tune it for 4 epochs on sentence pairs from PARABANK 2 (Hu et al., 2019a), which is a paraphrase dataset constructed by back-translating the Czech portion of an English-Czech parallel corpus. We use a subset of 5 million sentence pairs with the highest dual conditional cross-entropy score (Junczys-Dowmunt, 2018), and use only one of the five paraphrases provided for each sentence. We experimented with larger subsets of the dataset and found no significant difference. We use token-level cross-entropy loss calculated using the gold paraphrase sentence. To ensure the output of the model is grammatical, during training, we use the back-translated Czech sentence as the input and the human-written English phrase as the output. Training is done with mini-batches of 1280 examples where each mini-batch consists of sentences with similar lengths3. + +We use nucleus sampling (Holtzman et al., 2019) with top- $p = 0.9$ and generate 5 paraphrases per sentence in each round of paraphrasing. We use greedy + +
RestaurantsPeopleMoviesBooksMusicHotelsAverage
# Attributes25131615191817.7
TrainSchema2QA# of Annotations122951119610383
Synthesized Data270,081270,081270,081270,081270,081270,081
Human Paraphrase6,4197,1083,7743,9413,6263,311
AutoQA# of Annotations151121157150144160
Synthesized Data270,081270,081270,081270,081270,081270,081
Auto Paraphrase280,542299,327331,155212,274340,721285,324
Dev528499389362326443424.5
Test524500413410288528443.8
+ +Table 3: Size of Schema2QA and AutoQA datasets + +decoding and 4 temperatures (Ficler and Goldberg, 2017) of 0.3, 0.5, 0.7 and 1.0 to generate these paraphrases. Note that the input dataset to each paraphrasing round is the output of the previous round, and we have one round for Schema2QA and three rounds for Overnight experiments. + +Semantic Parsing Model. We adopt our previously proposed BERT-LSTM model (Xu et al., 2020) as the semantic parsing model. The model is a sequence-to-sequence neural network that uses a BERT pre-trained encoder (Devlin et al., 2019), coupled with an LSTM decoder (Hochreiter and Schmidhuber, 1997) with attention (Bahdanau et al., 2014). The model uses a pointer-generator decoder (See et al., 2017) to better generalize to entities not seen during training. The model was implemented using the Huggingface Transformers library (Wolf et al., 2019). We use the same hyperparameters as Xu et al. (2020) for all experiments. The model has approximately 128M parameters. + +# 6.2 Applying AutoQA to Schema2QA + +We first apply AutoQA to the Schema2QA dataset, a semantic parsing dataset that targets the ThingTalk query language, and uses Schema.org as the database schema. Queries are performed against structured data crawled from websites in 6 domains: restaurants (using data from Yelp), people (from LinkedIn), hotels (from the Hyatt hotel chain), books (from Goodreads), movies (from IMDb), and music (from Last.fm). + +The Schema2QA training data set was created using synthesis based on manual field annotations and human paraphrasing, while its evaluation data was crowdsourced by showing the list of attributes to workers and asking them for natural questions. The evaluation data contains complex questions referring up to 6 attributes, with comparisons and relational algebra operators: join, selection, projec + +tion, sort, and aggregates. + +In our experiments, we use the Schema2QA validation and test sets, but not the training data. We synthesize our own training data using the same 800 templates, and replace the manual annotations with our auto-annotation and the manual paraphrases with auto-paraphrases. + +For auto-annotation to work, the table and attribute names must be meaningful and unambiguous as discussed in Section 4. We found it necessary to override the original names in only three cases. In the restaurants domain, "starRating" is renamed to "michelinStar" to avoid ambiguity with "aggregateRating". In the people domain, "addressLocality" is renamed to "homeLocation" to avoid confusion with "workLocation". In the music domain, "musicRecording" is renamed to "song" to better match natural language. + +When applying auto-paraphrasing, we preprocess the questions to replace entity placeholders (e.g. TIME_0) with an equivalent token in natural language (e.g. 2pm), then postprocess the outputs to restore them. This way, the neural network does not have to deal with these tokens which it has not seen during its pre-training. + +As shown in Table 3, AutoQA generates about $45\%$ more attribute annotations, and produces 60 times larger paraphrase sets, compared with the original Schema2QA training set. Although AutoQA's training set is larger than Schema2QA's, we note that in our experiments, adding more synthetic data to Schema2QA did not improve its accuracy any further. We compare the diversity of the two datasets using distinct-1 and distinct-2 metrics (Li et al., 2016) which measure the ratio of distinct unigram and bigrams in the datasets. AutoQA's training sets have about $35\%$ higher distinct-1 and $60\%$ higher distinct-2. + +
ModelRestaurantsPeopleMoviesBooksMusicHotelsAverage
Schema2QA (Xu et al., 2020)69.775.270.070.063.967.069.3
Schema2QA w/o manual annotation & paraphrase30.030.436.634.933.759.737.6
AutoQA65.364.666.154.157.370.162.9
+ +Table 4: Test accuracy of AutoQA on the Schema2QA dataset. For the hotel domain, Xu et al. (2020) only report transfer learning accuracy, so we rerun the training with manual annotations and human paraphrases to obtain the accuracy for hotel questions. + +
RestaurantsPeopleMoviesBooksMusicHotelsAverage
Schema2QA (Xu et al., 2020)70.874.975.380.771.869.373.8
Schema2QA (w/o manual annotation & paraphrase)33.932.735.739.937.161.640.2
AutoQA69.566.168.067.666.966.667.4
- Auto-annotation43.250.151.459.649.767.353.5
- Auto-paraphrase62.150.562.761.558.659.159.1
- Paraphrase filtering50.448.055.044.153.544.749.3
+ +Table 5: Ablation study on Schema2QA development sets. Each “-” line removes only that feature from AutoQA. + +# 6.2.1 Evaluation + +Our evaluation metric is logical form accuracy: the logical form produced by our parser must exactly match the one in the test set. As shown in Table 4, AutoQA achieves an average accuracy of $62.9\%$ in six domains, only $6.4\%$ lower compared to the models trained with manual attribute annotations and human paraphrases. The difference is mainly because paraphrase fails to generate a few common phrases in some cases. For example, it fails derive "employee" or "employed by" from the canonical annotation "works for", which is quite common in the evaluation set. Compared with the baseline models trained with data generated by Schema2QA but without manual annotation and human paraphrase, AutoQA improves the accuracy by $25.3\%$ . This result is obtained on naturally sourced test data, as opposed to paraphrases. This shows that AutoQA is effective for bootstrapping question answering systems for new domains, without any manual effort in creating or collecting training data. + +# 6.2.2 Ablation Study + +We conduct an ablation study on the development set to evaluate how each part of our methodology contributes to the accuracy. We subtract different components from AutoQA, generate the training data, and run the experiment with the same hyperparameters. When paraphrase filtering is removed, we still use simple string matching to remove erroneous paraphrases where entities and numbers in the utterance do not match the logical form. + +As shown in Table 5, AutoQA reaches an overall accuracy of $67.4\%$ , $6.4\%$ lower than models trained + +with human annotations and human paraphrases. AutoQA outperforms the baseline trained on synthetic data generated from the canonical annotation by $27.2\%$ . This indicates that AutoQA is an efficient and cost-effective replacement for manual annotation and paraphrasing. + +On average, applying only auto-paraphrase on synthetic data based on canonical annotations without auto-annotation achieves $53.5\%$ , which is $13.9\%$ lower than the full AutoQA. Applying only auto-annotation without auto-paraphrase obtains $59.1\%$ , and is $8.3\%$ lower than AutoQA. This shows that the two components of AutoQA complement each other to achieve the best performance. + +If auto-paraphrase is used without filtering, not only does it not improve the accuracy, but also the average accuracy drops by $18\%$ . This shows that without filtering, even a paraphraser with a large pre-trained neural model like BART cannot be used for semantic parsing due to noisy outputs. + +# 6.3 Applying AutoQA to Overnight + +To evaluate if the AutoQA methodology generalizes to different types of databases, logical forms, and templates, we apply AutoQA on the well-known Overnight benchmark. Overnight is a semantic parsing dataset with questions over a knowledge base with very few entities across 8 domains. The dataset was constructed using paraphrasing; both training and test sets are paraphrased from the same set of synthetic sentences. + +We train the BERT-LSTM model on data synthesized from Overnight templates with both auto-annotation and auto-paraphrase. Auto-annotation + +
ModelBasketballBlocksCalendarHousingPublicationsRecipesRestaurantsSocialAverage
Only in-domain human data
Cao et al. (2019)-88.0-65.2-80.7-76.7-80.7-82.4-84.0-83.8-80.2
Chen et al. (2018)-88.2-61.4-81.5-74.1-80.7-82.9-80.7-82.1-79.0
Damonte et al. (2019)69.6-25.1-43.5-29.6-32.9-58.3-37.3-51.2-43.4-
BERT-LSTM84.187.542.662.458.379.848.770.464.676.468.575.955.482.870.481.961.675.0
Only out-of-domain human data
Herzig and Berant (2018b)---28.3-53.6-52.4-55.3-60.2-61.7-62.4-53.4
No human data
Marzoev et al. (2020)47-27-32-36-34-49-43-28-37-
BERT-LSTM (Synthetic only)29.731.527.637.828.034.518.032.828.037.340.748.634.947.016.124.227.949.4
BERT-LSTM w/ AutoQA (ours)70.173.938.454.958.972.651.970.956.574.564.468.157.578.647.261.555.669.8
+ +Table 6: Logical form accuracy (left) and answer accuracy (right) percentage on the Overnight test set. Numbers are copied from the cited papers. We report the numbers for the BL-Att model of Damonte et al. (2019), Att+Dual+LF of Cao et al. (2019), ZEROSHOT model of Herzig and Berant (2018b), and the Projection model of Marzoev et al. (2020). Herzig and Berant (2018b) do not evaluate on the Basketball domain. + +is limited to two parts of speech, since Overnight uses a very simple template set to synthesize training examples, with only placeholders for active verb phrase and noun phrase. We use the standard train/test split and following previous work, use $20\%$ of the human paraphrases from the original training set for validation, so that validation and test sets are from the same distribution. + +We evaluate both logical form accuracy and answer accuracy, which checks whether the answer retrieved from the knowledge base matches the gold answer. The model outputs a ranked list of logical forms for each input question using beam search with 25 beams, and chooses the first output that is syntactically valid. Other than this, all models and hyperparameters are the same as Section 6. + +In Table 6, we compare our technique to other approaches that do not use in-domain human data. They are either synthetic-only (Marzoev et al., 2020) or use human data from other Overnight domains (Herzig and Berant, 2018b). For reference, we also include two of the best-performing models that use in-domain human data (Cao et al., 2019; Chen et al., 2018) $^4$ . + +Whereas Schema2QA dataset has naturally sourced evaluation and test data, Overnight evaluates on human paraphrase data. Evaluating with paraphrase data is not as meaningful, and makes the benchmark easier for models trained with human paraphrase data (Campagna et al., 2019). Nonetheless, AutoQA achieves an average logical form accuracy of $55.6\%$ and answer accuracy of $69.8\%$ , which is only $5.2\%$ lower than the same parser + +trained with human paraphrases, and matches its performance in the housing domain. Compared to other zero-shot models trained with no in-domain data, AutoQA outperforms the state of the art by $18.6\%$ and $16.4\%$ on logical form accuracy and answer accuracy, respectively. This shows that by generating diverse and natural paraphrases in domain, AutoQA can reach comparable performance with models with human training data, and is much more accurate compared to other zero-shot approaches. + +# 7 Discussion + +In this work, we propose AutoQA, a methodology and a toolkit to automatically create a semantic parser given a database. We test AutoQA on two different datasets with different target logical forms and data synthesis templates. On both datasets, AutoQA achieves comparable accuracy to state-of-the-art QA systems trained with manual attribute annotation and human paraphrases. + +AutoQA relies on a neural paraphraser trained with an out-of-domain dataset to generate training data. We suspect the methodology to be less effective for domains full of jargon. Even for common domains, AutoQA sometimes failed to generate some common phrases. Further improvement on neural paraphraser is needed to generate more diverse outputs. Future work is also needed to handle attributes containing long free-form text, as AutoQA currently only supports database operations without reading comprehension. + +# Acknowledgements + +This work is supported in part by the National Science Foundation under Grant No. 1900638 and the + +Alfred P. Sloan Foundation under Grant No. G-2020-13938. + +# 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, pages 7383-7390. AAAI Press. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +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. +Giovanni Campagna, Agata Foryciarz, Mehrad Moradshahi, and Monica S Lam. 2020. Zero-shot transfer learning with synthesized data for multi-domain dialogue state tracking. arXiv preprint arXiv:2005.00891. +Giovanni Campagna, Silei Xu, Mehrad Moradshahi, Richard Socher, and Monica S. Lam. 2019. Genie: A generator of natural language semantic parsers for virtual assistant commands. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2019, pages 394-410, New York, NY, USA. ACM. +Ruisheng Cao, Su Zhu, Chen Liu, Jieyu Li, and Kai Yu. 2019. Semantic parsing with dual learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 51-64. +Shuaichen Chang, Pengfei Liu, Yun Tang, Jing Huang, Xiaodong He, and Bowen Zhou. 2019. Zero-shot text-to-SQL learning with auxiliary task. arXiv preprint arXiv:1908.11052. +Bo Chen, Le Sun, and Xianpei Han. 2018. Sequence-to-action: End-to-end semantic graph generation for semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 766-777, Melbourne, Australia. Association for Computational Linguistics. +Marco Damonte, Rahul Goel, and Tagyoung Chung. 2019. Practical semantic parsing for spoken language understanding. Proceedings of the 2019 Conference of the North. +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. +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). Association for Computational Linguistics. +Jessica Ficler and Yoav Goldberg. 2017. Controlling linguistic style aspects in neural language generation. Proceedings of the Workshop on Stylistic Variation. +Juri Ganitkevitch, Benjamin Van Durme, and Chris Callison-Burch. 2013. PPDB: The paraphrase database. In Proceedings of NAACL-HLT, pages 758-764, Atlanta, Georgia. Association for Computational Linguistics. +Ankush Gupta, Arvind Agarwal, Prawaan Singh, and Piyush Rai. 2017. A deep generative framework for paraphrase generation. arXiv preprint arXiv:1709.05074. +Junxian He, Jiatao Gu, Jiajun Shen, and Marc'Aurelio Ranzato. 2019. Revisiting self-training for neural sequence generation. arXiv preprint arXiv:1909.13788. +Jonathan Herzig and Jonathan Berant. 2018a. Decoupling structure and lexicon for zero-shot semantic parsing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1619-1629. +Jonathan Herzig and Jonathan Berant. 2018b. Decoupling structure and lexicon for zero-shot semantic parsing. Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735-1780. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2019. The curious case of neural text degeneration. arXiv preprint arXiv: 1904.09751. +J. Edward Hu, Abhinav Singh, Nils Holzenberger, Matt Post, and Benjamin Van Durme. 2019a. Large-scale, diverse, paraphrastic bittexts via sampling and clustering. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 44-54, Hong Kong, China. Association for Computational Linguistics. +Zhiting Hu, Bowen Tan, Russ R Salakhutdinov, Tom M Mitchell, and Eric P Xing. 2019b. Learning data manipulation for augmentation and weighting. In Advances in Neural Information Processing Systems, pages 15738-15749. + +Mohit Iyyer, John Wieting, Kevin Gimpel, and Luke Zettlemoyer. 2018. Adversarial example generation with syntactically controlled paraphrase networks. Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers). +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). Association for Computational Linguistics. +Marcin Junczys-Dowmunt. 2018. Dual conditional cross-entropy filtering of noisy parallel corpora. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 888-895, Belgium, Brussels. Association for Computational Linguistics. +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, Volume 2 (Short Papers), pages 452-457, New Orleans, Louisiana. Association for Computational Linguistics. +Jayant Krishnamurthy, Pradeep Dasigi, and Matt Gardner. 2017. Neural semantic parsing with type constraints for semi-structured tables. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1516-1526. +Varun Kumar, Ashutosh Choudhary, and Eunah Cho. 2020. Data augmentation using pre-trained transformer models. arXiv preprint arXiv:2003.02245. +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. +Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill 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. +Jonathan Mallinson, Rico Sennrich, and Mirella Lapata. 2017. Paraphrasing revisited with neural machine translation. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 1, Long Papers, pages 881-893, Valencia, Spain. Association for Computational Linguistics. +Alana Marzoev, Samuel Madden, M. Frans Kaashoek, Michael Cafarella, and Jacob Andreas. 2020. Unnatural language processing: Bridging the gap between + +synthetic and natural language data. arXiv preprint arXiv:2004.13645. +David McClosky, Eugene Charniak, and Mark Johnson. 2006. Effective self-training for parsing. In Proceedings of the Human Language Technology Conference of the NAACL, Main Conference, pages 152-159, New York City, USA. Association for Computational Linguistics. +Mehrad Moradshahi, Giovanni Campagna, Sina J. Semnani, Silei Xu, and Monica S. Lam. 2020. Localizing open-ontology QA semantic parsers in a day using machine translation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing. +Panupong Pasupat and Percy Liang. 2015. Compositional semantic parsing on semi-structured tables. 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). Association for Computational Linguistics. +Aaditya Prakash, Sadid A. Hasan, Kathy Lee, Vivek Datla, Ashequl Qadir, Joey Liu, and Oladimeji Farri. 2016. Neural paraphrase generation with stacked residual LSTM networks. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 2923-2934, Osaka, Japan. The COLING 2016 Organizing Committee. +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. +Abhinav Rastogi, Xiaoxue Zang, Srinivas Sunkara, Raghav Gupta, and Pranav Khaitan. 2019. Towards scalable multi-domain conversational agents: The schema-guided dialogue dataset. arXiv preprint arXiv:1909.05855. +Aurko Roy and David Grangier. 2019. Unsupervised paraphrasing without translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6033-6039, Florence, Italy. 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. +Sina J. Semnani, Madhulima Pandey, and Manish Pandey. 2019. Domain-specific question answering at scale for conversational systems. 3rd NeurIPS Conversational AI Workshop. +Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155. + +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. +Yushi Wang, Jonathan Berant, and Percy Liang. 2015. Building a semantic parser overnight. 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 1332-1342. Association for Computational Linguistics. +Nathaniel Weir, Prasetya Utama, Alex Galakatos, Andrew Crotty, Amir Ilkhechi, Shekar Ramaswamy, Rohin Bhushan, Nadja Geisler, Benjamin Hattasch, Steffen Eger, Ugur Cetinternetel, and Carsten Binnig. 2020. DBPal: A fully pluggable nl2sql training pipeline. In Proceedings of the 2020 ACM SIGMOD International Conference on Management of Data, SIGMOD '20, page 2347-2361, New York, NY, USA. Association for Computing Machinery. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Xing Wu, Shangwen Lv, Liangjun Zang, Jizhong Han, and Songlin Hu. 2019. Conditional BERT contextual augmentation. Computational Science - ICCS 2019, page 84-95. +Silei Xu, Giovanni Campagna, Jian Li, and Monica S Lam. 2020. Schema2QA: High-quality and low-cost Q&A agents for the structured web. In Proceedings of the 29th ACM International Conference on Information and Knowledge Management. +Qian Yang, Zhouyuan Huo, Dinghan Shen, Yong Cheng, Wenlin Wang, Guoyin Wang, and Lawrence Carin. 2019. An end-to-end generative architecture for paraphrase 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 3132-3142, Hong Kong, China. Association for Computational Linguistics. +David Yarowsky. 1995. Unsupervised word sense disambiguation rivaling supervised methods. In 33rd Annual Meeting of the Association for Computational Linguistics, pages 189-196, Cambridge, Massachusetts, USA. Association for Computational Linguistics. +Adams Wei Yu, David Dohan, Minh-Thang Luong, Rui Zhao, Kai Chen, Mohammad Norouzi, and Quoc V. Le. 2018a. QANet: Combining local convolution with global self-attention for reading comprehension. *ArXiv*, abs/1804.09541. + +Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, et al. 2018b. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3911-3921. +Victor Zhong, Caiming Xiong, and Richard Socher. 2017. Seq2SQL: Generating structured queries from natural language using reinforcement learning. arXiv preprint arXiv:1709.00103. + +# A The Cost of AutoQA + +The only form of cost in AutoQA's methodology is compute cost. Here we mention more details with regards to that. To use AutoQA for a new domain, the following steps will have to be executed to generate the final training set. Numbers are for the Schema2QA dataset, and batch sizes are set to maximize GPU utilization. + +- Automatic annotation: This step runs inference using the BART paraphrase model as introduced in Section 6.1, it takes less than 10 minutes for each domain. +- Template-based data synthesizer: This step synthesize data with annotation generated by auto-annotator. Depending on the domain, it takes between 3 to 5 hours on an AWS m5.4xlarge machine (16 vCPU and 64 GiB of memory). +- Training a parser with the synthetic dataset to use as filter: We train the BERT-LSTM model for 4000 iterations only, as we empirically observed that training more than that does not improve the quality of the filter. This takes less than half an hour on an AWS p3.2xlarge machine (16GB V100 GPU, 8vCPUs, 61 GiB of memory). +- Automatic paraphrasing and filtering: This step uses the fine-tuned BART large model, which has about 400M parameters, to generate 5 paraphrases per input, and then the BERT-LSTM parser, which has 128M parameters, to filter those paraphrases. Note that no training is done in this step. In our experiments, this step takes less than 4 GPU-hours. +- Training of the semantic parser: Similar to training the filter, but we train for 60000 iterations, and it takes less than 6 GPU-hours. + +The approximate total per-domain cost of Schema2QA experiments using Amazon Web Services is $36. \ No newline at end of file diff --git a/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/images.zip b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7fca596ff41bcace100fb7be516e2ca6835b3f9f --- /dev/null +++ b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7aece47958132ac52fcd0ae8cd1228ef1e98cfabd029f82ea1cdc18c2ed46e51 +size 361152 diff --git a/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/layout.json b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cc8ae34e1ca30878530e066b8303dec9db584e02 --- /dev/null +++ b/autoqafromdatabasestoqasemanticparserswithonlysynthetictrainingdata/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ac0902a789adb04f74c5ccd85ccf282c00e0981f14cffdbd00bd7d926f3032f +size 358127 diff --git a/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_content_list.json b/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2c56b706d4681839a1a2dd218e47d9a73284454c --- /dev/null +++ b/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:caa433c18955cbef18dabf3308e970b0af6131df5e50b43e058f5cdaf7fe7b63 +size 88251 diff --git a/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_model.json b/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a55213ecef6c6da1cde8ac8b668828e2ee1742d7 --- /dev/null +++ b/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df8d78caf1a984c2f9d4a80b86887cd8150313f257a01370a5fe89c6493570cf +size 107722 diff --git a/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_origin.pdf b/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5fb5add9b1d10b4259e7541847284b96dd6651b4 --- /dev/null +++ b/autoregressiveknowledgedistillationthroughimitationlearning/9b3a2492-2324-4910-a047-4297d03da4aa_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43959d0f074a220858903c7e58a1b6b9877db500e1cd87cb72af537f12e23417 +size 397222 diff --git a/autoregressiveknowledgedistillationthroughimitationlearning/full.md b/autoregressiveknowledgedistillationthroughimitationlearning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..08dd1368c437bf7efd68e148b268494ceb90aef8 --- /dev/null +++ b/autoregressiveknowledgedistillationthroughimitationlearning/full.md @@ -0,0 +1,369 @@ +# Autoregressive Knowledge Distillation through Imitation Learning + +Alexander Lin1 +ASAPP, Inc. +New York, NY, USA + +Jeremy Wohlwend2 +ASAPP, Inc. +New York, NY, USA + +Howard Chen3 +ASAPP, Inc. +New York, NY, USA + +Tao Lei4 +ASAPP, Inc. +New York, NY, USA + +$^{1}$ alexanderlin01@g.harvard.edu $^{2}$ jwohlwend@csail.mit.edu + +$^{3}$ howardchen@cs.princeton.edu $^{4}$ tao@asapp.com + +# Abstract + +The performance of autoregressive models on natural language generation tasks has dramatically improved due to the adoption of deep, self-attentive architectures. However, these gains have come at the cost of hindering inference speed, making state-of-the-art models cumbersome to deploy in real-world, time-sensitive settings. We develop a compression technique for autoregressive models that is driven by an imitation learning perspective on knowledge distillation. The algorithm is designed to address the exposure bias problem. On prototypical language generation tasks such as translation and summarization, our method consistently outperforms other distillation algorithms, such as sequence-level knowledge distillation. Student models trained with our method attain 1.4 to 4.8 BLEU/ROUGE points higher than those trained from scratch, while increasing inference speed by up to 14 times in comparison to the teacher model. + +# 1 Introduction + +Autoregressive models are ubiquitous in natural language processing. Due to the sequential nature of text generation, they are often the tool of choice for tackling sequence-to-sequence problems such as translation (Sutskever et al., 2014), summarization (Rush et al., 2015), and dialogue (Eric and Manning, 2017). Furthermore, they form the backbone of several successful generative pre-training architectures (Howard and Ruder, 2018; Peters et al., 2018; Radford et al., 2019; Dai et al., 2019). + +Two recent trends have made autoregressive models cumbersome to deploy in real-world, natural language generation (NLG) applications. First, state-of-the-art models have grown larger and larger, amounting to hundreds of millions and even + +billions of parameters (Dong et al., 2019; Liu and Lapata, 2019; Raffel et al., 2019). The increase in size and depth dramatically slows down inference speed. Second, the architecture of choice for autoregressive models seems to have shifted from the recurrent neural network (RNN) (Bahdanau et al., 2014; Luong et al., 2015) to the Transformer (Vaswani et al., 2017). Though the Transformer's self-attention mechanism improves performance, it also increases the computational complexity of the step-by-step generation algorithms that are used at test time. Thus, both of these trends have contributed to significantly increasing inference time costs, especially on CPUs and low-resource devices, hindering their use in production systems. + +Knowledge distillation (KD) (Bucilua et al., 2006; Hinton et al., 2015) is one popular method for model compression. It transfers the information learned by a large, pretrained teacher to a smaller, untrained student. In comparison to other methods such as weight pruning and quantization, KD allows the compressed model's architecture to significantly differ from that of the original teacher. This feature enables models trained with KD to achieve high performance while meeting particular inference requirements (e.g. memory, speed, etc.). + +Sequence-level knowledge distillation (SeqKD), proposed by Kim and Rush (2016), is the dominant technique for autoregressive KD in the current NLG literature, especially for machine translation (Gu et al., 2017; Ren et al., 2019; Zhou et al., 2019). This method trains a student model using a modified dataset generated by the teacher model and the standard negative log-likelihood objective. While SeqKD is simple and efficient, we argue that it does not take advantage of the teacher's full potential. + +Training the student model with a static dataset leads to the exposure bias problem. During training, the student model learns to predict the next token given previous tokens provided by the data. + +However, at inference time, the student generates the entire sequence from scratch by repeatedly using its own outputs as context for subsequent steps. This training-inference inconsistency causes a decrease in generation quality. Alternatively, we propose that the student can leverage the teacher in a dynamic fashion during the learning process. + +We devise a new compression algorithm for autoregressive models called imitation-based knowledge distillation (ImitKD). It is inspired by an imitation learning (IL) perspective on the autoregressive distillation problem. Our algorithm trains a student model within an IL framework by treating the teacher as an oracle, and allows the student to explore its own generation during training. The teacher corrects the student's generation at every time step, thereby guiding the student in learning how to generate. + +Experimental results in translation and summarization show that ImitKD is especially suitable for compressing deep Transformer models that achieve high performance into shallow RNNs that generate up to 14 times faster at inference time. Our method consistently outperforms other distillation algorithms (such as word-level KD and sequence-level KD), and yields student models that beat models trained without a teacher by 1.4 to 4.8 points on generation metrics such as BLEU and ROUGE. + +# 2 Background + +# 2.1 Autoregressive Distillation + +First, we formalize the task of autoregressive distillation. An autoregressive model $\pi$ specifies a joint distribution over a $T$ -dimensional target sequence $\mathbf{y} = \{y_1,\dots ,y_T\} \in \mathcal{V}$ by decomposing it into a product of univariate conditionals: + +$$ +\pi (\boldsymbol {y}) = \prod_ {t = 1} ^ {T} \pi \left(y _ {t} \mid \boldsymbol {y} _ {< t}\right), \tag {1} +$$ + +where $\pmb{y}_{< t}$ denotes $\{y_{1},\dots ,y_{t - 1}\}$ for $t > 1$ and $\varnothing$ for $t = 1$ . The joint distribution over $\pmb{y}$ may itself be conditional on some related source feature $\pmb{x} \in \mathcal{X}$ (e.g. translation, summarization) or not (e.g. language modeling). Since the former case can generalize the latter by letting $\mathcal{X} = \emptyset$ , we will specify the presence of $\pmb{x}$ in the rest of the paper. + +In autoregressive distillation, the goal is to learn a student model $\pi$ that performs well at sequence generation by minimizing its loss with respect to a pre-trained teacher model $\pi^{*}$ . In many cases, the + +training objective can be expressed as + +$$ +\mathcal {L} (\pi) = \mathbb {E} _ {\boldsymbol {y} | \boldsymbol {x} \sim \mathcal {D}} \left[ \sum_ {t = 1} ^ {T} \ell^ {\pi^ {*}} \left(\boldsymbol {y} _ {< t}, \boldsymbol {x}; \pi\right) \right], \tag {2} +$$ + +where $\ell^{\pi^{*}}(\cdot ;\pi)$ is the next-token loss function measuring the discrepancy between the teacher and student models given some prior context $\{\pmb {y}_{< t},\pmb {x}\}$ . + +Here, $\mathcal{D}$ denotes a distribution (or dataset) of source-target pairs $x\rightarrow y$ . Due to the combinatorial nature of sequence generation, an autoregressive distillation method must maximize its learning efficiency by carefully $\mathcal{D}$ , i.e. how it explores the exponentially-sized space. We motivate this choice with the field of imitation learning, an active research area of reinforcement learning. + +# 2.2 Distillation as Imitation Learning + +Autoregressive text generation can be interpreted as a $T$ -step Markov decision process (MDP). In particular, the autoregressive model $\pi$ we wish to learn can be treated as a policy learner that maps a state to a distribution over actions. In our case, a state is a partial sequence $\mathbf{y}_{Decoding MethodBleu ↑Transformer only33.8RNN only28.6RNN first, Transformer completes31.4 + +# 3.2 The ImitKD Algorithm + +Our imitation-based knowledge distillation algorithm (ImitKD) is given in Algorithm 1. The central training objective is + +$$ +\mathcal {L} _ {\text {I m i t K D}} (\pi) = \mathbb {E} _ {\boldsymbol {y} | \boldsymbol {x} \sim \tilde {\mathcal {D}}} \left[ \sum_ {t = 1} ^ {T} \ell^ {\pi^ {*}} \left(\boldsymbol {y} _ {< t}, \boldsymbol {x}; \pi\right) \right], \tag {4} +$$ + +where $\tilde{\mathcal{D}}$ is the data mixture defined by sampling from the initial dataset $\mathcal{D}$ and generating with the student (lines 8-11). The probability $\beta_{i} \in [0,1]$ (line 8) controls how often an example comes from $\mathcal{D}$ . The loss function $\ell^{\pi^{*}}$ can be realized as the negative log-likelihood of the oracle's optimal next token/action, + +$$ +\ell_ {\mathrm {o p t}} ^ {\pi^ {*}} (\boldsymbol {y} _ {< t}, \boldsymbol {x}; \pi) = - \log \pi (v ^ {*} \mid \boldsymbol {y} _ {< t}, \boldsymbol {x}), \tag {5} +$$ + +where $v^{*} = \arg \max_{v\in \mathcal{V}}\pi^{*}(v\mid \boldsymbol{y}_{< t},\boldsymbol {x})$ . Alternatively, $\ell^{\pi^*}$ can be the cross-entropy loss between the full distributions, + +$$ +\begin{array}{l} \ell_ {\text {f u l l}} ^ {\pi^ {*}} \left(\boldsymbol {y} _ {< t}, \boldsymbol {x}; \pi\right) \tag {6} \\ = - \sum_ {v \in \mathcal {V}} \pi^ {*} (v \mid \boldsymbol {y} _ {< t}, \boldsymbol {x}) \cdot \log \pi (v \mid \boldsymbol {y} _ {< t}, \boldsymbol {x}). \\ \end{array} +$$ + +Next, we describe some practical implementations in order to make Algorithm 1 suitable for compressing deep learning systems. One limitation of DAgger is that the training data keeps growing, making each iteration successively more expensive. As an alternative to aggregation, we perform data replacement within each training batch. + +As shown in Algorithm 1, we treat each minibatch $\tilde{\mathcal{D}}_i$ as a new iteration of the dataset and perform a single step of stochastic gradient descent on $\mathcal{L}_{\mathrm{ImitKD}}$ (Equation 4) with respect to the parameters of the previous model $\pi_{i}$ to yield $\pi_{i + 1}$ . Thus, the number of iterations $I$ becomes the number of mini-batches used to train the student model. + +Our practical algorithmic changes are inspired by theory. The dataset aggregation algorithm (Ross et al., 2011) achieves its regret bounds because it reduces to the Follow-the-Leader algorithm for + +Table 1: Greedy decoding BLEU scores on the IWSLT validation set for the preliminary test. + +
Algorithm 1 Imitation-Based Distillation
1: Let D be initial dataset.
2: Initialize π1 at random.
3: for i = 1, . . ., I do
4: Initialize new dataset˜Di = ∅.
5: repeat B times
6: Sample an example e = y | x ~ D.
7: Sample uniformly u ~ [0,1].
8: if u > βi then
9: Generate˜y from πi given x.
10: Replace example with e =˜y | x.
11: end if
12: Append example e to˜Di.
13: Compute LImitKD(πi) on˜Di with π*.
14: Let πi+1 = πi - αi · ∂LImitKD/∂πi.
15: end for
16: return Best policy π on validation set.
+ +online learning (Kakade et al., 2009). Our training paradigm can be similarly interpreted as an online gradient descent algorithm, which has comparable guarantees for strongly convex losses (Hazan et al., 2007) and even certain non-strongly convex losses (Garber, 2019). Variants of this paradigm have also been employed in other deep learning work (Bengio et al., 2015; Sun et al., 2017). + +# 3.3 Data Mixture Selection and Annealing + +Dataset replacement requires an initial dataset that can be potentially replaced at each step. A natural candidate for this initial dataset is the original supervised training data (denoted as $\mathcal{D}^{\prime}$ ), which can be interpreted as a collection of samples from a human oracle. Alternatively, we can use the SeqKD dataset $\mathcal{D}^{*}$ , which has generations from the teacher. + +If we take samples from $\mathcal{D}'$ or $\mathcal{D}^*$ and replace some of them with student-generated samples, we effectively create a teacher-student dataset mixture. Unlike DAgger, this mixture occurs at the sequence level instead of the token/state level. An advantage of sequence-level mixtures is that they do not require generating with the teacher during each training iteration, which can be quite expensive if the teacher is a large neural network. Instead, the teacher only needs to compute the batched loss, which is comparatively much cheaper. The exact mixing schedule $\beta_{1},\ldots ,\beta_{I}$ is a customizable feature of Algorithm 1. Empirically, we have found an exponential decay to work well, i.e. $\beta_{i} = r^{i / I}$ , where $r\in [0,1]$ is the final mixing rate. + +# 3.4 Speeding Up Training + +Generating sequences $\hat{\pmb{y}}$ on the fly at every iteration (line 9) can be a major computation bottleneck during training. We speed up this step by generating a pool of $B\cdot M$ examples in parallel only once every $M$ iterations, where $B$ is the batch size and $M$ is a hyperparameter. One caveat of this modification is that at iteration $i$ , the loss function may no longer be computed on examples generated by the most recent set of model parameters, but rather parameters from up to $M$ iterations prior. Nonetheless, we have found that setting $M$ to a small integer (e.g. 2-8) can speed up training time without impacting final model performance. + +We use greedy decoding or top- $K$ sampling with small $K$ to produce samples $\hat{\pmb{y}}$ (line 9) in our algorithm. These two strategies are efficient to run, operate similarly to the generation employed at inference time, and have empirically worked well in our experiments. Of course, the generation strategy can be customized for different tasks. + +# 4 Related Work + +The distillation problem for autoregressive models was first tackled by Kim and Rush (2016), who introduced sequence-level knowledge distillation for neural machine translation. Subsequent works have used seqKD for non-autoregressive translation models (Gu et al., 2017; Zhou et al., 2019), low-resource settings (Chen et al., 2017), and ensemble distillation with multiple teachers (Kuncoro et al., 2016; Tan et al., 2019). Wei et al. (2019) proposed a behavioral cloning method for distilling autoregressive translation models into non-autoregressive translation models. In contrast, our method aims to address the learning challenges in autoregressive distillation, such as exposure bias. + +Various methods other than standard supervised learning have been explored for training generative models of language. MIXER (Ranzato et al., 2015) and Beam Search Optimization (Wiseman and Rush, 2016) also perform generation during training, but use sequence-level metrics (e.g. BLEU score) as training supervision. Similarly, SEARNN (Leblond et al., 2017) trains RNNs to iteratively generate sequences with beam search to compute the local loss of a single action during the decoding process. Scheduled sampling (Bengio et al., 2015) and its extensions (Goyal et al., 2017; Zhang et al., 2019) alleviate exposure bias by replacing some words in the true context with the model's + +prediction. However, without a dynamic queryable oracle, these methods face the challenge of properly defining the training signal when the generated sequence no longer exists in the static training data. For example, directly reusing the tokens in the static dataset as the target next token leads to an inconsistent training procedure (Huszár, 2015). In contrast to these methods, distillation can fully leverage the teacher oracle, allowing us to design a simple and efficient imitation learning algorithm. + +# 5 Experimental Setup + +We test our autoregressive distillation method and all baselines on three language generation tasks - IWSLT 2014 German $\rightarrow$ English translation, WMT 2016 English $\rightarrow$ German translation, and CNN/DailyMail abstractive news summarization. + +Datasets The IWSLT 2014 De $\rightarrow$ En dataset consists of approximately 170K sequence pairs. Following standard practice (Bahdanau et al., 2016; Deng et al., 2018; Wang et al., 2019), we randomly sample $4\%$ of this dataset as the validation set and let the remaining be the training set. The test set is the concatenation of the dev2010, tst2010, tst2011, and tst2012 files. We use a shared vocabulary of 14K lowercased BPE tokens (Sennrich et al., 2015). + +The WMT 2016 En $\rightarrow$ De dataset has 4.5 million training pairs. We use the same preprocessing of the prior work (Ott et al., 2018), newstest2013 as the validation set and newstest2014 as the test set. The vocabulary consists of 32K based BPE tokens. + +The CNN/DailyMail summarization dataset has 287K, 13K and 12K pairs in the training, validation and test sets, respectively. Following prior work (See et al., 2017), we truncate documents to 400 tokens and summaries to 100 tokens in the training set. During evaluation, we generate up to 128 tokens. We use a pre-trained BERT (Devlin et al., 2018) tokenizer with a vocabulary of 30K lowercased tokens (Liu and Lapata, 2019). + +Models Transformers often attain state-of-the-art performance on common language generation tasks. On the other hand, RNNs (without self-attention) generate much faster at inference time. Thus, from a practitioner's standpoint, it may be most desirable to compress a high-performing Transformer into a lightweight RNN. For all tasks, we use the state-of-the-art Transformer architecture (Vaswani et al., 2017) as the teacher model. The teacher models are trained using vanilla super + +
VariantContext (States)Loss
VanillaDataNLL
SeqKDTeacherNLL
ImitKDStudent/Data MixNLL
ImitKD*Student/Teacher MixNLL
Vanilla + FullDatalπfull*
SeqKD + FullTeacherlπfull*
ImitKD + FullStudent/Data Mixlπfull*
ImitKD* + FullStudent/Teacher Mixlπfull*
+ +Table 2: Summary of training variants. Base variants use the negative log-likelihood (NLL) of the optimal next token - which is taken from the data for Vanilla, found using beam search for SeqKD, and queried from the teacher for ImitKD (i.e. $\ell_{\mathrm{opt}}^{\pi^{*}}$ ). All "+" Full" variants are trained with the full teacher-student cross entropy. + +vised learning. For WMT, we directly use the pretrained Transformer model provided by the Fairseq library (Ott et al., 2018, 2019). + +In all tasks, we use a recurrent neural network, specifically SRU (Lei et al., 2017), as the student model. For completeness, we also train Transformer, GRU (Cho et al., 2014), and LSTM (Hochreiter and Schmidhuber, 1997) based student models on the IWSLT translation task, illustrating the effectiveness of our distillation method for various neural architectures. All RNN-based models follow the seq2seq, encoder-decoder architecture (Sutskever et al., 2014) and employ a single scaled dot-product attention between the encoder and decoder (Bahdanau et al., 2014; Luong et al., 2015). + +All models are trained using the Adam optimizer (Kingma and Ba, 2014) with an inverse-square-root learning rate scheduler and learning rate warmup (Vaswani et al., 2017). Our experiments were conducted using Flambé, a PyTorch-based model training and evaluation library (Wohlwend et al., 2019). More implementation details such as hyperparameter settings are provided in Appendix A. + +**Variants** For the student models, we compare a wide range of training variants, including baselines such as vanilla supervised learning (which directly uses the original training set) and sequence-level knowledge distillation (SeqKD). All SeqKD variants form the teacher-generated dataset using beam search with beam size $K = 5$ . For our imitation-based method, we experiment with annealing from the original training set (ImitKD) or the teacher-generated SeqKD dataset (ImitKD*). We also ex + +periment with different token-level losses; base variants are trained with the optimal next token while “+ Full” variants are trained with the full cross entropy. Table 2 summarizes all variants and highlights their differences. Note that the Vanilla + Full baseline – referred to as “WordKD” by Kim and Rush (2016) – has appeared in other distillation works (e.g. Tan et al., 2019; Sanh et al., 2019). + +Evaluation We use BLEU score (Papineni et al., 2002) for translation and report ROUGE-1, ROUGE-2 and ROUGE-L scores (Lin, 2004) for summarization. For all models, the training checkpoint with the highest BLEU/ROUGE-1 score on the validation set is used for test set evaluation. We also report the perplexity metric for all tasks. + +# 6 Results + +IWSLT De→En Translation Table 3 compares all distillation methods on the IWSLT dataset. The teacher model is an 8-layer Transformer. We use a 3-layer SRU, a 2-layer SRU and a 2-layer Transformer as student models. For all three student models, our ImitKD method outperforms all baselines in terms of BLEU score with beam size 1 $(\mathrm{Bleu}_1)$ , BLEU score with beam size 5 $(\mathrm{Bleu}_5)$ and perplexity (PPL). The improvement on Bleu score ranges from 1.4 to 4.8 points compared to the Vanilla training method. The 3-layer SRU model trained with ImitKD + Full even slightly exceeds the performance of the teacher model. Furthermore, our method consistently outperforms SeqKD by up to 1.4 BLEU, highlighting the benefit of training the student model with its own state distribution. + +To further demonstrate the effectiveness of ImitKD across different model types, we report validation set $\mathrm{Bleu}_1$ for various 2-layer neural architectures in Table 4. Our ImitKD method outperforms the baselines in all cases, with the gains being especially large for recurrent architectures. + +WMT En→De Translation Table 5 presents our results for the WMT dataset. The teacher is a 6-layer Transformer and the student is a 4-layer SRU. Here, we see that ImitKD performs closer to SeqKD. These results reveal that direct behavioral cloning (SeqKD) can be quite effective when the amount of oracle demonstrations is sufficiently high, e.g. several millions of examples. Nonetheless, ImitKD and ImitKD* can improve on SeqKD by training the student with its own states. Among all variants, ImitKD + Full performs + +
VariantPPL ↓Bleu1 ↑Bleu5 ↑
Transf. (8-layer)
Teacher5.634.435.2
SRU (3-layer)
Vanilla7.430.031.2
SeqKD153.033.033.1
ImitKD14.734.134.4
Vanilla + Full5.434.234.8
SeqKD + Full6.134.334.8
ImitKD + Full5.334.835.4
SRU (2-layer)
Vanilla7.429.530.6
SeqKD102.132.032.4
ImitKD12.733.333.7
Vanilla + Full6.033.033.8
SeqKD + Full6.833.133.7
ImitKD + Full5.733.734.5
Transf. (2-layer)
Vanilla6.432.833.4
SeqKD23.434.034.2
ImitKD7.534.334.6
Vanilla + Full5.933.834.2
SeqKD + Full7.134.034.4
ImitKD + Full5.934.434.8
+ +Table 3: Results on IWSLT test dataset. + +
VariantSRUGRULSTMTransf.
Vanilla28.628.627.732.4
SeqKD31.431.230.533.3
ImitKD32.732.732.433.7
+ +the best while avoiding the overhead of creating a teacher-modified dataset. Furthermore, we see that ImitKD is especially effective in low-data regimes. As shown in the bottom block of Table 5, ImitKD methods achieve much stronger results over baselines when we reduce the WMT training data to the same size as IWSLT. + +CNN/DailyMail Summarization In Table 6, we present the CNN/DailyMail results for a 6-layer Transformer teacher and a 2-layer SRU student. Once again, the best student is ImitKD + Full, which achieves ROUGE scores that are within 1 point of the teacher's. ImitKD variants outperform the baselines on all ROUGE metrics, showcasing the utility of our method on a different NLG task. + +Table 4: BLEU scores of different student architectures on the IWSLT validation set. We use a beam size of 1. The teacher attains a validation BLEU of 33.8. + +
VariantPPL ↓Bleu1 ↑Bleu5 ↑
Teacher3.228.729.2
Vanilla5.522.023.1
SeqKD9.024.925.5
ImitKD7.424.625.5
ImitKD*8.425.325.8
Vanilla + Full5.223.824.5
SeqKD + Full5.624.725.3
ImitKD + Full5.625.325.9
ImitKD* + Full5.625.025.8
△Vanilla18.713.815.1
△SeqKD42.317.117.9
△ImitKD15.017.819.0
△ImitKD*17.818.619.5
+ +Table 5: Results on WMT dataset. ImitKD* is trained on a student/teacher dataset mixture. $\triangle$ indicates that the model is trained with $25\times$ less data. + +
VariantPPL ↓R1 ↑R2 ↑RL ↑
Teacher12.539.017.635.7
Vanilla14.736.115.632.8
SeqKD52.936.416.133.1
ImitKD17.237.316.434.1
ImitKD*37.137.716.734.5
Vanilla + Full13.636.216.032.9
SeqKD + Full20.237.416.534.0
ImitKD + Full14.038.417.134.9
ImitKD* + Full17.938.117.134.6
+ +Table 6: Results on CNN/DailyMail dataset. All models generate using beam search $K = 5$ decoding. + +Size and Speed Analysis In Table 7, we analyze how our distillation technique can reduce computational costs, using the IWSLT (Table 3), WMT (Table 5), and CNN/DailyMail (Table 6) teacher/student pairs as case studies. By training small student models with ImitKD, we can substantially decrease model size and increase inference speed, while minimizing performance loss. Shallow, recurrent architectures are especially attractive, because they can generate 4-14 times faster than deep Transformer teachers, and 2-3 times faster than Transformer students of similar size. + +Performance Analysis at Different Lengths Figure 1 breaks down BLEU score vs. decoding length for IWSLT models trained with different algorithms (Vanilla, SeqKD, ImitKD). We show results for the three types of RNNs and the Transformer of Table 4. All models have two layers. + +
TaskModelSize% CompressCPU Time× Faster% Perform
IWSLTTransf. (8-layer)†20.1 M269 / 518 ms
SRU (3-layer)14.0 M68.7%55 / 97 ms4.9 / 5.3101.2%
SRU (2-layer)8.6 M42.7%37 / 56 ms7.2 / 9.398.0%
Transf. (2-layer)8.5 M42.3%78 / 144 ms3.4 / 3.6100.0%
WMTTransf. (6-layer)†209.9 M816 / 1466 ms
SRU (4-layer)34.2 M16.3%174 / 306 ms4.7 / 4.888.2%
CNN/DMTransf. (6-layer)†59.8 M1900 / 12138 ms
SRU (2-layer)14.4 M24.1%258 / 826 ms7.4 / 14.798.5%
+ +![](images/7f3ade997350d7afbe8de99099780b211dc3f482c462f0091e79ffe0421e26e4.jpg) +Figure 1: Bleu score versus sequence decoding length across different models and training variants. Each point on the graph represents the Bleu score of all sequences whose length is within a bin of width 20. + +As expected, we observe that the generation quality (in terms of BLEU score) degrades as the decoding length increases. This phenomenon can be explained by the global error compounding with each additional decision step (Ross et al., 2011) and has been reported in previous works (Bahdanau et al., 2014; Zhang et al., 2019). As shown in Figure 1, models trained with the vanilla objective, especially RNN-based models, suffer the most from this problem. SeqKD improves the performance across all sequence lengths, but still experiences some BLEU score degradation for longer sequences. ImitKD further improves the BLEU score across all bins, and more importantly, the improvement is most significant for longer sequences. This analysis suggests that ImitKD explicitly addresses the exposure bias problem for training student models. + +Additive Effect of Fine-Tuning Kim and Rush (2016) propose a fine-tuning method for autoregressive distillation called SeqInter. This method can further improve pretrained student models by exposing them to the sequence in the teacher beam's + +Table 7: Model types, along with statistics on size (in number of parameters) and CPU inference time per decoding (in milliseconds) for beam search with beam size $K \in \{1,5\}$ . Teacher models are marked with $^{\dagger}$ . The " % Perform" column records the ratio of the best student's performance to the teacher's performance on BLEU score for translation tasks and ROUGE-1 for the summarization task. + +
VariantSRUGRULSTMTransf.
Vanilla32.131.931.234.0
SeqKD32.232.031.434.2
ImitKD33.533.433.134.4
+ +Table 8: IWSLT validation set BLEU scores of SeqInter fine-tuning applied to the different student architectures of Table 4. We use a beam size of 1. The teacher (without fine-tuning) attains a validation BLEU of 33.8. + +that is closest to the target in terms of sentence-level BLEU. In Table 8, we show the results of applying SeqInter to each of the IWSLT models that were trained from scratch in Table 4. While SeqInter enables Vanilla models to "close the gap" on SeqKD models, ImitKD models clearly maintain their superior performance even after fine-tuning. + +# 7 Conclusion + +In this work, we developed a new knowledge distillation technique inspired by imitation learning for compressing large and cumbersome autoregressive + +models into smaller and faster counterparts. We demonstrated the empirical success of our method over popular baselines on several natural language generation tasks. + +We are excited about several possible avenues for future work. One branch of ideas involves incorporating more advanced IL algorithms beyond DAGger, such as LOLS (Chang et al., 2015), to further improve the distillation process. Another possibility is to design imitation-based fine-tuning analogs to the SeqInter method. Finally, although our experiments in this paper focused on sequence-to-sequence settings, we are interested in exploring the use of ImitKD for compressing large language models aimed at transfer learning. + +# Acknowledgments + +We thank the ASAPP NLP team - especially Yi Yang, Nicholas Matthews, Joshua Shapiro, Hugh Perkins, Amit Ganatra, Lili Yu, Xinyuan Zhang, and Yoav Artzi - as well as the EMNLP reviewers for their helpful feedback on the paper. + +# References + +Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. 2016. An actor-critic algorithm for sequence prediction. arXiv preprint arXiv:1607.07086. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +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, pages 1171-1179. +Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. 2006. Model compression. In Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 535-541. +Kai-Wei Chang, Akshay Krishnamurthy, Alekh Agarwal, Hal Daume, and John Langford. 2015. Learning to search better than your teacher. In International Conference on Machine Learning, pages 2058-2066. PMLR. +Yun Chen, Yang Liu, Yong Cheng, and Victor OK Li. 2017. A teacher-student framework for zeroresource neural machine translation. arXiv preprint arXiv:1705.00753. + +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. arXiv preprint arXiv:1406.1078. +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. +Yuntian Deng, Yoon Kim, Justin Chiu, Demi Guo, and Alexander Rush. 2018. Latent alignment and variational attention. In Advances in Neural Information Processing Systems, pages 9712-9724. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805. +Li Dong, Nan Yang, Wenhui Wang, Furu Wei, Xiaodong Liu, Yu Wang, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. 2019. Unified language model pre-training for natural language understanding and generation. arXiv preprint arXiv:1905.03197. +Mihail Eric and Christopher D Manning. 2017. A copy-augmented sequence-to-sequence architecture gives good performance on task-oriented dialogue. arXiv preprint arXiv:1701.04024. +Dan Garber. 2019. Logarithmic regret for online gradient descent beyond strong convexity. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 295-303. +Kartik Goyal, Chris Dyer, and Taylor Berg-Kirkpatrick. 2017. Differentiable scheduled sampling for credit assignment. arXiv preprint arXiv:1704.06970. +Jiatao Gu, James Bradbury, Caiming Xiong, Victor OK Li, and Richard Socher. 2017. Non-autoregressive neural machine translation. arXiv preprint arXiv:1711.02281. +Elad Hazan, Amit Agarwal, and Satyen Kale. 2007. Logarithmic regret algorithms for online convex optimization. Machine Learning, 69(2-3):169-192. +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. 2015. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735-1780. +Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. arXiv preprint arXiv:1801.06146. + +Ferenc Huszár. 2015. How (not) to train your generative model: Scheduled sampling, likelihood, adversary? arXiv preprint arXiv:1511.05101. +Sham M. Kakade, Karthik Sridharan, and Ambuj Tewari. 2009. On the complexity of linear prediction: Risk bounds, margin bounds, and regularization. In Advances in neural information processing systems, pages 793-800. +Yoon Kim and Alexander M Rush. 2016. Sequence-level knowledge distillation. arXiv preprint arXiv:1606.07947. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Adhiguna Kuncoro, Miguel Ballesteros, Lingpeng Kong, Chris Dyer, and Noah A Smith. 2016. Distilling an ensemble of greedy dependency parsers into one MST parser. arXiv preprint arXiv:1609.07561. +Rémi Leblond, Jean-Baptiste Alayrac, Anton Osokin, and Simon Lacoste-Julien. 2017. Searnn: Training rnns with global-local losses. arXiv preprint arXiv:1706.04499. +Tao Lei, Yu Zhang, Sida I Wang, Hui Dai, and Yoav Artzi. 2017. Simple recurrent units for highly parallelizable recurrence. arXiv preprint arXiv:1709.02755. +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. +Yang Liu and Mirella Lapata. 2019. Text summarization with pretrained encoders. arXiv preprint arXiv:1908.08345. +Minh-Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Effective approaches to attention-based neural machine translation. arXiv preprint arXiv:1508.04025. +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. +Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. 2018. Scaling neural machine translation. arXiv preprint arXiv:1806.00187. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311-318. Association for Computational Linguistics. + +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. +Ofir Press and Lior Wolf. 2016. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859. +Alec Radford, Jeffrey Wu, Dario Amodei, Daniela Amodei, Jack Clark, Miles Brundage, and Ilya Sutskever. 2019. Better language models and their implications. OpenAI Blog https://openai.com/blog/better-language-models. +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. +Marc'Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. 2015. Sequence level training with recurrent neural networks. arXiv preprint arXiv:1511.06732. +Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. 2019. *Fastspeech: Fast, robust and controllable text to speech*. In *Advances in Neural Information Processing Systems*, pages 3165–3174. +Stéphane Ross and Drew Bagnell. 2010. Efficient reductions for imitation learning. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 661-668. +Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. 2011. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 627-635. +Alexander M Rush, Sumit Chopra, and Jason Weston. 2015. A neural attention model for abstractive sentence summarization. arXiv preprint arXiv:1509.00685. +Victor Sanh, Lysandre Debut, Julien Chaumont, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108. +Abigail See, Peter J Liu, and Christopher D Manning. 2017. Get to the point: Summarization with pointer-generator networks. arXiv preprint arXiv:1704.04368. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2015. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909. +Wen Sun, Arun Venkatraman, Geoffrey J Gordon, Byron Boots, and J Andrew Bagnell. 2017. Deeply + +aggravated: Differentiable imitation learning for sequential prediction. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 3309-3318. JMLR.org. +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. +Xu Tan, Yi Ren, Di He, Tao Qin, Zhou Zhao, and TieYan Liu. 2019. Multilingual neural machine translation with knowledge distillation. arXiv preprint arXiv:1902.10461. +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. +Dilin Wang, Chengyue Gong, and Qiang Liu. 2019. Improving neural language modeling via adversarial training. arXiv preprint arXiv:1906.03805. +Bingzhen Wei, Mingxuan Wang, Hao Zhou, Junyang Lin, and Xu Sun. 2019. Imitation learning for non-autoregressive neural machine translation. arXiv preprint arXiv:1906.02041. +Sam Wiseman and Alexander M Rush. 2016. Sequence-to-sequence learning as beam-search optimization. arXiv preprint arXiv:1606.02960. +Jeremy Wohlwend, Nicholas Matthews, and Ivan Itz-covich. 2019. Flambé: A customizable framework for machine learning experiments. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 181-188. +Jiakai Zhang and Kyunghyun Cho. 2016. Query-efficient imitation learning for end-to-end autonomous driving. arXiv preprint arXiv:1605.06450. +Wen Zhang, Yang Feng, Fandong Meng, Di You, and Qun Liu. 2019. Bridging the gap between training and inference for neural machine translation. arXiv preprint arXiv:1906.02448. +Chunting Zhou, Graham Neubig, and Jiatao Gu. 2019. Understanding knowledge distillation in non-autoregressive machine translation. arXiv preprint arXiv:1911.02727. + +# A Appendices + +# A.1 DAgger Algorithm + +The dataset aggregation (DAgger) algorithm (Ross et al., 2011) minimizes the following objective: + +$$ +\mathcal {L} _ {\operatorname {I m i t}} (\pi) = \mathbb {E} _ {s _ {1}, \dots , s _ {T} \sim \mathcal {D}} \left[ \sum_ {t = 1} ^ {T} \ell^ {\pi^ {*}} \left(s _ {t}; \pi\right) \right], \tag {7} +$$ + +where $\mathcal{D}$ is a distribution (or dataset) of $T$ -step state trajectories and $\ell^{\pi^{*}}(s,\pi)$ is the action-discrepancy loss between the oracle $\pi^{*}$ and the policy learner $\pi$ in state $s$ . The full DAgger algorithm is given in Algorithm 2. + +Algorithm 2 Dataset Aggregation +1: Let $\mathcal{D} = \emptyset$ be initial dataset. +2: Initialize $\pi_1$ at random. +3: for $i = 1, \ldots, I$ do +4: Let mixture policy $\tilde{\pi}_i = \beta_i \pi^* + (1 - \beta_i) \pi_i$ . +5: Initialize new dataset $\mathcal{D}^i = \emptyset$ . +6: repeat $B$ times +7: Run MDP on $\tilde{\pi}_i$ , sample $\{s_1, \ldots, s_T\}$ . +8: Append new states $\{s_1, \ldots, s_T\}$ to $\mathcal{D}^i$ . +9: Aggregate $\mathcal{D} = \mathcal{D} \cup \mathcal{D}^i$ . +10: Train $\pi_{i+1}$ on $\mathcal{D}$ to min $\mathcal{L}_{\mathrm{Imit}}$ with $\pi^*$ . +11: end for +12: return Best policy $\pi$ on validation set. + +# A.2 Implementation Details + +In all experiments, all RNN-based models with hidden dimension $N$ consist of a bidirectional encoder with hidden dimension $N / 2$ and a left-to-right decoder with hidden dimension $N$ . + +For BLEU score evaluation, we use the NLTK library. For ROUGE score evaluation, we use the py-rouge library. + +Preliminary Study For Table 1, we train both an 8-layer Transformer and a 2-layer RNN (specifically SRU) on the IWSLT dataset using standard supervised learning. The architectural and training details are the same as those outlined in the IWSLT experiments. At test time, both the Transformer and the RNN perform greedy decoding. On average, ground-truth translations in the IWSLT test set have 24.5 tokens. The "RNN first, Transformer completes" mixed decoding strategy generates 12 + +tokens (i.e. half on average) with the RNN and the rest with the Transformer. We measure generation quality using Bleu score. + +IWSLT The IWSLT 2014 German $\rightarrow$ English dataset is taken directly from the source website. + +We train an 8-layer Transformer teacher model with model dimension 256, feedforward dimension 1024, and four attention heads as the teacher model. The 2-layer student SRU model has a hidden dimension 512, and the 3-layer model has hidden dimension 1024 and projection dimension 256. The student Transformer model has model dimension 256, feedforward dimention 768 and 4 attention heads. + +All models have word embedding dimension 256 and exhibit weight tying between the decoder embeddings and the output layer (Press and Wolf, 2016). We train models for 80K steps with batch size 128 using the Adam optimizer with base learning rate 0.1. We use an inverse-square-root learning rate scheduler (Vaswani et al., 2017) with 10K warmup steps for the teacher and 5K warmup steps for all students. Validation set metrics are recorded every 1K steps. For all ImitKD variants, we set the final mixing rate $r = 0.005$ (i.e. very close to 0), and use top- $K$ sampling with $K = 5$ as the generation algorithm during training. We use $M = 4$ as the batch parallelization parameter. + +In Table 4, the 2-layer SRU and the 2-layer Transformer follow the same architecture as those in Table 3. To standardize architecture across RNNs, the GRU and the LSTM have the same embedding dimension (i.e. 256) and hidden dimension (i.e. 512) as the SRU. + +WMT The WMT 2016 dataset is taken from the Fairseq library. + +We use a pre-trained Transformer-large model from the Fairseq library (Ott et al., 2018, 2019) as our teacher model. It has embedding dimension 1024, model dimension 1024, and feedforward dimension 4096. The student is a 4-layer SRU with hidden size 1024, projection size 256, and embedding size 256. The student is trained for 15 epochs with batch size 512, base learning rate 0.1, and 4K warmup steps. We record validation metrics every 1/4 of the epoch. The encoder embeddings, decoder embeddings, and decoder output layer share + +the same weight parameters. We tune the final mixing rate $r \in \{0.5, 0.1, 0.005\}$ for our ImitKD variants. + +CNN/Dailymail The CNN/DailyMail dataset is taken from Professor Kyunghyun Cho's website, a commonly used source for this dataset. The teacher model is a 6-layer Transformer-base model with embedding dimension 512, model dimension 512, and feedforward dimension 2048. The student is a 2-layer SRU with embedding dimension 256, hidden size 1024, and projection size 256. We use a batch size of 128. For both models, the learning rate follows an inverse-square root schedule with warmup of 2K steps. Validation set metrics are recorded every 2K steps. The teacher has a base learning rate of 0.03, while the student has a base learning rate of 0.1. The teacher benefits from larger effective batch sizes by accumulating gradients every eight steps. On the other hand, the student does not seem to benefit from gradient accumulation and therefore takes a gradient step after processing each batch. All ImitKD variants use final mixing rate $r = 0.1$ and greedy decoding during training. We use $M = 4$ as the batch parallelization parameter. + +Size and Speed Analysis CPU generation times for all models were measured on a 2019 MacBook Pro with a $2.6\mathrm{GHz}$ 6-core Intel Core i7 processor. Time estimates reported in Table 7 were averaged over examples in the test set of the corresponding dataset. + +Performance Analysis at Different Lengths For each IWSLT variant, we ran greedy decoding (i.e. beam search decoding with beam size $K = 1$ ) on the test set. Then, we sorted the decoded sequences by length into the following bins: [0, 20], [21, 40], [41, 60], [61, 80], [81, 100], [101, 120]. Each point in Figure 1 is the Bleu score of all sequences within one of these bins for the corresponding IWSLT variant. + +Additive Effect of Fine-Tuning For the fine-tuning experiments, we generated SeqInter data with a beam size of $K = 5$ and NLTK's sentence-level BLEU implementation. We used the Adam optimizer with a base learning rate of 0.01 and an inverse-square root scheduler with 2K warmup steps. All models were fine-tuned for 20K iterations. Models were validated every 1K iterations. \ No newline at end of file diff --git a/autoregressiveknowledgedistillationthroughimitationlearning/images.zip b/autoregressiveknowledgedistillationthroughimitationlearning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..555258bdb6437001d2cad96244863e2f17fb4e02 --- /dev/null +++ b/autoregressiveknowledgedistillationthroughimitationlearning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69e60f9b3b8de55b1bf2ae44f384bb04f66ad9befe8ddc972558a9d0a0ef2c01 +size 485018 diff --git a/autoregressiveknowledgedistillationthroughimitationlearning/layout.json b/autoregressiveknowledgedistillationthroughimitationlearning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..01ebd9e04147bcd6419262bb0da859a13e111036 --- /dev/null +++ b/autoregressiveknowledgedistillationthroughimitationlearning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:494ea4725ff8a645b1088dee3f72a5d68b76d2170152b4e355df328e18323ee0 +size 454119 diff --git a/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_content_list.json b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3b8cbed6f23321a6190f26892fcaa42c5d85d949 --- /dev/null +++ b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e735050786b170659d3de12b9a1ceab7b264f6fcf131f9fef3419bac97141863 +size 73001 diff --git a/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_model.json b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_model.json new file mode 100644 index 0000000000000000000000000000000000000000..49386bf35d109bc8fc8dc146e98f22a98f296822 --- /dev/null +++ b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9058cc65a2209d6d762ab33ac62c0fdc59e26273450c0817dfbd47709ec8a4d2 +size 89814 diff --git a/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_origin.pdf b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..2cfcf751e408c7082238b23f58babc55f50d5fb1 --- /dev/null +++ b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/8a99955f-ee2e-40ab-9acd-5157d41403ac_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8403b12d51348f3e0c60dd7b3579702069b9ec09db01aa464420d163525424a3 +size 371390 diff --git a/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/full.md b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3968b41c4739fe79a746352a7d8b781cc1f74c70 --- /dev/null +++ b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/full.md @@ -0,0 +1,277 @@ +# Avoiding the Hypothesis-Only Bias in Natural Language Inference via Ensemble Adversarial Training + +Joe Stacey + +University College London + +ucakjd0@ucl.ac.uk + +Pasquale Minervini + +University College London + +p.minervini@ucl.ac.uk + +Haim Dubossarsky + +University of Cambridge + +hd423@cam.ac.uk + +# Sebastian Riedel + +University College London + +s.riedel@cs.ucl.ac.uk + +# Tim Rocktäschel + +University College London + +t.rocktaschel@cs.ucl.ac.uk + +# Abstract + +Natural Language Inference (NLI) datasets contain annotation artefacts resulting in spurious correlations between the natural language utterances and their respective entailment classes. These artefacts are exploited by neural networks even when only considering the hypothesis and ignoring the premise, leading to unwanted biases. Belinkov et al. (2019b) proposed tackling this problem via adversarial training, but this can lead to learned sentence representations that still suffer from the same biases. We show that the bias can be reduced in the sentence representations by using an ensemble of adversaries, encouraging the model to jointly decrease the accuracy of these different adversaries while fitting the data. This approach produces more robust NLI models, outperforming previous de-biasing efforts when generalised to 12 other NLI datasets (Belinkov et al., 2019a; Mahabadi et al., 2020). In addition, we find that the optimal number of adversarial classifiers depends on the dimensionality of the sentence representations, with larger sentence representations being more difficult to de-bias while benefiting from using a greater number of adversaries. + +# 1 Introduction + +NLI datasets are known to contain artefacts associated with their human annotation processes (Gururangan et al., 2018). Neural models are particularly prone to picking up on artefacts, relying on these biases and spurious correlations rather than acquiring a true understanding of the task. Because these artefacts are often dataset specific (Poliak et al., 2018; Tsuchiya, 2018), models that rely on these artefacts consequently generalise poorly when tested on other datasets (Belinkov et al., 2019a). + +One way to alleviate this problem is via adversarial training: the task classifier and an adversarial classifier jointly share an encoder, with the adversarial classifier trained to produce the correct + +predictions by analysing the artefacts in the training data. The encoder optimises the training objective while also reducing the performance of the adversarial classifier. In this context, adversarial training aims to produce sentence representations that do not incorporate information about the artefacts (or bias) in the data, resulting in less biased models that generalise better. + +Previous studies show that adversarial training is associated with better generalisation performance across other datasets, although there are concerns that the biases are not removed from the model sentence representations, with classifiers able to relearn such biases from the representations after these are frozen (Belinkov et al., 2019b; Elazar and Goldberg, 2018). It is therefore unclear whether any improvements are as a result of the de-biasing, and whether actually removing these biases from the model representations will further improve generalisation. We focus our effort on this discrepancy and argue that, in order to show de-biasing is effective, improvements in performance should also correspond to an observed reduction of the bias in the model representations, therefore creating representations that generalise better to other data. + +In this paper we show that NLI models can avoid learning from the hypothesis-only bias, using an ensemble of adversarial classifiers to prevent the bias being relevant from a model's representations. Furthermore, we show that the more bias is removed from the model representations, the better these models generalise to other NLI datasets. Removing the bias from the representations proves to be a highly effective strategy, producing more robust NLI models that outperform previous de-biasing efforts when tested on 12 different NLI datasets (Belinkov et al., 2019a; Mahabadi et al., 2020). In addition, we show that the ability to de-bias a sentence representation depends on its dimensionality, with large sentence representations being harder to de-bias and requiring more adversarial classifiers + +during training. + +In summary, this paper makes the following core contributions: $i$ ) We investigate whether using an ensemble of adversarial classifiers can remove the hypothesis-only bias within NLI models. For large enough dimensions, this method achieves a statistically significant reduction of the bias. $ii$ ) We test whether removing more of the bias improves how well the model generalises. Our method improves model accuracy across 12 NLI datasets and outperforms previous research (Belinkov et al., 2019a; Mahabadi et al., 2020). $iii$ ) We inspect the optimal number of adversaries to use depending on the dimensionality of the sentence representations. We find that as this dimensionality is increased, more adversaries are required to de-bias a model. $iv$ ) We compare the effect of adversarial training with a linear classifier to using a non-linear multi-layer perceptron as the adversary, showing that using a more complex adversarial classifier is not always beneficial. Instead, the best choice of adversary depends on the classifier being used to relearn the bias. + +# 2 Related Work + +The Hypothesis-Only Bias Gururangan et al. (2018) and Tsuchiya (2018) demonstrate how models can predict the class within the SNLI dataset when only processing the hypothesis, reaching accuracy scores as high as twice the majority baseline $(67\%$ vs. $34\%)$ . This is possible due to hypothesis-only biases, such as the observation that negation words ("no" or "never") are more commonly used in contradicting hypotheses (Gururangan et al., 2018; Poliak et al., 2018). The hypothesis sentence length is another example of an artefact that models can learn from, with entailment hypotheses being, on average, shorter than either contradiction or neutral hypotheses (Gururangan et al., 2018). + +Tsuchiya (2018) show that the hypothesis-only bias predictions are significantly better than the majority baseline for SNLI, although this is not the case for the SICK dataset (Marelli et al., 2014). Poliak et al. (2018) find that human-elicited datasets such as SNLI and MultiNLI have the largest hypothesis-only bias. As a result, our paper focuses on removing the hypothesis-only bias from SNLI, the dataset with the largest hypothesis-only bias reported by Poliak et al. (2018). This bias is + +also dataset specific, with Belinkov et al. (2019a) finding that only MultiNLI shares some of the same hypothesis-only bias as the SNLI dataset. + +Generalisation to Other Datasets Bowman et al. (2015) and Williams et al. (2018) show that models trained on the SNLI and MultiNLI datasets do not necessarily learn good representations for other NLI datasets, such as SICK. Analogous results were also reported by Talman and Chatzikyriakidis (2018) for more complex models. Gururangan et al. (2018) and Tsuchiya (2018) identify how NLI models perform worse on hard examples, which are defined as the examples that a hypothesis-only model has misclassified. This suggests that the success of NLI models may be overstated, with models relying on artefacts in their training data to achieve high performance (Gururangan et al., 2018). Our paper will assess whether NLI models that no longer learn from the hypothesis-only bias can still retain this high level of accuracy. + +Biases and Artefacts SNLI and MultiNLI are not the only datasets that suffer from the presence of annotation artefacts and biases. In the past, machine reading datasets were also found to contain syntactic clues that were giving away the correct prediction (Vanderwende and Dolan, 2005; Snow et al., 2006). For instance, Kaushik and Lipton (2018) show that, in several reading comprehension datasets such as bAbI (Weston et al., 2016) and Children's Books Test (Hill et al., 2016), it is possible to get non-trivial results by considering only the last passage of the paragraph. In visual question answering datasets, several studies find it is often possible to answer the question without looking at the corresponding image (Zhang et al., 2016; Kafle and Kanan, 2016; Goyal et al., 2017; Agrawal et al., 2018). Similarly, for the ROCStories corpus (Mostafazadeh et al., 2016), Schwartz et al. (2017) and Cai et al. (2017) show it is possible to achieve non-trivial prediction accuracy by only considering candidate endings and without taking the stories in account. The de-biasing approach introduced in this paper could be applied in any of these situations where a model involves a classifier based on latent representations. + +Learning Robust Models Neural models are known to be vulnerable to so-called adversarial examples, i.e. instances explicitly crafted by an adversary to cause the model to make a mistake (Szegedy et al., 2014). Most recent work focuses on sim + +ple semantic-invariant transformations, showing that neural models can be overly sensitive to small modifications of the inputs and paraphrasing. For instance, Ribeiro et al. (2018) use a set of simple syntactic changes, such as replacing What is with What's. Other semantics-preserving perturbations include typos (Hosseini et al., 2017), the addition of distracting sentences (Wang and Bansal, 2018; Jia and Liang, 2017), character-level perturbations (Ebrahimi et al., 2018), and paraphrasing (Iyyer et al., 2018). Minervini and Riedel (2018) propose searching for violations of constraints, such as the symmetry of contradiction and transitivity of entailment, for identifying where NLI models make mistakes and then creating more robust models by training on these adversarial examples. Alternatively, Clark et al. (2019), He et al. (2019) and Mahabadi et al. (2020) create naive models that make predictions based on known dataset biases, and then train robust models in an ensemble with the naive models to focus on other patterns in the data that generalise better. + +Adversarial Training Another procedure for creating more robust models is through adversarial training with latent representations, with a classifier trained to learn the bias from the model sentence representations which in turn update to reduce the performance of the bias classifier (Wang et al., 2019). For example, Ganin and Lempitsky (2015) use adversarial training to improve domain adaption, allowing models to learn features helpful for the model task but which are also invariant with respect to changes in the domain. This was achieved by jointly training two models, one to predict the class label and one to predict the domain, and then regularising the former model to decrease the accuracy of the latter via gradient reversal. + +Belinkov et al. (2019b) use adversarial training to remove the hypothesis-only bias from models trained on SNLI. While this approach produced models that generalised better to other datasets, these same models show degraded performance on SNLI-hard (Belinkov et al., 2019a), which is supposedly the ideal dataset to test for generalisation as it resembles SNLI the most in terms of domain and style while lacking the examples with the largest bias (Gururangan et al., 2018). Moreover, the bias is not removed from the model sentence representations and can be almost fully recovered if these representations stop updating (Belinkov et al., 2019b). It is therefore unclear whether any improvements + +are caused by de-biasing, or are instead a result of perturbations from the adversarial training procedure. Similarly, Elazar and Goldberg (2018) find that adversarial training and gradient reversal does not remove demographic information such as age or gender, with this information still present in the de-biased sentence representations. Here, we propose using an ensemble of multiple adversaries to avoid the hypothesis-only bias, significantly reducing the bias stored within a model's representations and outperforming previous de-biasing research efforts when testing model generalisation. + +Using Model Ensembles Grefenstette et al. (2018) find that using ensembles of models is a better use of computational budget when training from adversarial examples compared to using a larger model with more parameters. Elazar and Goldberg (2018) show that using an ensemble of up to 5 adversarial classifiers helped remove demographic information contained within Twitter messages, however beyond this they were not able to re-learn the main task. Mahabadi et al. (2020) provide further support for using model ensembles after implementing a Product of Experts approach with multiple hypothesis-only models, producing more robust NLI models despite not attempting to remove the bias from the underlying representations. We compare our results with Mahabadi et al. (2020) to quantify the benefits of removing the bias from the sentence representations. + +# 3 Ensemble Adversarial Training + +We follow an adversarial training approach for reducing the hypothesis-only bias contained within the sentence representations. Specifically, we generalise the adversarial training framework proposed by Belinkov et al. (2019a) to make use of multiple adversaries: $n$ hypothesis-only adversaries are jointly trained for predicting the relationship between the premise and hypothesis given only the representation of the hypothesis from the sentence encoder. At the same time, the sentence encoder together with an hypothesis-premise model are jointly trained to fit the training data, while decreasing the accuracy of these adversaries. Formally, given a hypothesis $\mathbf{h}$ and a premise $\mathbf{p}$ , the predictions of the hypothesis-premise model $\hat{y}$ and the $i$ -th hypothesis-only adversary $\hat{y}_{a_i}$ can be for + +malised as follows: + +$$ +\begin{array}{l} \mathbf {e} _ {h} = \mathrm {e n c o d e r} _ {\theta_ {e}} (\mathbf {h}), \quad \mathbf {e} _ {h} \in \mathbb {R} ^ {k} \\ \mathbf {e} _ {p} = \operatorname {e n c o d e r} _ {\theta_ {e}} (\mathbf {p}), \quad \mathbf {e} _ {p} \in \mathbb {R} ^ {k} \\ \hat {y} = \mathrm {M L P} _ {\theta_ {c}} \left(\left[ \mathbf {e} _ {h}; \mathbf {e} _ {p}; \mathbf {e} _ {h} - \mathbf {e} _ {p}; \mathbf {e} _ {h} \odot \mathbf {e} _ {p} \right]\right) \\ \hat {y} _ {a _ {i}} = \mathrm {M L P} _ {\theta_ {a _ {i}}} (\mathbf {e} _ {h}), \\ \end{array} +$$ + +where $\hat{y},\hat{y}_{a_i}\in \mathbb{R}^3$ are (unnormised) score distributions over the three NLI classes, i.e. entailment, contradiction, and neutral, and $\theta_{e},\theta_{c},\theta_{a_{i}}$ respectively denote the parameters of the encoder, the hypothesis-premise model, and the $i$ -th hypothesis-only adversary. The adversarial training procedure can be formalised as optimising the following minimax objective: + +$$ +\begin{array}{l} \min _ {\theta_ {e}, \theta_ {c}} \max _ {\theta_ {a}} \sum_ {\langle \mathbf {h}, \mathbf {p}, y \rangle \in \mathcal {D}} (1 - \lambda) \mathcal {L} _ {c e} (y, \hat {y}) \\ - \frac {\lambda}{n} \sum_ {i = 1} ^ {n} \mathcal {L} _ {c e} (y, \hat {y} _ {a _ {i}}), \tag {1} \\ \end{array} +$$ + +where $\mathcal{D}$ is a dataset, and $\mathcal{L}_{ce}$ denotes the cross-entropy loss (Goodfellow et al., 2016), and $n\in \mathbb{N}_+$ is the number of adversaries. The hyperparameter $\lambda \in [0,1]$ denotes the trade-off between the losses of the hypothesis-premise model and the hypothesis-only adversaries. Similarly to Belinkov et al. (2019a), we optimise the minimax objective in Eq. (1) using gradient reversal (Ganin and Lempitsky, 2015), which leads to an optimisation procedure equivalent to the popular gradient descent ascent algorithm (Lin et al., 2019). The gradient reversal multiplies the gradient from the adversarial classifiers by a negative constant, training the encoder to reduce the performance of these classifiers. + +To test the impact of using multiple adversarial classifiers when changing the dimensionality of the representations, we train with $\{1,5,10,20\}$ bias classifiers for $\{256,512,1024,2048\}$ dimensional sentence representations. The learned sentence representation is then frozen, and 20 adversarial classifiers are randomly reinitialised before they attempt to re-learn the hypothesis-only bias from the frozen de-biased sentence representation. The maximum accuracy from across the 20 adversarial classifiers is then reported after trying to remove the bias, showing the maximum bias that can still be learnt from the representation. + +The ability of adversarially trained models to de-bias sentence representations is + +tested across a range of $\lambda$ hyper-parameters $\{0.001, 0.01, 0.1, 0.2, 0.3, \ldots, 0.8, 0.9, 0.99, 0.999\}$ . This shows whether any improvement is due to the choice of $\lambda$ , or whether there is an improvement regardless. + +Model Architecture Following the same experimental set-up as Belinkov et al. (2019a) and Poliak et al. (2018), we use an InferSent model (Connieu et al., 2017) with pretrained GloVe 300-dimensional word embeddings. The InferSent model architecture consists of a Long Short-Term Memory network (LSTM, Hochreiter and Schmidhuber, 1997) encoder which creates a 2048 dimensional sentence representation. + +# 3.1 Significance Testing + +We perform statistical testing to assess whether the differences between using one or five adversarial classifiers is significant. This involves repeating the experiments for both one and five adversarial classifiers with ten different random seeds. For each experiment, the de-biasing is performed before a classifier attempts to learn the bias again from the frozen sentence representations. + +We use bootstrapping hypothesis testing (Efron and Tibshirani, 1993) to test the statistical significance by comparing the means from the two samples. We also provide p-values from a Mann Whitney U-test (Mann and Whitney, 1947). The bootstrapping considers the null hypothesis that there is no difference between the mean bias re-learnt from using five adversarial classifiers compared to just using one adversarial classifier. In addition, we use a Bonferroni correction factor (Shaffer, 1995) of four when evaluating the p-values, taking into account multiple hypothesis testing across each different dimension. P-values smaller than 0.05 are considered significant. + +# 3.2 Using Deeper Adversaries + +We also investigate using a multi-layer perceptron as a more complex adversarial classifier to understand whether the bias that can be re-learnt depends on the type of classifier used. The experiments are repeated using non-linear classifiers instead of linear classifiers, both during the adversarial training and also afterwards when the classifiers try to relearn the biases from the frozen representations. In addition to testing 2048 dimensions using ten adversaries, a 512 dimensional representation is also tested using a smaller number of adversaries (five). + +![](images/d89bc089c5971210ecda9f393934c54482f75e7b4ef9413ce5093899cc687324.jpg) + +![](images/22ac49e659d55c7a3945ce38f95def6e04f38dd1906fe5379f79ec1ee336de60.jpg) + +![](images/ba31189544bc6b7be60d7abe32da94fac5dabe2b86cb5d9405829383cc6c8cca.jpg) +Figure 1: The maximum bias classifier accuracy after the bias is re-learnt from the frozen de-biased representations (in blue), compared to the accuracy of an independent bias classifier (not an adversary) at the end of the adversarial training (in purple). The main NLI task accuracy is also displayed. + +![](images/ca8f7209c6b5f60817a060beaf43dbeac52a6581462e488a32ace8ac1376b107.jpg) + +We perform the experiments with three scenarios: i) Using the non-linear classifiers during the adversarial training, but not afterwards, and instead trying to re-learn the bias with a linear classifier. ii) Using linear classifiers during the adversarial training but then non-linear classifiers are used to try to re-learn the biases after the sentence representation is frozen. iii) Finally, non-linear classifiers are used both during adversarial training and afterwards when trying to re-learn the biases from the frozen sentence representation. The non-linear multi-layer perceptron classifier consists of three linear layers, and two non-linear layers using tanh. + +# 3.3 Evaluating De-biased Sentence Encoders + +After training the models on SNLI with adversarial training, we test these de-biased models on a range of different datasets to see whether they generalise better. The performance of the de-biased models is compared to a baseline model trained on SNLI where no adversarial training has been performed. + +By using different random seeds, we compare ten baseline SNLI-trained models with models using one adversary and 20 adversaries, with each of these models tested on SNLI-hard. We perform bootstrap hypothesis testing to understand whether there is a significant difference between using one adversary and the baseline models with no adversarial training. We have repeated this hypothesis testing to compare models de-biased using 20 adversaries to the baseline models. + +Additionally, we evaluate the de-biased models on 12 different datasets to understand whether models trained with an ensemble of adversaries perform better than the baseline and models trained with one adversary. The datasets in these experiments are the same datasets tested by Belinkov et al. (2019a): ADD-ONE-RTE (Pavlick and Callison-Burch, 2016), GLUE (Wang et al., 2018), JOCI (Zhang et al., 2017), MNLI (Williams et al., 2018), MPE (Lai et al., 2017), SCITAIL (Khot et al., 2018), SICK (Marelli et al., 2014), SNLI + +
DimensionsNumber of adversaries
0151020
2566544424344
5126552454444
1,0286658535252
2,0486662585753
+ +Table 1: Maximum accuracy $(\%)$ from 20 bias classifiers when re-learning the hypothesis-only bias from the frozen de-biased sentence representation. The lowest accuracy figure for each dimension is highlighted, after testing 0, 1, 5, 10 and 20 adversaries. + +hard (Gururangan et al., 2018), and three datasets recast by White et al. (2017): DPR (Rahman and Ng, 2012), FN+ (Pavlick et al., 2015) and SPR (Reisinger et al., 2015). + +While the previous results in this paper use an LSTM encoder, a bidirectional LSTM has been used when testing other datasets to ensure the experiments are a like-for-like comparison with Belinkov et al. (2019a). We select the hyper-parameters that yield the highest accuracy on a validation set, in line with the experiments conducted by Belinkov et al. (2019a). Finally, the model results are compared to the Product of Experts (PoE) de-biasing approach proposed by Mahabadi et al. (2020). + +# 4 Results + +We use an ensemble of multiple adversarial classifiers during model training to understand whether it is possible to reduce the bias within the model sentence representations. Our results show that training a model with an ensemble of adversaries does reduce the model bias, doing so across each dimensionality of sentence representations tested. Moreover, more adversaries are required for de-biasing larger dimensional sentence representations. + +When using just one adversarial classifier for a 2,048 dimensional sentence representation, after the representation was frozen and the bias classifiers had a chance to re-learn the hypothesis-only bias, the accuracy of the bias classifiers increased to $62\%$ (see Table 1). This result mirrors the findings of Belinkov et al. (2019b), where using one adversarial classifier does not remove the bias from the model sentence representations. We additionally show that an independent bias classifier can still reach $58\%$ accuracy at the end of the adversarial training, without needing to freeze the representa + +![](images/1a896ddfeb508a7503303f2cd2e93f850e015cd93212f0a113bd5f6cd1739cb8.jpg) +Figure 2: The fall in accuracy of hypothesis-only classifiers when using 1 or 20 adversaries to remove the hypothesis-only bias (compared to a baseline with no adversaries). This is shown alongside the overall accuracy of the de-biased NLI models. + +tion in order to relearn the bias (see Fig. 1). + +For 2,048 dimensional sentence representations, as the number of adversaries are increased up to 20, less bias can be found in the resulting de-biased sentence representation. When the number of adversarial classifiers are increased from 1 to 20, the accuracy of the hypothesis-only bias classifiers reduces from $62\%$ to $53\%$ (see Table 1). + +The higher the dimensionality of the sentence representation, the more difficult it is to remove its bias. Additionally, the optimal number of adversarial classifiers depends on the dimensionality of the representations, with more adversaries required for higher dimensions. For 2,048 dimensions this is 20 adversaries, while for 256 dimensions this reduces to 5 adversaries (see Table 1). For 256, 512 and 1,028 dimensions, the improvements plateau after a set number of adversaries, and therefore scaling up the number of adversaries beyond 20 is unlikely to lead to further improvements. + +The improvements in de-biasing when using an ensemble of adversaries is consistent across different $\lambda$ hyper-parameter values: when comparing a model trained with one adversary to a model trained with 20 adversaries, the model trained with 20 consistently removes more bias. Using a single adversary does reduce the bias for $\lambda$ values of 0.9 and above, but at the expense of the overall model accuracy which reduces dramatically (Fig. 2). This suggests that valuable information about the hypothesis is being removed instead of just the bias. Interestingly, when using 20 adversaries, even for the largest values of $\lambda$ , the overall model accuracy does not start to decrease. + +![](images/15e7bcac2eae7648cd93fb0db96079b43e289e79bde4e38dad5a29052ea5b3d2.jpg) +Figure 3: Maximum accuracy scores of the bias classifiers when they are retrained on de-biased sentence representations for each of the experiments tested. Ten experiments were performed for each condition, using one or five adversaries for each dimension. + +# 4.1 Evaluating Multiple Adversaries + +We applied statistical testing to understand whether the improvements seen using an ensemble of adversarial classifiers is statistically significant. For sentence representations with 2,048, 1,024 or 512 dimensions this is a statistically significant result. Although the results are not statistically significant for a smaller 256 dimensional representation. + +For 2,048, 1,024 and 512 dimensional sentence representations, the statistical testing provides p-values smaller than 0.05. The null hypothesis is therefore rejected in these cases, with the alternative hypothesis stating that using five adversaries reduces the mean bias re-learnt from the sentence representations compared to using just one adversarial classifier (see Table 2). Fig. 3 displays these results in a boxplot diagram. + +# 4.2 Using Deeper Adversaries + +To investigate the impact of changing the strength of the adversary, multi-layer perceptrons are used during model training as the adversarial classifiers. The results show that more complex multi-layer perceptrons do not always perform better, and that the best choice of adversary depends on the type of classifier used to relearn the bias. + +When a non-linear model is used to re-learn the bias from the frozen sentence representation, less bias can be recovered if a non-linear model was used as the adversarial classifier during training instead of a linear adversarial classifier (see Table 3). Therefore, when using a more complex classifier to re-learn the bias, a model of at least the same complexity should be used in the adversarial train + +ing to remove these biases. If a linear classifier is used as the adversary, a non-linear classifier can find more bias when learning from the de-biased representation than a linear classifier can. + +The results also show that if a linear model is being used to re-learn the bias, then using a linear model as the adversary instead of a multi-layer perceptron reduces the amount of bias that can be recovered (see Table 3). This could suggest that the best approach is to use the same type of classifier for both the adversarial model and the classifier used to re-learn the bias. However, more adversarial classifiers may be required when using nonlinear classifiers as adversaries, and therefore more experimentation is required to test this hypothesis. + +The classifier chosen to relearn the bias will depend on the model that is being de-biased. If a classifier cannot relearn the bias from the sentence representations, this is a guarantee that a model using the de-biased representations and this classifier will not be influenced by the bias. + +# 4.3 Evaluating De-biased Encoders + +The models trained with an ensemble of adversaries are applied to 12 different NLI datasets to test whether these de-biased models generalise better than models trained with either one or no adversarial classifier. The datasets tested include SNLI-hard, where models that are no longer influenced by the hypothesis-only bias are expected to perform better. Models trained using an ensemble of adversaries performed better across most of these datasets, including SNLI-hard where there is a statistically significant improvement compared to a baseline model with no adversarial training. + +Models trained with one adversary were not significantly better than a baseline model when tested on SNLI-hard (1.1% improvement, corresponding to a p-value of 0.07). On the other hand, there is a statistically significant improvement when using an ensemble of 20 adversarial classifiers (achieving a 1.6% improvement with a p-value of 0.015). As a result, we accept the alternative hypothesis that models trained with 20 adversaries have a higher mean accuracy than the baseline models. + +Across 8 of the 13 datasets analysed, models trained with an ensemble of 20 adversarial classifiers performed better than when using only one adversarial classifier (see Table 4). For three of the remaining datasets, the performance was the same between using one adversary and 20 adversaries. + +
P-ValueAccuracy of bias classifier
Dim.Mann-WhitneyBootstrappingMean (Median), 1 Adv.Mean (Median), 5 Adv.
2561142.4 (42.0)41.8 (41.6)
5120.0009*<0.0001*49.8 (49.4)45.8 (45.9)
1,0280.0008*<0.0001*58.9 (59.5)52.6 (52.8)
2,0480.0005*0.0105*61.6 (61.7)58.7 (58.4)
+ +Table 2: p-values after performing Bootstrapping and Mann-Whitney hypothesis tests, using a Bonferroni correction factor of 4. * indicates a statistically significant result with a p-value below 0.05. Highlighted values indicate that the mean is significantly smaller than its comparison mean value, using the bootstrapping p-values. + +
Adversary typeClass. typeAccuracy
2,048 dim (10 adv)
LinearLinear56
LinearNon-linear66
Non-LinearLinear61
Non-LinearNon-linear62
512 dim (5 adv)
LinearLinear44
LinearNon-linear66
Non-LinearLinear55
Non-LinearNon-linear60
+ +The performance when using an ensemble of adversaries was on average 0.9 points higher than when using one adversary, which in turn outperformed the baseline by 1.6 points. The ensemble of adversaries also outperforms the Product of Experts approach proposed by Mahabadi et al. (2020). + +# 4.4 Discussion + +We find that the higher the dimensionality of the representations, the less effective a single adversary is at removing the bias, with the de-biasing also dependant on the strength of the classifier. These differences explain why past research has found that biases can remain hidden within the model representations (Elazar and Goldberg, 2018; Belinkov et al., 2019b), with Elazar and Goldberg (2018) using a model with a non-linear classifier while Belinkov et al. (2019b) use a single adversary with 2,048 dimensional sentence representations. + +Table 3: Accuracy of bias classifiers when relearning the bias after using either a linear or non-linear adversary, when the classifier used to re-learn the bias (class. type) is also either linear or nonlinear. + +
DatasetBaselinePoE1 Adv.Ens.
AOR61.24+1.8-2.3+1.3
DPR46.30+0+2.9+0.9
FN+38.43+0.7+6.8+12.2
GLUE43.12+0.4+0.6-1.0
JOCI40.77+1.1+0.8+1.6
MNLI Match.53.38-0.3+0.8+0.8
MNLI Mism.52.91+0.8-0.5-0.1
MPE57.30+1.2-0.4+0.5
SCIT47.98-1.1+0.5+0.5
SICK50.61+1.70.4-0.4
SNLI Hard65.72+4.2+1.2+1.7
SNLI83.29-3.9+0.2+0.8
SPRL30.35+9.2+10.3+13.5
Average+1.2+1.6+2.5
+ +Table 4: Accuracy of the de-biased models when tested on 12 different NLI datasets, comparing models trained with one adversary (1 Adv.) as per Belinkov et al. (2019a), to models trained with an ensemble of adversaries (Ens.). The Product of Experts (PoE) approach proposed by Mahabadi et al. (2020) is also included. + +# 5 Conclusions + +We set out to prevent NLI models learning from the hypothesis-only bias by using an ensemble of adversarial classifiers. Our method produced sentence representations with significantly less bias, and these more robust models generalised better to 12 different NLI datasets, improving over previous approaches in the literature (Belinkov et al., 2019b; Mahabadi et al., 2020). + +The higher the dimensionality of the sentence representations, the harder it is to de-bias these representations and the higher the optimal number of adversarial classifiers appears to be. Furthermore, the models trained with an ensemble of adversaries also performed better when tested on SNLI-hard compared to using only one adversarial classifier. + +This is the behaviour expected from de-biased models that no longer use the hypothesis-only bias to inform their predictions. + +By preventing a linear classifier from learning the bias from the de-biased representations, we conclusively show that a model using such a classifier with these representations will not make decisions based on the bias. However, after implementing the adversarial training, a non-linear classifier may still be able to detect the bias in the sentence representations where linear classifiers are not able to. While we illustrate the conditions under which biases are removed from a linear classifier, preventing a nonlinear classifier from learning the biases is more difficult and merits further experimentation. + +# Acknowledgements + +We would like to thank Yonatan Belinkov and Rabeeh Karimi Mahabadi for providing us with their code and hyper-parameters so that we could reproduce and review their previous work. We would also like to thank Adam Poliak for publishing a quality code base that we were able to adapt. We also thank the anonymous reviewers for their thoughtful feedback and the amazing UCL NLP group for all their encouragement along the way. Pasquale Minervini's work is supported by the EU Horizon 2020 Research and Innovation Programme under the grant 875169. + +# References + +Aishwarya Agrawal, Dhruv Batra, Devi Parikh, and Aniruddha Kembhavi. 2018. Don't just assume; look and answer: Overcoming priors for visual question answering. In CVPR, pages 4971-4980. IEEE Computer Society. +Yonatan Belinkov, Adam Poliak, Stuart M. Shieber, Benjamin Van Durme, and Alexander M. Rush. 2019a. Don't take the premise for granted: Mitigating artifacts in natural language inference. In ACL (1), pages 877-891. Association for Computational Linguistics. +Yonatan Belinkov, Adam Poliak, Stuart M. Shieber, Benjamin Van Durme, and Alexander M. Rush. 2019b. On adversarial removal of hypothesis-only bias in natural language inference. In *SEM@NAACL-HLT*, pages 256-262. Association for Computational Linguistics. +Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015. A large annotated corpus for learning natural language inference. In *EMNLP*, pages 632–642. The Association for Computational Linguistics. + +Zheng Cai, Lifu Tu, and Kevin Gimpel. 2017. Pay attention to the ending: Strong neural baselines for the ROC story cloze task. In ACL (2), pages 616-622. Association for Computational Linguistics. +Christopher Clark, Mark Yatskar, and Luke Zettlemoyer. 2019. Don't take the easy way out: Ensemble based methods for avoiding known dataset biases. In EMNLP-IJCNLP, pages 4060-4073. Association for Computational Linguistics. +Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. 2017. Supervised learning of universal sentence representations from natural language inference data. In EMNLP, pages 670-680. Association for Computational Linguistics. +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. 2018. Hotflip: White-box adversarial examples for text classification. In ACL (2), pages 31-36. Association for Computational Linguistics. +Bradley Efron and Robert Tibshirani. 1993. An Introduction to the Bootstrap. Springer. +Yanai Elazar and Yoav Goldberg. 2018. Adversarial removal of demographic attributes from text data. In EMNLP, pages 11-21. Association for Computational Linguistics. +Yaroslav Ganin and Victor S. Lempitsky. 2015. Unsupervised domain adaptation by backpropagation. In ICML, volume 37 of JMLR Workshop and Conference Proceedings, pages 1180-1189. JMLR.org. +Ian J. Goodfellow, Yoshua Bengio, and Aaron C. Courville. 2016. Deep Learning: Adaptive computation and machine learning. MIT Press. +Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. 2017. Making the V in VQA matter: Elevating the role of image understanding in visual question answering. In CVPR, pages 6325-6334. IEEE Computer Society. +Edward Grefenstette, Robert Stanforth, Brendan O'Donoghue, Jonathan Uesato, Grzegorz Swirszcz, and Pushmeet Kohli. 2018. Strength in numbers: Trading-off robustness and computation via adversarially-trained ensembles. +Suchin Gururangan, Swabha Swayamdipta, Omer Levy, Roy Schwartz, Samuel R. Bowman, and Noah A. Smith. 2018. Annotation artifacts in natural language inference data. In *NAACL-HLT* (2), pages 107-112. Association for Computational Linguistics. +He He, Sheng Zha, and Haohan Wang. 2019. Unlearn dataset bias in natural language inference by fitting the residual. In DeepLo@EMNLP-IJCNLP. +Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. 2016. The goldilocks principle: Reading children's books with explicit memory representations. In ICLR. + +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural Computation, 9(8):1735-1780. +Hossein Hosseini, Baicen Xiao, and Radha Poovendran. 2017. Deceiving google's cloud video intelligence API built for summarizing videos. In CVPR Workshops, pages 1305-1309. IEEE Computer Society. +Mohit Iyyer, John Wieting, Kevin Gimpel, and Luke Zettlemoyer. 2018. Adversarial example generation with syntactically controlled paraphrase networks. In *NAACL-HLT*, pages 1875–1885. Association for Computational Linguistics. +Robin Jia and Percy Liang. 2017. Adversarial examples for evaluating reading comprehension systems. In EMNLP, pages 2021-2031. Association for Computational Linguistics. +Kushal Kafle and Christopher Kanan. 2016. Answer-type prediction for visual question answering. In CVPR, pages 4976-4984. IEEE Computer Society. +Divyansh Kaushik and Zachary C. Lipton. 2018. How much reading does reading comprehension require? A critical investigation of popular benchmarks. In EMNLP, pages 5010-5015. Association for Computational Linguistics. +Tushar Khot, Ashish Sabharwal, and Peter Clark. 2018. Scitail: A textual entailment dataset from science question answering. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 5189-5197. AAAI Press. +Alice Lai, Yonatan Bisk, and Julia Hockenmaier. 2017. Natural language inference from multiple premises. In Proceedings of the Eighth International Joint Conference on Natural Language Processing, IJCNLP 2017, Taipei, Taiwan, November 27 - December 1, 2017 - Volume 1: Long Papers, pages 100-109. Asian Federation of Natural Language Processing. +Tianyi Lin, Chi Jin, and Michael I. Jordan. 2019. On gradient descent ascent for nonconvex-concave minimax problems. CoRR, abs/1906.00331. +Rabeeh Karimi Mahabadi, Yonatan Belinkov, and James Henderson. 2020. End-to-end bias mitigation by modelling biases in corpora. +Henry B Mann and Donald R Whitney. 1947. On a test of whether one of two random variables is stochastically larger than the other. In The annals of Mathematical Statistics, pages 50-60. Institute of Mathematical Statistics. + +Marco Marelli, Stefano Menini, Marco Baroni, Luisa Bentivogli, Raffaella Bernardi, and Roberto Zamparelli. 2014. A SICK cure for the evaluation of compositional distributional semantic models. In LREC, pages 216-223. European Language Resources Association (ELRA). +Pasquale Minervini and Sebastian Riedel. 2018. Adversarially regularising neural NLI models to integrate logical background knowledge. In CoNLL, pages 65-74. Association for Computational Linguistics. +Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James F. Allen. 2016. A corpus and cloze evaluation for deeper understanding of commonsense stories. In HLT-NAACL, pages 839–849. The Association for Computational Linguistics. +Ellie Pavlick and Chris Callison-Burch. 2016. "babies" are "little" and most "problems" are "huge": Compositional entailment in adjective-nouns. 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. +Ellie Pavlick, Travis Wolfe, Pushpendre Rastogi, Chris Callison-Burch, Mark Dredze, and Benjamin Van Durme. 2015. Framenet+: Fast paraphrastic tripling of framenet. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing of the Asian Federation of Natural Language Processing, ACL 2015, July 26-31, 2015, Beijing, China, Volume 2: Short Papers, pages 408-413. The Association for Computer Linguistics. +Adam Poliak, Jason Naradowsky, Aparajita Haldar, Rachel Rudinger, and Benjamin Van Durme. 2018. Hypothesis only baselines in natural language inference. In *SEM@NAACL-HLT*, pages 180-191. Association for Computational Linguistics. +Altaf Rahman and Vincent Ng. 2012. Resolving complex cases of definite pronouns: The winograd schema challenge. In Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, EMNLP-CoNLL 2012, July 12-14, 2012, Jeju Island, Korea, pages 777-789. ACL. +Drew Reisinger, Rachel Rudinger, Francis Ferraro, Craig Harman, Kyle Rawlins, and Benjamin Van Durme. 2015. Semantic proto-roles. Trans. Assoc. Comput. Linguistics, 3:475-488. +Marco Túlio Ribeiro, Sameer Singh, and Carlos Guestrin. 2018. Semantically equivalent adversarial rules for debugging NLP models. In ACL (1), pages 856-865. Association for Computational Linguistics. + +Roy Schwartz, Maarten Sap, Ioannis Konstas, Leila Zilles, Yejin Choi, and Noah A. Smith. 2017. The effect of different writing tasks on linguistic style: A case study of the ROC story cloze task. In CoNLL, pages 15-25. Association for Computational Linguistics. +Juliet Popper Shaffer. 1995. Multiple hypothesis testing. Annual Review of Psychology, 46:561-581. +Rion Snow, Lucy Vanderwende, and Arul Menezes. 2006. Effectively using syntax for recognizing false entailment. In HLT-NAACL. The Association for Computational Linguistics. +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. 2014. Intriguing properties of neural networks. In *ICLR (Poster)*. +Aarne Talman and Stergios Chatzikyriakidis. 2018. Neural network models for natural language inference fail to capture the semantics of inference. CoRR, abs/1810.09774. +Masatoshi Tsuchiya. 2018. Performance impact caused by hidden bias of training data for recognizing textual entailment. In LREC. European Language Resources Association (ELRA). +Lucy Vanderwende and William B. Dolan. 2005. What syntax can contribute in the entailment task. In MLCW, volume 3944 of Lecture Notes in Computer Science, pages 205-216. Springer. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2018. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the Workshop: Analyzing and Interpreting Neural Networks for NLP, BlackboxNLP@EMNLP 2018, Brussels, Belgium, November 1, 2018, pages 353-355. Association for Computational Linguistics. +William Yang Wang, Sameer Singh, and Jiwei Li. 2019. Deep adversarial learning for NLP. In *NAACL-HLT (Tutorial Abstracts)*, pages 1-5. Association for Computational Linguistics. +Yicheng Wang and Mohit Bansal. 2018. Robust machine comprehension models via adversarial training. In *NAACL-HLT* (2), pages 575-581. Association for Computational Linguistics. +Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. 2016. Towards ai-complete question answering: A set of prerequisite toy tasks. In ICLR (Poster). +Aaron Steven White, Pushpendre Rastogi, Kevin Duh, and Benjamin Van Durme. 2017. Inference is everything: Recasting semantic resources into a unified evaluation framework. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), + +pages 996-1005. Asian Federation of Natural Language Processing. +Adina Williams, Nikita Nangia, and Samuel R. Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In *NAACL-HLT*, pages 1112–1122. Association for Computational Linguistics. +Peng Zhang, Yash Goyal, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. 2016. Yin and yang: Balancing and answering binary visual questions. In CVPR, pages 5014-5022. IEEE Computer Society. +Sheng Zhang, Rachel Rudinger, Kevin Duh, and Benjamin Van Durme. 2017. Ordinal commonsense inference. Transactions of the Association for Computational Linguistics, 5:379-395. \ No newline at end of file diff --git a/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/images.zip b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..2973f172a984fed4dc2e9492e368de99450b668f --- /dev/null +++ b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b29f7f130c4bb59656959d92e42c1223fe08ac48aa3539d4640b770791463fa4 +size 337074 diff --git a/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/layout.json b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..214f0263fb49c9b3f15c2e430a3b90acebfec109 --- /dev/null +++ b/avoidingthehypothesisonlybiasinnaturallanguageinferenceviaensembleadversarialtraining/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:befefa5d5644fda896477b115583332dff57f3a8cc31d352963c1dfc1da4e3ea +size 302178 diff --git a/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_content_list.json b/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..cddabec0b95e7e76ac57bd2f2761b42dfde1bbd4 --- /dev/null +++ b/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68f4f69c2d5cafeaa5f2e7052359162c78c31763c848baf047e19cde002fff8f +size 104568 diff --git a/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_model.json b/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_model.json new file mode 100644 index 0000000000000000000000000000000000000000..d2be6222e0268aee2bb4d4dfae63dae253558355 --- /dev/null +++ b/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e9eaa42d8660fddcd67785001ce3226cedac74edaa4faa4ea95fea9c05a6b0a +size 129342 diff --git a/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_origin.pdf b/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e533905af71b9349b5ae8cf172f5322b24c49742 --- /dev/null +++ b/axcellautomaticextractionofresultsfrommachinelearningpapers/0dca963e-4ae3-4f94-a72f-034c204b8ea9_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68d9adf48286ff4e68fdecd04844f5ded6ebdf53e7cefd453a0dd38f3ef5748f +size 521254 diff --git a/axcellautomaticextractionofresultsfrommachinelearningpapers/full.md b/axcellautomaticextractionofresultsfrommachinelearningpapers/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7b55b8e122ad355845158ab8c9ee5ed7a9705937 --- /dev/null +++ b/axcellautomaticextractionofresultsfrommachinelearningpapers/full.md @@ -0,0 +1,484 @@ +# AXCELL: Automatic Extraction of Results from Machine Learning Papers + +Marcin Kardas1 + +Piotr Czapla² + +Pontus Stenetorp3 + +Sebastian Ruder + +Sebastian Riedel1,3 + +Ross Taylor + +Robert Stojnic1 + +1Facebook AI Research, {mkardas,sriedel,rjt,rstojnic}@fb.com + +$^{2}$ n-waves, piotr.czapla@n-waves.com + +3University College London, p.stenetorp@cs.ucl.ac.uk + +4DeepMind, ruder@google.com + +# Abstract + +Tracking progress in machine learning has become increasingly difficult with the recent explosion in the number of papers. In this paper, we present AXCELL, an automatic machine learning pipeline for extracting results from papers. AXCELL uses several novel components, including a table segmentation subtask, to learn relevant structural knowledge that aids extraction. When compared with existing methods, our approach significantly improves the state of the art for results extraction. We also release a structured, annotated dataset for training models for results extraction, and a dataset for evaluating the performance of models on this task. Lastly, we show the viability of our approach enables it to be used for semi-automated results extraction in production, suggesting our improvements make this task practically viable for the first time. Code is available on GitHub.1 + +# 1 Introduction + +Machine learning studies how machines learn with respect to a task, a performance metric, and a dataset (Mitchell, 2006). The (task, dataset, metric name, metric value) tuple can therefore be seen as representing a single result of a machine learning paper. To make progress as a field we need to make comparisons between results achieved with different methodologies. In light of the explosion in the number of machine learning publications in recent years, such comparisons have become more difficult. This poses serious challenges to peer review, among others. For instance, across ten language modelling papers submitted to ICLR 2018, the perplexity score of the best baseline differed by more + +than 50 points (Ruder, 2018). + +One way to deal with the deluge of papers is to develop automatic approaches for extracting results from papers and aggregating them into leaderboards. Authors typically publish their results in a tabular format in the paper, including a selection of comparisons between their approach and past papers. Automatic extraction of result tuples from tables—and optionally metadata such as model names—enables a full comparison between published methods. + +Online leaderboards for comparison have become increasingly common in the research community. But these are only available for a few tasks and do not aid the comparison of models across tasks. To fill the gap, result aggregation tools such as Papers With Code3 and NLP-Progress4 utilise crowdsourced community contributions to populate paper leaderboards. However, human annotation of results can be laborious and error-prone, leading to omission or misreporting of paper results. Automating at least some parts of the process can speed-up the annotation, reduce number of errors and lower the expert knowledge required to correctly annotate a paper. This motivates the need for a machine learning approach to create a comprehensive results resource for the field. + +Existing state-of-the-art approaches for results extraction are brittle and noisy, relying on text formatting hints and tables extraction from PDF files (Hou et al., 2019). In contrast, we propose AxCELL, a pipeline for automatic extraction of results from machine learning papers. AxCELL breaks down the results extraction task into several subtasks including table type classification, table semantic segmentation and linking results to leaderboards. We employ an ULMFiT-based classifier + +architecture (Howard and Ruder, 2018) to make full use of paper and table context to interpret tabular content, and extract results accordingly. + +As a whole, this paper makes three main contributions to the literature. First, we significantly improve over the state-of-the-art for results extraction with our AXCELL system. On the subset of the NLP-TDMS dataset of Hou et al. (2019) where LATEX code is available, our approach achieves a micro $\mathrm{F}_1$ score of 25.8 compared to the state of the art of 7.5. Secondly, we release a structured, annotated dataset for training models for results extraction, and an evaluation dataset for evaluating the performance of models on this task. Lastly, our approach is used in an in-production setting at paperswithcode.com to semi-automatically (by aiding the human review) extract results from papers and track progress in machine learning. + +# 2 Related Work + +Results Extraction. Previous works have studied the problem of extracting results tuples (task, dataset, metric name, metric value) from papers. Singh et al. (2019) perform search over publications and compose a leaderboard for a queried triplet. Similar to our approach, they use tables extracted from LATEX sources. In contrast, they do not extract absolute metric values but rank papers and do not appear to utilise the text content of publications. Our goal in this paper is to extract complete results to create leaderboards, so unlike Singh et al. (2019), we focus on extracting raw metric values. Additionally we make use of the content of the publication as context for entity recognition and linking. + +Closer to our formulation, Hou et al. (2019) extract absolute metric values alongside the metric name, task and dataset. They also use text excerpts as well as direct tabular information to make inferences for table contents. They frame extraction as a natural language inference problem and apply an NLI model based on a BERT architecture (Devlin et al., 2019) to extract results from PDF files. The disadvantage of this approach is that using PDFs leads to a lot of noise in structural information such as the partition of a table into cells. In our work, we explicitly utilise the structural information from the LATEX source to extract entire tables in order to perform semantic segmentation. We demonstrate that this structural information and segmentation are crucial for boosting extraction performance. + +Table Extraction. The more general problem of retrieving information from tables has been studied in past works (Milosevic et al., 2019; Ghasemi-Gol and Szekely, 2018; Wei et al., 2006; Herzig et al., 2020). Our focus in this paper is on the problem of extracting and interpreting content of tables characteristic to machine learning papers. The goal of our table semantic segmentation model is to classify cells into categories. That is, instead of performing structural segmentation where one tries to distinguish between captions, headers and rows in a stream of text (Pinto et al., 2003) we focus on semantic segmentation (i.e., assigning roles to each cell) of tables. + +# 3 Our Approach + +The task of paper results extraction is to take a machine learning paper as an input and extract results contained within the paper, specifically tuples of the form (task, dataset, metric name, metric value). As an example, if we were to take the Efficient-Net paper of Tan and Le (2019) as an input, some example results tuples we would want to extract would be (Image Classification, ImageNet, Top 1 Accuracy, $84.4\%$ ), (Image Classification, ImageNet, Top 5 Accuracy, $97.1\%$ ) and (Image Classification, Stanford Cars, Accuracy, $94.7\%$ ). + +To tackle this problem effectively we define subtasks that take us from paper to results. In particular, we introduce the AxCELL pipeline that consists of the following subtasks: (i) table type classification, identifying whether a table in a paper has relevant results; (ii) table segmentation, segmenting and classifying table cells according to whether they hold metrics, datasets, models, etc.; and (iii) linking results to leaderboards, taking the result tuples and matching them to an existing leaderboard of results. The end-to-end system is shown in Figure 1 with reference to an example. We now introduce the different components of AxCELL. + +# 3.1 Table Type Classification + +The first stage of AxCELL is to categorize tables from papers into one of three categories: leaderboard tables, ablation tables and irrelevant tables. A leaderboard table contains the principal results of the paper on a selected benchmark, including comparisons with other papers. An ablation table compares different permutations of the paper's methodology. + +![](images/5c8f5cc3a3b6391401fee4797b2bb8d167846a02531fb5aee2799bfa874a6e1e.jpg) +Figure 1: Graphical depiction of AxCell. The extraction starts with $\mathrm{LATEX}$ source code of a paper, from which we extract 1) tables and 2) text. 3) We classify the caption to filter out irrelevant tables. 4) The content of each cell is looked up in the paper's text. Retrieved mentions are used to 5) segment cells based on their meaning (see the legend in the top-right corner). The segmented table and the paper's text are used to 6) obtain contexts for each numeric cell. 7) Results tuples are scored based on contexts and numeric values are normalized to match required format. 8) Inferior results or results below a confidence threshold are filtered out. + +Lastly, irrelevant tables include hyperparameters, dataset statistics and other information that is not directly relevant for result extraction. + +For this stage we employ a classifier with a ULMFiT architecture (Howard and Ruder, 2018) with LSTM layers and a SentencePiece unigram model (Kudo, 2018) for tokenization. We train the SentencePiece model and pretrain a left-to-right ULMFiT language model on text of papers from an unlabelled dataset of arXiv articles (see Section 4). Table 5 in the Appendix contains details on the hyperparameters and training regime. + +The classifier head is a standard ULMFiT classifier with a pooling layer followed by two linear layers. We treat the problem as a two-label classification with labels: leaderboard and ablation. A table is considered irrelevant if it is neither a leaderboard nor ablation (we use a confidence threshold of 0.5). In practice it is common for a single table to include both principal results introduced in a given paper as well as results of ablation + +studies. For this reason we extract results from both leaderboard and ablation tables and pick only the best results during filtering (see Section 3.6). We train the model on the SEGMENTEDTABLES dataset (see Section 4.2). + +# 3.2 Table Segmentation + +The second stage of AxCELL is to pass relevant tables to a table segmentation subtask. The goal is to annotate each non-numeric cell of a table with a label denoting what type of data a given cell contains. To this end, we classify each table cell into one of: dataset name, metric name, paper model, cited model, and other (containing meta and task cells). An example of a segmented table is shown in Figure 1. + +To help classify each table cell, we provide a context in which the cell content is mentioned. We search for cell content in the full paper content using a BM25 scoring algorithm. Retrieved text fragments are then passed to a ULMFiT-based classifier with some handcrafted features for the cell. These features include information such as the position of the cell in the table, whether the cell is a header, and cell styles. A full list is available in the Appendix. For processing the retrieved text fragments, the retrieved term from the cell is replaced + +On TREC-6, significantly improves upon training from scratch; as examples are shorter and fewer, supervised and semi-supervised achieve similar results. + +Figure 2: An example of a text excerpt from the paper by Howard and Ruder (2018) used as evidence for a cell content query with ULMFiT (covered with token) as paper model. + +with a special mask token to inhibit memorization of common names (see Figure 2 for an example). Table segmentation can then be treated as a classification problem with 5 exclusive labels. We use the same pre-trained language model to train the table type classifier. Results for this stage of the model are outlined in Table 3. + +# 3.3 Cell Context Generation + +The next stage after table segmentation is to generate contexts for numeric cells. As an example, if we know a numeric cell has a dataset cell somewhere in its row, and a model cell somewhere in its column, then this table context is informative for deciding the dataset and model for this result. But there is much broader context in the paper that is useful for linking. + +For example, a paper studying semantic segmentation with models evaluated on KITTI and CamVid datasets could mention semantic segmentation in the introduction, test set in a subsection referring to a results table, KITTI in the description of that table and class IoU in the column header. Figure 3 shows a visual representation of this hierarchy of context. + +To reflect this hierarchy we generate several types of contexts for each cell. The table context, as discussed, looks at a numeric cell and other cells in its row or column labeled as model, dataset or metric. We also define text contexts: a caption context, the table caption; a mentions context, text fragments referencing the table; an abstract context, the paper abstract; and a global paper context, containing the entire paper text. The gathered contexts are then used to link potential results to predefined leaderboards of results. + +![](images/c2ad4332edd6098d996b07bd1ce151a245926015fa1cb74733b5db44c30d9166.jpg) +Figure 3: Using the context hierarchy and evidences for linking. This figure highlights the context hierarchy, from the global paper to the specific table, the evidence for tasks (blue), datasets (pink) and metrics (violet) for the 56.3 value extracted from cell contexts, and lastly the result from linking. + +![](images/2abe06c0bbddee313eb88bc2803e2e8154d2fe1a82fd56ca67928fff79d59f9b.jpg) + +# 3.4 Linking Cells to Leaderboards + +Once we have the cell contexts, the next stage of AxCELL is to link them to leaderboards to form performance records. The goal is to take a metric value associated with a paper model cell and infer the leaderboard it is connected to. A leaderboard is defined by a (task, dataset, metric name) triplet. For example: (Image Classification, ImageNet, Top 1 Accuracy) can capture papers that report performance on Image Classification for ImageNet and report Top 1 Accuracy. To simplify the problem, we assume a closed-domain with all leaderboards known in advance. To match results to leaderboards we look for evidence in cell contexts, which we now explain. + +Pieces of evidence are words or phrases that correspond to a task, dataset or metric. For example, SST-2, binary and polarity could all serve as evidence for the two-class Stanford Sentiment Treebank dataset (Socher et al., 2013). Pieces of evidence allow us to infer whether an entity has been mentioned in a given context. Using the same example, if "SST-2" appears in the table caption then this is evidence that a numeric value in the table could be linked to the Stanford Sentiment Treebank dataset. + +# 3.5 Model + +Our goal is to determine the probability $p(k|E)$ of a leaderboard $k \in \{1 \dots K\}$ being associated with a given cell, conditioned on the evidence $E$ we + +have collected for this cell. Instead of modelling this directly using a discriminative model, we opt for a simple generative model $p(k,E)$ that can be adapted to new leaderboards as well as types of evidence without additional training data. While this should be possible for discriminative models as well, we leave this open for future work. + +Let $E = \{e_1, \ldots, e_s\}$ consist of pieces of evidence $e_j$ of the form $e_j = (m, t, c)$ where $m$ is a mention such as "acc", $t$ is a type of entity such as "Metric" and $c$ is the type of context the evidence was found in, such as "Table." Our model generates leaderboard and evidence using $p(k, E) = p(k)p(E|k)$ . To model the likelihood of evidence, we make a Naive Bayes assumption and set $p(E|k) = \prod_{e \in E} p(e|k)$ . + +We assume that the type of context $c$ controls the generation of the remainder of the evidence $m$ and $t$ : + +$$ +p (e | k) = p (m, t, c | k) = p (c) p (m, t | c, k). +$$ + +Once we know the context type $c$ , using a latent noise variable $n$ we generate evidence either independent or dependent of the actual leaderboard: + +$$ +\begin{array}{l} p (m, t | c, k) = p (t | c, k) \left[ p (n | t, c) p (m | n, t) \right. \\ \left. + (1 - p (n | t, c)) p (m | \neg n, t, k) \right]. \\ \end{array} +$$ + +Finally, we assume that a leaderboard generates its mention as follows: + +$$ +p (m | \neg n, t, k) = p (m | \neg n, t, \mathrm {p r o p e r t y} (t, k)) +$$ + +where $\text{property}(t, k)$ is the $t$ property of the leaderboard $k$ . For example if the leaderboard $k$ consists of (Image Classification, ImageNet, Accuracy) then property(Metric, $k$ ) = Accuracy. + +Inference To score a leaderboard $k$ given evidence $E$ , we calculate $p(k, E) / \sum_{k'} p(k', E)$ summing over all leaderboards in the taxonomy. This is feasible as we assume a closed-domain scenario. + +Estimation Most of our parameters are hand-set to uniform distributions. In particular, we set $p(k) = \frac{1}{K}$ , $p(t|c,k) = \frac{1}{3}$ , $p(c) = \frac{1}{5}$ . We set $p(m|\neg n,t,\text{property}(t,k))$ to be inversely proportional to the number of other entities of type $t$ with the same mention evidence $m$ (see Appendix C for details). + +The probabilities $p(n|t, c)$ of a mention of type $t$ in context $c$ being noisy are tuned manually for + +each of 15 $(t,c)$ pairs. The probabilities $p(m|n,t)$ of a noisy mention are assumed to be the same for all mentions of a given type $t$ and are tuned as well. We tune 18 parameters in total. + +# 3.6 Filtering + +The final step of AxCELL is to filter out (i) results for cited models, (ii) results with a linking score that is too low and (iii) inferior results (to avoid extraction of ablation results). + +First, we filter out records not associated with models introduced in a paper being processed. We then remove records for which a linking score is below some given threshold. The remaining records are grouped by leaderboard and for each leaderboard only the best result is kept, based on higher is better annotation available in taxonomy; e.g., Accuracy would keep higher values, Error Rate would keep lower values. Finally, we remove all results with a linking score below the second threshold. This gives us the final list of results tuples extracted from the paper. + +# 4 Dataset + +In this section we explain the datasets we used for training and evaluating AxCELL for results extraction. The primary input we use for a training dataset is Latex source code of machine learning papers from arXiv.org. Over $90\%$ of considered papers have source code available. This allows us to obtain a high quality dataset without common artifacts that arise from extracting data directly from PDF files. + +For training our models we use two main datasets: + +- ARXIVPAPERS: An unlabelled dataset of over 100,000 machine learning papers. Used for language model pre-training. +- SEGMENTEDTABLES: A table segmentation dataset where each cell is annotated according to whether it is a paper, metric, dataset, and so on. Used for table segmentation and table type classification. + +We manually tune the linking and filtering performance of our method using a validation dataset: + +- LINKEDRESULTS: An annotated dataset of over 200 papers with results tuples, capturing the performance of models in the papers, and links to tables. + +Lastly we evaluate the end-to-end performance of AxCELL on our test set: + +- PWC LEADERBOARDS: An annotated dataset of over 2,000 leaderboards with results tuples. Used for end-to-end performance evaluation. + +We now describe in detail these datasets. + +# 4.1 arXiv Papers + +The dataset contains 104, 710 papers published on arXiv.org between 2007-2020. 93, 811 papers are available with LATEX sources, from which we extracted 277, 946 tables in total. Due to licensing limitations the dataset we release with this paper contains only metadata (available in the public domain) and links to articles. The dataset is unlabeled, designated for use in self-supervised pretraining. + +# 4.2 Segmented Tables + +This is a dataset for table classification and segmentation, containing 1994 annotated tables from 352 articles. The dataset provides data on dataset mentions in captions, the type of table (leaderboard, ablation, irrelevant) and ground truth cell annotations into classes: dataset, metric, paper model, cited model, meta and task. + +# 4.3 Linked Results + +This is a set of 239 papers we annotated with 1591 results tuples, capturing the performance of models in the papers. Additionally we include metrics scores in a normalized form. We also record metadata such as the names of the models used in papers. Each results tuple (task, dataset, metric name, metric value) is linked to a particular table, row and cell it originates from. Note that results that appear outside of a table, for instance in the paper's text or graphs, are not present in this dataset. + +# 4.4 PwC Leaderboards + +This is a dataset of 2,291 leaderboards, where the data is collected from the Papers with Code labelling interface (see Figure 5 in Appendix). This interface allows annotators on Papers with Code to take a paper and label it with results tuples. Annotations are then reviewed by the community and revised if necessary. Since this is the biggest and most diverse curated ground-truth dataset, it is a good test for evaluating the end-to-end performance of our solution. + +Table 1: End-to-end extraction results on subset of NLP-TDMS (Exp) dataset. + +
MethodMicroMacro
PRF1PRF1
(task, dataset, metric)
TDMS-IE53.466.359.257.166.158.5
AXCELL65.858.561.956.055.854.1
(task, dataset, metric, score)
TDMS-IE6.88.47.58.69.58.8
AXCELL27.424.425.820.220.619.7
+ +# 5 Experiments + +We now evaluate the end-to-end performance of AxCELL on the results extraction task. We evaluate on two datasets: the NLP-TDMS dataset introduced in Hou et al. (2019), in order to compare our method to the state of the art, and on our PwC LEADERBOARDS dataset, which contains many more leaderboards and acts as a more challenging benchmark. + +# 5.1 NLP-TDMS Results + +We compare AxCELL to the TDMS-IE model from Hou et al. (2019) on the NLP-TDMS dataset in Table 1. The NLP-TDMS (Full) dataset contains 332 papers related to Natural Language Processing with 848 performance annotations of task, dataset, metric and score and 168 unique leaderboards. The subset NLP-TDMS (Exp) is limited to 77 leaderboards appearing in at least 5 papers. See Table 10 in the Appendix for dataset statistics. To compare with Hou et al. (2019), we use the Exp dataset. + +Hou et al. (2019) extract records directly from PDF, so the methods are not fully comparable. In order to run AxCELL on that dataset we limit the dataset to papers for which IATEX source code is available. Table 1 shows results on that subset with TDMS-IE performance computed based on published predictions. Our solution yields significantly better results for whole records retrieval despite not being trained on their taxonomy (i.e., the zero-shot scenario in Hou et al. (2019)). + +# 5.2 PwC LEADERBOARDS Results + +Having validated the performance of our approach compared to the state of the art, we now apply it to our much larger dataset of leaderboards. Compared + +Table 2: Extraction results of AxCELL on PWC LEADERBOARDS dataset (restricted to our taxonomy) for entire records (TDMS), records without score (TDM) and individual entities. + +
EntityMicroMacro
PRF1PRF1
TDMS37.423.228.724.021.821.1
TDM67.847.856.147.946.443.5
Task70.657.363.360.762.659.7
Dataset70.248.457.353.552.749.9
Metric68.858.563.358.460.456.5
+ +to the NLP-TDMS dataset, whose taxonomy consists of 77 leaderboards, our taxonomy consists of 3,445 leaderboards making prediction much more challenging. + +The results of our approach for extracting each entity are detailed in Table 2. We achieve reasonable performance on extracting the full TDMS (task, dataset, metric, score) tuple, which is the most challenging setting and the highest scores for extracting task and metric information. The lower scoring entities are generally the ones that depend on the quality of extraction of other entities. For example, extracting leaderboards depends on how well we extract task, dataset and metric entities. + +The large difference in performance between extraction of TDM and full TDMS tuples is due to the fact that in order to get the score right, the model needs to correctly predict the table, column and row the score value is present in. Additionally, the extracted value needs to be normalized. On the other hand, the right TDM can often be inferred from other results reported in a paper. + +# 6 Performance Studies + +Due to working with machine learning papers from multiple domains (from CV to NLP to biology) and a multistep approach (where errors compound) the errors are characterized by a long-tail distribution and it is difficult to pin-point the biggest source of errors. In this section, we analyze the various steps of AXCELL in order to better understand their relative importance. + +# 6.1 Table Type Classification + +The biggest issue of table type classification is in distinguishing between leaderboard and ablation tables (see Figure 7 in Appendix). These tables can + +be very similar structurally: ablations may even compare on the same split of data as the primary result. As the distinction is not always clear, during results retrieval we extract results from both types of tables and pick only the best results during filtering (i.e., the highest or lowest based on predicted metric). + +# 6.2 Table Segmentation + +One goal of table segmentation is to generalise to tables from unseen tasks. To study this, we partitioned SEGMENTEDTABLES dataset into 11 folds, based on the task name extracted from paper abstracts. The fold with tables from Image Classification papers is always used as a validation set. For each of the remaining 10 folds we train 5 models with a given fold used as a test set and the other 9 folds used as training data. The final table segmentation model used in AxCELL is the one with the highest micro $\mathrm{F_1}$ score on the validation set. + +Table 3 shows micro precision, recall and $\mathrm{F_1}$ score of classifying each non-numeric cell into one of 5 exclusive classes: dataset, metric, competing model, paper's model or other. + +We can see that we achieve strong results on all tasks, although some tasks perform better than others. A task like semantic segmentation has less table and benchmark diversity, so benchmark tables for datasets like Cityscapes and PASCAL VOC 2012 are fairly standardised across papers. This makes extraction fairly straightforward. In contrast, the worse performing tasks are unusual in their own way. In image generation, for instance, we are less able to extract the correct dataset entity, whereas in speech recognition, our model has more problems distinguishing paper models from competing models; see Figure 6 in the Appendix. + +# 6.3 Linking + +To evaluate linking performance in isolation of other steps we run it on tables with ground truth type and segmentation annotations. The annotations are available in the SEGMENTEDTABLES dataset for 24 Speech Recognition and 32 Semantic Segmentation papers with 287 annotated leaderboard records in total. For each cell with associated leaderboard annotation we generate cell contexts and use linking to retrieve the top-5 predictions. We test four approaches to generate evidence of mentions. + +Table 3: Table segmentation results for 10-fold training with image classification papers fixed as a validation set and variable test set. Micro precision, recall and $\mathrm{F}_1$ score are averaged over 5 runs. + +
test setvalidationtest
PRF1PRF1
image gen.84.587.986.273.481.677.3
misc.84.088.286.081.793.587.2
machine trans.83.190.886.880.594.486.9
NLI83.689.686.584.597.390.4
object detection81.991.486.383.796.789.7
pose estimation85.189.987.486.096.891.1
question ans.83.689.586.480.489.684.8
semantic seg.81.491.186.090.295.992.9
speech rec.84.789.887.267.290.777.1
text class.83.990.487.074.993.383.1
+ +Bag-of-Phrases The full name and any word (which is not an English stop-word) occurring in the name of a metric or dataset (as found in taxonomy) is evidence of mention. For example, for Exact Match Ratio metric we get exact match ratio, exact, match and ratio. + +Abbreviations We run an abbreviation detector (Neumann et al., 2019) over the ARXIVPAPERS dataset to extract pairs of common abbreviations and their full forms. The previous approach is extended with abbreviations of full forms occurring in the name of the metric or dataset. For example, with an extracted abbreviation-full form pair (en-vi, English-Vietnamese) and dataset name IWSLT2015 English-Vietnamese, en-vi is added as mention evidence for this dataset. For the Exact Match Ratio metric we extend the Bag-of-Phrases evidence with: em and er (extracted Exact Match Ratio abbreviations), em (extracted Exact Match abbreviation), mr (extracted Match Ratio abbreviation) and $r$ (extracted Ratio abbreviation). To deal with the noise in abbreviations for a given full form we include only short forms that appear at least $20\%$ of times as an abbreviation of that full form. + +Manually Curated We extend the Bag-of-Phrases approach with list of manually curated mention evidence. Only mentions of datasets and metrics related to speech recognition and semantic segmentation are modified. + +Combined The previous approach extended with abbreviations. + +In Table 4 we show Top-1 and Top-5 accuracy of the predictions over all leaderboard records from + +Table 4: Linking performance using ground truth annotations of table types and segmentation. + +
Top-1 Accuracy [%]
evidencespeech rec.sem. segmentation
TDMSTDMTDMSTDM
BoP4286457249957167
abbrs5687577456957974
curated7687778777958987
combined6787687872958685
Top-5 Accuracy [%]
evidencespeech rec.sem. segmentation
TDMSTDMTDMSTDM
BoP7288738482998993
abbrs76897684931009499
curated8590859197999999
combined8189818997999999
+ +each collection of papers. Using abbreviations significantly improves the performance over the Bag-of-Phrases approach. The worse performance caused by adding abbreviations to manually curated lists suggests that abbreviations could increase the rate of false-positive matches of mentions. Another explanation might be that manually curated lists of mentions are biased towards leaderboards related to speech recognition and semantic segmentation due to construction of the lists. + +The overall performance of the linking step allows us to use it in production environment for efficient semi-automated extraction of results. Our solution proposes to users the Top-5 predictions associated with cells they indicated, thus eliminating the tedious and error-prone step of matching the results with existing leaderboards and ensuring that metric values are correctly normalized. + +# 6.4 End-to-End Performance + +We use annotations for Semantic Segmentation papers from SEGMENTEDTABLES and LINKEDRESULTS datasets to analyse how AXCELL performs in an end-to-end fashion. Figure 4 shows fractions of gold truth records incorrectly rejected in various steps of our pipeline. Both table type classification and segmentation steps were done using models trained with the Semantic Segmentation fold as a test set. + +The most common reason for misprediction of datasets is confusion between validation and test sets. Additionally the linking model has difficulties in distinguishing between variants of Intersection over Union metrics (mean IoU, frequency weighted IoU, class and category IoU). The confus + +![](images/7a1c2014fae99dcd7872d5b2eda1ffc65252c9fd866658a510245d0cd7502716.jpg) +Figure 4: Analysis of end-to-end extraction on the Semantic Segmentation fold of LINKEDRESULTS dataset. Green blocks show percentage of gold truth tuples of (task, dataset, metric, score) that are correctly classified in various stages of our pipeline. Red blocks show reasons for which a given fraction of gold truth records is incorrectly rejected. + +ing datasets and metrics names are also reasons for a low confidence of linked results, as the score is distributed over similar entities. + +One should keep in mind that the above analysis might not fully generalise to other tasks. As shown in Table 3 and Figure 6, table segmentation performs differently on papers related to different machine learning tasks. Moreover, it is more common in case of Semantic Segmentation papers to report results on both validation and test sets due to test sets often being hidden. The difference between tasks is also apparent in linking performance on Speech Recognition and Semantic Segmentation papers, as presented in Table 4. While the Top-1 Accuracy is similar for both tasks, in terms of Top-5 Accuracy the linking step performs significantly better on Semantic Segmentation papers—most of the time the top 5 entries are sufficient to cover variants of Semantic Segmentation datasets and metrics. + +# 7 Future Work + +We cover three possible extensions to our work for future research. + +First, we might want to consider methods that retrieve all results rather than just the principal results introduced in the paper. This includes extracting ablation studies to enable search over fine-grained comparison results. + +Secondly, we could look more into automatic taxonomy discovery. Currently, we assume a closed-domain approach with a taxonomy of leaderboards known in advance. While manually extending the taxonomy requires only adding the task, dataset + +and metric names, it becomes problematic to cover a large fraction of papers due to publication rate and long tail of leaderboards. + +Finally, to relax the necessity of AXCELL to have access to $\mathrm{LATEX}$ source we consider using the ARXIVPAPERS dataset as a corpus to train extraction working directly with PDF files. + +# 8 Conclusions + +We presented a pipeline for extracting results from machine learning papers. Our method performs well across various tasks and leaderboards within machine learning, with a taxonomy that can be easily extended without retraining. Additionally we released a new collection of datasets for training and evaluating on the results extraction task. These datasets enable the training of more fine-grained feature extractors and detailed error analysis. We demonstrated that our approach achieves significant performance gains over the state-of-the-art. Future work may want to build on our approach for more comprehensive extraction tasks, focussing on more types of result, as well as other information contained in papers such as architectural details and hyperparameters. + +# Acknowledgements + +The authors would like to thank Waleed Ammar, Sebastian Kohlmeier, Iz Beltagy, and Adam Liska for useful discussion and feedback. + +# 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. +Majid Ghasemi-Gol and Pedro A. Szekely. 2018. Tabvec: Table vectors for classification of web tables. CoRR, abs/1802.06290. +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. +Yufang Hou, Charles Jochim, Martin Gleize, Francesca Bonin, and Debasis Ganguly. 2019. Identification of tasks, datasets, evaluation metrics, and numeric scores for scientific leaderboards construction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5203-5213, Florence, Italy. Association for Computational Linguistics. +Jeremy Howard and Sylvain Gugger. 2020. fastai: A layered API for deep learning. Information, 11. +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. +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. +Nikola Milosevic, Cassie Gregson, Robert Hernandez, and Goran Nenadic. 2019. A framework for information extraction from tables in biomedical literature. International Journal on Document Analysis and Recognition (IJDAR). +Tom Mitchell. 2006. The discipline of machine learning. Machine Learning Department technical report CMU-ML-06-108, Carnegie Mellon University. +Mark Neumann, Daniel King, Iz Beltagy, and Waleed Ammar. 2019. ScispaCy: Fast and robust models for biomedical natural language processing. In Proceedings of the 18th BioNLP Workshop and Shared Task, pages 319-327, Florence, Italy. Association for Computational Linguistics. + +David Pinto, Andrew McCallum, Xing Wei, and W. Bruce Croft. 2003. Table extraction using conditional random fields. In Proceedings of the 26th Annual International ACM SIGIR Conference on Research and Development in Informaion Retrieval, SIGIR '03, page 235-242, New York, NY, USA. Association for Computing Machinery. +Sebastian Ruder. 2018. Tracking the Progress in Natural Language Processing. +Mayank Singh, Rajdeep Sarkar, Atharva Vyas, Pawan Goyal, Animesh Mukherjee, and Soumen Chakrabarti. 2019. Automated early leaderboard generation from comparative tables. In Advances in Information Retrieval - 41st European Conference on IR Research, ECIR 2019, Cologne, Germany, April 14-18, 2019, Proceedings, Part I, volume 11437 of Lecture Notes in Computer Science, pages 244-257. Springer. +Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631-1642, Seattle, Washington, USA. Association for Computational Linguistics. +Mingxing Tan and Quoc V. Le. 2019. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML. +Xing Wei, Bruce Croft, and Andrew Mccallum. 2006. Table extraction for answer retrieval. Inf. Retr., 9(5):589-611. + +Table 5: ULMFiT language model architecture and hyperparameters. + +
vocabulary size30,000
tokenizationunigram model
RNN typeLSTM
recurrent layers3
embeddings dimension400
hidden state dimension1152
optimizerAdamW
lr scheduleone cycle policy
maximum lr0.01
weight decay0.1
pretraining12 epochs
batch size256
BPTT80
number of parameters32M
floating-point arithmeticfp32
+ +# Appendix + +# A Training Details + +# A.1 Language Model Pre-training + +Table Type Classifier and Table Semantic Segmentation models use ULMFiT architecture (Howard and Ruder, 2018) with a language model pretrained from scratch on the ARXIVPAPERS dataset. We trained a single language model with most of the hyperparameters set to the defaults from the fast.ai implementation (Howard and Gugger, 2020) (see Table 5). + +All ULMFiT-based models were trained on a single NVIDIA Tesla V100 GPU instance with 16 GB of memory. See the corresponding Jupyter notebooks for the average training times. + +# A.2 Table Type Classifier + +We use the pre-trained language model described above to train Table Type Classifier on the SEGMENTEDTABLES dataset. We used the Image Classification fold of the SEGMENTEDTABLES dataset as a validation set, Speech Recognition fold as a test set and the remaining 9 folds as a training set. We run grid search over configurations presented in Table 6. The model with the best binary accuracy (distinguishing leaderboard and ablation tables from irrelevant tables) on the validation set is used in AxCELL. All models are trained for 12 epochs in total with gradual unfreezing of encoder layers. + +Table 6: ULMFiT table classifier hyperparameters. Multiple values were used for grid search, with the same 5 random seeds per configuration. The final configuration is in bold. + +
dropout mult.[0.0, 0.5, ..., 1.0]
batch size[64, 128, 192, 256]
floating-point validation set[fp16, fp32]
Image Classification
test setSpeech Recognition
features[caption, caption+headers]
+ +Table 7: ULMFiT table semantic segmentation hyperparameters. Multiple values were used for grid search, with the same 5 random seeds per configuration. The final configuration is in bold. + +
mask query[False, True]
lowercase input[False, True]
dropout mult.[0.0, 0.5, ..., 0.75, ..., 1.0]
batch size64
floating-pointfp16
validation setImage Classification
test set[., Pose Estimation, ... ]
+ +# A.3 Table Semantic Segmentation + +We use the pre-trained language model and folds of the SEGMENTEDTABLES dataset. We used the Image Classification fold as a validation set. For each of the remaining 10 folds we run grid search with a given fold used as a test set and the other 9 folds used as training data. The search was performed over the configurations showed in Table 7. The model with the best micro $\mathrm{F_1}$ score on the validation set is used in AxCELL. Table 8 presents features input to the model. All models are trained for 10 epochs in total. + +Table 8: Features For Table Segmentation + +
FeatureDescription
is emphasisedwhether text in cell is bold, colored, etc.
cell stylee.g. "align-left top-border"
textmentions of cell's content (as in Figure 3)
cell contentcell's content without styles and references, e.g. "ULMFiT"
row contextconcatenated cell's row, e.g. "ULMFiT <sep> 94.5% <sep> 92.1%"
column contextconcatenated cell's column, e.g. "Method <sep> LSTM <sep> GRU <sep> ULMFiT <sep> BERT"
cell referencelist of reference ids used in cell, e.g. "bib4, bib18"
+ +Table 9: Linking and filtering hyperparameters. + +
p (n | Task, Paper)0.1
p (n | Task, Abstract)1.0
p (n | Task, Sections)1.0
p (n | Task, Caption)0.1
p (n | Task, Table)0.1
p (n | Dataset, Paper)0.99
p (n | Dataset, Abstract)1.0
p (n | Dataset, Sections)1.0
p (n | Dataset, Caption)0.25
p (n | Dataset, Table)0.01
p (n | Metric, Paper)0.99
p (n | Metric, Abstract)1.0
p (n | Metric, Sections)1.0
p (n | Metric, Caption)0.25
p (n | Metric, Table)0.01
p (m | n, Task)0.01
p (m | n, Dataset)0.001
p (m | n, Metric)0.01
filtering threshold10.8
filtering threshold20.85
+ +# A.4 Linking and Filtering + +Table 9 shows manually tuned hyperparameters for linking and filtering. The results with confidence score in $\left[\text{threshold}_1, \text{threshold}_2\right)$ are not returned, but can prevent returning inferior results (in terms of metric value). + +# B Datasets + +# B.1 ARXIVPAPERS Dataset + +The ARXIVPAPERS dataset consists of 104,710 papers published on arXiv.org in the following categories: Artificial Intelligence (cs.AI), Computation and Language (cs.CL), Computer Vision and Pattern Recognition (cs.CV), Information Retrieval (cs.IR), Machine Learning (stat.ML, cs.LG), Neural and Evolutionary Computing (cs.NE). + +When submitting a preprint to arXiv.org the submit- mitter must either grant arXiv.org a non-exclusive and irrevocable license to distribute the article or select one of CC BY 4.0, CC BY-SA 4.0, CC BY-NC-SA 4.0 or CC0 1.0 public domain license. Currently the most common is the first, default op + +Table 10: Statistics of the NLP-TDMS (Hou et al., 2019) Full and Exp datasets. + +
FullExp
unique leaderboards16877
unique tasks3518
unique datasets9944
unique metrics7230
papers332332
results848606
+ +tion. Additionally, arXiv.org provided metadata of submitted papers is available in public domain. + +As a consequence of legal requirements we are not able to fully publish the dataset of articles in a ready to use form, with extracted texts and tables. In order to make research in this area reproducible and results comparable, we publish our extraction pipeline and detailed information of extraction results. In particular, each paper contained in the ARXIVPAPERS dataset includes the following fields: + +- arxiv_id: arXiv identifier with version, +- archive_size: the file size in bytes of the e-print archive, +- sha256: SHA-256 hash of the e-print archive, +title: paper's title, +- status: the text and tables extraction status for this paper, one of: success, no-tex (LaTeX source is unavailable), processing-error (extraction issues), withdrawn (the paper is withdrawn from arXiv), +- sections: number of extracted sections and subsections, +- tables: number of extracted tables. + +Extraction of texts and tables from papers was run on a single machine with 48 cores / 96 threads CPU with $2.5\mathrm{GHz}$ base clock. See the corresponding Jupyter notebooks for the average extraction time. + +# B.2 SEGMENTEDTABLES and LINKEDRESULTS datasets + +The SEGMENTEDTABLES dataset contains annotations of 1,994 tables. Each paper contains the following fields: + +Table 11: Statistics for the SEGMENTEDTABLES and LINKEDRESULTS datasets. + +
SEGMENTEDTABLES
papers352
tables1994
leaderboard tables796
ablation tables468
LINKEDRESULTS
unique leaderboards470
unique tasks56
unique datasets245
unique metrics88
papers239
results1591
+ +- arxiv_id: arXiv identifier with version, +- sha256: SHA-256 hash of the e-print archive, +- fold: one of 11 folds (image classification, image generation, machine translation, miscellaneous, natural language inference, object detection, pose estimation, question answering, semantic segmentation, speech recognition, text classification), assigned automatically based on tasks names found in paper's abstract, +- tables: annotated tables with + +- index: 0-based index of tables extracted from paper, +- leaderboard: a boolean denoting if this table is a leaderboard table, +- ablation: a boolean denoting if this table is an ablation table, +- dataset_text: datasets mentioned in table's caption, not normalized, +- segmentation: for leaderboard tables, a 2D array (list of lists) with one label per cell. + +Additionally we annotated a subset of the tables present in SEGMENTEDTABLES with performance results. Each table has an array of records with items containing the following fields: + +- task, dataset, metric: task, dataset and metric names normalized across all papers from the dataset, + +- value: normalized metric value, +- model: model name, +- row, column: 0-based cell location with this result. + +Annotation Process Both datasets were annotated in our custom made web interface. For each paper the annotator is present with: title, abstract, tags (user editable), notes (user editable) and extracted tables. The interface allows annotators to quickly consult: PDF version of the paper, HTML version of the paper, Papers With Code and Semantic Scholar pages of the paper. + +For each table extracted from the paper we show: + +- caption (extracted), +- dataset text (user editable): caption fragment denoting datasets presented in the table, +- notes (user editable), +- tags (user editable), +- table content with color-coded segmentation. + +Dataset text field denotes comma separated mentions of datasets found in table's caption. For example, for caption "Table 8: WER on SWB and CH with various LM configurations." the annotators were instructed to put "SWB, CH", i.e., to use exact form from the caption and not the full dataset name. + +Table tags are defined as follows: + +- leaderboard: table contains the principal results of the paper, including comparisons with other papers, +- ablation: table compares different variants of the paper's methodology, +- error: parsing error in the table extraction, +- datasets: table describing datasets used in the paper, +- architecture: table listing hyperparameters or architecture details, +- irrelevant: other type of tables, f.e., showing samples from a dataset. + +The SEGMENTEDTABLES dataset contains tables not tagged with error label. Table tags are not exclusive. + +For semantic segmentation, tables are present as a grid. An annotator can select a range of cells and assign them one of the following classes: + +- best model: the best performing model introduced in the paper being annotated, +- paper model: model introduced in the paper that is not the best performing, +- competing model: model from another paper used for comparison or a baseline method used by authors, +- subdataset: subdataset (f.e., "dev", "test" or "MS-COCO Trees", +- dataset, +- paper dataset: dataset introduced in the paper +- metric, +- error: parsing issue, not required if the table is tagged with the error tag, +- parameters: model parameters used to distinguish various configurations (f.e., number of parameters, hidden state size, backbone network), +- meta: cell describing what is in other cells, f.e., "Model", "Dataset", "Task", "Our models". + +Segmentation annotation was done for tables labelled with the leaderboard tag. In order to easy present the color-coded table structure the cell tags are exclusive. For cells for which more than one tag applies, the annotators were instructed to use most informative tag. For example, a cell containing "TIMIT PER" should be tagged as "dataset" and not "metric", as metric is often implied by dataset. + +By selecting cells an annotator can annotate what is in corresponding cells by editing a dynamically created spreadsheet-like grid. The grid allows one to specify: task name, dataset name, metric name, metric value and model name. The annotators were instructed to provide records only for cells corresponding to the best performing models introduced in a given paper. + +The interface allows to link directly to a particular table to make it easy for annotators to consult ambiguous cases. + +Table 12: Statistics for the PWC LEADERBOARD dataset with all entries (Full) and entries restricted to our taxonomy (Restricted). + +
FullRestricted
unique leaderboards.2295649
unique tasks252134
unique datasets1156433
unique metrics414162
papers733516
results54062802
+ +Figure 5: A screenshot of the labeling interface used to annotate PWC LEADERBOARDS dataset. An annotator is presented with tables extracted from a paper on the left-hand side and annotations on the right hand side. + +![](images/8fc98a2cbfd83fba54e51f7fdaf2608ba3b1bad72efb332133fd992022045c0a.jpg) + +# B.3 PWC LEADERBOARDS dataset + +The PWC LEADERBOARDS dataset is based on open data published by Papers With Code and annotated by their community. We converted the data into format similar in structure to the LINKEDRESULTS dataset. + +# C Mention Probabilities + +Using the methodology from Section 3.4, we can calculate $p(k \mid E)$ by combining probabilities of mentions, $p(m \mid \neg n, t, \text{property}(t, k))$ . + +We compute all possible mentions directly from tasks, datasets and metrics names appearing in leaderboards. For a name of dataset or metric the mentions list consists of the whole name as well as each word, without duplicates and English stop words. As tasks names often consist of common words, to limit the number of false positives the mentions list for a given task contains only that task's name. The mentions can be additionally extended with human curated lists or abbreviations + +extracted from papers, as described in Section 6.3. + +Let $R(t) = \{ \text{property}(t, k) \colon k \in \{1, \dots, K\} \}$ be a set of all entities of type $t$ and let $M(t, r)$ denote a set of all possible mentions for a given entity $r \in R(t)$ . We compute the probability $p(m \mid \neg n, \text{property}(t, k))$ assuming all mentions (separately for tasks, datasets and metrics) for a given entity $r$ are distributed uniformly, $p(r \mid \neg n, t, m) = 1 / |M(t, r)|$ . We then use Bayes rule to get $p(m \mid \neg n, \text{property}(t, k))$ , assuming that all mentions of a given type are distributed uniformly. This results in the conditional probability of a mention being inversely proportional to the number of entities having that mention evidence in common: + +$$ +\begin{array}{c} p \left(m \mid \neg n, t, \text {p r o p e r t y} (t, k)\right) \propto \\ \frac {1}{| \{r ^ {\prime} \in R (t) \colon m \in M (t , r ^ {\prime}) \} |}. \end{array} +$$ + +# D Additional Results + +![](images/8f968e1f798754e680d87f375ce0004ba27bced1fc881c23dbb3f7fe0e4d74d2.jpg) +Figure 7: Confusion matrix of table type classification step. +Predicted label + +![](images/66a943c386662493c253acc25e8c3154dd5700f148b45c8a2124979e974918a4.jpg) +Figure 6: Confusion matrices of segmenting cells into five classes: dataset (including subdatasets), metric, model introduced in processed paper, competing model and other. Results averaged over 5 runs for each task, using 10-fold training as described in Section 6.2 with tables from a) Speech Recognition, b) Image Generation and c) Semantic Segmentation papers as a test set. + +![](images/11bb0554c7a485a2120860dbc8ad8270c87346ff7f767e15141c7ad7acf41204.jpg) +(a) Speech Recognition + +![](images/6475591a9c492900174a175fe52b7eb18fca7ee86e745a7478b088deda18d1b2.jpg) +(b) Image Generation +(c) Semantic Segmentation \ No newline at end of file diff --git a/axcellautomaticextractionofresultsfrommachinelearningpapers/images.zip b/axcellautomaticextractionofresultsfrommachinelearningpapers/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..8da31cdab401bac5a93de7f2cc1a2a0a035e08c2 --- /dev/null +++ b/axcellautomaticextractionofresultsfrommachinelearningpapers/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f4f26609ea2b0aa97475670783fe3f6e86388e4941f5ded457f1223fb08a4fe +size 774970 diff --git a/axcellautomaticextractionofresultsfrommachinelearningpapers/layout.json b/axcellautomaticextractionofresultsfrommachinelearningpapers/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..445448837201ec13ff5a172e344b205b385b60b0 --- /dev/null +++ b/axcellautomaticextractionofresultsfrommachinelearningpapers/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d587fa8dd0a3bd7723bc9f87cb3ce5bcba54a5c57dc19a08bbc48517070b795 +size 488233 diff --git a/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_content_list.json b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..124eea0ce23a6556d2e547b181b67275fe97e89e --- /dev/null +++ b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc98171566e6cbd60adc8a0b1d8ac0ecdb6f6cfc1cec3e9f0d5e0ac1c756910e +size 77888 diff --git a/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_model.json b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_model.json new file mode 100644 index 0000000000000000000000000000000000000000..a105531c3192202ad32a53be08da1fb80c6a79c7 --- /dev/null +++ b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c371ace0e99a31fac0cb311bbae352e397c90f19688f3be04daf0b0465fb0387 +size 97682 diff --git a/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_origin.pdf b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6021423854047246239c4533416828509bda4b4b --- /dev/null +++ b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/15f626ad-5a9a-42a9-8714-89118289f3bc_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5cb925027c8e2bde25376451010fb6fd74f94045a0ad838c8928b1a1dbdf8cb +size 5393138 diff --git a/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/full.md b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a5dd9adf2d673293c12b28a2d00fb31c908022c3 --- /dev/null +++ b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/full.md @@ -0,0 +1,340 @@ +# Back to the Future: Unsupervised Backprop-based Decoding for Counterfactual and Abductive Commonsense Reasoning + +Lianhui Qin†‡ Vered Shwartz†‡ Peter West†‡ Chandra Bhagavatula‡ +Jena D. Hwang‡ Ronan Le Bras‡ Antoine Bosselut†‡ Yejin Choi†‡ +†Paul G. Allen School of Computer Science & Engineering, University of Washington +‡Allen Institute for Artificial Intelligence +{lianhuiq, pawest, antoineb, yejin}@cs.washington.edu +{vered, chandrab, jenah, ronanlb}@allenai.org + +# Abstract + +Abductive and counterfactual reasoning, core abilities of everyday human cognition, require reasoning about what might have happened at time $t$ , while conditioning on multiple contexts from the relative past and future. However, simultaneous incorporation of past and future contexts using generative language models (LMs) can be challenging, as they are trained either to condition only on the past context or to perform narrowly scoped text-infilling. + +In this paper, we propose DELOREAN, a new unsupervised decoding algorithm that can flexibly incorporate both the past and future contexts using only off-the-shelf, left-to-right language models and no supervision. The key intuition of our algorithm is incorporating the future through back-propagation, during which, we only update the internal representation of the output while fixing the model parameters. By alternating between forward and backward propagation, DELOREAN can decode the output representation that reflects both the left and right contexts. We demonstrate that our approach is general and applicable to two nonmonotonic reasoning tasks: abductive text generation and counterfactual story revision, where DELOREAN outperforms a range of unsupervised and some supervised methods, based on automatic and human evaluation. + +# 1 Introduction + +Everyday causal reasoning requires reasoning about the likely explanations to partially observable past and future (abductive reasoning (Peirce, 1960)) and reasoning about the alternative future based on counterfactual past (counterfactual reasoning). Such nonmonotonic reasoning requires + +![](images/c404c12db27d14789c8f0eb26dad399f102eb1a12962d0fd4198301d3a4a0b02.jpg) +Figure 1: DELOREAN, our proposed method, with generated reasoning results. Top: the goal in abductive reasoning is to generate a hypothesis $(Y)$ of what happened between the observed past $(X)$ and future $(Z)$ contexts. Bottom: In counterfactual reasoning, given a story context altered by a counterfactual condition, $X$ , and the original ending $Z$ , the goal is to generate a new ending $Y$ which is coherent with $X$ while remaining similar to $Z$ . The story from TIMETRAVEL (Qin et al., 2019a) consists of five sentences. Our approach alternates forward (left-to-right) and backward (right-to-left) passes that iteratively refine the generated texts w.r.t context from each side. + +inferring plausible but potentially defeasible conclusions from incomplete or hypothetical observations (Reiter, 1988). While humans are remarkably good at this type of causal reasoning, developing AI systems capable of nonmonotonic reasoning for + +a wide range of situations describable in natural language has been a major open research question. + +More concretely, with abductive reasoning, the goal is to find the most plausible explanation for incomplete observations (Peirce, 1960). In the top part of Figure 1, given the first observation that Ray is "making his daughter a swing" and the later observation that he "ran to [her] to make sure she was okay," we can hypothesize that she somehow got hurt by the swing. + +In contrast, counterfactual reasoning concerns the causal changes to future events given a change in the past condition (i.e., "counterfactual condition"; Goodman, 1947). For example, the bottom part of Figure 1 shows the original five sentence story $(S_{1},\ldots ,S_{5})$ and an alternative counterfactual condition given in $S_2^{\prime}$ -that instead of being a generic "Halloween party", the new counterfactual condition is that it is going to be a "Game of Thrones themed party!"! Given these, the problem we want to solve is to update the future events $(S_3^{\prime},\dots,S_5^{\prime})$ , so that instead of "Zeke dressed up as skeleton", we have "Zeke dressed up like a Stark".2 + +Recently, two tasks and corresponding benchmarks have been introduced to tackle language-based nonmonotonic reasoning: the ART dataset for abductive NLG (Bhagavatula et al., 2019), and the TimETravel dataset for counterfactual story rewriting (Qin et al., 2019a). Both tasks are framed as conditional generation, with multiple contexts to condition on. The currently dominant paradigm for conditional text generation tasks is fine-tuning pre-trained language models (LMs), such as GPT2 (Radford et al., 2019a), on large-scale training data for supervision. However, despite the large number of training examples, supervised approaches still perform considerably worse than humans and are subject to developing superficial strategies such as repeating the observations as is or memorizing prevalent surface patterns specific in the dataset (Qin et al., 2019a). Furthermore, having to require large-scale training data for each domain and task would be utterly inefficient for broad coverage nonmonotonic reasoning in language. + +In this paper, we investigate an alternative path toward language-based nonmonotonic reasoning using pre-trained language models as is. Intuitively, both the abductive and counterfactual reasoning + +requires learning coherent patterns in narrative, which should be already available in large-scale pretrained language models. However, the key challenge is that most generative language models are trained to condition only on the left context, or to perform narrowly scoped text-infilling. + +This paper presents DELOREAN: DEcoding for nonmonotonic LOgical REAsoNing, an unsupervised decoding algorithm that only assumes off-the-shelf left-to-right language models with no supervision. The key intuition of our algorithm is incorporating the future through back-propagation, during which, we only update the internal representation of the output while fixing the model parameters. More specifically, DELOREAN alternates between the forward and backward passes, where the forward pass performs left-to-right inference given the left context (roughly maximizing $P(Y|X)$ in Figure 1), while the backward pass instills the right constraint through right-to-left backpropagation with a task-specific loss (roughly maximizing $P(Z|XY)$ ). The forward and backward outputs are mixed into a single vector, from which tokens are sampled to generate the desired output. To choose the best output across iterations, we employ an unsupervised ranking step based on BERT's next sentence prediction task to measure coherence (Devlin et al., 2018). + +On both tasks, DELOREAN outperforms all other unsupervised methods in terms of both automatic metrics and human evaluation, demonstrating that nonmonotonic reasoning through conditional decoding is a promising research direction. Moreover, outputs produced by our model are judged as more coherent than those from the supervised models. In sum, our study shows that backpropagation-based decoding may enable additional future applications of unsupervised generation and reasoning. + +# 2 Background + +Most NLP benchmarks have focused on reasoning about information that is entailed from the premise. For instance, natural language inference (NLI; Bowman et al., 2015) focuses primarily on whether a hypothesis is entailed from a given premise, which means the information stated in the hypothesis is a subset of the information provided in the premise. However, it has been noted that human reasoning is often the other way, where hypotheses often contain new information that was not available in the premise, but plausibly true (but + +![](images/819f43202beac0be1929b6087b91bbeff04dd2f7904d4640e1c7dea1a4d4a383.jpg) +Figure 2: Illustration of the DELOREAN decoding procedure, using abductive reasoning as an example. At initialization (upper-left box), the language model (LM) initializes the logits $\tilde{Y} = \{\tilde{y}_1,\dots ,\tilde{y}_N\}$ of the hypothesis by reading the past context $X$ and generating a continuation with regular decoding. At each forward-backward iteration, we compute the task-specific loss $\mathcal{L}_{\tilde{Y}}$ of the logits based on the future constraint $Z$ (red box). The backward pass then performs back-propagation and produces the backward logits $\tilde{Y}^{b} = \{\tilde{y}_{1}^{b},\dots ,\tilde{y}_{N}^{b}\}$ . In the subsequent forward pass, for each step $n$ , we compute the forward logits $\tilde{y}_n^f$ conditioning on the preceding logits $\tilde{y}_{n - 1}$ , and then mix it with the respective backward logits to produce the new logits $\tilde{y}_n$ at step $n$ . + +possibly defeasible with new additional context) (Johnson-Laird, 2006; Mercier and Sperber, 2017). This type of reasoning corresponds to nonmonotonic reasoning (Kraus et al., 1990), as it contradicts the monotonicity property according to which valid arguments cannot be made invalid by adding premises. We study two tasks of that nature: abductive reasoning (§2.1) and counterfactual reasoning (§2.2). + +# 2.1 Abductive Reasoning + +Abductive reasoning aims at finding the most likely explanation to partial observations (Peirce, 1960). It has a central role in the human ability to "read between the lines," and is crucial for language acquisition (Andersen, 1973), understanding sentences in discourse (Hobbs et al., 1993), and many more. Despite the importance, however, relatively little focus has been given to it in NLP research. + +Recently, Bhagavatula et al. (2019) propose the + +abductive reasoning task. Given two observations, the goal is to determine the most likely explanation of what happened in-between. The dataset introduced for the task, $\mathcal{ART}$ , consists of 20k observations derived from the first and last sentence of stories in the ROCStories dataset (Mostafazadeh et al., 2016a). We focus on the abductive NLG setup introduced in the paper, which is framed as a conditional generation task where a plausible explanation to the observations must be generated using language. The authors reported the performance of several pre-trained LM-based baselines and showed promises and limitations of such approaches. + +# 2.2 Counterfactual Reasoning + +Counterfactual reasoning aims at inferring alternative past events that could have happened given a certain change in conditions (Goodman, 1947; Starr, 2019). While counterfactual reasoning plays an important role in AI systems (Isard, 1974; Gins + +berg, 1986), it requires causal reasoning abilities, which are arguably absent from current association-based AI (Pearl and Mackenzie, 2018). While there has been work on counterfactual reasoning in NLP, including recognizing counterfactuals in text (Son et al., 2017), and improving the performance of NLP tasks using counterfactual learning (Lawrence et al., 2017; Lawrence and Riezler, 2018), it remains a major research challenge. + +Recently, Qin et al. (2019a) introduce the task of counterfactual story generation. Given a 5-sentence original story, and an alternative context in which the second sentence of the story was altered by a counterfactual, the task is to generate a new 3-sentence story ending that addresses the alternative beginning while minimally editing the original ending. The associated TimETRAVEL dataset is based on fictional narratives from ROCStories, for which counterfactual contexts and alternative endings are crowdsourced, yielding 29,849 problem instances. Qin et al. (2019a) report several baseline performances, and find that models based on pre-trained LMs produce output that recognize the counterfactual, but generated endings which deviated considerably from the original storyline. In contrast, in the supervised setup, models optimize the easier of the two goals and generate endings that are overly similar to the original endings. + +# 3 The DELOREAN Approach + +Humans make inferences based on available information and refine them when new information arrives. Since currently available pre-trained LMs generate text by sequentially predicting the next token from left to right, they are incapable of conditioning on future constraints. Therefore, we propose DELOREAN: an unsupervised backprop-based decoding algorithm, which is summarized in Algorithm 1, illustrated in Figure 2, and detailed below. DELOREAN intermittently refines the predictions to cohere with either the context or the constraints (Section 3.1). The candidate generations are then ranked by coherence (Section 3.2). + +# 3.1 Decoding Strategy + +Given context text $X$ , the goal is to generate continuation text $Y = (y_{1}, \ldots, y_{N})$ , such that $Y$ satisfies certain constraints according to the reasoning tasks, usually defined based on another context $Z$ (see Figure 1; we discuss the task-specific constraints in the respective task sections). + +Algorithm 1: DELOREAN Decoding +Input: Pre-trained language model (LM) +Context $X$ +Future constraint $Z$ +1: Initialize logits $\tilde{Y}^{(0)}$ +2: Initialize $Y_{s}$ , list of candidate generations +3: for $t\gets 1$ to $T$ do +4: // Backward pass +5: for $n\gets N$ to 1 do +6: Compute backward logits $\tilde{\pmb{y}}_n^{\mathrm{b}}$ , Eq.(1) +7: end for +8: // Forward pass +9: for $n\gets 1$ to $N$ do +10: Compute forward logits $\tilde{\pmb{y}}_n^{\mathrm{f}}$ , Eq.(2) +11: Mix forward and backward logits, Eq.(3) +12: end for +13: Sample candidate $Y$ from logits $\tilde{Y}$ and add to $Y_{s}$ +14: end for +15: Rank $Y_{s}$ by coherence +Output: The most coherent generated text $Y$ from $Y_{s}$ + +The proposed approach interleaves two procedures, namely, forward and backward, that produce and iteratively refine the generation, for a predefined number of iterations $T$ . In particular, the forward pass ensures the generated text is a fluent continuation of the context $X$ , while the backward pass informs the model about the constraint and steers the generation to satisfy it. + +As detailed below, the backward pass uses gradient descent to update the generation $Y$ . However, $Y$ is a discrete text that is not differentiable. Instead, throughout the algorithm, we maintain a soft representation of the sequence $\tilde{Y} = (\tilde{\mathbf{y}}_1,\dots ,\tilde{\mathbf{y}}_N)$ , where $\tilde{\mathbf{y}}_n\in \mathbb{R}^V$ represents the logits of the $n$ -th token and $V$ is the vocabulary size. After the logits are refined over multiple iterations of the forward and backward passes, we generate discrete text at each step by sampling from $y_{n}\sim \mathrm{softmax}(\tilde{\mathbf{y}}_n / \tau)$ where $\tau >0$ is the temperature. + +We start by initializing the logits before the first iteration, $\tilde{Y}^{(0)} = (\tilde{y}_1^{(0)}\dots \tilde{y}_N^{(0)})$ , by feeding the context $X$ into the LM and greedily decoding $N$ continuation tokens. + +Backward The backward pass uses gradient backpropagation to update the generation with respect to the constraint. Specifically, we express the task-specific constraint as a loss function $\mathcal{L}(X,\tilde{Y}^{(t - 1)},Z)$ that evaluates how well the generation $Y$ (approximated with the soft representation $\tilde{Y}$ ) obeys the constraint (see the subsequent sections for concrete instantiations of the loss). The goal of this pass is thus to minimize the loss w.r.t the generation. Specifically, at iteration $t$ , for each + +step $n$ in the generation, we update its logits with: + +$$ +\tilde {\boldsymbol {y}} _ {n} ^ {(t), \mathfrak {b}} = \tilde {\boldsymbol {y}} _ {n} ^ {(t - 1)} - \lambda \cdot \nabla_ {\tilde {\boldsymbol {y}} _ {n}} \mathcal {L} (X, \tilde {Y} ^ {(t - 1)}, Z), \tag {1} +$$ + +where $\nabla_{\tilde{y}_n}\mathcal{L}(X,\tilde{Y}^{(t - 1)},Z)$ is the gradient of the constraint-informed loss $\mathcal{L}$ w.r.t the $n$ -th logits, and $\lambda \in \mathbb{R}$ is the step size. In practice, we may repeat the gradient updates multiple times in a single pass. + +Forward The forward pass ensures that $Y$ is fluent and coherent with the preceding context $X$ . At iteration $t$ , for a particular step $n$ , we compute the forward logits with the LM: + +$$ +\tilde {\boldsymbol {y}} _ {n} ^ {(t), \mathrm {f}} = \mathrm {L M} (X, \tilde {Y} _ {1: n - 1} ^ {(t)}). \qquad (2) +$$ + +We then mix the nth-step forward and backward logits to get the final logits of iteration $t$ : + +$$ +\tilde {\boldsymbol {y}} _ {n} ^ {(t)} = \gamma \cdot \tilde {\boldsymbol {y}} _ {n} ^ {(t), \mathrm {f}} + (1 - \gamma) \cdot \tilde {\boldsymbol {y}} _ {n} ^ {(t), \mathrm {b}}, \qquad (3) +$$ + +where $0 < \gamma < 1$ is the mixing weight. The resulting logits $\tilde{\pmb{y}}_n^{(t)}$ are then fed to the LM to compute the forward logits at the $(n + 1)$ th step (Eq.2). This way, information from the backward pass is integrated into the left-to-right generation process to produce text that is informed by the constraint. + +We pre-define the number of tokens $N$ required by the backward pass, but we allow the forward pass to generate more than $N$ tokens if those are needed to obtain complete sentences. In that case, we set the logits of the extra tokens to the forward logits, without mixing: $\tilde{\pmb{y}}_n^{(t)} = \tilde{\pmb{y}}_n^{(t),\mathrm{f}}$ for $n > N$ . We then prune any trailing tokens in the sampled text to get complete sentences. + +# 3.2 Ranking + +The output of the decoding step is a list of candidate generations for each iteration: $Y_{s} = \{Y^{(t)}|t = 1,\dots,T\}$ . We further use an unsupervised approach to rank and pick the best sample as the final output. Specifically, we take advantage of the BERT model, which was pre-trained with a next-sentence prediction (NSP) objective. Given two sentences $A$ and $B$ , we use NSP to compute the likelihood of $B$ following $A$ as a proxy for coherence: + +$$ +c (A, B) = \operatorname {B E R T} \operatorname {N S P} (A, B), \tag {4} +$$ + +where $c(\cdot, \cdot)$ denotes the coherence score. This score is used to evaluate the quality of a given candidate continuation $Y$ by measuring (1) its compatibility with the subsequent text of the context $X$ , (2) the internal consistency of $Y$ if it consists of multiple sentences, and (3) the compatibility of $Y$ with its right-side text when it is applicable. + +
ModelBLEU-4ROUGE-LBERT
Supervised
Sup32.8225.6049.38
+COMET-Emb33.9726.0649.71
Unsupervised
Zero-ShotX18.3014.9939.36
Zero-ShotZX15.9014.2340.03
Zero-ShotX-Ranked19.2416.7641.58
Zero-ShotZX-Ranked20.1317.2541.93
DELOREAN22.6018.9442.86
Human53.5630.4053.30
+ +Table 1: Automatic evaluation results on the abductive task, using the test set of ART. + +# 4 Task 1: Abductive Reasoning + +Each instance in the ART dataset consists of two observations $O_{1}$ , $O_{2}$ and a hypothesis $H$ that explains the two observations. These inputs naturally map to $X$ , $Z$ and $Y$ in our framework. Formally, the abductive generation task aims to maximize $P(Y|X,Z)$ - i.e. models must consider both left and right contexts ( $X$ and $Z$ ) jointly. + +# 4.1 Task Setup + +Constraints We maximize $Z$ given $X\tilde{Y}$ by defining the loss function as the cross-entropy loss of generating $Z$ given $X\tilde{Y}$ with the LM: + +$$ +\mathcal {L} (X, \tilde {Y}, Z) := - \sum_ {n = 1} ^ {N _ {Z}} \log P _ {\mathrm {L M}} \left(z _ {n} | X, \tilde {Y}, Z _ {1: n - 1}\right), \tag {5} +$$ + +where $P_{\mathrm{LM}}(a_j | a_{1:j-1})$ is the likelihood of generating token $a_j$ given the preceding text $a_{1:j-1}$ . + +Ranking We rank candidates by the overall coherence after inserting $Y$ in between $X$ and $Z$ : + +$$ +\operatorname {r a n k i n g} _ {\mathcal {S}} \operatorname {c o r e} (Y) = c (X Y, Z) + c (X, Y Z). \tag {6} +$$ + +Hyperparameters We use GPT2-345M (Radford et al., 2019b) as the pre-trained LM for all models. We use the $\mathcal{A}\mathcal{R}\mathcal{T}$ development set to select hyperparameters. We use greedy decoding for our method and top k decoding (Fan et al., 2018) $(k = 40, \tau = 0.7)$ for our baselines. Other hyperparameters are outlined in Appendix A.1. + +# 4.2 Experimental Setup + +Baselines We compare our method against baselines from Bhagavatula et al. (2019). The unsupervised baselines use a pre-trained GPT-2 model + +![](images/47f5c8c4943eb24b1dd206ca08090078aab1d21209e30671fab9dce8f37fd152.jpg) +Figure 3: Examples of generated hypotheses on three abductive reasoning cases. Given observations O1 and O2, DELOREAN generates a hypothesis explaining the observations. + +to generate $Y$ given a prompt text—either the observation $X$ alone (Zero-Shot $_X$ ) or $Z\langle e\rangle X$ (Zero-Shot $_{ZX}$ ), where $\langle e\rangle$ denotes a special end-of-text token. The supervised method (Sup) follows the same input format as Zero-Shot $_{ZX}$ , but finetunes GPT-2 on the ART training set. Finally, our knowledge-informed baseline (+COMET-Emb) further augments the representation of Sup with knowledge from COMET (Bosselut et al., 2019). + +To separately study the contribution of our decoding strategy and ranking component, we also report the performance of ranking the baseline outputs. Specifically, we let each baseline generate 20 candidates and rank them by coherence (Eq. 6).4 + +# 4.3 Results + +Automatic Evaluation We report the same metrics as Bhagavatula et al. (2019): BLEU-4 (Papineni et al., 2002), ROUGE-L (Lin, 2004) and BERTSCORE (Zhang et al., 2019) (with the bert-base-uncased model). The results in Table 1 show that DELorean performs best among the unsupervised systems across all metrics. We also note that our ranking step improves both the performance of our model and that of the zero-shot baselines. + +Human Evaluation We conduct two sets of human evaluations on 100 test examples using crowd-workers from Amazon Mechanical Turk. In the scoring setting, presented in Table 2, workers were presented a pair of observations $(X$ and $Z)$ and a generated hypothesis $Y$ , and asked to rate the coherence of the hypothesis with respect to the observation $X$ $(X - Y)$ , the observation $Z$ $(Y - Z)$ , and both $(X - Y - Z)$ , on a 4-point Likert scale. In the + +
ModelX-YY-ZX-Y-Z
Supervised
Sup0.5100.3750.314
+COMET-Emb0.4660.3420.286
Unsupervised
Zero-ShotZX0.2330.1030.108
Zero-ShotX-Ranked0.4780.2080.195
Zero-ShotZX-Ranked0.4740.2380.236
DELOREAN0.5220.3250.297
Human0.8790.8230.783
+ +Table 2: Human calibration results on test set of ART. All scores are normalized to [0, 1]. + +
Overall - Human Judges Preferred
Our modelNeutral36%Comparator
DELOREAN21%43%Sup
DELOREAN25%44%31%+COMET-Emb
DELOREAN23%62%15%Zero-ShotX-Ranked
DELOREAN27%50%23%Zero-ShotXZ-Ranked
DELOREAN3%11%86%Human
+ +Table 3: Human pairwise comparison results on the test set of $\mathcal{ART}$ , between DELorean and each of the baselines, by jointly considering all 3 criteria from Table 2. "Neutral" means "equally good/bad". + +pairwise comparison setting, presented in Table 3, workers were presented the outputs from a pair of systems (DELOREAN and baseline) and asked to choose the better output in terms of the same coherence criteria. Each example was labeled by 3 workers.5 + +In both evaluation setups, our method substantially outperforms the unsupervised baselines, achieving a relative improvement of $36\% - 215\%$ with respect to $Y - Z$ coherence. Our method also outperforms the supervised methods with respect to $X - Y$ coherence (Table 2), and achieve competitive performance in the pairwise comparison (Table 3). + +
BLEUROUGEBERT
Supervised + Discriminative
Sup+Disc75.7172.7262.39
Unsupervised+ Discriminative
Recon+CF75.9270.9362.49
Unsupervised
FT4.0624.0962.55
FT+CF4.0224.3562.63
Pretrained-only
Zero-Shot s1s2'1.7421.4159.31
Zero-Shot s1s2'-Ranked2.2625.8160.07
DELorean21.3540.7363.36
Human64.9367.6461.87
+ +Table 4: Automatic evaluation results of counterfactual story rewriting, on the test set of TIMETRAVEL. + +
Coherence - Human Judges Preferred
Our modelNeutralComparator
DELOREAN25%58%17%Sup+Disc
DELOREAN23%70%7%Recon+CF
DELOREAN22%48%30%FT
DELOREAN18%60%22%Zero-Shots1s2
DELOREAN27%42%31%Zero-Shots1s2-Ranked
DELOREAN10%29%61%Human
+ +
Min-Edits - Human Judges Preferred
Our modelNeutralComparator
DELOREAN4%17%79%Sup+Disc
DELOREAN1%14%85%Recon+CF
DELOREAN21%76%3%FT
DELOREAN28%71%1%Zero-Shots1s2
DELOREAN37%56%7%Zero-Shots1s2-Ranked
M+Sup8%22%70%Human
+ +Table 5: Human pairwise comparison results on the counterfactual task, between our best model and each baseline with respect to coherence and min-edits. + +Again, the ranking component contributes to increasing performance for the zero-shot baselines. Finally, the large performance gap between the methods and human-written explanations stresses the difficulty of this reasoning task and warrants future research. + +Qualitative Analysis Figure 3 presents two example outputs produced by DELOREAN. We can see our approach generates reasonable hypotheses by taking into account both the past and future contexts. For instance, in the first example, the future observation (O2) "car was totaled" indicates that Ray had a car accident, which is correctly captured in the generated hypothesis "car is hit by a car". + +![](images/cb5e0d89d5b8c99b7edcee1280582067ca1c35cd416ee00c2539bcea2951133b.jpg) +Figure 4: Human calibration results for counterfactual generation in terms of weighted harmonic mean of coherence and min-edit, $H_{\beta} = \frac{(1 + \beta^{2})\cdot\mathrm{coherence}\cdot\mathrm{min\_edit}}{\beta^{2}\cdot\mathrm{coherence} + \mathrm{min\_edit}}$ , as a function of the scaling factor $\beta$ . Low $\beta$ values assign more weight to coherence, and high $\beta$ values emphasize more on min-edit. + +# 5 Task 2: Counterfactual Reasoning + +Given an original story ending $Z$ of story context $X^{ori}$ , and a counterfactual condition $X$ that changes $X^{ori}$ to invalidate $Z$ (see Fig. 1), the task is to generate a new story ending $Y$ that minimally edits the original ending $Z$ to regain coherence with the counterfactual condition $X$ (Qin et al., 2019a). + +# 5.1 Task Setup + +Constraints The constraint we enforce is that $Y$ is close to $Z$ (i.e., minimal edits). We impose this constraint by minimizing their KL divergence: + +$$ +\mathcal {L} (X, \tilde {Y}, Z) := \mathrm {K L} \left(Z \| \operatorname {s o f t m a x} (\tilde {Y} / \tau)\right), \tag {7} +$$ + +where, with a slight abuse of notation, $Z$ is the one-hot distribution of the tokens in the original ending. That is, we encourage the generated logits to recover the original ending. + +Ranking We rank the candidates based on both their coherence with the context, as well as the internal coherence between the multiple sentences of each candidate (rewritten ending, consists of 3 sentences). More concretely, given a candidate $Y$ , we compute the aggregated coherence score: + +$$ +\operatorname {r a n k i n g} - \operatorname {s c o r e} (Y) = c (X, Y) + \sum_ {s = 1} ^ {S - 1} c (Y [ s ], Y [ s + 1 ]), \tag {8} +$$ + +where each candidate has $S$ sentences (here, $S = 3$ ) and $Y[s]$ denotes the $s$ th sentence. + +![](images/7d4dc818592a1e70b755058f39c3ce0a2311bab25e912e49da3116b4bac065d5.jpg) +Figure 5: Examples of generated story endings on three counterfactual reasoning cases. Given a story context, a counterfactual condition, and a original ending, DELOREAN generates a rewritten ending which is coherent with the counterfactual condition and is similar to the original ending. + +Hyperparameters We largely follow the same setting as in the abductive reasoning task, but tune hyperparameters on the TIMETRAVEL development set. Deviations from these settings are outlined in Appendix A.2. + +# 5.2 Experimental Setup + +Baselines We compare our method with baselines from Qin et al. (2019a). The zero-shot baseline uses the pre-trained GPT-2 model to generate $Y$ as a continuation to the counterfactual condition $X$ . It is the most apt comparison to our method which also doesn't require additional supervision. We also experiment with two baselines that fine-tune GPT-2 on the original story $X^{ori}Z$ to fit the model to the story domain, either with an LM objective (FT) or a tailored conditional objective that encourages minimal edits of $Z$ (Recon+CF). Finally, we report the performance of a supervised baseline (Sup), in which GPT-2 is fine-tuned to produce the gold $Y$ from $X^{ori}Z$ and $X$ . + +# 5.3 Results + +Automatic Evaluation Following Qin et al. (2019a), we report BERTSCORE (Zhang et al., 2019), which was shown to best correlate with human judges' notion of counterfactual coherence, and BLEU-4 and ROUGE-L, which better measure minimum edits. We find that the discriminative baselines achieve the highest degree of plot + +fidelity. Meanwhile, DELOREAN achieves the highest BERTSCORE for counterfactual coherence. + +Human Evaluation We repeat the human evaluation setup from Section 4.3. Presented with the original story, the counterfactual condition $X$ , and the generated ending $Y$ , workers were asked to judge (1) the coherence of $Y$ with respect to the $X$ ; and (2) to what extent the generated ending minimally edits the original ending.7 In order to judge both criteria, we report the weighted harmonic mean $H_{\beta}$ of these scores across a range of weights $\beta$ (Figure 4). + +Our results show that DELOREAN is the only model that maintains a consistent balance between coherence (1.66) and minimal edits (1.54). While the ranking-augmented zero-shot model produces the most coherent endings (coherence $= 1.8$ ), it deviates from the original ending. As $\beta$ is increased (i.e., increasing importance of minimal edits), its weighted performance drops considerably, indicating it cannot generate new endings that follow the original plot of the story (min-edit $= 1.25$ ). Conversely, Recon+CF generates stories that are faithful to the original endings, but are far less coherent with the counterfactual condition (coherence $= 1.23$ ). Through human annotation, we found that Recon+CF copies the original ending word-for-word in a $84\%$ of cases. + +The pairwise comparison results in Table 5 + +parallel these observations. DELOREAN significantly outperforms the discriminative approaches (Recon+CF and Sup+Disc) in coherence, while falling short of the Zero-shot re-ranked baselines. In minimal edits, this pattern is flipped with our approach outperforming Zero-shot baselines considerably and losing to the discriminative baselines. + +Qualitative Analysis Figure 5 provides two example results for counterfactual story rewriting by DELOREAN. The approach successfully captures the causal relations between events and properly rewrites the endings with minimal edits. For instance, in the first example, given the counterfactual condition that "Tara ordered a shirt online" (as opposed to the original "went to mall"), the rewritten ending is about "sent shirt" to Tara (as opposed to the original "browsed from stores"). The last sentence of the original ending "She looked forward to wearing it" is correctly preserved as it is coherent with the counterfactual condition. + +# 6 Related Work + +Unsupervised text generation. Unsupervised approaches are often applied to problems that copy information from a source text into decoded text. Unsupervised paraphrasing requires repeating this information (Miao et al., 2019; Bao et al., 2019), as does translation, but with a bilingual transformation (Artetxe et al., 2017; Lample et al., 2018). In summarization there is an additional task to select a subset of the original text (Baziotis et al., 2019; Schumann et al., 2020; West et al., 2019). In cases where information is mostly copied from the original, auto-encoding objectives can ensure the correct information is captured (Bao et al., 2019; Baziotis et al., 2019; Artetxe et al., 2017). This work tackles problems where generation is more open-ended. Rather than reproducing information from the prompt, generations should agree with and expand on it, making autoencoding less applicable. + +Controllable language generation. Earlier approaches for controllable generation involved preserving the content of text while changing it along discrete dimensions, such as theme, sentiment, or style (Koncel-Kedziorski et al., 2016; Hu et al., 2017; Ficler and Goldberg, 2017; Shen et al., 2017; Lample et al., 2019). Recent works such as Grover (Zellers et al., 2019) and CTRL model (Keskar et al., 2019) used these ideas to augment transformer language models that can condition on struc + +tured metadata such as source, domain, etc. The Plug & Play model (PPLM; Dathathri et al., 2019) controls topic and sentiment in an approach similar to ours that involves forward and backward passes to update token distributions. However, PPLM relies on trained attribute discriminators for supervision, while our method is unsupervised. While these models are restricted to specific dimensions, often with pre-defined values, our model can adjust to any open-ended textual constraint. Perhaps the most similar work in that aspect is the "text infilling" models, which, however, are in a more narrow setting by filling only a relatively short text span (Devlin et al., 2018; Zhu et al., 2019; Donahue et al., 2020), and more restrictive due to the reliance on an extra right-to-left language model (Sun et al., 2017) or a pre-specified generation length (Zeldes et al., 2020, which is not publicly available). + +Reasoning about narratives. A prominent resource from recent years is the RocStories corpus (Mostafazadeh et al., 2016b), consisting of 98K crowdsourced 5-sentence everyday life stories. It was used for the story cloze task whose goal was to predict the story ending from its first 4 sentences, but gained popularity and became the base of additional benchmarks (Rashkin et al., 2018). Additional related work includes "script knowledge", i.e. learning about prototypical series of events (Schank and Abelson, 1977; Chambers and Jurafsky, 2008; Pichotta and Mooney, 2014), temporal commonsense (Granroth-Wilding and Clark, 2016; Li et al., 2018), and modeling pre- and post- conditions of events (Roemmle et al., 2011; Sap et al., 2019; Bosselut et al., 2019). Qin et al. (2019b) studied conversation modeling that reads and connects the dots of events in related documents. Finally, a recent line of work explores counterfactual questions in reading comprehension (Huang et al., 2019; Tandon et al., 2019), but instantiates the problem of counterfactual reasoning as a multiple choice task. + +# 7 Conclusion + +We presented DELOREAN, an unsupervised LM-based approach to generate text conditioned on past context as well as future constraints, through forward and backward passes considering each condition. We demonstrated its effectiveness for abductive and counterfactual reasoning, on which it performed substantially better than unsupervised baselines. Our method is general and can be easily adapted for other generative reasoning tasks. + +# Acknowledgements + +We thanks the anonymous reviewers and colleagues at UW NLP and AI2 for many helpful comments. This research was supported in part by DARPA CwC through ARO (W911NF15-1-0543), DARPA MCS program through NIWC Pacific (N66001-19-2-4031), and Allen Institute for AI. + +# References + +Henning Andersen. 1973. Abductive and deductive change. Language, pages 765-793. +Mikel Artetxe, Gorka Labaka, Eneko Agirre, and Kyunghyun Cho. 2017. Unsupervised neural machine translation. arXiv preprint arXiv:1710.11041. +Yu Bao, Hao Zhou, Shujian Huang, Lei Li, Lili Mou, Olga Vechtomova, Xinyu Dai, and Jiajun Chen. 2019. Generating sentences from disentangled syntactic and semantic spaces. arXiv preprint arXiv:1907.05789. +Christos Baziotis, Ion Androutsopoulos, Ioannis Konstas, and Alexandros Potamianos. 2019. Seq3: Differentiable sequence-to-sequence-to-sequence autoencoder for unsupervised abstractive sentence compression. In NAACL-HLT. +Chandra Bhagavatula, Ronan Le Bras, Chaitanya Malaviya, Keisuke Sakaguchi, Ari Holtzman, Hannah Rashkin, Doug Downey, Wen-tau Yih, and Yejin Choi. 2019. Abductive commonsense reasoning. In International Conference on Learning Representations. +Antoine Bosselut, Hannah Rashkin, Maarten Sap, Chaitanya Malaviya, Asli Celikyilmaz, and Yejin Choi. 2019. COMET: Commonsense transformers for automatic knowledge graph construction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4762-4779, Florence, Italy. Association for Computational Linguistics. +Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. 2015. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326. +Nathanael Chambers and Dan Jurafsky. 2008. Unsupervised learning of narrative event chains. In Proceedings of ACL-08: HLT, pages 789-797. +Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. 2019. Plug and play language models: a simple approach to controlled text generation. arXiv preprint arXiv:1912.02164. + +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. +C. Donahue, M. Lee, and P. Liang. 2020. Enabling language models to fill in the blanks. In ACL. +Angela Fan, Mike Lewis, and Yann Dauphin. 2018. Hierarchical neural story generation. In ACL. +Jessica Ficler and Yoav Goldberg. 2017. Controlling linguistic style aspects in neural language generation. In Proceedings of the Workshop on Stylistic Variation, pages 94-104. +Joseph L Fleiss. 1971. Measuring nominal scale agreement among many raters. Psychological bulletin, 76(5):378. +Matthew L Ginsberg. 1986. Counterfactuals. Artificial intelligence, 30(1):35-79. +Nelson Goodman. 1947. The problem of counterfactual conditionals. The Journal of Philosophy, 44(5):113-128. +Mark Granroth-Wilding and Stephen Clark. 2016. What happens next? event prediction using a compositional neural network model. In Thirtieth AAAI Conference on Artificial Intelligence. +Jerry R Hobbs, Mark E Stickel, Douglas E Appelt, and Paul Martin. 1993. Interpretation as abduction. Artificial intelligence, 63(1-2):69-142. +Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. 2017. Toward controlled generation of text. In ICML. +Lifu Huang, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. 2019. Cosmos qa: Machine reading comprehension with contextual commonsense reasoning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2391-2401. +Steve D Isard. 1974. What would you have done if...? Theoretical Linguistics, 1(1-3):233-256. +Philip Nicholas Johnson-Laird. 2006. How we reason. Oxford University Press, USA. +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. +Rik Koncel-Kedziorski, Ioannis Konstas, Luke Zettlemoyer, and Hannaneh Hajishirzi. 2016. A themerewriting approach for generating algebra word problems. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1617-1628. + +Sarit Kraus, Daniel Lehmann, and Menachem Magidor. 1990. Nonmonotonic reasoning, preferential models and cumulative logics. Artificial intelligence, 44(1-2):167-207. +Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, and Marc'Aurelio Ranzato. 2018. Phrase-based & neural unsupervised machine translation. arXiv preprint arXiv:1804.07755. +Guillaume Lample, Sandeep Subramanian, Eric Smith, Ludovic Denoyer, Marc'Aurelio Ranzato, and Y-Lan Boureau. 2019. Multiple-attribute text rewriting. In ICLR. +Carolin Lawrence and Stefan Riezler. 2018. Improving a neural semantic parser by counterfactual learning from human bandit feedback. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1820-1830. +Carolin Lawrence, Artem Sokolov, and Stefan Riezler. 2017. Counterfactual learning from bandit feedback under deterministic logging: A case study in statistical machine translation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2566-2576. +Zhongyang Li, Xiao Ding, and Ting Liu. 2018. Constructing narrative event evolutionary graph for script event prediction. In IJCAI. +Chin-Yew Lin. 2004. Rouge: A package for automatic evaluation of summaries. Text Summarization Branches Out. +Hugo Mercier and Dan Sperber. 2017. The enigma of reason. Harvard University Press. +Ning Miao, Hao Zhou, Lili Mou, Rui Yan, and Lei Li. 2019. Cgmh: Constrained sentence generation by metropolis-hastings sampling. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6834-6842. +Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. 2016a. A corpus and evaluation framework for deeper understanding of commonsense stories. arXiv preprint arXiv:1604.01696. +Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James F. Allen. 2016b. A corpus and cloze evaluation for deeper understanding of commonsense stories. In HLT-NAACL. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a method for automatic evaluation of machine translation. In ACL, pages 311-318. +Judea Pearl and Dana Mackenzie. 2018. The book of why: the new science of cause and effect. Basic Books. + +Charles Sanders Peirce. 1960. Collected papers of charles sanders peirce, volume 2. Harvard University Press. +Karl Pichotta and Raymond Mooney. 2014. Statistical script learning with multi-argument events. In EACL, pages 220-229. +Lianhui Qin, Antoine Bosselut, Ari Holtzman, Chandra Bhagavatula, Elizabeth Clark, and Yejin Choi. 2019a. 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. +Lianhui Qin, Michel Galley, Chris Brockett, Xiaodong Liu, Xiang Gao, Bill Dolan, Yejin Choi, and Jianfeng Gao. 2019b. Conversing by reading: Contentful neural conversation with on-demand machine reading. In ACL, pages 5427-5436. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019a. Language models are unsupervised multitask learners. -. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019b. Language models are unsupervised multitask learners. OpenAI Blog, 1:8. +Hannah Rashkin, Antoine Bosselut, Maarten Sap, Kevin Knight, and Yejin Choi. 2018. Modeling naive psychology of characters in simple commonsense stories. arXiv preprint arXiv:1805.06533. +Raymond Reiter. 1988. Nonmonotonic reasoning. In Exploring artificial intelligence, pages 439-481. Elsevier. +Melissa Roemmele, Cosmin Adrian Bejan, and Andrew S Gordon. 2011. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In 2011 AAAI Spring Symposium Series. +Maarten Sap, Ronan LeBras, Emily Allaway, Chandra Bhagavatula, Nicholas Lourie, Hannah Rashkin, Brendan Roof, Noah A Smith, and Yejin Choi. 2019. ATOMIC: An atlas of machine commonsense for if then reasoning. In AAAI. +Roger C Schank and Robert P Abelson. 1977. Scripts, plans, goals and understanding: An inquiry into human knowledge structures. +Raphael Schumann, Lili Mou, Yao Lu, Olga Vechtomova, and Katja Markert. 2020. Discrete optimization for unsupervised sentence summarization with word-level extraction. arXiv preprint arXiv:2005.01791. +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, pages 6830-6841. + +Youngseo Son, Anneke Buffone, Joe Raso, Allegra Larche, Anthony Janocko, Kevin Zembroski, H Andrew Schwartz, and Lyle Ungar. 2017. Recognizing counterfactual thinking in social media texts. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 654-658. +William Starr. 2019. Counterfactuals. In Edward N. Zalta, editor, The Stanford Encyclopedia of Philosophy, fall 2019 edition. Metaphysics Research Lab, Stanford University. +Qing Sun, Stefan Lee, and Dhruv Batra. 2017. Bidirectional beam search: Forward-backward inference in neural sequence models for fill-in-the-blank image captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6961-6969. +Niket Tandon, Bhavana Dalvi Mishra, Keisuke Sakaguchi, Antoine Bosselut, and Peter Clark. 2019. Wiqa: A dataset for" what if..." reasoning over procedural text. In EMNLP. +Peter West, Ari Holtzman, Jan Buys, and Yejin Choi. + +2019. Bottlesum: Unsupervised and self-supervised sentence summarization using the information bottleneck principle. 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 3743-3752. +Yoel Zeldes, Dan Padnos, and Barak Peleg. 2020. Haim-1.5 - the next generation. +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 9051-9062. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2019. BERTScore: Evaluating text generation with BERT. CoRR, abs/1904.09675. +Wanrong Zhu, Zhiting Hu, and Eric Xing. 2019. Text infilling. arXiv preprint arXiv:1901.00158. \ No newline at end of file diff --git a/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/images.zip b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7ff0a4d7ce6addcfb6980ea275ffdc25bf595906 --- /dev/null +++ b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12679029bbebfdec06b2e5d2496fa42f6ce707fd4a086d1939e2a1a1a736903d +size 578430 diff --git a/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/layout.json b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c3da786f7d9f29dd416a7ee5c4c2e5b3fa9033c8 --- /dev/null +++ b/backtothefutureunsupervisedbackpropbaseddecodingforcounterfactualandabductivecommonsensereasoning/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdafe0f5a85b3adc3e63e3a8ace8d13df002979eacb2b8532c203148415589fd +size 467681 diff --git a/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_content_list.json b/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8c2f902f6ff8ce52c4ff2ffd3f8c23eb1b6efcb8 --- /dev/null +++ b/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8aad7536b9e5a44c2f5ef373317e82a3e923837a64f94155fd8d74ec5abb7b4 +size 61391 diff --git a/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_model.json b/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..5fa51f9ef3a452873e909bbd43b928d6d82a12f0 --- /dev/null +++ b/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c62b0a827d9f98b2aac0e7aeca77e459b27aa7c37e5af6af694dc9b37869d210 +size 78260 diff --git a/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_origin.pdf b/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fafe1f95cef623326f617144d8aa0260cd18eef5 --- /dev/null +++ b/baebertbasedadversarialexamplesfortextclassification/a7fa6334-95ed-487a-a538-fe375de5f78a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb060b00290a35d284f4cffaed2ab56ee549e02273dfc2fc0c417413d9ca51de +size 1183544 diff --git a/baebertbasedadversarialexamplesfortextclassification/full.md b/baebertbasedadversarialexamplesfortextclassification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..8fc7a38d14bf340417396c6b1e6598e53c257a34 --- /dev/null +++ b/baebertbasedadversarialexamplesfortextclassification/full.md @@ -0,0 +1,291 @@ +# BAE: BERT-based Adversarial Examples for Text Classification + +Siddhant Garg*† + +Amazon Alexa AI Search Manhattan Beach, CA, USA sidgarg@amazon.com + +Goutham Ramakrishnan*† + +Health at Scale Corporation San Jose, CA, USA gouthamr@cs.wisc.edu + +# Abstract + +Modern text classification models are susceptible to adversarial examples, perturbed versions of the original text indiscernible by humans which get misclassified by the model. Recent works in NLP use rule-based synonym replacement strategies to generate adversarial examples. These strategies can lead to out-of-context and unnaturally complex token replacements, which are easily identifiable by humans. We present BAE, a black box attack for generating adversarial examples using contextual perturbations from a BERT masked language model. BAE replaces and inserts tokens in the original text by masking a portion of the text and leveraging the BERT-MLM to generate alternatives for the masked tokens. Through automatic and human evaluations, we show that BAE performs a stronger attack, in addition to generating adversarial examples with improved grammaticality and semantic coherence as compared to prior work. + +# 1 Introduction + +Recent studies have exposed the vulnerability of ML models to adversarial attacks, small input perturbations which lead to misclassification by the model. Adversarial example generation in NLP (Zhang et al., 2019) is more challenging than in commonly studied computer vision tasks (Szegedy et al., 2014; Kurakin et al., 2017; Papernot et al., 2017) because of (i) the discrete nature of the input space and (ii) the need to ensure semantic coherence with the original text. A major bottleneck in applying gradient based (Goodfellow et al., 2015) or generator model (Zhao et al., 2018) based approaches to generate adversarial examples in NLP is the backward propagation of the perturbations from the continuous embedding space to the discrete token space. + +![](images/a21df7320243d333832c19af0f4fc786432007cc50b7d443aa9001881bd3beeb.jpg) +Figure 1: We use BERT-MLM to predict masked tokens in the text for generating adversarial examples. The MASK token replaces a word (BAE-R attack) or is inserted to the left/right of the word (BAE-I). + +Initial works for attacking text models relied on introducing errors at the character level (Ebrahimi et al., 2018; Gao et al., 2018) or adding and deleting words (Li et al., 2016; Liang et al., 2017; Feng et al., 2018) for creating adversarial examples. These techniques often result in unnatural looking adversarial examples which lack grammatical correctness, thereby being easily identifiable by humans. + +Rule-based synonym replacement strategies (Alzantot et al., 2018; Ren et al., 2019) have recently lead to more natural looking adversarial examples. Jin et al. (2019) combine both these works by proposing TextFooler, a strong black-box attack baseline for text classification models. However, the adversarial examples generated by TextFooler solely account for the token level similarity via word embeddings, and not the overall sentence semantics. This can lead to out-of-context and unnaturally complex replacements (see Table 3), which are easily human-identifiable. Consider a simple example: "The restaurant service was poor". Token level synonym replacement of 'poor' may lead to an inappropriate choice such as 'broke', while a context-aware choice such as 'terrible' leads to better retention of semantics and grammaticality. + +Therefore, a token replacement strategy contingent on retaining sentence semantics using a pow- + +erful language model (Devlin et al., 2018; Radford et al., 2019) can alleviate the errors made by existing techniques for homonyms (tokens having multiple meanings). In this paper, we present BAE (BERT-based Adversarial Examples), a novel technique using the BERT masked language model (MLM) for word replacements to better fit the overall context of the English language. In addition to replacing words, we also propose inserting new tokens in the sentence to improve the attack strength of BAE. These perturbations in the input sentence are achieved by masking a part of the input and using a LM to fill in the mask (See Figure 1). + +Our BAE attack beats the previous baselines by a large margin on empirical evaluation over multiple datasets and models. We show that, surprisingly, just a few replace/insert operations can reduce the accuracy of even a powerful BERT classifier by over $80\%$ on some datasets. Moreover, our human evaluation reveals the improved grammaticality of the adversarial examples generated by BAE over the baseline TextFooler, which can be attributed to the BERT-MLM. To the best of our knowledge, we are the first to use a LM for generating adversarial examples. We summarize our contributions as: + +- We propose BAE, an adversarial example generation technique using the BERT-MLM. +- We introduce 4 BAE attack modes by replacing and inserting tokens, all of which are almost always stronger than previous baselines on 7 text classification datasets. +- Through human evaluation, we show that BAE yields adversarial examples with improved grammaticality and semantic coherence. + +# 2 Methodology + +Problem Definition. We are given a dataset $(S,Y) = \{(\mathbb{S}_1,y_1),\ldots (\mathbb{S}_m,y_m)\}$ and a trained classification model $C:\mathbb{S}\to Y$ .We assume the soft-label black-box setting where the attacker can only query the classifier for output probabilities on a given input, and does not have access to the model parameters, gradients or training data. For an input pair $(\mathbb{S} = [t_{1},\dots ,t_{n}],y)$ , we want to generate an adversarial example $\mathbb{S}_{adv}$ such that $C(\mathbb{S}_{adv})\neq y$ Additionally we would like $\mathbb{S}_{adv}$ to be grammatically correct and semantically similar to S. + +BAE. For generating an adversarial example $\mathbb{S}_{adv}$ , we introduce 2 types of token-level perturbations: (i) Replace a token $t\in \mathbb{S}$ with another and (ii) Insert a new token $t^\prime$ in $\mathbb{S}$ . Some tokens in the input contribute more towards the final prediction by $C$ + +Algorithm 1: BAE-R Pseudocode +Input: Sentence $\mathbb{S} = [t_1,\dots ,t_n]$ , ground truth label $y$ classifier model C +Output: Adversarial Example Sadv +Initialization: Sadv $\leftarrow \mathbb{S}$ +Compute token importance $I_{i}\forall t_{i}\in \mathbb{S}$ +for i in descending order of $I_{i}$ do + $\mathbb{S}_M\gets \mathbb{S}_{adv[1:i - 1]}[M]\mathbb{S}_{adv[i + 1:n]}$ Predict top-K tokens T for mask M E SM +T $\leftarrow$ FILTER(T) +L $\equiv \{\}$ / python-style dict +for $t\in \mathbb{T}$ do +| $\mathbb{L}[t] = \mathbb{S}_{adv[1:i - 1]}[t]\mathbb{S}_{adv[i + 1:n]}$ +end +if $\exists t\in \mathbb{T}$ s.t $C(\mathbb{L}[t])\neq y$ then +Return: Sadv $\leftarrow \mathbb{L}[t^{\prime}]$ where $C(\mathbb{L}[t^{\prime}])\neq y$ L[t' ] has maximum similarity with S +else +Sadv $\leftarrow \mathbb{L}[t^{\prime}]$ where $\mathbb{L}[t^{\prime}]$ causes maximum reduction in probability of $y$ in $C(\mathbb{L}[t^{\prime}])$ +end if +end +Return: Sadv $\leftarrow$ None + +than others. Replacing these tokens or inserting a new token adjacent to them can thus have a stronger effect on altering the classifier prediction. This intuition stems from the fact that the replaced/inserted tokens changes the local context around the original token. We estimate token importance $I_{i}$ of each $t_i \in \mathbb{S}$ , by deleting $t_i$ from $\mathbb{S}$ and computing the decrease in probability of predicting the correct label $y$ , similar to Jin et al. (2019); Ren et al. (2019). + +The Replace (R) and Insert (I) operations are performed on a token $t$ by masking it and inserting a mask token adjacent to it respectively. The pretrained BERT-MLM is used to predict the mask tokens (See Figure 1). BERT-MLM is a powerful LM trained on a large training corpus ( $\sim 2$ billion words), and hence the predicted mask tokens fit well into the grammar and context of the text. + +The BERT-MLM, however, does not guarantee semantic coherence to the original text as demonstrated by the following simple example. Consider the sentence: 'the food was good'. For replacing the token 'good', BERT-MLM may predict the token 'bad', which fits well into the grammar and context of the sentence, but changes the original sentiment of the sentence. To achieve a high semantic similarity with the original text on introducing perturbations, we filter the set of top K tokens (K is a pre-defined constant) predicted by BERT-MLM for the masked token, using a Universal Sentence Encoder (USE) based sentence similarity scorer (Cer et al., 2018). For the R operation, we additionally filter out predicted tokens that do not form the same part of speech (POS) as the original token. + +
ModelAdversarial AttackDatasets
AmazonYelpIMDBMR
wordLSTMOriginal88.085.082.081.16
TextFooler31.0 (0.747)28.0 (0.829)20.0 (0.828)25.49 (0.906)
BAE-R21.0 (0.827)20.0 (0.885)22.0 (0.852)24.17 (0.914)
BAE-I17.0 (0.924)22.0 (0.928)23.0 (0.933)19.11 (0.966)
BAE-R/I16.0 (0.902)19.0 (0.924)8.0 (0.896)15.08 (0.949)
BAE-R+I4.0 (0.848)9.0 (0.902)5.0 (0.871)7.50 (0.935)
wordCNNOriginal82.085.081.076.66
TextFooler42.0 (0.776)36.0 (0.827)31.0 (0.854)21.18 (0.910)
BAE-R16.0 (0.821)23.0 (0.846)23.0 (0.856)20.81 (0.920)
BAE-I18.0 (0.934)26.0 (0.941)29.0 (0.924)19.49 (0.971)
BAE-R/I13.0 (0.904)17.0 (0.916)20.0 (0.892)15.56 (0.956)
BAE-R+I2.0 (0.859)9.0 (0.891)14.0 (0.861)7.87 (0.938)
BERTOriginal96.095.085.085.28
TextFooler30.0 (0.787)27.0 (0.833)32.0 (0.877)30.74 (0.902)
BAE-R36.0 (0.772)31.0 (0.856)46.0 (0.835)44.05 (0.871)
BAE-I20.0 (0.922)25.0 (0.936)31.0 (0.929)32.05 (0.958)
BAE-R/I11.0 (0.899)16.0 (0.916)22.0 (0.909)20.34 (0.941)
BAE-R+I14.0 (0.830)12.0 (0.871)16.0 (0.856)19.21 (0.917)
+ +Table 1: Automatic evaluation of adversarial attacks on 4 Sentiment Classification tasks. We report the test set accuracy. The average semantic similarity, between the original and adversarial examples, obtained from USE are reported in parentheses. Best performance, in terms of maximum drop in test accuracy, is highlighted in **boldface**. + +If multiple tokens can cause $C$ to misclassify $\mathbb{S}$ when they replace the mask, we choose the token which makes $\mathbb{S}_{adv}$ most similar to the original $\mathbb{S}$ based on the USE score. If no token causes misclassification, then we choose the one that decreases the prediction probability $P(C(\mathbb{S}_{adv}) = y)$ the most. We apply these token perturbations iteratively in decreasing order of token importance, until either $C(\mathbb{S}_{adv}) \neq y$ (successful attack) or all the tokens of $\mathbb{S}$ have been perturbed (failed attack). + +We present 4 attack modes for BAE based on the R and I operations, where for each token $t$ in $\mathbb{S}$ : + +- BAE-R: Replace token $t$ (See Algorithm 1) +- BAE-I: Insert a token to the left or right of $t$ +- BAE-R/I: Either replace token $t$ or insert a token to the left or right of $t$ +- BAE-R+I: First replace token $t$ , then insert a token to the left or right of $t$ + +# 3 Experiments + +Datasets and Models. We evaluate BAE on different text classification tasks. Amazon, Yelp, IMDB are sentiment classification datasets used in recent works (Sarma et al., 2018) and MR (Pang and Lee, 2005) contains movie reviews based on sentiment polarity. MPQA (Wiebe and Wilson, 2005) is a dataset for opinion polarity detection, Subj (Pang and Lee, 2004) for classifying a sentence as subjective or objective and TREC (Li and Roth, 2002) for question type classification. + +We use 3 popular text classification models: word-LSTM (Hochreiter and Schmidhuber, 1997), word-CNN (Kim, 2014) and a fine-tuned BERT (Devlin et al., 2018) base-uncased classifier. We train models on the training data and perform the adversarial attack on the test data. For complete model details, refer to Appendix A. + +As a baseline, we consider TextFooler (Jin et al., 2019) which performs synonym replacement using a fixed word embedding space (Mrkšić et al., 2016). We only consider the top $\mathrm{K} = 50$ synonyms from the BERT-MLM predictions and set a threshold of 0.8 for the cosine similarity between USE based embeddings of the adversarial and input text. + +Automatic Evaluation Results. We perform the 4 BAE attacks and summarize the results in Tables 1 and 2. Across datasets and models, our BAE attacks are almost always more effective than the baseline attack, achieving significant drops of $40 - 80\%$ in test accuracies, with higher average semantic similarities as shown in parentheses. + +With just one exception, BAE-R+I is the strongest attack since it allows both replacement and insertion at the same token position. We observe a general trend that the BAE-R and BAE-I attacks often perform comparably, while the BAE-R/I and BAE-R+I attacks are much stronger. We observe that the BERT classifier is more robust to BAE and TextFollower attacks than + +
ModelAdversarial AttackDatasets
MPQASubjTREC
wordLSTMOriginal89.4391.990.2
TextFooler48.49 (0.745)58.5 (0.882)42.4 (0.834)
BAE-R45.66 (0.748)50.2 (0.899)32.4 (0.870)
BAE-I40.94 (0.871)49.8 (0.958)18.0 (0.964)
BAE-R/I31.60 (0.820)43.1 (0.946)20.4 (0.954)
BAE-R+I25.57 (0.766)29.0 (0.929)11.8 (0.874)
wordCNNOriginal89.0691.393.2
TextFooler48.77 (0.733)58.9 (0.889)47.6 (0.812)
BAE-R44.43 (0.735)51.0 (0.899)29.6 (0.843)
BAE-I44.43 (0.876)49.8 (0.958)15.4 (0.953)
BAE-R/I32.17 (0.818)41.5 (0.940)13.0 (0.936)
BAE-R+I27.83 (0.764)31.1 (0.922)8.4 (0.858)
BERTOriginal90.6697.097.6
TextFooler36.23 (0.761)69.5 (0.858)42.8 (0.866)
BAE-R43.87 (0.764)77.2 (0.828)37.2 (0.824)
BAE-I33.49 (0.862)74.6 (0.918)32.2 (0.931)
BAE-R/I24.53 (0.826)64.0 (0.903)23.6 (0.908)
BAE-R+I24.34 (0.766)58.5 (0.875)20.2 (0.825)
+ +Table 2: Automatic evaluation of adversarial attacks on MPQA, Subj and TREC datasets. Other details follow those from Table 1. All 4 modes of BAE attacks almost always outperform TextFooer. + +the word-LSTM and word-CNN possibly due to its large size and pre-training on a large corpus. + +The TextFollower attack is sometimes stronger than the BAE-R attack for the BERT classifier. We attribute this to the shared parameter space between the BERT-MLM and the BERT classifier before fine-tuning. The predicted tokens from BERT-MLM may not be able to drastically change the internal representations learned by the BERT classifier, hindering their ability to adversarially affect the classifier prediction. + +Additionally, we make some interesting observations pertaining to the average semantic similarity of the adversarial examples with the original sentences (computed using USE). From Tables 1, 2 we observe that across different models and datasets, all BAE attacks have higher average semantic similarity than TextFooler. Notably, the BAE-I attack achieves the highest semantic similarity among all the 4 modes. This can be explained by the fact that all tokens of the original sentence are retained, in the original order, in the adversarial example generated by BAE-I. Interestingly, we observe that the average semantic similarity of the BAE-R+I attack is always higher than the BAE-R attack. This lends support to the importance of the 'Insert' operation in ameliorating the effect of the 'Replace' operation. We further investigate this through an ablation study discussed later. + +![](images/6bbe3851a35c482e667e3f2fd9571aa930da9d1af756dc62693c8f38939ed48c.jpg) +(a) Word-LSTM + +![](images/a2e854fde78e2c36b92814a7db09c53cfed9b5e0deff20749ab9ede9cc24f0d7.jpg) +(b) BERT +Figure 2: Graphs comparing attack effectiveness on the TREC dataset, as a function of maximum $\%$ perturbation to the input. + +Effectiveness. We study the effectiveness of BAE on limiting the number of R/I operations permitted on the original text. We plot the attack performance as a function of maximum % perturbation (ratio of number of word replacements and insertions to the length of the original text) for the TREC dataset. From Figure 2, we clearly observe that the BAE attacks are consistently stronger than TextFooler. The classifier models are relatively robust to perturbations up to $20\%$ , while the effectiveness saturates at $40 - 50\%$ . Surprisingly, a $50\%$ perturbation for the TREC dataset translates to replacing or inserting just 3-4 words, due to the short text lengths. + +Qualitative Examples. We present adversarial examples generated by the attacks on sentences from the IMDB and Yelp datasets in Table 3. All attack strategies successfully changed the classification to negative, however the BAE attacks produce more natural looking examples than TextFooler. The tokens predicted by the BERT-MLM fit well in the sentence context, while TextFooler tends to replace words with complex synonyms, which can be easily detected. Moreover, BAE's additional degree of freedom to insert tokens allows for a successful attack with fewer perturbations. + +Human Evaluation. We perform human evaluation of our BAE attacks on the BERT classifier. For 3 datasets, we consider 100 samples from each test set shuffled randomly with their successful ad + +Original [Positive Sentiment]: This film offers many delights and surprises. + +TextFollower: This flick citations disparate revel and surprises. + +BAE-R: This movie offers enough delights and surprises + +BAE-I: This lovely film platform offers many pleasant delights and surprises + +BAE-R/I: This lovely film serves several pleasure and surprises. + +BAE-R+I: This beautiful movie offers many pleasant delights and surprises + +Original [Positive Sentiment]: Our server was great and we had perfect service. TextFooter: Our server was tremendous and we assumed faultless services. + +BAE-R: Our server was decent and we had outstanding service. + +BAE-I: Our server was great enough and we had perfect service but. + +BAE-R/I: Our server was great enough and we needed perfect service but. + +BAE-R+I: Our server was decent company and we had adequate service. + +Table 3: Qualitative examples of each attack on the BERT classifier (Replacements: Red, Inserts: Blue) + +versarial examples from BAE-R, BAE-R+I and TextFooler. We calculate the sentiment accuracy by asking 3 annotators to predict the sentiment for each sentence in this shuffled set. To evaluate the naturalness of the adversarial examples, we first present the annotators with 50 other original data samples to get a sense of the data distribution. We then ask them to score each sentence (on a Likert scale of 1-5) in the shuffled set on its grammar and likelihood of being from the original data. We average the 3 scores and present them in Table 4. + +Both BAE-R and BAE-R+I attacks almost always outperform TextFollower in both metrics. BAE-R outperforms BAE-R+I since the latter inserts tokens to strengthen the attack, at the expense of naturalness and sentiment accuracy. Interestingly, the BAE-R+I attacks achieve higher average semantic similarity scores than BAE-R, as discussed in Section 3. This exposes the shortcomings of using USE for evaluating the retention of semantics of adversarial examples, and reiterates the importance of human-centered evaluation. The gap between the scores on the original data and the adversarial examples speaks for the limitations of the attacks, however BAE represents an important step forward towards improved adversarial examples. + +Replace vs. Insert. Our BAE attacks allow insertion operations in addition to replace. We analyze the benefits of this flexibility of R/I operations in + +
DatasetWord-LSTMWord-CNNBERT
ABCABCABC
MR15.110.13.112.49.62.824.312.95.7
Subj14.412.35.116.213.87.413.911.47.5
TREC16.61.60.220.05.01.414.08.62.4
+ +Table 5: Analyzing relative importance of 'Replace' and 'Insert' perturbations for BAE. A denotes % of test instances which are successfully attacked by BAE-R/I, but not BAE-R, i.e. A: (R/I) ∩ R. Similarly, B: (R/I) ∩ I and C: (R/I) ∩ R ∩ I. + +
DatasetSentiment Accuracy (%)
OriginalTFRR+I
Amazon95.779.185.283.8
IMDB90.383.184.379.3
MR93.382.084.682.4
DatasetNaturalness (1-5)
OriginalTFRR+I
Amazon4.263.173.913.71
IMDB4.353.413.893.76
MR4.193.353.843.74
+ +Table 4: Human evaluation results (TF: TextFooler and $\mathrm{R}\left( {\mathrm{R} + \mathrm{I}}\right) : \mathrm{{BAE}} - \mathrm{R}\left( {\mathrm{R} + \mathrm{I}}\right)$ ). + +Table 5. From Table 5, the splits $\mathbb{A}$ and $\mathbb{B}$ are the $\%$ of test points which compulsorily need I and R operations respectively for a successful attack. We can observe that the split $\mathbb{A}$ is larger than $\mathbb{B}$ thereby indicating the importance of the I operation over R. Test points in split $\mathbb{C}$ require both R and I operations for a successful attack. Interestingly, split $\mathbb{C}$ is largest for Subj, which is the most robust to attack (Table 2) and hence needs both R/I operations. Thus, this study gives positive insights towards the importance of having the flexibility to both replace and insert words. + +We present complete effectiveness graphs and details of human evaluation in Appendix B and C. BAE is implemented1 in TextAttack (Morris et al., 2020), a popular suite of NLP adversarial attacks. + +# 4 Conclusion + +In this paper, we have presented a new technique for generating adversarial examples (BAE) through contextual perturbations based on the BERT Masked Language Model. We propose inserting and/or replacing tokens from a sentence, in their order of importance for the text classification task, using a BERT-MLM. Automatic and human evaluation on several datasets demonstrates the strength and effectiveness of our attack. + +# Acknowledgments + +The authors thank Arka Sadhu, Kalpesh Krishna, Aws Albarghouthi, Yingyu Liang and Justin Hsu for providing in-depth feedback for this research. The authors thank Jack Morris and Jin Yong Yoo for integrating BAE in the TextAttack framework. This work is supported, in part, by the National Science Foundation CCF under award 1652140. + +# References + +Moustafa Alzantot, Yash Sharma, Ahmed Elgohary, Bo-Jhang Ho, Mani Srivastava, and Kai-Wei Chang. 2018. Generating natural language adversarial examples. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics. +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. +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. +Javid Ebrahimi, Anyi Rao, Daniel Lowd, and Dejing Dou. 2018. HotFlip: White-box adversarial examples for text classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 31-36, Melbourne, Australia. Association for Computational Linguistics. +Shi Feng, Eric Wallace, Mohit Iyyer, Pedro Rodriguez, Alvin Grissom II, and Jordan L. Boyd-Graber. 2018. Right answer for the wrong reason: Discovery and mitigation. CoRR, abs/1804.07781. +Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. 2018. Black-box generation of adversarial text sequences to evade deep learning classifiers. CoRR, abs/1801.04354. +Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. 2015. Explaining and harnessing adversarial examples. In International Conference on Learning Representations. +Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. *Neural Com.*, 9(8):1735-1780. +Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. 2019. Is bert really robust? natural language attack on text classification and entailment. arXiv preprint arXiv:1907.11932. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, pages 1746-1751. +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. 2017. Adversarial examples in the physical world. ICLR Workshop. +Jiwei Li, Will Monroe, and Dan Jurafsky. 2016. Understanding neural networks through representation erasure. CoRR, abs/1612.08220. +Xin Li and Dan Roth. 2002. Learning question classifiers. In Proceedings of the 19th International Conference on Computational Linguistics - Volume 1, COLING '02, pages 1-7, Stroudsburg, PA, USA. Association for Computational Linguistics. + +Bin Liang, Hongcheng Li, Miaoqiang Su, Pan Bian, Xirong Li, and Wenchang Shi. 2017. Deep text classification can be fooled. CoRR, abs/1704.08006. +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ć, Ivan Vulic, Diarmuid Řeaghdha, Ira Leviant, Roi Reichart, Milica Gašić, Anna Korhonen, and Steve Young. 2017. Semantic specialization of distributional word vector spaces using monolingual and cross-lingual constraints. Transactions of the Association for Computational Linguistics. +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. In Proceedings of HLT-NAACL. +Bo Pang and Lillian Lee. 2004. A sentimental education: Sentiment analysis using subjectivity. In Proceedings of ACL, pages 271-278. +Bo Pang and Lillian Lee. 2005. Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales. In Proceedings of ACL. +Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. 2017. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, ASIA CCS '17, pages 506-519, New York, NY, USA. ACM. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +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. Association for Computational Linguistics. +Prathusha K Sarma, Yingyu Liang, and Bill Sethares. 2018. Domain adapted word embeddings for improved sentiment classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 37-42. +Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. 2014. Intriguing properties of neural networks. In International Conference on Learning Representations. +Janyce Wiebe and Theresa Wilson. 2005. Annotating expressions of opinions and emotions in language. Language Resources and Evaluation. + +Wei Emma Zhang, Quan Z. Sheng, and Ahoud Abdulrahmni F. Alhazmi. 2019. Generating textual adversarial examples for deep learning models: A survey. CoRR, abs/1901.06796. + +Zhengli Zhao, Dheeru Dua, and Sameer Singh. 2018. Generating natural adversarial examples. In International Conference on Learning Representations. + +# Broader Ethical Impact + +Our work addresses the important problem of adversarial vulnerabilities of modern text classification models. While we acknowledge the possibility of its misuse to maliciously attack publicly available text classifiers, we believe our work represents an important step forward in analyzing the robustness of NLP models. We hope our work inspires improved defenses against adversarial attacks on text classification models. + +# A Experimental Reproducibility + +Dataset and Models The dataset statistics are reported in Table 5 and we give a brief overview of the dataset and the task for which it is used along with public links to download the datasets. + +- Amazon: Amazon product reviews dataset 2. +- Yelp: A restaurant reviews dataset from $\text{Yelp}^2$ . +- IMDB:IMDBmovie reviews dataset2. +- $MR$ : A movie reviews dataset based on subjective rating and sentiment polarity3. +- MPQA: An unbalanced dataset for polarity detection of opinions ${}^{4}$ . +- TREC: A dataset for classifying types of questions with 6 classes ${}^{5}$ . +- SUBJ: A dataset for classifying a sentence as objective or subjective. + +
Dataset# ClassesTrainTestAvg Length
Amazon290010010.29
Yelp290010011.66
IMDB290010017.56
MR29595106720.04
MPQA2954310603.24
Subj29000100023.46
TREC659515007.57
+ +Table 5: Summary statistics for the datasets + +Training Details On the sentence classification task, we target three models: word-based convolutional neural network (WordCNN), word-based LSTM, and the state-of-the-art BERT. We use 100 filters of sizes 3,4,5 for the WordCNN model with a dropout of 0.3. Similar to (Jin et al., 2019) we use a 1-layer bi-directional LSTM with 150 hidden units and a dropout of 0.3. For both models, we use the 300 dimensional pre-trained counter fitted word embeddings (Mrkšić et al., 2017). For the BERT classifier, we used the BERT base uncased model which has 12-layers, 12 attention heads and 768 hidden dimension size. Across all models and datasets, we use the standard BERT uncased vocabulary of size 30522. We first train all three models on the training data split and use early stopping on the test dataset. For BERT fine-tuning, we use the standard setting of an Adam classifier having a learning rate of $2 \times 10^{-5}$ and 2 fine-tuning epochs. + +For our BAE attacks, we use a pre-trained BERT Base-uncased MLM to predict the masked tokens. We only consider the top $\mathrm{K} = 50$ synonyms from the BERT-MLM predictions and set a threshold of 0.8 for the cosine similarity between USE based embeddings of the adversarial and input text. + +For R operations, we filter out predicted tokens which form a different POS than the original token in the sentence. For both R and I operations, we filter out stop words using NLTK from the set of predicted tokens. Additionally we filter out antonyms using synonym embeddings (Mrkšić et al., 2016) for sentiment analysis tasks. + +# B Results + +Figures 3 - 8 are the complete set of graphs showing the attack effectiveness for all seven datasets. + +# C Human Evaluation + +We ask the human evaluators to judge the naturalness of texts presented to them, i.e. whether they think they are adversarial examples or not. They were instructed to do so on the basis of grammar and how likely they think it is from the original dataset, and rate each example on the following Likert scale of 1-5: 1) Sure adversarial sample, 2) Likely an adversarial example, 3) Neutral, 4) Likely an original sample, 5) Sure original sample. From the results of Table 3, it is clear that BAE-R always beats the sentiment accuracy and naturalness score of TextFooler. The latter is due to unnaturally long and complex synonym replacements on using TextFooler. + +![](images/728d8c60a4e3ea65968aa8a809feaf18ab0342b66fb53b9a203854286e94c22b.jpg) +(a) Word-LSTM + +![](images/8b4073a0a7da9ea84a25ba0938e7bdff504c15ca74039a7b51b3743492705bbd.jpg) +(b) Word-CNN + +![](images/0cacd6be8a66251074105141741ab38ced1d5ec83bd786f482020258c60b2092.jpg) +(c) BERT +Figure 3: Amazon + +![](images/d8159cade62acec28ce0e907ea6a38776a80c4bec6dbaf13c25ff027d45fd9be.jpg) +(a) Word-LSTM + +![](images/96c95f235ab4362344e2b5ac424271252e37eb0b19d5cba47afdf567ce8b8759.jpg) +(b) Word-CNN + +![](images/12586d056d4f154fdb8277143f73f44422c9653794b29eb4646798fbefad8ce5.jpg) +(c) BERT +Figure 4: Yelp + +![](images/46e2eaaa303dd74167a8c376bbf89eb2b9c297b7124a8415ee2d2219031f5f27.jpg) +(a) Word-LSTM + +![](images/c32ef20d8e204bf4912471d2af3c0268294d083383224db5b4b4a118f6d2a5ac.jpg) +(b) Word-CNN +Figure 5:IMDB + +![](images/8b446866606a2fcef67afad72246f35b93c7dc673854cef01cd29e22455238c3.jpg) +(c) BERT + +![](images/42701c4cb8e2c7a4ad0e0fb79ebd0a8c92bcbea2b0ad93940ac64eaea441ed69.jpg) +(a) Word-LSTM + +![](images/16b67f943cf9dbbcabb5f878062d40bc5e6e6c3228be29dff3cb68bfad880004.jpg) +(b) Word-CNN +Figure 6: MR + +![](images/8fd106f2dfbb6b3130a6815d08c0dac5a58c422839d3ff2a8f742cf24ee396bf.jpg) +(c) BERT + +![](images/2bfc29e3e42bb01b2d79d8f6602ede0410ed0a987f667177928076033068cc80.jpg) +(a) Word-LSTM + +![](images/cf7bb7127f586addfc0a794a6a9da6596f9dc7ff2c986e2fddb30fa4cf6f8078.jpg) +(b) Word-CNN +Figure 7: MPQA + +![](images/d5cdd17366cfb359a9797e9dc5d7e1aef677c0d175b4b5cfdc7897aefd307c9c.jpg) +(c) BERT + +![](images/4d5ae1006927c40d58763866c52dfc6fe279820fec05a3cfe9448a9a5581cde8.jpg) +(a) Word-LSTM + +![](images/a60eebda05d006a68d02c4215415030c0b4c32b317bf8609394ea814124cd967.jpg) +(b) Word-CNN +Figure 8: Subj + +![](images/3531bf5dada687db510e90bc1efdf4b72f1233e66d8157c3f830c90bc0bc0eb7.jpg) +(c) BERT \ No newline at end of file diff --git a/baebertbasedadversarialexamplesfortextclassification/images.zip b/baebertbasedadversarialexamplesfortextclassification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0d55afda7412c0b5d3613f86c2e60318290cd5c0 --- /dev/null +++ b/baebertbasedadversarialexamplesfortextclassification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79e4e54886d40c49c43318ab60cc8a42945f285a9670fbe8a42144f686e29c7a +size 443472 diff --git a/baebertbasedadversarialexamplesfortextclassification/layout.json b/baebertbasedadversarialexamplesfortextclassification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..7088207615cfe89a4eb45807a316f9a7437df927 --- /dev/null +++ b/baebertbasedadversarialexamplesfortextclassification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e3d0043a9961adb7600cd91feecf8af40ed10ce34b1c577ce45b5c3f7fcf9e6 +size 350039 diff --git a/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_content_list.json b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..274ac415947669cb42f13b24c3aed706ddb41b10 --- /dev/null +++ b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:542f51d69e46d2ebf3f5a55ddcaaca66297730b6a28fa551bf4b002a3c81d9b5 +size 73975 diff --git a/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_model.json b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_model.json new file mode 100644 index 0000000000000000000000000000000000000000..02a921f02d685d322c918abac803330eed7dcea3 --- /dev/null +++ b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3573a921b37593172d5ff1554f821e341fc7f074942ad71b0c9260f45c0d01ab +size 89367 diff --git a/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_origin.pdf b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5c88a4ff6b065f52952ff879cb6798be336b6cf7 --- /dev/null +++ b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/0c2ae6de-7742-4df5-83ae-63b13962df1c_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:076103217d58d96765138201f80e246f15e5f8d35ece06eb876a3f7df86fce15 +size 583748 diff --git a/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/full.md b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/full.md new file mode 100644 index 0000000000000000000000000000000000000000..db2ef6e694fe5c029adf2b7c8a7a3fa09e31ffb5 --- /dev/null +++ b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/full.md @@ -0,0 +1,326 @@ +# Be More with Less: Hypergraph Attention Networks for Inductive Text Classification + +Kaize Ding + +Arizona State University + +kaize.ding@asu.edu + +Jianling Wang + +Texas A&M University + +jlwang@tamu.edu + +Jundong Li + +University of Virginia + +jundong@virginia.edu + +Dingcheng Li + +Amazon Inc. + +lidingch@amazon.com + +Huan Liu + +Arizona State University + +huan.liu@asu.edu + +# Abstract + +Text classification is a critical research topic with broad applications in natural language processing. Recently, graph neural networks (GNNs) have received increasing attention in the research community and demonstrated their promising results on this canonical task. Despite the success, their performance could be largely jeopardized in practice since they are: (1) unable to capture high-order interaction between words; (2) inefficient to handle large datasets and new documents. To address those issues, in this paper, we propose a principled model – hypergraph attention networks (HyperGAT), which can obtain more expressive power with less computational consumption for text representation learning. Extensive experiments on various benchmark datasets demonstrate the efficacy of the proposed approach on the text classification task. + +# 1 Introduction + +Text classification, as one of the most fundamental tasks in the field of natural language processing, has received continuous endeavors from researchers due to its wide spectrum of applications, including sentiment analysis (Wang et al., 2016), topic labeling (Wang and Manning, 2012), and disease diagnosis (Miotto et al., 2016). Inspired by the success of deep learning techniques, methods based on representation learning such as convolutional neural networks (CNNs) (Kim, 2014) and recurrent neural networks (RNNs) (Liu et al., 2016) have been extensively explored in the past few years. In essence, the groundbreaking achievements of those methods can be attributed to their strong capability of capturing sequential context information from local consecutive word sequences. + +More recently, graph neural networks (GNNs) (Kipf and Welling, 2017; Velicković et al., 201b; Hamilton et al., 2017) have drawn + +much attention and demonstrated their superior performance in the task of text classification (Yao et al., 2019; Wu et al., 2019a; Liu et al., 2020). This line of work leverages the knowledge from both training and test documents to construct a corpus-level graph with global word co-occurrence and document-word relations, and consider text classification as a semi-supervised node classification problem. Then with GNNs, long-distance interactions between words could be captured to improve the final text classification performance. + +Despite their promising early results, the usability of existing efforts could be largely jeopardized in real-world scenarios, mainly owing to their limitations in the following two aspects: (i) *Expressive Power*. Existing GNN-based methods predominately focus on pairwise interactions (i.e., dyadic relations) between words. However, word interactions are not necessarily dyadic in natural language, but rather could be triadic, tetradic, or of a higher-order. For instance, consider the idiom "eat humble pie", whose definition is "admit that one was wrong" in common usage. If we adopt a simple graph to model the word interactions, GNNs may misinterpret the word pie as "a baked dish" based on its pairwise connections to other two words (humble - pie and eat - pie), then further misunderstand the actual meaning of the whole idiom. Hence, how to go beyond pairwise relations and further capture the high-order word interactions is vital for high-quality text representation learning, but still remains to be explored. (ii) *Computational Consumption*. On the one hand, most of the endeavors with GNN backbone tend to be memory-inefficient when the scale of data increases, due to the fact that constructing and learning on a global document-word graph consumes immense memory (Huang et al., 2019). On the other hand, the mandatory access to test documents during training renders those methods inherently trans- + +ductive. It means that when new data arrives, we have to retrain the model from scratch for handling newly added documents. Therefore, it is necessary to design a computationally efficient approach for solving graph-based text classification. + +Upon the discussions above, one critical research question to ask is "Is it feasible to acquire more expressive power with less computational consumption?" To achieve this goal, we propose to adopt document-level hypergraph (hypergraph is a generalization of simple graph, in which a hyperedge can connect arbitrary number of nodes) for modeling each text document. The use of document-level hypergraphs potentially enables a learning model not only to alleviate the computational inefficiency issue, but more remarkably, to capture heterogeneous (e.g., sequential and semantic) high-order contextual information of each word. Therefore, more expressive power could be obtained with less computational consumption during the text representation learning process. As conventional GNN models are infeasible to be used on hypergraphs, to bridge this gap, we propose a new model named HyperGAT, which is able to capture the encoded high-order word interactions within each hypergraph. In the meantime, its internal dual attention mechanism highlights key contextual information for learning highly expressive text representations. To summarize, our contributions are in three-fold: + +- We propose to model text documents with document-level hypergraphs, which improves the model expressive power and reduces computational consumption. +- A principled model HyperGAT based on a dual attention mechanism is proposed to support representation learning on text hypergraphs. +- We conduct extensive experiments on multiple benchmark datasets to illustrate the superiority of HyperGAT over other state-of-the-art methods on the text classification task. + +# 2 Related Work + +# 2.1 Graph Neural Networks + +Graph neural networks (GNNs) – a family of neural models for learning latent node representations in a graph, have achieved remarkable success in different graph learning tasks (Defferrard et al., 2016; Kipf and Welling, 2017; Velicković et al., 201b; Ding et al., 2019a, 2020). Most of the prevailing GNN models follow the paradigm of neighborhood + +aggregation, aiming to learn latent node representations via message passing among local neighbors in the graph. With deep roots in graph spectral theory, the learning process of graph convolutional networks (GCNs) (Kipf and Welling, 2017) can be considered as a mean-pooling neighborhood aggregation. Later on, GraphSAGE (Hamilton et al., 2017) was developed to concatenate the node's feature with mean/max/LSTM pooled neighborhood information, which enables inductive representation learning on large graphs. Graph attention networks (GATs) (Velicković et al., 201b) incorporate trainable attention weights to specify fine-grained weights on neighbors when aggregating neighborhood information of a node. Recent research further extend GNN models to consider global graph information (Battaglia et al., 2018) and edge information (Gilmer et al., 2017) during aggregation. More recently, hypergraph neural networks (Feng et al., 2019; Bai et al., 2020; Wang et al., 2020) are proposed to capture high-order dependency between nodes. Our model HyperGAT is the first attempt to shift the power of hypergraph to the canonical text classification task. + +# 2.2 Deep Text Classification + +Grounded on the fast development of deep learning techniques, various neural models that automatically represent texts as embeddings have been developed for text classification. Two representative deep neural models, CNNs (Kim, 2014; Zhang et al., 2015) and RNNs (Tai et al., 2015; Liu et al., 2016) have shown their superior power in the text classification task. To further improve the model expressiveness, a series of attentional models have been developed, including hierarchical attention networks (Yang et al., 2016), attention over attention (Cui et al., 2017), etc. More recently, graph neural networks have shown to be a powerful tool for solving the problem of text classification by considering the long-distance dependency between words. Specifically, TextGCN (Yao et al., 2019) applies the graph convolutional networks (GCNs) (Kipf and Welling, 2017) on a single large graph built from the whole corpus, which achieves state-of-the-art performance on text classification. Later on, SGC (Wu et al., 2019a) is proposed to reduce the unnecessary complexity and redundant computation of GCNs, and shows competitive results with superior time efficiency. TensorGCN (Liu et al., 2020) proposes a text graph + +tensor to learn word and document embeddings by incorporating more context information. (Huang et al., 2019) propose to learn text representations on document-level graphs. However, those transductive methods are computationally inefficient and cannot capture the high-order interactions between words for improving model expressive power. + +# 3 Methodology + +In this section, we introduce a new family of GNN models developed for inductive text classification. By reviewing the existing GNN-based endeavors, we first summarize their main limitations that need to be addressed. Then we illustrate how we use hypergraphs to model text documents for achieving the goals. Finally, we propose the model HyperGAT based on a new dual attention mechanism and model training for inductive text classification. + +# 3.1 GNNs for Text Classification + +With the booming development of deep learning techniques, graph neural networks (GNNs) have achieved great success in representation learning on graph-structured data (Zhou et al., 2018; Ding et al., 2019b). In general, most of the prevailing GNN models follow the neighborhood aggregation strategy, and a GNN layer can be defined as: + +$$ +\mathbf {h} _ {i} ^ {l} = \operatorname {A G G R} ^ {l} \left(\mathbf {h} _ {i} ^ {l - 1}, \left\{\mathbf {h} _ {j} ^ {l - 1} \mid \forall j \in \mathcal {N} _ {i} \right\}\right), \tag {1} +$$ + +where $\mathbf{h}_i^l$ is the node representation of node $i$ at layer $l$ (we use $\mathbf{x}_i$ as $\mathbf{h}_i^0$ ) and $\mathcal{N}_i$ is the local neighbor set of node $i$ . AGGR is the aggregation function of GNNs and has a series of possible implementations (Kipf and Welling, 2017; Hamilton et al., 2017; Velicković et al., 201b). + +Given the capability of capturing long-distance interactions between entities, GNNs also have demonstrated promising performance on text classification (Yao et al., 2019; Wu et al., 2019b; Liu et al., 2020). The prevailing approach is to build a corpus-level document-word graph and try to classify documents through semi-supervised node classification. Despite their success, most of the existing efforts suffer from the computational inefficiency issue, not only because of the mandatory access of test documents, but also the construction of corpus-level document-word graphs. In the meantime, those methods are largely limited by the expressibility of using simple graphs to model word interactions. Therefore, how to improve model ex + +pressive power with less computational consumption is a challenging and imperative task to solve. + +# 3.2 Documents as Text Hypergraphs + +To address the aforementioned challenges, in this study, we alternatively propose to model text documents with document-level hypergraphs. Formally, hypergraphs can be defined as follows: + +Definition 3.1 Hypergraphs: A hypergraph is defined as a graph $G = (\mathcal{V}, \mathcal{E})$ , where $\mathcal{V} = \{v_1, \ldots, v_n\}$ represents the set of nodes in the graph, and $\mathcal{E} = \{e_1, \ldots, e_m\}$ represents the set of hyperedges. Note that for any hyperedge $e$ , it can connect two or more nodes (i.e., $\sigma(e) \geq 2$ ). + +Notably, the topological structure of a hypergraph $G$ can also be represented by an incidence matrix $\mathbf{A} \in \mathbb{R}^{n \times m}$ , with entries defined as: + +$$ +\mathbf {A} _ {i j} = \left\{ \begin{array}{l} 1, \text {i f} v _ {i} \in e _ {j}, \\ 0, \text {i f} v _ {i} \notin e _ {j}. \end{array} \right. \tag {2} +$$ + +In the general case, each node in hypergraphs could come with a $d$ -dimensional attribute vector. Therefore, all the node attributes can be denoted as $\mathbf{X} = [\mathbf{x}_1,\mathbf{x}_2,\dots ,\mathbf{x}_n]^{\mathrm{T}}\in \mathbb{R}^{n\times d}$ , and we can further use $G = (\mathbf{A},\mathbf{X})$ to represent the whole hypergraph for simplicity. + +For a text hypergraph, nodes represent words in the document and node attributes could be either one-hot vector or the pre-trained word embeddings (e.g., word2vec, GloVe). In order to model heterogeneous high-order context information within each document, we include multi-relational hyperedges as follows: + +Sequential Hyperedges. Sequential context depicts the language property of local co-occurrence between words, which has demonstrated its effectiveness for text representation learning (Yao et al., 2019). To leverage the sequential context information of each word, we first construct sequential hyperedges for each document in the corpus. One natural way is to adopt a fixed-size sliding window to obtain global word co-occurrence as the sequential context. Inspired by the success of hierarchical attention networks (Yang et al., 2016), here we consider each sentence as a hyperedge and it connects all the words in this sentence. As another benefit, using sentences as sequential hyperedges enables our model to capture the document structural information at the same time. + +![](images/4e3fa6a8996f61de811d364bedfb0d2494af60a9772f31f6a2a6eb2d1c933c4a.jpg) +Figure 1: Illustration of the proposed hypergraph attention networks (HyperGAT) for inductive text classification. We construct a hypergraph for each text document and feed it into HyperGAT. Based on the node and edge-level attention, text representations that capture high-order word interactions can be derived. Figure best viewed in color. + +Semantic Hyperedges. Furthermore, in order to enrich the semantic context for each word, we build semantic hyperedges to capture topic-related high-order correlations between words (Linmei et al., 2019). Specifically, we first mine the latent topics $T$ from the text documents using LDA (Blei et al., 2003) and each topic $t_i = (\theta_1, \dots, \theta_w)$ ( $w$ denotes the vocabulary size) can be represented by a probability distribution over the words. Then for each topic, we consider it as a semantic hyperedge that connects the top $K$ words with the largest probabilities in the document. With those topic-related hyperedges, we are able to enrich the high-order semantic context of words in each document. + +It is worth mentioning that though we only discuss sequential and semantic hyperedges in this study, other meaningful hyperedges (e.g., syntactic-related) could also be integrated into the proposed model for further improving the model expressiveness and we leave this for future work. + +# 3.3 Hypergraph Attention Networks + +To support text representation learning on the constructed text hypergraphs, we then propose a new model called HyperGAT (as shown in Figure 1) in this section. Apart from conventional GNN models, HyperGAT learns node representations with two different aggregation functions, allowing to capture heterogeneous high-order context information of words on text hypergraphs. In general, a HyperGAT layer can be defined as: + +$$ +\begin{array}{l} \mathbf {h} _ {i} ^ {l} = \operatorname {A G G R} _ {\text {e d g e}} ^ {l} \left(\mathbf {h} _ {i} ^ {l - 1}, \left\{\mathbf {f} _ {j} ^ {l} \mid \forall e _ {j} \in \mathcal {E} _ {i} \right\}\right), \tag {3} \\ \mathbf {f} _ {j} ^ {l} = \mathrm {A G G R} _ {n o d e} ^ {l} \Big (\{\mathbf {h} _ {k} ^ {l - 1} | \forall v _ {k} \in e _ {j} \} \Big), \\ \end{array} +$$ + +where $\mathcal{E}_i$ denotes the set of hyperedges connected to node $v_i$ and $\mathbf{f}_j^l$ is the representation of hyperedge $e_j$ in layer $l$ . AGGR edge is an aggregation function that aggregates features of hyperedges to nodes and AGGR node is another aggregation function that aggregates features of nodes to hyperedges. In this work, we propose to implement those two functions based on a dual attention mechanism. We will start by describing a single layer $l$ for building arbitrary HyperGAT architectures as follows: + +Node-level Attention. Given a specific node $v_{i}$ , our HyperGAT layer first learns the representations of all its connected hyperedges $\mathcal{E}_i$ . As not all the nodes in a hyperedge $e_j \in \mathcal{E}_i$ contribute equally to the hyperedge meaning, we introduce attention mechanism (i.e., node-level attention) to highlight those nodes that are important to the meaning of the hyperedge and then aggregate them to compute the hyperedge representation $\mathbf{f}_j^l$ . Formally: + +$$ +\mathbf {f} _ {j} ^ {l} = \sigma \left(\sum_ {v _ {k} \in e _ {j}} \alpha_ {j k} \mathbf {W} _ {1} \mathbf {h} _ {k} ^ {l - 1}\right), \tag {4} +$$ + +where $\sigma$ is the nonlinearity such as ReLU and $\mathbf{W}_1$ is a trainable weight matrix. $\alpha_{jk}$ denotes the attention coefficient of node $v_{k}$ in the hyperedge $e_j$ , which can be computed by: + +$$ +\alpha_ {j k} = \frac {\exp \left(\mathbf {a} _ {1} ^ {\mathrm {T}} \mathbf {u} _ {k}\right)}{\sum_ {v _ {p} \in e _ {j}} \exp \left(\mathbf {a} _ {1} ^ {\mathrm {T}} \mathbf {u} _ {p}\right)}, \tag {5} +$$ + +$$ +\mathbf {u} _ {k} = \mathrm {L e a k y R e L U} (\mathbf {W} _ {1} \mathbf {h} _ {k} ^ {l - 1}), +$$ + +where $\mathbf{a}_1^{\mathrm{T}}$ is a weight vector (a.k.a, context vector). + +Edge-level Attention. With all the hyperedges representations $\{\mathbf{f}_j^l |\forall e_j\in \mathcal{E}_i\}$ , we again apply an edge-level attention mechanism to highlight the informative hyperedges for learning the next-layer representation of node $v_{i}$ . This process can be formally expressed as: + +$$ +\mathbf {h} _ {i} ^ {l} = \sigma \left(\sum_ {e _ {j} \in \mathcal {E} _ {i}} \beta_ {i j} \mathbf {W} _ {2} \mathbf {f} _ {j} ^ {l}\right), \tag {6} +$$ + +where $\mathbf{h}_i^l$ is the output representation of node $v_{i}$ and $\mathbf{W}_2$ is a weight matrix. $\beta_{ij}$ denotes the attention coefficient of hyperedge $e_j$ on node $v_{i}$ , which can be computed by: + +$$ +\begin{array}{l} \beta_ {i j} = \frac {\exp \left(\mathbf {a} _ {2} ^ {\mathrm {T}} \mathbf {v} _ {j}\right)}{\sum_ {e _ {p} \in \mathcal {E} _ {i}} \exp \left(\mathbf {a} _ {2} ^ {\mathrm {T}} \mathbf {v} _ {p}\right)}, \tag {7} \\ \mathbf {v} _ {j} = \operatorname {L e a k y R e L U} ([ \mathbf {W} _ {2} \mathbf {f} _ {j} ^ {l} | | \mathbf {W} _ {1} \mathbf {h} _ {i} ^ {l - 1} ]), \\ \end{array} +$$ + +where $\mathbf{a}_2^{\mathrm{T}}$ is another weight (context) vector for measuring the importance of the hyperedges and $||$ is the concatenation operation. + +The proposed dual attention mechanism enables a HyperGAT layer not only to capture the high-order word interactions, but also to highlight the key information at different granularities during the node representation learning process. + +# 3.4 Inductive Text Classification + +For each document, after going through $L$ HyperGAT layers, we are able to compute all the node representations on the constructed text hypergraph. Then we apply the mean-pooling operation on the learned node representations $\mathbf{H}^L$ to obtain the document representation $\mathbf{z}$ , and feed it to a softmax layer for text classification. Formally: + +$$ +\hat {\mathbf {y}} = \operatorname {s o f t m a x} \left(\mathbf {W} _ {c} \mathbf {z} + \mathbf {b} _ {c}\right), \tag {8} +$$ + +where $\mathbf{W}_c$ is a parameter matrix mapping the document representation into an output space and $\mathbf{b}_c$ is the bias. $\hat{\mathbf{y}}$ denotes the predicted label scores. Specifically, the loss function of text classification is defined as the cross-entropy loss: + +$$ +\mathcal {L} = - \sum_ {d} \log \left(\hat {\mathbf {y}} _ {j} ^ {d}\right), \tag {9} +$$ + +where $j$ is the ground truth label of document $d$ . Thus HyperGAT can be learned by minimizing the above loss function over all the labeled documents. + +Note that HyperGAT eliminates the mandatory access of test documents during training, making + +
Dataset20NGR8R52OhsumedMR
# Doc18,8467,6749,1007,40010,662
# Train11,3145,4856,5323,3577,108
# Test7,5322,1892,5684,0433,554
# Word42,7577,6888,89214,15718,764
Avg Len221.2665.7269.82135.8220.39
# Class20852232
+ +Table 1: Summary statistics of the evaluation datasets. + +the model different from existing GNN-based methods. For unseen documents, we can directly feed their corresponding text hypergraphs to the previously learned model and compute their labels. Hence, we can handle the newly added data in an inductive way instead of retraining the model. + +# 4 Experiments + +# 4.1 Experimental Setting + +Evaluation Datasets. To conduct a fair and comprehensive evaluation, we adopt five benchmark datasets from different domains in our experiments: 20-Newsgroups (20NG), Reuters (R8 and R52), Ohsumed, and Movie Review (MR). Those datasets have been widely used for evaluating graph-based text classification performance (Yao et al., 2019; Huang et al., 2019; Liu et al., 2020). Specifically, the 20-Newsgroups dataset and two Reuters datasets are used for news classification. The Ohsumed dataset is medical literature. The Movie Review dataset is collected for binary sentiment classification. A summary statistics of the benchmark datasets is presented in table 1 and more detailed descriptions can be found in (Yao et al., 2019). For quantitative evaluation, we follow the same train/test splits and data preprocessing procedure in (Yao et al., 2019) in our experiments. In each run, we randomly sample $90\%$ of the training samples to train the model and use the left $10\%$ data for validation. More details can be found in Appendix A.1. + +Compared Methods. In our experiments, the baselines compared with our model HyperGAT can be generally categorized into three classes: (i) word embedding-based methods that classify documents based on pre-trained word embeddings, including fastText (Joulin et al., 2016), and more advanced methods SWEM (Shen et al., 2018) and LEAM (Wang et al., 2018); (ii) sequence-based methods which capture text fea + +
Model20NGR8R52OhsumedMR
CNN-rand0.7693 ± 0.00610.9402 ± 0.00570.8537 ± 0.00470.4387 ± 0.01000.7498 ± 0.0070
CNN-non-static0.8215 ± 0.00520.9571 ± 0.00520.8759 ± 0.00480.5833 ± 0.01060.7775 ± 0.0072
LSTM0.6571 ± 0.01520.9368 ± 0.00820.8554 ± 0.01130.4114 ± 0.01170.7506 ± 0.0044
LSTM (pretrain)0.7543 ± 0.01720.9609 ± 0.00190.9048 ± 0.00860.5110 ± 0.01500.7733 ± 0.0089
Bi-LSTM0.7318 ± 0.01850.9631 ± 0.00330.9054 ± 0.00910.4927 ± 0.01070.7768 ± 0.0086
fastText0.7938 ± 0.00300.9613 ± 0.00210.9281 ± 0.00090.5770 ± 0.00490.7514 ± 0.0020
fastText (bigrams)0.7967 ± 0.00290.9474 ± 0.00110.9099 ± 0.00050.5569 ± 0.00390.7624 ± 0.0012
SWEM0.8516 ± 0.00290.9532 ± 0.00260.9294 ± 0.00240.6312 ± 0.00550.7665 ± 0.0063
LEAM0.8191 ± 0.00240.9331 ± 0.00240.9184 ± 0.00230.5858 ± 0.00790.7695 ± 0.0045
Graph-CNN0.8142 ± 0.00320.9699 ± 0.00120.9275 ± 0.00220.6386 ± 0.00530.7722 ± 0.0027
TextGCN (transductive)0.8643 ± 0.00090.9707 ± 0.00100.9356 ± 0.00180.6836 ± 0.00560.7674 ± 0.0020
TextGCN (inductive)0.8331 ± 0.00260.9578 ± 0.00290.8820 ± 0.00720.5770 ± 0.00350.7480 ± 0.0025
Text-level GNN0.8416 ± 0.00250.9789 ± 0.00200.9460 ± 0.00300.6940 ± 0.00600.7547 ± 0.0006
HyperGAT (ours)0.8662 ± 0.00160.9797 ± 0.00230.9498 ± 0.00270.6990 ± 0.00340.7832 ± 0.0027
+ +Table 2: Test accuracy on document classification with different models. Each model we ran 10 times and report the mean ± standard deviation. HyperGAT significantly outperforms all the baselines based on t-tests ( $p < 0.05$ ). + +tures from local consecutive word sequences, including CNNs (Kim, 2014), LSTMs (Liu et al., 2016), and Bi-LSTM (Huang et al., 2015); (iii) graph-based methods that aim to capture interactions between words, including Graph-CNN (Defferrard et al., 2016), two versions of TextGCN (Yao et al., 2019) and Text-level GNN (Huang et al., 2019). Note that TextGCN (transductive) is the model proposed in the original paper and TextGCN (inductive) is the inductive version implemented by the same authors. Text-level GNN is a state-of-the-art baseline which performs text representation learning on document-level graphs. More details of baselines can be found in (Yao et al., 2019). + +Implementation Details. HyperGAT is implemented by PyTorch and optimized with the Adam optimizer. We train and test the model on a 12 GB Titan Xp GPU. Specifically, our HyperGAT model consists of two layers with 300 and 100 embedding dimensions, respectively. We use one-hot vectors as the node attributes and the batch size is set to 8 for all the datasets. The optimal values of hyperparameters are selected when the model achieves the highest accuracy for the validation samples. The optimized learning rate $\alpha$ is set to 0.0005 for MR and 0.001 for the other datasets. L2 regularization is $10^{-6}$ and dropout rate is 0.3 for the best performance. For learning HyperGAT, we train the model for 100 epochs with early-stopping strategy. To construct the semantic hyperedges, we train an LDA model for each dataset using the training documents and select the Top-10 words from each topic. The topic number is set to the same + +number of classes. For baseline models, we either show the results reported in previous research (Yao et al., 2019) or run the codes provided by the authors using the parameters described in the original papers. More details can be found in the Appendix A.2. Our data and source code is available at https://github.com/kaize0409/HyperGAT. + +# 4.2 Experimental Results + +Classification Performance. We first conduct comprehensive experiments to evaluate model performance on text classification and present the results in Table 2. Overall, our model HyperGAT outperforms all the baselines on the five evaluation datasets, which demonstrates its superior capability in text classification. In addition, we can make the following in-depth observations and analysis: + +- Graph-based methods, especially GNN-based models are able to achieve superior performance over the other two categories of baselines on the first four datasets. This observation indicates that text classification performance can be directly improved by capturing long-distance word interactions. While for the MR dataset, sequence-based methods (CNNs and LSTMs) show stronger classification capability than most of the graph-based baselines. One potential reason is that sequential context information plays a critical role in sentiment classification, which cannot be explicitly captured by the majority of existing graph-based methods. + +- Not surprisingly, without the additional knowledge on test documents, the performance of + +
ModelTextGCN (transductive)HyperGAT
20NG1,4479.36MB180.33MB
R8931.58MB41.75MB
R521289.48MB46.85MB
Ohsumed1822.71MB63.17MB
MR3338.24MB80.99MB
+ +Table 3: GPU memory consumption of different methods. The batch size for HyperGAT is set to 8. + +TextGCN (inductive) largely falls behind its original transductive version. Though Text-level GNN is able to achieve performance improvements by adding trainable edge weights between word, its performance is still limited by the information loss of using pairwise simple graph. In particular, our model HyperGAT achieves considerable improvements over other GNN-based models, demonstrating the importance of high-order context information for learning word representations. + +Computational Efficiency. Table 3 presents the computational cost comparison between the most representative transductive baseline TextGCN and our approach. Form the reported results, we can clearly find that HyperGAT has a significant computational advantage in terms of memory consumption. The main reason is that HyperGAT conducts text representation learning at the document-level and it only needs to store a batch of small text hypergraphs during training. On the contrary, TextGCN requires constructing a large document-word graph using both training and test documents, which inevitably consumes a great amount of memory. Another computational advantage of our model is that HyperGAT is an inductive model that can generalize to unseen documents. Thus we do not have to retrain the whole model for newly added documents like transductive methods. + +Model Sensitivity. The model performance on 20NG and Ohsumed with different first-layer embedding dimensions is reported in Figure 2, and we omit the results on other datasets since similar results can be observed. Notably, the best performance of HyperGAT is achieved when the first-layer embedding size is set to 300. It indicates that small embedding size may render the model less expressive, while the model may encounter overfitting if the embedding size is too large. In the meantime, to evaluate the effect of the size of + +![](images/3842b12c22f93478923e3bc650f784eb8efe646fed494f4cc43e87bb46c816d7.jpg) +(a) 20NG + +![](images/b1f3e95f7d0f5ad637c299f07181e78427a06deae6239f6a1d0233f6b4142f08.jpg) +(b) Ohsumed + +![](images/2d278d1b51a3eb989078f7e93c8183a282ddbdcb12db943a972d09964e95107f.jpg) +Figure 2: Test accuracy by varying the embedding size of the first HyperGAT layer. +(a) Ohsumed +Figure 3: Test accuracy by varying the proportions of training data $(2.5\%, 5\%, 7.5\%, 10\%, 25\%, 50\%, 75\%)$ . + +![](images/86a6c467aa0239ac26c771116217fa15d274c2f1c77a777abc995f5bf872ff79.jpg) +(b) MR + +labeled training data, we compare several best performing models with different proportions of the training data and report the results on Ohsumed and MR in Figure 3. In general, with the growth of labeled training data, all the evaluated methods can achieve performance improvements. More remarkably, HyperGAT can significantly outperform other baselines with limited labeled data, showing its effectiveness in real-world scenarios. + +# 4.3 Ablation Analysis + +To investigate the contribution of each module in HyperGAT, we conduct an ablation analysis and report the results in Table 4. Specifically, w/o attention is a variant of HyperGAT that replaces the dual attention with convolution. w/o sequential and w/o semantic are another two variants by excluding sequential, semantic hyperedges, respectively. From the reported results we can learn that HyperGAT can achieve better performance by stacking more layers. This observation can verify the usefulness of long-distance word interactions for text representation learning. Moreover, the performance gap between w/o attention and HyperGAT shows the effectiveness of the dual attention mechanism for learning more expressive word representations. By comparing the results of w/o sequential and w/o semantic, we can learn that the context informa + +
Model20NGR8R52OhsumedMR
w/o attention0.8645 ± 0.00060.9705 ± 0.00150.9321 ± 0.00230.6611 ± 0.00420.7699 ± 0.0044
w/o sequential0.6813 ± 0.00240.9448 ± 0.00530.9051 ± 0.00230.5664 ± 0.00470.7766 ± 0.0009
w/o semantic0.8602 ± 0.00310.9714 ± 0.00260.9415 ± 0.00320.6848 ± 0.00450.7811 ± 0.0028
HyperGAT (1 layer)0.8610 ± 0.00140.9735 ± 0.00120.9472 ± 0.00230.6913 ± 0.00230.7788 ± 0.0016
HyperGAT0.8662 ± 0.00160.9797 ± 0.00230.9498 ± 0.00270.6990 ± 0.00340.7832 ± 0.0027
+ +Table 4: Text classification comparison results w.r.t. test accuracy (mean ± standard deviation). HyperGAT significantly outperforms all its variants on each dataset based on t-tests $(p < 0.05)$ . + +tion encoded by the sequential hyperedges is more important, but adding semantic hyperedges can enhance the model expressiveness. It also indicates that heterogeneous high-order context information can complement each other and we could investigate more meaningful hyperedges to further improve the performance of our approach. + +# 4.4 Case Study + +Embedding Visualization. In order to show the superior embedding quality of HyperGAT over other methods, we use t-SNE (Maaten and Hinton, 2008) to visualize the learned representations of documents for comparison. Specifically, Figure 4 shows the visualization results of the best performing baseline Text-level GNN and HyperGAT on the test documents of Ohsumed. Note that the node's color corresponds to its label, which is used to verify the model's expressive power on 23 document classes. From the embedding visualization, we are able to observe that HyperGAT can learn more expressive document representations over the state-of-the-art method Text-level GNN. + +Attention Visualization. To better illustrate the learning process of the proposed dual attention mechanism, we take a text document from 20NG (labeled as sport.baseball correctly) and visualize the attention weights computed for the word player. As shown in Figure 5, player is con + +![](images/de63a7cefe5180d515e5b22a8cd14e81e40aae1dc01b1bdc9d90160ca5c11d65.jpg) +(a) Text-level GNN + +![](images/4bab3bf45f37d9313a13d2d450ff6f18e9c62c15290367e952eb83e19a2f27ca.jpg) +(b) HyperGAT +Figure 4: The t-SNE visualization of Text-level GNN and HyperGAT for test documents in Ohsumed. + +![](images/60e59c91f9ed711c88e359730eeb22b38b3ebe7c2895d29e1a373901e96667cc.jpg) +Figure 5: Visualization of the dual attention mechanism in HyperGAT. Figure best viewed in color. + +nected to four hyperedges within the constructed document-level hypergraph. The first three lines ended with periods represent sequential hyperedges, while the last one without a period is a semantic hyperedge. Note that we use orange to denote the node-level attention weight and blue to denote the edge-level attention weight. Darker color represents larger attention weight. + +On the one hand, node-level attention is able to select those nodes (words) carrying informative context on the same hyperedge. For example, win and team in the third hyperedge gain larger attention weights since they are more expressive compared to other words in the same sentence. On the other hand, edge-level attention can also assign fine-grained weights to highlight meaningful hyperedges. As we can see, the last hyperedge that connects player with baseball and win receives higher attention weight since it can better characterize the meaning of player in the document. To summarize, this case study shows that our proposed dual attention can capture key information at different granularities for learning expressive text representations. + +# 5 Conclusion + +In this study, we propose a new graph-based method for solving the problem of inductive text classification. Apart from the existing efforts, we propose to model text documents with document + +level hypergraphs and further develop a new family of GNN model named HyperGAT for learning discriminative text representations. Specifically, our method is able to acquire more expressive power with less computational consumption for text representation learning. By conducting extensive experiments, the results demonstrate the superiority of the proposed model over the state-of-the-art methods. + +# Acknowledgements + +This material is in part supported by the National Science Foundation (NSF) grant 1614576. + +# References + +Song Bai, Feihu Zhang, and Philip HS Torr. 2020. Hypergraph convolution and hypergraph attention. Pattern Recognition. +Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. 2018. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261. +David M Blei, Andrew Y Ng, and Michael I Jordan. 2003. Latent dirichlet allocation. Journal of machine Learning research. +Yiming Cui, Zhipeng Chen, Si Wei, Shijin Wang, Ting Liu, and Guoping Hu. 2017. Attention-over-attention neural networks for reading comprehension. ACL. +Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. 2016. Convolutional neural networks on graphs with fast localized spectral filtering. In NeurIPS. +Kaize Ding, Jundong Li, Rohit Bhanushali, and Huan Liu. 2019a. Deep anomaly detection on attributed networks. In SDM. +Kaize Ding, Yichuan Li, Jundong Li, Chenghao Liu, and Huan Liu. 2019b. Feature interaction-aware graph neural networks. arXiv preprint arXiv:1908.07110. +Kaize Ding, Jianling Wang, Jundong Li, Kai Shu, Chenghao Liu, and Huan Liu. 2020. Graph prototypical networks for few-shot learning on attributed networks. arXiv preprint arXiv:2006.12739. +Yifan Feng, Haoxuan You, Zizhao Zhang, Rongrong Ji, and Yue Gao. 2019. Hypergraph neural networks. In AAAI. +Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. 2017. Neural message passing for quantum chemistry. In ICML. + +Will Hamilton, Zhitao Ying, and Jure Leskovec. 2017. Inductive representation learning on large graphs. In NeurIPS. +Lianzhe Huang, Dehong Ma, Sujian Li, Xiaodong Zhang, and Houfeng WANG. 2019. Text level graph neural network for text classification. EMNLP. +Zhiheng Huang, Wei Xu, and Kai Yu. 2015. Bidirectional lstm-crf models for sequence tagging. arXiv preprint arXiv:1508.01991. +Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2016. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759. +Yoon Kim. 2014. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Thomas N Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. NeurIPS. +Hu Linmei, Tianchi Yang, Chuan Shi, Houye Ji, and Xiaoli Li. 2019. Heterogeneous graph attention networks for semi-supervised short text classification. In EMNLP. +Pengfei Liu, Xipeng Qiu, and Xuanjing Huang. 2016. Recurrent neural network for text classification with multi-task learning. *IJCAI*. +Xien Liu, Xinxin You, Xiao Zhang, Ji Wu, and Ping Lv. 2020. Tensor graph convolutional networks for text classification. In AAAI. +Laurens van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-sne. Journal of machine learning research. +Riccardo Miotto, Li Li, Brian A Kidd, and Joel T Dudley. 2016. Deep patient: an unsupervised representation to predict the future of patients from the electronic health records. Scientific reports. +Dinghan Shen, Guoyin Wang, Wenlin Wang, Martin Renqiang Min, Qinliang Su, Yizhe Zhang, Chunyuan Li, Ricardo Henao, and Lawrence Carin. 2018. Baseline needs more love: On simple word-embedding-based models and associated pooling mechanisms. In ACL. +Kai Sheng Tai, Richard Socher, and Christopher D Manning. 2015. Improved semantic representations from tree-structured long short-term memory networks. ACL. +Petar Velicković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 201b. Graph attention networks. *ICLR*. + +Guoyin Wang, Chunyuan Li, Wenlin Wang, Yizhe Zhang, Dinghan Shen, Xinyuan Zhang, Ricardo Henao, and Lawrence Carin. 2018. Joint embedding of words and labels for text classification. In ACL. +Jianling Wang, Kaize Ding, Liangjie Hong, Huan Liu, and James Caverlee. 2020. Next-item recommendation with sequential hypergraphs. In WSDM. +Sida Wang and Christopher D Manning. 2012. Baselines and bigrams: Simple, good sentiment and topic classification. In ACL. +Yequan Wang, Minlie Huang, Xiaoyan Zhu, and Li Zhao. 2016. Attention-based LSTM for aspect-level sentiment classification. In EMNLP. +Felix Wu, Tianyi Zhang, Amauri Holanda de Souza Jr, Christopher Fifty, Tao Yu, and Kilian Q Weinberger. 2019a. Simplifying graph convolutional networks. ICML. +Man Wu, Shirui Pan, Xingquan Zhu, Chuan Zhou, and Lei Pan. 2019b. Domain-adversarial graph neural networks for text classification. In ICDM. +Zichao Yang, Diyi Yang, Chris Dyer, Xiaodong He, Alex Smola, and Eduard Hovy. 2016. Hierarchical attention networks for document classification. In NAACL-HLT. +Liang Yao, Chengsheng Mao, and Yuan Luo. 2019. Graph convolutional networks for text classification. In AAAI. +Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In NeurIPS. +Jie Zhou, Ganqu Cui, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. 2018. Graph neural networks: A review of methods and applications. arXiv preprint arXiv:1812.08434. + +# A Appendix + +# A.1 Implementation Details + +As the supplement to Section 4, in the following, we explain the implementation of HyperGAT. + +LDA Model Training. We use the implementation provided in scikit-learn to train the LDA model. We only use the documents in the training set to train the LDA model for each dataset. We select to use the Online Variational Bayes method for model learning. We set the random state is set to be 0 and the learning offset to be 50. As for the other parameters, we follow the default setting provided by scikit-learn. The topic number is set to be the same as the number of classes for each of + +the datasets. And we select the Top-10 keywords of each topic to construct the semantic hyperedges. Implementation of HyperGAT. The proposed HyperGAT model is implemented in PyTorch and optimized with the Adam optimizer (Kingma and Ba, 2014). It is trained and tested on a 12 GB Titan Xp GPU. Specifically, the hypergraph attention network consists of two layers with 300 and 100 embedding dimensions, respectively. We use one-hot vectors as the node attributes. The batch size is set to be 8 for all the datasets. We grid search for the learning rate in $\{0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1\}$ , L2 regularization in $\{10^{-6}, 10^{-5}, 10^{-4}, 10^{-3}, 10^{-2}, 10^{-1}\}$ and the dropout rate in $\{0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7\}$ . The optimal values are selected when the model achieves the highest accuracy for the validation samples. The optimized learning rate $\alpha$ for MR is 0.0005 while that for the other datasets is 0.001. We select the L2 regularization to be $10^{-6}$ and the dropout rate to be 0.3 for the best performance. For each dataset, we train the model for 100 epochs or stop if the performance for the validation doesn't increase for 5 consecutive epochs as an early-stopping strategy. Under the optimized setup, the model can converge in 587s, 145s, 156s, 97s and 78s on average for 20NG, R8, R52, Ohsumed and MR, respectively. + +Validation Performance. As supplement to the test results in Table 2, we also report the corresponding validation performance of the proposed HyperGAT. The validation accuracy is $0.9355 \pm 0.0011$ , $0.9755 \pm 0.0019$ , $0.9375 \pm 0.0023$ , $0.6964 \pm 0.0024$ and $0.7779 \pm 0.0015$ for 20NG, R8, R52, Ohsumed and MR, respectively. + +# A.2 Space Complexity Analysis + +Theoretically, the main difference of memory usage between HyperGAT and other methods lies in the size of the adjacency matrix. Formally, let $N$ denote vocabulary size and $M$ denote document size. Take TextGCN as an example, the size of the adjacency matrix is $(N + M)^2$ . As HyperGAT adopts document-level hypergraphs, for each hypergraph, the adjacency matrix size is $n \times m$ , where $n$ is the number of words and $m$ is the number of hyperedges in a document. Based on mini-batch training, the memory consumption for each minibatch is about $n \times m \times bsz$ . Since $N$ and $M$ are way larger than $n$ and $m$ , the memory consumption of HyperGAT can be largely reduced in practice. \ No newline at end of file diff --git a/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/images.zip b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..b6c96d0cd6f1c13796c4a07ab95c3f2fa284aa80 --- /dev/null +++ b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df8e6b7f3e531d93c91b46ab6bb012ff2293f2c55ec0f96da537746907dd2506 +size 476169 diff --git a/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/layout.json b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..19bf67c728313ef1db5835382e7aaaf1a4c36a81 --- /dev/null +++ b/bemorewithlesshypergraphattentionnetworksforinductivetextclassification/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fae7c1c7336c7043f6c03d6ecb0ba3331c07f4fe3a344b788470fc60752f67b5 +size 355906 diff --git a/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_content_list.json b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..36cc957b6ae8a5fb1c251823c9c58ab5eb0c3d69 --- /dev/null +++ b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8fcaf9c2ac808f9c990ce8cd40cc23a3617d9510c4e049fe884eee8fee798a6 +size 132809 diff --git a/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_model.json b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7df06949c2ce286090a6f83aa6102b3ba5d7421e --- /dev/null +++ b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:971f3e1299d456579207630c84a7aafa1b5c699f517bbd3332cd24ba6c0c7888 +size 157226 diff --git a/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_origin.pdf b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7ffd9c9c084b3c81491714e1e790091326654d55 --- /dev/null +++ b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/bdbfe1b3-9062-4a91-9714-1b2b9c4e22de_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:977d1db7914db038681943da613e35c7e67d5fca1c32290db0c62c895cfdeda3 +size 588577 diff --git a/benchmarkingmeaningrepresentationsinneuralsemanticparsing/full.md b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ffb47f9c673328d38c0fca50bb1cb048a563a50a --- /dev/null +++ b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/full.md @@ -0,0 +1,774 @@ +# Benchmarking Meaning Representations in Neural Semantic Parsing + +Jiaqi Guo $^{1*}$ , Qian Liu $^{2*}$ , Jian-Guang Lou $^{3}$ , Zhenwen Li $^{4}$ , Xueqing Liu $^{5}$ , Tao Xie $^{4}$ , Ting Liu $^{1}$ + +$^{1}$ Xi'an Jiaotong University, Xi'an, China $^{2}$ Beihang University, Beijing, China + +3Microsoft Research, Beijing, China 4Peking University, Beijing, China + +Stevens Institute of Technology, Hoboken, New Jersey, USA + +jasperguo2013@stu.xjtu.edu.cn, qian.liu@buaa.edu.cn + +jlou@microsoft.com, {lizhenwen, taoxie}@pku.edu.cn + +xueqing.liu@stevens.edu, tingliu@mail.xjtu.edu.cn + +# Abstract + +Meaning representation is an important component of semantic parsing. Although researchers have designed a lot of meaning representations, recent work focuses on only a few of them. Thus, the impact of meaning representation on semantic parsing is less understood. Furthermore, existing work's performance is often not comprehensively evaluated due to the lack of readily-available execution engines. Upon identifying these gaps, we propose UNIMER, a new unified benchmark on meaning representations, by integrating existing semantic parsing datasets, completing the missing logical forms, and implementing the missing execution engines. The resulting unified benchmark contains the complete enumeration of logical forms and execution engines over three datasets $\times$ four meaning representations. A thorough experimental study on UNIMER reveals that neural semantic parsing approaches exhibit notably different performance when they are trained to generate different meaning representations. Also, program alias and grammar rules heavily impact the performance of different meaning representations. Our benchmark, execution engines and implementation can be found on: https://github.com/JasperGuo/Unimer. + +# 1 Introduction + +A remarkable vision of artificial intelligence is to enable human interactions with machines through natural language. Semantic parsing has emerged as a key technology for achieving this goal. In general, semantic parsing aims to transform a natural language utterance into a logic form, i.e., a formal, machine-interpretable meaning representation (MR) (Zelle and Mooney, 1996; Dahl et al., 1994).1 Thanks to the recent development + +
MRGeoATISJob
Prolog--91.4
Lambda90.491.385.0
FunQL92.5--
SQL78.069.0-
Prolog89.6-92.1
Lambda---
FunQL---
SQL82.579.2-
+ +Table 1: State-of-the-art performance for MRs on Geo, ATIS, and Job. The top table shows exact-match accuracy whereas the bottom table shows execution-match accuracy. Most existing work focuses on evaluating only a small subset of dataset $\times$ MR pairs, leaving most of the table unexplored. A finer-grained table is available in the supplementary material (Table 8). + +of neural networks techniques, significant improvements have been made in semantic parsing performance (Jia and Liang, 2016; Yin and Neubig, 2017; Dong and Lapata, 2018; Shaw et al., 2019). + +Despite the advancement in performance, we identify three important biases in existing work's evaluation methodology. First, although multiple MRs are proposed, most existing work is evaluated on only one or two of them, leading to less comprehensive or even unfair comparisons. Table 1 shows the state-of-the-art performance of semantic parsing on different dataset $\times$ MR combinations, where the rows are the MRs and the columns are the datasets. We can observe that while Lambda Calculus is intensively studied, the other MRs have not been sufficiently studied. This biased evaluation is partly caused by the absence of target logic forms in the missing cells. Second, existing work often compares the performance on different MRs directly (Sun et al., 2020; Shaw et al., 2019; Chen et al., 2020) without considering the confounding + +role that MR plays in the performance,² causing unfair comparisons and misleading conclusions. Third, a more comprehensive evaluation methodology would consider both the exact-match accuracy and the execution-match accuracy, because two logic forms can be semantically equivalent yet do not match precisely in their surface forms. However, as shown in Table 1, most existing work is only evaluated with the exact-match accuracy. This bias is potentially due to the fact that execution engines are not available in six out of the twelve dataset $\times$ MR combinations. + +Upon identifying the three biases, in this paper, we propose UNIMER, a new unified benchmark, by unifying four publicly available MRs in three of the most popular semantic parsing datasets: Geo, ATIS and Jobs. First, for each natural language utterance in the three datasets, UNIMER provides annotated logical forms in four different MRs, including Prolog, Lambda Calculus, FunQL, and SQL. We identify that annotated logical forms in some MR $\times$ dataset combinations are missing. As a result, we complete the benchmark by semi-automatically translating logical forms from one MR to another. Second, we implement six missing execution engines for MRs so that the execution-match accuracy can be readily computed for all the dataset $\times$ MR combinations. Both the logical forms and their execution results are manually checked to ensure the correctness of annotations and execution engines. + +After constructing UNIMER, to obtain a preliminary understanding on the impact of MRs on semantic parsing, we empirically study the performance of MRs on UNIMER by using two widely-used neural semantic parsing approaches (a seq2seq model (Dong and Lapata, 2016; Jia and Liang, 2016) and a grammar-based neural model (Yin and Neubig, 2017)), under the supervised learning setting. + +In addition to the empirical study above, we further analyze the impact of two operations, i.e., program alias and grammar rules, to understand how they affect different MRs differently. First, Program alias. A semantically equivalent program may have many syntactically different forms. As a result, if the training and testing data have a difference in their syntactic distributions of logic forms, a naive maximum likelihood estimation can suffer from this difference because it fails to + +capture the semantic equivalence (Bunel et al., 2018). As different MRs have different degrees of syntactic difference, they suffer from this problem differently. Second, Grammar rules. Grammar-based neural models can guarantee that the generated program is syntactically correct (Yin and Neubig, 2017; Wang et al., 2020; Sun et al., 2020). For a given set of logical forms in an MR, there exist multiple sets of grammar rules to model them. We observe that when the grammar-based neural model is trained with different sets of grammar rules, it exhibits a notable performance discrepancy. This finding alias with the one made in traditional semantic parsers (Kate, 2008) that properly transforming grammar rules can lead to better performance of a traditional semantic parser. + +In summary, this paper makes the following main contributions: + +- We propose UNIMER, a new unified benchmark on meaning representations, by integrating and completing semantic parsing datasets in three datasets $\times$ four MRs; we also implement six execution engines so that execution-match accuracy can be evaluated in all cases; +- We provide the baseline results for two widely used neural semantic parsing approaches on our benchmark, and we conduct an empirical study to understand the impact that program alias and grammar rule plays on the performance of neural semantic parsing; + +# 2 Preliminaries + +In this section, we provide a brief description of the MRs and neural semantic parsing approaches that we study in the paper. + +# 2.1 Meaning Representations + +We investigate four MRs in this paper, namely, Prolog, Lambda Calculus, FunQL, and SQL, because they are widely used in semantic parsing and we can obtain their corresponding labeled data in at least one semantic parsing domain. We regard Prolog, Lambda Calculus, and FunQL as domain-specific MRs, since the predicates defined in them are specific for a given domain. Consequently, the execution engines of domain-specific MRs need to be significantly customized for different domains, requiring plenty of manual efforts. In contrast, SQL is a domain-general MR for querying relational + +
MRLogical Form
Prologanswer(A, (flight(A), tomorrow(A), during_day(A, B), const(B, period (morning)), from(A, C), const(C, city(Pittsburgh)), to(A, D), const(D, city(Atlanta))))
Lambda Calculus( lambda A:e ( (flight A) ∧ (during_day A morning:pd) ∧ (from A Pittsburgh:ci) ∧ (to A Atlanta:ci) ∧ (tomorrow A))
FunQLanswer ( flight ( tomorrow ( intersect ( during_day ( period ( morning ) ), from ( city ( Pittsburgh ) ), to ( city ( Atlanta ) ) ) ))
SQLSELECT flight_id FROM ... WHERE city_1.city_name = 'pittsburgh' AND city_2.city_name = 'atlanta' AND date_day_1.year = 1991 AND date_day_1.month_number = 1 AND date_day_1.day_number = 20 AND departure_time BETWEEN 0 AND 1200
+ +Table 2: Examples of meaning representations for utterance "what flights do you have in tomorrow morning from pittsburgh to atlanta?" in the ATIS domain. + +databases. Its execution engines (e.g., MySQL) can be used directly in different domains. Table 2 shows a logical form for each of the four MRs in the ATIS domain. + +Prolog has long been used to represent the meaning of natural language (Zelle and Mooney, 1996; Kate and Mooney, 2006). Prolog includes first-order logical forms, augmented with some higher-order predicates, e.g., most, to handle issues such as quantification and aggregation. Take the first logical form in Tables 2 as an example. The uppercase characters denote variables, and the predicates in the logical form specify the constraints between variables. In this case, character A denotes a variable, and it is required to be a flight, and the flight should depart tomorrow morning from Pittsburgh to Atlanta. The outer predicate answer indicates the variable whose binding is of interest. One major benefit of Prolog-style MRs is that they allow predicates to be introduced in the order where they are actually named in the utterance. For instance, the order of predicates in the logical form strictly follows their mentions in the natural language utterance. + +Lambda Calculus is a formal system to express computation. It can represent all first-order logic and it naturally supports higher-order functions. It represents the meanings of natural language with logical expressions that contain constants, quantifiers, logical connectors, and lambda abstract. These properties make it prevalent in semantic parsing. Consider the second logical form in Table 2. It defines an expression that takes an entity A as input and returns true if the entity satisfies the constraints defined in the expressions. Lambda Calculus can be typed, allowing type checking during generation and execution. + +FunQL, abbreviated for Functional Query Language, is a variable-free language (Kate et al., + +2005). It abstracts away variables and encodes compositionality via its nested function-argument structure, making it easier to implement an efficient execution engine for FunQL. Concretely, unlike Prolog and Lambda Calculus, predicates in FunQL take a set of entities as input and return another set of entities that meet certain requirements. Considering the third logical form in Table 2, the predicate during_day (period(morning)) returns a set of flights that depart in the morning. With this function-argument structure, FunQL can directly return the entities of interest. + +SQL is a popular relational database query language. Since it is domain-agnostic and has well-established execution engines, the subtask of semantic parsing, Text-to-SQL, has received a lot of interests. Compared with domain-specific MRs, SQL cannot encapsulate too much domain prior knowledge in its expressions. As shown in Table 2, to query flights that depart tomorrow, one needs to specify the concrete values of year, month, and day in the SQL query. However, these values are not explicitly mentioned in the utterance and may even change over time. + +It is important to note that although these MRs are all expressive enough to represent all meanings in some domains, they are not equivalent in terms of their general expressiveness. For example, FunQL is less expressive than Lambda Calculus in general, partially due to the elimination of variables and quantifiers. + +# 2.2 Neural Semantic Parsing Approaches + +During the last few decades, researchers have proposed different approaches for semantic parsing. Most state-of-the-art approaches are based on neural models and formulate the semantic parsing problem as a sequence transduction problem. Due to the generality of sequence transduction, these ap + +![](images/e18f85dcc1eaf88d7fd2c527e9045e095f4daf22a78bef2e5b142a6878e1ff06.jpg) + +![](images/d86ad10ad01040196d3b308786d4984be660a6428c4c76375ed3339b71e6c667.jpg) +(b) Grammar-based Model +Figure 1: Illustrations of the seq2seq model and the grammar-based model with utterance "Rivers in California?" and its corresponding logical form in Prolog. + +proaches can be trained to generate any MRs. In this work, without loss of generality, we benchmark MRs by evaluating the seq2seq model (Dong and Lapata, 2016; Jia and Liang, 2016) and the grammar-based model (Yin and Neubig, 2017) under the supervised learning setting. We select the two models because most neural approaches are designed based on them. + +Seq2Seq Model. Dong and Lapata (2016) and Jia and Liang (2016) formulated the semantic parsing problem as a neural machine translation problem and employed the sequence-to-sequence model (Sutskever et al., 2014) to solve it. As illustrated in Figure 1a, the encoder takes an utterance as input and outputs a distributed representation for each word in the utterance. A decoder then sequentially predicts words in the logical form. When augmented with the attention mechanism (Bahdanau et al., 2014; Luong et al., 2015), the decoder can better utilize the encoder's information to predict logical forms. Moreover, to address the problem caused by the long tail distribution of entities in logical forms, Jia and Liang (2016) proposed an attention-based copying mechanism. That is, at each time step, the decoder takes one of two types of actions, one to predict a word from the vocabulary of logical forms and the other to copy a word from the input utterance. + +Grammar-based Model. By treating a logical form as a sequence of words, the seq2seq model cannot fully utilize the property that logical forms + +are well-formed and must conform to certain grammars of an MR. To bridge this gap, Yin and Neubig (2017) proposed a grammar-based decoder that outputs a sequence of grammar rules instead of words, as presented in Figure 1b. The decoded grammar rules can deterministically generate a valid abstract syntax tree (AST) of a logical form. In this way, the generated logical form is guaranteed to be syntactically correct. This property makes it widely used in a lot of code generation and semantic parsing tasks (Sun et al., 2020; Wang et al., 2020; Bogin et al., 2019). The grammar-based decoder can also be equipped with the attention-based copying mechanism to address the long-tail distribution problem. + +# 3 Benchmark + +To provide an infrastructure for exploring MRs, we construct UNIMER, a unified benchmark on MRs, based on existing semantic parsing datasets. Currently, UNIMER covers three domains, namely Geo, ATIS, and Job, each of which has been extensively studied in previous work and has annotated logical forms for at least two MRs. All natural language utterances in UNIMER are written in English. + +Geo focuses on querying a database of U.S. geography with natural language. To solve the problem, Zelle and Mooney (1996) designed a Prolog-style MR and annotated 880 (utterance, logical form) pairs. Popescu et al. (2003) and Kate et al. (2005) proposed to use SQL and FunQL to represent the meanings, respectively. Almost the same time, Zettlemoyer and Collins (2005) proposed to use Lambda Calculus and manually converted the Prolog logical forms to equivalent expressions in Lambda Calculus. Following their work, we adopt the standard 600/280 training/test split. + +ATIS is a dataset of flight booking questions. It consists of 5,418 questions and their corresponding SQL queries. Zettlemoyer and Collins (2007) proposed to use Lambda Calculus to represent the meanings of natural language and automatically map these SQL queries to its equivalent logical forms in Lambda Calculus. Following the work of Kwiatkowski et al. (2011), we use the standard 4480/480/450 training/dev/test split. + +Job is a dataset about job announcements posted in the newsgroup austin.jobs (Califf and Mooney, 1999). It consists of 640 utterances and their corresponding Prolog logical forms that query computer-related job postings. Similarly, in Geo, Zettlemoyer + +and Collins (2005) proposed using Lambda Calculus and manually converted them to equivalent expressions in Lambda Calculus. We use the same training-test split with them, containing 500 training and 140 test instances. + +Since not all the four MRs that we introduce in Section 2.1 are used in these three domains, we semi-automatically translate logical forms in one MR into another. This effort enables researchers to explore MRs in more domains and make a fair comparison among them. Take the translation of Lambda Calculus to FunQL in ATIS as an example. We first design predicates for FunQL based on those defined in Lambda Calculus and implement an execution engine for FunQL. Then, we translate logical forms in Lambda Calculus to FunQL and compare the execution results to verify the correctness of the translation. In this process, we find that there is no ready-to-use Lambda Calculus execution engine for the three domains. Hence, we implement one for each domain. These engines, on the one hand, enable evaluations of semantic parsing approaches with both exact-match accuracy and execution-match accuracy. On the other hand, they enable exploration of weakly supervised semantic parsing with Lambda Calculus. In addition, we find some annotation mistakes in logical forms and several bugs in existing execution engines of Prolog and FunQL. By correcting the mistakes and fixing the bugs in the engines, we create a refined version of these datasets. Section A.1 in the supplementary material provides more details about the construction process. + +We plan to cover more domains and more MRs in UNIMER. We have made UNIMER along with the execution engines publicly available.3 We believe that UNIMER can provide fertile soil for exploring MRs and addressing challenges in semantic parsing. + +# 4 Experimental Setup + +Based on UNIMER, we take the first attempt to study the characteristics of different MRs and their impact on neural semantic parsing. + +# 4.1 Experimental Design + +Meaning Representation Comparison. To understand the impact of MRs on neural semantic + +
RuleDescription
ShuffleShuffle expressions in Select, From, Where, and Having clauses
ArgmaxExpress Argmax/min with OrderBy and Limit clause instead of subquery
In2JoinReplace In clause with Join clause
+ +Table 3: Three basic transformation rules for SQL. + +Parsing, we first experiment with the two neural approaches described in Section 2.2 on UNIMER, and we compare the resulting performance of different MRs with two metrics: exact-match accuracy (a logical form is regarded as correct if it is syntactically identical to the gold standard),4 and execution-match accuracy (regarded as correct if a logical form's execution result is identical to that of the gold standard).5 + +Program Alias. To explore the effect of program alias, we replace a different proportion of logical forms in a training set with their aliases (semantically equivalent but syntactically different logical forms), and we re-train the neural approaches to quantify its effect. To search for aliases of a logical form, we first derive multiple transformation rules for each MR. Then, we apply these rules to the logical form to get its aliases and randomly sample one. We compare the execution results of the resulting logical forms to ensure their equivalence in semantics. Table 3 presents three transformation rules for SQL. We provide a detailed explanation of transformation rules and examples for each MR in Section A.3 of the supplementary material. + +Grammar Rules. To understand the grammar rules' impact on grammar-based models, we provide two sets of grammar rules for each MR. Each set of rules can cover all the logical forms in the three domains. We compare the performance of models trained with different sets of rules. Specifically, Wong and Mooney (2006) and Wong and Mooney (2007) have induced a set of grammar rules for Prolog and FunQL in Geo. We directly use them in Geo and extend them to support logical forms in ATIS and Job. As for SQL, Boin et al. (2019) have induced a set of rules for SQL in the Spider benchmark, and we adapt it to support the SQL queries in the three domains that we study. + +When it comes to Lambda Calculus, we use the one induced by Yin and Neubig (2018). For comparison, we also manually induce another set of grammar rules for the four MRs. Section A.4 in the supplementary material provides definitions of all the grammar rules. + +# 4.2 Implementations + +We implement each approach with the AllenNLP (Gardner et al., 2018) and PyTorch (Paszke et al., 2019) frameworks. To make a fair comparison, we tune the hyper-parameters of approaches for each MR on the development set or through cross-validation on the training set, with the NNI platform. Due to the limited number of test data in each domain, we run each approach five times and take the average number. Section A.2 in the supplementary material provides the search space of hyper-parameters for each approach and the preprocessing procedures of logical forms. + +Multiple neural semantic parsing approaches (Dong and Lapata, 2016; Iyer et al., 2017; Rabinovich et al., 2017) adopt the data anonymization techniques to replace entities in utterances with placeholders. However, the techniques are usually ad-hoc and specific for domains and MRs, and they sometimes require manual efforts to resolve conflicts (Finegan-Dollak et al., 2018). Hence, we do not apply data anonymization to avoid bias. + +# 5 Experimental Results + +# 5.1 Meaning Representation Comparison + +Table 4 presents our experimental results on UNIMER. Since we do not use data anonymization techniques, the performance is generally lower than that shown in Table 1 and Table 8, but the performance is on par with the numbers reported in ablation studies of previous work (Dong and Lapata, 2016; Jia and Liang, 2016; Finegan-Dollak et al., 2018). We can make the following three observations from the table. + +First, neural approaches exhibit notably different performance when they are trained to generate different MRs. The difference can vary by as much as $20\%$ in both exact-match and execution-match metrics. This finding tells us that an apple-to/apple comparison is extremely important when comparing two neural semantic parsing approaches. However, we notice that some papers (Sun et al., 2020; + +![](images/aeb893c30ba18d0203d06b68240a1443c9ab7a3105ef57318698bf18304f2555.jpg) +Figure 2: Statistics of logical forms in the training set of Prolog (P), Lambda Calculus (L), FunQL (F) and SQL (S). The y-axis indicates the number of production rules in each logical form. + +![](images/56ff3acded7c58978f70c959602cbe145f84216767d37dcc6af37140b8a3daed.jpg) + +![](images/66c01fef914798d559e711fcaf8274e111502870f653ed76c0a231c734fbb4d9.jpg) + +Shaw et al., 2019; Chen et al., 2020) do not clearly note the MRs used in baselines and compare with them using different metrics; the attained result can be somewhat misleading. + +Second, domain-specific MRs (Prolog, Lambda Calculus, and FunQL) tend to outperform SQL (domain-general) by a large margin. For example, in Geo, the execution-match accuracy of FunQL is substantially higher than that of SQL in all approaches. This result is expected because a lot of domain knowledge is injected into domain-specific MRs. Consider the logical forms in Table 2. There is a predicate tomorrow in all three domain-specific MRs, and this predicate can directly align to the description in the utterance. However, one needs to explicitly express the concrete date values in the SQL query; this requirement can be a heavy burden for neural approaches, especially when the values will change over time. In addition, a recent study (Finegan-Dollak et al., 2018) in Text-to-SQL has shown that domain-specific MRs are more robust against generating never-seen logical forms than SQL, because their surface forms are much closer to natural language. + +Third, among all the domain-specific MRs, FunQL tends to outperform the others in neural approaches. In Geo, FunQL outperforms the other MRs in both metrics by a large margin. In Job, the grammar-based (w/ copy) model trained with FunQL achieves the state-of-the-art performance. One possible reason is that FunQL is more compact than the other MRs, due to its elimination of variables and quantifiers. Figure 2 shows box plots about the number of grammars rules in the AST of a logical form. We can observe that while FunQL has almost the same number of grammar rules with the other MRs (Table 5), it has much fewer grammar rules involved in a logical form than the others + +
ApproachPrologLambda CalculusFunQLSQL
ExactExecutionExactExecutionExactExecutionExactExecution
Geo
Seq2Seq70.0 ±2.173.9 ±2.464.7 ±2.370.1 ±2.176.8 ±2.479.4 ±2.258.0 ±2.468.7 ±3.7
w/ Copy72.9 ±2.178.7 ±2.475.4 ±0.580.1 ±1.380.3 ±1.487.1 ±0.972.3 ±1.176.8 ±1.8
Grammar68.6 ±1.275.7 ±2.370.7 ±1.175.1 ±1.476.1 ±0.378.2 ±0.363.3 ±2.070.8 ±1.9
w/ Copy74.3 ±2.179.5 ±1.175.6 ±1.580.7 ±0.781.8 ±0.386.2 ±0.467.9 ±0.772.1 ±1.0
ATIS
Seq2Seq65.9 ±1.573.8 ±1.368.7 ±1.876.3 ±0.970.8 ±0.676.3 ±1.05.6 ±0.361.1 ±4.6
w/ Copy73.7 ±1.980.4 ±0.575.4 ±2.483.1 ±1.378.0 ±1.182.7 ±1.08.0 ±0.670.0 ±1.5
Grammar70.9 ±0.976.3 ±1.071.7 ±1.577.4 ±1.372.1 ±0.877.5 ±0.95.5 ±0.263.7 ±1.3
w/ Copy73.4 ±1.279.2 ±1.175.7 ±0.482.1 ±0.876.5 ±0.782.7 ±1.27.2 ±0.661.0 ±1.1
Job
Seq2Seq68.1 ±2.375.7 ±1.765.8 ±1.378.6 ±1.571.4 ±2.181.4 ±2.368.5 ±3.075.6 ±3.0
w/ Copy71.4 ±3.679.1 ±2.277.9 ±2.888.0 ±1.475.6 ±2.485.9 ±3.078.7 ±2.187.3 ±2.3
Grammar70.4 ±2.479.4 ±2.468.4 ±3.982.9 ±4.172.9 ±2.786.3 ±2.574.6 ±1.583.3 ±1.8
w/ Copy75.9 ±1.184.4 ±2.180.2 ±1.891.0 ±1.378.4 ±2.192.4 ±1.578.7 ±1.487.6 ±2.1
+ +Table 4: Experimental results of the seq2seq model and the grammar-based model. We highlight the best performance of each approach and MR in both metrics. The poor SQL exact-match accuracy in ATIS is caused by the different distribution of SQL queries in test set. Iyer et al. (2017) rewrote the SQL queries in test set to improve their execution efficiency. + +
MRGeoATISJob
# Vo# Ru# Vo# Ru# Vo# Ru
Prolog146234503732170230
Lambda180245466532200208
FunQL152188494706195208
SQL187269530656211227
+ +on average. This statistic is crucial for neural semantic parsing approaches as it directly determines the number of decoding steps in decoders. + +A similar reason can be used to explain that the performance on SQL is lower than others. As Figure 2 shows, SQL has larger medians of the number of grammar rules, and it also has much more outliers than domain-specific MRs. It makes neural models more challenging to learn. + +Interestingly, this finding contradicts the finding in CCG-based semantic parsing approaches (Kwiatkowski et al., 2010), in which they show that Lambda Calculus outperforms FunQL in the Geo domain. The reason is that compared with Lambda Calculus, the deeply nested structure of FunQL makes it more challenging to learn a high-quality CCG lexicon, which is crucial for CCG parsing. In contrast, neural approaches do not rely on a lexicon and directly learn a mapping between source and target languages. + +# 5.2 Program Alias + +Figure 3 shows the execution-match accuracy of the seq2seq (w/ copy) model with different pro + +![](images/3c725557cb20df29f98e700f5fb793f472ccb2d9a2de309cf9379ff59de5232d.jpg) +(a) Geo +Figure 3: Execution-match accuracy of the seq2seq (w/ copy) model when different proportions of logical forms in training set are replaced with their aliases. + +![](images/2c3c061f670d9caf6a0bb23a53b3ed8b51c48102af8c9924cd3318ee9110a922.jpg) +(b) ATIS + +Table 5: Statistics of logical forms in different MRs. '# Vo' and '# Ru' indicate the vocabulary size and the number of grammar rules of an MR, respectively. + +
MRGeoATIS
ExactExecutionExactExecution
Prolog24.2%15.1%7.0%5.4%
Lambda11.9%8.6%6.2%0.9%
FunQL24.7%8.0%7.0%4.1%
SQL19.4%4.9%9.1%3.6%
+ +Table 6: Relative decline of performance when $25\%$ of logical forms in training data are replaced with aliases. + +portions of logical forms in the training set replaced with aliases. Since not all the logical forms have aliases, the curves in Figure 3 stop at different points. Among all the domain-specific MRs, FunQL has the fewest logical forms with aliases, while Prolog has the largest. For example, in Geo, only $42\%$ of FunQL logical forms in the training set have aliases, while more than $70\%$ of logical forms in Lambda Calculus and Prolog have aliases. + +
MRGrammarGeoATIS
PrologG172.6 ±1.277.5 ±0.9
G275.7 ±2.376.2 ±1.0
LambdaG175.1 ±1.474.9 ±1.5
G275.6 ±1.577.4 ±1.3
FunQLG174.5 ±1.774.0 ±2.2
G278.2 ±0.477.5 ±0.9
SQLG168.2 ±2.463.7 ±1.3
G270.2 ±1.061.3 ±1.7
+ +Table 7: Execution-match accuracy of the grammar-based model (w/o Copy). 'G1' denotes the grammar rules induced by (Wong and Mooney, 2006, 2007; Yin and Neubig, 2018; Bogin et al., 2019); 'G2' denotes the grammar rules induced by ourselves. + +From the figure, we have two main observations. First, in both domains, as more logical forms are replaced, the performance of all MRs declines gradually. Among all the MRs, the performance of Prolog declines more seriously than the others in both domains. In other words, it suffers from the program alias problem more seriously. The trends of Lambda Calculus and FunQL in ATIS are impressive, as their performance decreases only slowly. Selecting an MR with the less effect of program alias could be a better choice when we need to develop a semantic parser for a new domain, because we can save many efforts in defining annotation protocols and checking consistency, which could be extremely tedious. Second, the exact-match accuracy declines more seriously than execution-match. Table 6 provides the relative declines in both exact-match and execution-match metrics when $25\%$ of logical forms are replaced. We find that the exact-match accuracy declines more seriously than execution-match, indicating that under the effect of program alias, exact-match may not be suitable as it may massively underestimate the performance. At last, given a large number of semantically equivalent logical forms, it would be valuable to explore whether they can be leveraged to improve semantic parsing (Zhong et al., 2018). + +# 5.3 Grammar Rules + +Table 7 presents the experimental results of the grammar-based (w/o copy) model trained with different sets of grammar rules. As the table shows, there is a notable performance discrepancy between different sets of rules. For example, in ATIS, we can observe $2.5\%$ absolute improvement when the model is trained with G2 for Lambda Calculus. Moreover, G2 is not always better than G1. While the model trained with G2 for Prolog outperforms + +G1 in Geo, it lags behind G1 in ATIS. This observation motivates us to consider what factors contribute to the discrepancy. We had tried to explore the search space of logical forms defined by different grammar rules and the distribution drift between the AST of logical forms in the training and test set. However, the exploration results cannot consistently explain the performance discrepancy. As our important future work, we would explore whether or not the discrepancy is caused by better alignments between utterances and grammar rules. Intuitively, it would be easier for decoders to learn the set of grammar rules having better alignments with utterances. + +We can learn from these results that similar to traditional semantic parsers, properly transforming grammar rules for MRs can also lead to better performance in neural approaches. Therefore, grammar rules should be considered as a very important hyper-parameter of grammar-based models, and it is recommended to mention the used grammar rules in research papers clearly. + +# 6 Related Work + +Meaning representations for semantic parsing. Recent work has shown that properly designing new MRs often helps improve the performance of neural semantic parsing. Except for the four MRs that we study, Liang et al. (2011); Liang (2013) presented DCS and lambda DCS for querying knowledge bases and demonstrated their advantages over Lambda Calculus. Guo et al. (2019) proposed SemQL, an MR for relational database queries, and they showed improvements in the Spider benchmark. Wolfson et al. (2020) designed an MR, named QDMR, for representing the meaning of questions through question decomposition. Instead of designing new MRs, Cheng et al. (2019) proposed a transition-based semantic parsing approach that supports generating tree-structured logical forms in either top-down or bottom-up manners. Their experimental results on various semantic parsing datasets using FunQL showed that top-down generation outperforms bottom-up in various settings. Our work aims to investigate the characteristics of different MRs and their impact on neural semantic parsing. + +Ungrounded semantic parsing. Except for the grounded MRs studied in this work, there are also ungrounded MRs that are not tied to any particular applications, such as AMR (Banarescu et al., + +2013), MRS (Copestake et al., 2005; Flickinger et al., 2017), and UCCA (Abend and Rappoport, 2013). Abend and Rappoport (2017) conducted a survey on ungrounded MRs to assess their achievements and shortcomings. Hershcovich et al. (2019) evaluated the similarities and divergences in the content encoded by ungrounded MRs and syntactic representation. Lin and Xue (2019) carried out a careful analysis on AMR and MRS to understand the factors contributing to the discrepancy in their parsing accuracy. Partly inspired by this line of work, we conduct a study on grounded MRs and investigate their impact on neural semantic parsing. Hershcovich et al. (2018) proposed to leverage annotated data in different ungrounded MRs to improve parsing performance. With UNIMER, we can explore whether it is feasible in grounded semantic parsing. + +Extrinsic parser evaluation. Another line of research that is closely related to our work is extrinsic parser evaluation. Miyao et al. (2008) benchmarked different syntactic parsers and their representations, including dependency parsing, phrase structure parsing, and deep parsing, and evaluated their impact on an information extraction system. Oepen et al. (2017) provided a flexible infrastructure, including data and software, to estimate the relative utility of different types of dependency representations for a variety of downstream applications that rely on an analysis of grammatical structure of natural language. There has not been work on benchmarking MRs for grounded semantic parsing in neural approaches, to the best of our knowledge. + +Weakly supervised semantic parsing. In this paper, we focus on supervised learning for semantic parsing, where each utterance has its corresponding logical form annotated. But the similar evaluation methodology could be applied to weakly supervised semantic parsing, which receives wide attention because parsers are only supervised with execution results and annotated logical forms are no longer required (Berant et al., 2013; Pasupat and Liang, 2015; Goldman et al., 2018; Liang et al., 2018; Mueller et al., 2019). We also notice that various MRs have been used in weakly supervised semantic parsing, and it would be valuable to explore the impact of MRs in such settings. + +# 7 Conclusion + +In this work, we propose UNIMER, a unified benchmark on meaning representations, based on established semantic parsing datasets; UNIMER covers three domains and four different meaning representations along with their execution engines. UNIMER allows researchers to comprehensively and fairly evaluate the performance of their approaches. Based on UNIMER, we conduct an empirical study to understand the characteristics of different meaning representations and their impact on neural semantic parsing. By open-sourcing our source code and benchmark, we believe that our work can facilitate the community to inform the design and development of next-generation MRs. + +Implications. Our findings have clear implications for future work. First, according to our experimental results, FunQL tends to outperform Lambda Calculus and Prolog in neural semantic parsing. Additionally, FunQL is relatively robust against program alias. Hence, when developers need to design an MR for a new domain, FunQL is recommended to be the first choice. Second, to reduce program alias' negative effect on neural semantic parsing, developers should define a concrete protocol for annotating logical forms to ensure their consistency. Specifically, given an MR, developers should identify as many as possible sources where program alias can occur. Take SQL as an example. To express the argmax semantics, one can either use subquery or the OrderBy clause. $^{8}$ Having identified these sources, developers need to determine using which expression in what context, e.g., argmax is always expressed with subquery, and the unordered expressions in conjunctions are always sorted by characters. + +# Acknowledgments + +We would like to thank Bei Chen for helpful discussions and thank the anonymous reviewers for their constructive comments. Ting Liu was partially supported by NSFC (61632015, 61721002) and State Grid R&D Program (5226SX1800FC). + +# References + +Omri Abend and Ari Rappoport. 2013. UCCA: A semantics-based grammatical annotation scheme. In Proceedings of the 10th International Conference + +on Computational Semantics, pages 1-12, Potsdam, Germany. Association for Computational Linguistics. +Omri Abend and Ari Rappoport. 2017. The state of the art in semantic representation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 77-89, Vancouver, Canada. Association for Computational Linguistics. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +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. +Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on Freebase from question-answer pairs. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1533-1544, Seattle, Washington, USA. Association for Computational Linguistics. +Ben Bogin, Matt Gardner, and Jonathan Berant. 2019. Global reasoning over database structures for text-to-SQL parsing. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 3659-3664, Hong Kong, China. Association for Computational Linguistics. +Rudy Bunel, Matthew Hausknecht, Jacob Devlin, Rishabh Singh, and Pushmeet Kohli. 2018. Leveraging grammar and reinforcement learning for neural program synthesis. In International Conference on Learning Representations. +Mary Elaine Califf and Raymond J. Mooney. 1999. Relational learning of pattern-match rules for information extraction. In Proceedings of the 16th National Conference on Artificial Intelligence and the 7th Innovative Applications of Artificial Intelligence Conference Innovative Applications of Artificial Intelligence, page 328-334, USA. American Association for Artificial Intelligence. +Ruisheng Cao, Su Zhu, Chen Liu, Jieyu Li, and Kai Yu. 2019. Semantic parsing with dual learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 51-64, Florence, Italy. Association for Computational Linguistics. +Bo Chen, Xianpei Han, Ben He, and Le Sun. 2020. Learning to map frequent phrases to sub-structures + +of meaning representation for neural semantic parsing. In Proceedings of the 34th AAAI Conference on Artificial Intelligence, pages 7546-7553. AAAI Press. +Jianpeng Cheng, Siva Reddy, Vijay Saraswat, and Mirella Lapata. 2019. Learning an executable neural semantic parser. Computational Linguistics, 45(1):59-94. +Ann Copestake, Dan Flickinger, Carl Pollard, and Ivan A. Sag. 2005. Minimal recursion semantics: An introduction. Research on Language & Computation, 3(4):281-332. +Deborah A. Dahl, Madeleine Bates, Michael Brown, William Fisher, Kate Hunicke-Smith, David Pallett, Christine Pao, Alexander Rudnicky, and Elizabeth Shriberg. 1994. Expanding the scope of the atis task: The atis-3 corpus. In Proceedings of the Workshop on Human Language Technology, page 43-48, USA. 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, 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, pages 731-742, Melbourne, Australia. Association for Computational Linguistics. +Catherine Finegan-Dollak, Jonathan K. Kummerfeld, Li Zhang, Karthik Ramanathan, Sesh Sadasivam, Rui Zhang, and Dragomir Radev. 2018. Improving text-to-SQL evaluation methodology. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 351-360, Melbourne, Australia. Association for Computational Linguistics. +Dan Flickinger, Stephan Oepen, and Emily M. Bender. 2017. Sustainable Development and Refinement of Complex Linguistic Annotations at Scale, pages 353-377. Springer Netherlands, Dordrecht. +Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F. Liu, Matthew Peters, Michael Schmitz, and Luke Zettlemoyer. 2018. Allennlp: A deep semantic natural language processing platform. In Proceedings of Workshop for NLP Open Source Software, pages 1-6, Melbourne, Australia. Association for Computational Linguistics. +Omer Goldman, Veronica Latcinnik, Ehud Nave, Amir Globerson, and Jonathan Berant. 2018. Weakly supervised semantic parsing with abstract examples. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 1809-1819, Melbourne, Australia. Association for Computational Linguistics. + +Jiaqi Guo, Zecheng Zhan, Yan Gao, Yan Xiao, Jian-Guang Lou, Ting Liu, and Dongmei Zhang. 2019. 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. +Daniel Hershcovich, Omri Abend, and Ari Rappoport. 2018. Multitask parsing across semantic representations. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, pages 373-385, Melbourne, Australia. Association for Computational Linguistics. +Daniel Hershcovich, Omri Abend, and Ari Rappoport. 2019. Content differences in syntactic and semantic representation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 478-488, Minneapolis, Minnesota. Association for Computational Linguistics. +Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, Jayant Krishnamurthy, and Luke Zettlemoyer. 2017. Learning a neural semantic parser from user feedback. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 963-973, Vancouver, Canada. Association for Computational Linguistics. +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, pages 12-22, Berlin, Germany. Association for Computational Linguistics. +Rohit J. Kate. 2008. Transforming meaning representation grammars to improve semantic parsing. In Proceedings of the 12th Conference on Computational Natural Language Learning, pages 33-40, Manchester, England. Coling 2008 Organizing Committee. +Rohit J. Kate and Raymond J. Mooney. 2006. Using string-kernels for learning semantic parsers. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pages 913-920, Sydney, Australia. Association for Computational Linguistics. +Rohit J. Kate, Yuk Wah Wong, and Raymond J. Mooney. 2005. Learning to transform natural to formal languages. In Proceedings of the 20th National Conference on Artificial Intelligence, page 1062-1068. AAAI Press. +Tom Kwiatkowski, Luke Zettlemoyer, Sharon Goldwater, and Mark Steedman. 2010. Inducing probabilistic CCG grammars from logical form with higher-order unification. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 1223-1233, Cambridge, MA. Association for Computational Linguistics. + +Tom Kwiatkowski, Luke Zettlemoyer, Sharon Goldwater, and Mark Steedman. 2011. Lexical generalization in CCG grammar induction for semantic parsing. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pages 1512-1523, Edinburgh, Scotland, UK. Association for Computational Linguistics. +Chen Liang, Mohammad Norouzi, Jonathan Berant, Quoc V Le, and Ni Lao. 2018. Memory augmented policy optimization for program synthesis and semantic parsing. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 9994-10006. Curran Associates, Inc. +Percy Liang. 2013. Lambda dependency-based compositional semantics. arXiv preprint arXiv:1309.4408. +Percy Liang, Michael Jordan, and Dan Klein. 2011. Learning dependency-based compositional semantics. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 590-599, Portland, Oregon, USA. Association for Computational Linguistics. +Zi Lin and Nianwen Xue. 2019. Parsing meaning representations: Is easier always better? In Proceedings of the First International Workshop on Designing Meaning Representations, pages 34-43, Florence, Italy. Association for Computational Linguistics. +Thang Luong, Hieu Pham, and Christopher D. Manning. 2015. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1412-1421, Lisbon, Portugal. Association for Computational Linguistics. +Yusuke Miyao, Rune Sætre, Kenji Sagae, Takuya Matsuzaki, and Jun'ichi Tsujii. 2008. Task-oriented evaluation of syntactic parsers and their representations. In Proceedings of the 46th Annual Meeting of the Association for Computation Linguistics: Human Language Technologies, pages 46-54, Columbus, Ohio. Association for Computational Linguistics. +Thomas Mueller, Francesco Piccinno, Peter Shaw, Massimo Nicosia, and Yasemin Altun. 2019. Answering conversational questions on structured data without logical forms. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 5902-5910, Hong Kong, China. Association for Computational Linguistics. +Stephan Oepen, Lilja Øvrelid, Jari Björne, Richard Johansson, Emanuele Lapponi, Filip Ginter, and Erik Velldal. 2017. The 2017 shared task on extrinsic parser evaluation. towards a reusable community infrastructure. In Proceedings of the 2017 Shared Task on Extrinsic Parser Evaluation at the Fourth International Conference on Dependency Linguistics and + +the 15th International Conference on Parsing Technologies. Pisa, Italy, pages 1-16. +Panupong Pasupat and Percy Liang. 2015. Compositional semantic parsing on semi-structured tables. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pages 1470–1480, Beijing, China. 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 Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 8024-8035. Curran Associates, Inc. +Ana-Maria Popescu, Oren Etzioni, and Henry Kautz. 2003. Towards a theory of natural language interfaces to databases. In Proceedings of the 8th International Conference on Intelligent User Interfaces, page 149-157, New York, NY, USA. Association for Computing Machinery. +Maxim Rabinovich, Mitchell Stern, and Dan Klein. 2017. Abstract syntax networks for code generation and semantic parsing. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 1139-1149, Vancouver, Canada. Association for Computational Linguistics. +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. +Zeyu Sun, Qihao Zhu, Yingfei Xiong, Yican Sun, Lili Mou, and Lu Zhang. 2020. Treegen: A tree-based transformer architecture for code generation. In Proceedings of the 34th AAAI Conference on Artificial Intelligence, pages 8984-8991. AAAI Press. +Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. In Proceedings of the 27th International Conference on Neural Information Processing Systems, page 3104-3112, Cambridge, MA, USA. MIT Press. +Adrienne Wang, Tom Kwiatkowski, and Luke Zettlemoyer. 2014. Morpho-syntactic lexical generalization for CCG semantic parsing. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, pages 1284-1295, Doha, Qatar. Association for Computational Linguistics. + +Bailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov, and Matthew Richardson. 2020. RAT-SQL: Relation-aware schema encoding and linking for text-to-SQL parsers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7567-7578, Online. Association for Computational Linguistics. +Tomer Wolfson, Mor Geva, Ankit Gupta, Matt Gardner, Y. Goldberg, D. Deutch, and Jonathan Berant. 2020. Break it down: A question understanding benchmark. Transactions of the Association for Computational Linguistics, 8:183-198. +Yuk Wah Wong and Raymond Mooney. 2006. Learning for semantic parsing with statistical machine translation. In Proceedings of the Human Language Technology Conference of the NAACL, Main Conference, pages 439-446, New York City, USA. Association for Computational Linguistics. +Yuk Wah Wong and Raymond Mooney. 2007. Learning synchronous grammars for semantic parsing with lambda calculus. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pages 960-967, Prague, Czech Republic. Association for Computational Linguistics. +Pengcheng Yin and Graham Neubig. 2017. A syntactic neural model for general-purpose code generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 440-450, Vancouver, Canada. Association for Computational Linguistics. +Pengcheng Yin and Graham Neubig. 2018. TRANX: A transition-based neural abstract syntax parser for semantic parsing and code generation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 7-12, Brussels, Belgium. Association for Computational Linguistics. +John M. Zelle and Raymond J. Mooney. 1996. Learning to parse database queries using inductive logic programming. In Proceedings of the 13th National Conference on Artificial Intelligence, page 1050-1055. AAAI Press. +Luke Zettlemoyer and Michael Collins. 2007. Online learning of relaxed CCG grammars for parsing to logical form. In Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, pages 678-687, Prague, Czech Republic. Association for Computational Linguistics. +Luke S. Zettlemoyer and Michael Collins. 2005. Learning to map sentences to logical form: Structured classification with probabilistic categorial grammars. In Proceedings of the Twenty-First Conference on Uncertainty in Artificial Intelligence, page 658-666, Arlington, Virginia, USA. AUAI Press. + +Kai Zhao and Liang Huang. 2015. Type-driven incremental semantic parsing with polymorphism. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1416-1421, Denver, Colorado. Association for Computational Linguistics. + +Zexuan Zhong, Jiaqi Guo, Wei Yang, Jian Peng, Tao Xie, Jian-Guang Lou, Ting Liu, and Dongmei Zhang. 2018. SemRegex: A semantics-based approach for generating regular expressions from natural language specifications. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1608-1618, Brussels, Belgium. Association for Computational Linguistics. + +# A Supplemental Material + +# Algorithm 1: Translation of Lambda Calculus Logical Forms to FunQL + +Input: A Lambda Calculus logical form $p$ +Output: A FunQL logical form $f$ + +1 types $=$ InferTypes $(p)$ +2 tokens $=$ Tokenize $(p)$ +3 expressions, stack $= \left[ \begin{array}{l}1, \end{array} \right]$ ; +4 $i = 0$ +5 for $t\in$ tokens do + +6 if $t = =$ (’then +7 | Appendstack,i); +8 else if $t = =$ )’ then +9 $j = =$ Pop stack); +10 e $\equiv$ Search(expressions, j, i); +11 Remove(e); +12 ne $\equiv$ Translate(tokens[j:i],e, types); +13 Append(expressions,ne); +14 $i + = 1;$ + +15 end + +16 $f =$ expressions[0]; + +# A.1 Details of Benchmark Construction + +Geo. Since the four MRs we study have annotated logical forms and have execution engines except for Lambda Calculus in Geo, we directly use them (SQL taken from (Finegan-Dollak et al., 2018), Prolog taken from (Jia and Liang, 2016), FunQL taken from (Wong and Mooney, 2006), and Lambda Calculus taken from (Kwiatkowski et al., 2010)). We implement an execution engine with Haskell for Lambda Calculus. With these resources, we crossvalidate the correctness of annotations and execution engines by comparing the execution results of logical forms. As a result, we found nearly 30 Prolog logical forms with annotation mistakes and two bugs in the execution engines of Prolog and FunQL. + +ATIS. There are only annotated logical forms for Lambda Calculus and SQL in ATIS. We directly use Lambda Calculus logical forms provided by (Jia and Liang, 2016) and SQL queries provided by (Iyer et al., 2017). To provide annotations for FunQL and Prolog, we semi-automatically translate Lambda Calculus logical forms to equivalent logical forms in FunQL and Prolog. Algorithm 1 presents the pseudo code for translating a Lambda Calculus logical form to FunQL. Basically, we first + +
ApproachMRExactExec
Geo
Kwiatkowski et al. (2010)FunQL84.3-
Shaw et al. (2019)*FunQL89.3-
Jia and Liang (2016)*Prolog-89.3
- data augmentationProlog-85.0
Chen et al. (2020)*Prolog-89.6
Kwiatkowski et al. (2010)λ87.9-
Wang et al. (2014)λ90.4-
Zhao and Huang (2015)λ88.9-
Dong and Lapata (2016)*†λ87.1-
Rabinovich et al. (2017)*†λ87.1-
Dong and Lapata (2018)*†λ88.2-
Sun et al. (2020)*†λ89.1-
Iyer et al. (2017)*†SQL-82.5
ATIS
Wang et al. (2014)λ91.3-
Zhao and Huang (2015)λ84.2-
Jia and Liang (2016)*λ83.3-
- data augmentationλ76.3-
Dong and Lapata (2016)*†λ84.6-
Rabinovich et al. (2017)*†λ85.9-
Yin and Neubig (2018)*†λ88.2-
Dong and Lapata (2018)*†λ87.7-
Cao et al. (2019)*†λ89.1-
Sun et al. (2020)*†λ89.6-
Shaw et al. (2019)*λ87.1-
Iyer et al. (2017)*†SQL-79.2
Jobs
Zettlemoyer and Collins (2005)λ79.3-
Zhao and Huang (2015)λ85.0-
Dong and Lapata (2016)*†Prolog90.0-
Rabinovich et al. (2017)*†Prolog91.4-
Chen et al. (2020)*Prolog-92.1
+ +Table 8: Performance of semantic parsing approaches, where * denotes neural approaches and † denotes approaches using data anonymization techniques. ‘λ’ denotes Lambda Calculus. ‘Exact’ and ‘Exec’ denote exact-match and execution-match, respectively. + +perform a type inference for variables in the logical form, since some predicates in Lambda Calculus can take different types of variables as input, e.g., for the predicate to $(\mathsf{A},\mathsf{B})$ , variable B can be either an airport or a city. Then, we tokenize the input logical form and recursively translate each sub-expression in the logical form into FunQL expressions based on the predicates we design for FunQL. Translation from Lambda Calculus to Prolog is performed in a similar way. The source code for translation is also available in our Github repository. We also implement execution engines for Lambda Calculus, Prolog, and FunQL. + +Job. There are only annotated logical forms for Lambda Calculus and Prolog in Job. We directly use Prolog logical forms provided on the website. To provide annotations for FunQL, we semi + +automatically translate Prolog logical forms to equivalent logical forms in FunQL with an algorithm similar to Algorithm 1. In terms of SQL, the logical forms in Job are relatively simple and can be expressed with the SELECT, FROM and WHERE clauses of SQL. We simply translate each subexpression in Prolog to an expression in WHERE clause and use a conjunction to join the resulting expressions. Since we cannot find the annotated Lambda Calculus logical forms provided by (Zettlemoyer and Collins, 2005), we also translate the Prolog logical forms to Lambda Calculus. We implement execution engines for Lambda Calculus and FunQL. + +# A.2 Model Configuration + +Preprocessing of Prolog and Lambda Calculus As Prolog and Lambda Calculus have variables, we need to standardize their variable naming before training. Following (Jia and Liang, 2016), we preprocess the Prolog logical forms to the De Brujin index notation. We standardize the variable naming of Lambda Calculus based on their occurrence order in logical forms. + +Attention Copying Mechanism. In Geo and Job, we use the standard copy mechanism, i.e., directly copying a source word to a logical form. In ATIS, following (Jia and Liang, 2016), we leverage an external lexicon to identify potential copy candidates, e.g., slc: ap can be identified as a potential entity for description "salt lake city airport" in utterance. When we copy a source word that is part of a phrase in the lexicon, we write the entity associated with that lexicon entry to a logical form. + +Hyper-Parameters. For the seq2seq model, the embedding dimension of both source and target languages ranges over $\{100, 200\}$ . We select a one-layer bi-directional LSTM as an encoder. The hidden dimension of the encoder ranges over $\{32, 64, 128, 256\}$ . Similarly, a one-layer LSTM is selected as the decoder. Its hidden dimension is as same as the encoder. In terms of attention, we select bi-linear as the activation function, where the hidden dimension is 2 times that of the encoder. We employ dropout at training time with rate ranging over $\{0.1, 0.2, 0.3\}$ . We select batch size from $\{16, 32, 48, 64\}$ , and select learning rate from $\{0.001, 0.0025, 0.005, 0.01, 0.025, 0.05\}$ . Following (Dong and Lapata, 2016), we use the RMSProp algorithm to update the parameters. The smoothing constant of RMSProp is 0.95. We initialize all + +parameters uniformly at random within the interval $[-0.1, 0.1]$ . + +Similarly, for the grammar-based model, a one-layer bi-directional LSTM is used as an encoder and another LSTM is employed as a decoder. The layers of the decoder are selected from $\{1,2\}$ . The hidden dimension of the encoder ranges over $\{64, 128, 256\}$ . The hidden dimension of the decoder is 2 times that of the encoder. The hidden dimension of both the grammar rule and non-terminal is selected from $\{64, 128, 256\}$ . We also employ dropout in the encoder and decoder at training time with rate selected from $\{0.1, 0.2, 0.3\}$ . We select batch size from $\{16, 32, 48, 64\}$ , and select learning rate from $\{0.001, 0.0025, 0.005, 0.01, 0.025, 0.05\}$ . We use the Adam algorithm to update the parameters. + +For both models, gradients are clipped at 5 to alleviate the exploding gradient problem, and early stopping is used to determine the number of epochs. We provide the detailed configurations of the NNI platform in our Github repository. + +# A.3 Search for Aliases for Logical Forms. + +Algorithm 2: Search for Program Alias +Prolog Shuffle: +Prolog Remove: +Prolog Merge: +FunQL Swap: +FunQL Replace: +SQL Argmax: +Input: A logical form $p$ +Output: A set of aliases of the input logical form aliases +1 $ast = \mathrm{Parse}(p)$ . +2 aliases $= []$ . +3 for $r\in$ Rules do +4 $C = \mathrm{Apply}(\mathrm{ast},r)$ . +5 for $c\in C$ do +6 if IsEquivalent(p, c) then 7 | Append(aliases,c); +8 end +9 end + +Algorithm 2 presents the way we search for aliases for a logical form. Transformation rules can be categorized into two groups based on whether they are domain-specific. Considering the following two logical forms: + +Lambda A:e (exists B (and (flight B) (fare B A)))) + +Lambda A:e (exists B (and (flight B) (equals (fare B) A)))) + +they are semantically equivalent due to the multiple meaning definitions of fare. There are also + +Rule Description +Prolog Shuffle expressions in conjunction Remove redundant expressions Merge Put expressions into higher-order predicates Lambda Calculus Shuffle expressions in conjunction Replace Replace semantically equivalent predicates +FunQL Shuffle expressions in conjunction Remove redundant expressions Swap Swap unit relation predicate Replace semantically equivalent predicates +SQL Shuffle expressions in Select, From, Where, and Having clauses Express Argmax/min with OrderBy and Limit clause instead of subquery Replace In clause with Join clause + +Table 9: Transformation rules for Prolog, Lambda Calculus and FunQL. + +domain-general transformation rules, e.g., permuting the expressions in the conjunction predicate: + +Lambda A:e (exists B (and (flight B) (fare B A)))) + +Lambda A:e (exists B (and (fare B A) (flight B)))) + +In this work, we primarily consider domain-general transformation rules and only when there is limited aliases found by domain-general rules, we use domain-specific rules. Table 9 presents the transformation rules we used in Geo domains. Rules in ATIS are similar. We provide examples below to illustrate the rules. + +answer(A,(area(B,A),const(B,stateid(Texas)))) +answer(A,(const(B,stateid(texas)),area(B,A,))) + +answer(A,(loc(B,A),city(B),const(B,cityid(Austin,_)))) +answer(A,(loc(B,A),const(B,cityid(Austin,_))) + +answer(A,state(A),loc(B,A),highest(B,place(B)))) +answer(A,(highest(B,placeB),locB,A),stateA)))) + +answer(count(major(city(loc_2(stateid(Texas)))))) +answer(count(city-major(loc_2(stateid(Texas))))))) + +answer(city(loc_2-largest(state(all)))) +answer(city(loc_2-largest_one(area_1(state(all)))) + +SELECT city.city_name FROM city WHERE city/population = (SELECT MAX(c1(population) FROM city as c1 WHERE c1.state_name = 'arizona') and city.state_name = 'arizona'; + +
MRGeoATIS
Prolog98.0%96.2%
Lambda Calculus69.7%95.3%
FunQL42.5%87.9%
SQL38.5%95.5%
+ +Table 10: Number of logical forms in training set of Geo and ATIS that have aliases. + +SELECT city.city_name FROM city WHERE state_name = 'arizona' ORDER BY city/population DESC LIMIT 1; + +# SQL In2Join: + +SELECT river.river_name FROM river WHERE river.traverse IN (SELECT state.state_name FROM state WHERE state.area = (SELECT MAX(s1.area) FROM state as s1)); + +SELECT river.river_name FROM river, state WHERE river.traverse = state.state_name AND state.area = (SELECT MAX(s1.area) FROM state as s1); + +Table 10 presents the number of logical forms in the training set of Geo and ATIS that have aliases, from which we can see that with these simple rules, we are able to find a lot of aliases. Since the logical forms in Geo are generally simpler than that of ATIS, the number of Geo is lower than ATIS. + +# A.4 Grammar + +We present the grammar rules used in our experiments for Geo (Figure 4-11). The grammar rules for different MRs in ATIS follow a similar definition. It is important to note that although all logical forms in an MR can be modeled by both G1 and G2, they are not necessarily equivalent in expressiveness. For example, answer (largest(place(all))) is a syntactically correct but semantically incorrect FunQL logical form in Geo, because the predicate largest is not allowed to take places as input. However, G2 of FunQL still can accept this logical form, while G1 cannot, because G1 explicitly encodes type constraints in the its rules. Nevertheless, the performance of G1 is lower than G2 in both Geo and ATIS domains, which is surprising. For all the grammar rules we present, G1 and G2 for Prolog and Lambda Calculus and equivalent. G1 and G2 for FunQL and SQL are not equivalent. + +![](images/c51f933ce99dfd63e4d41d2742df58644cf4a1f90ca6e46686ce891d9de520f3.jpg) +Figure 4: The grammar rules for Prolog in Geo induced by (Wong and Mooney, 2007) (G1). + +```txt +statement := "answer(" var ", " goal ")" +goal := "(" predicate conjunction ")" | meta | unit Relation +conjunction := "=" | ", predicate conjunction +predicate := "not" declaration | "not(([ " predicate conjunction ])" +meta := count | fewest | highest | largest | longest | lowest +most | shortest | smallest | sum +unit Relation := is_capital | is_city | is_lake | ismajor +is_mountain | is_place | is_river | is_state +binary Relation := is_area | is_capital_of | is_density | is_elevation +isEqual | is_high_point | is_higher | is_len +is Located_in | is_longer | is_low_point | is_lower +is_next_to | is_populonl | is_size | is_traverse +declaration := "const(" var ", " object ") +object := "countryid(usa)" | city | place | river | state +retrieve := area | len | population +var := "a" | "b" | "c" | "d" | "e" | "f" | "g" | "nv" | "v0" +| "v1" | "v2" | "v3" | "v4" | "v5" | "v6" | "v7" +is_capital := "capital(" var "); +is_capital_of := "capital(" var ", " var "); +is_city := "city(" var "); +is_density := "density(" var ", " var "); +is_elevation := "elevation(" var ", " literal "); +| elevation(" var ", " var "); +isequal := "equal(" var ", " var "); +is_high_point := "high_point(" var ", " var "); +is_higher := "higher(" var ", " var "); +is_lake := "lake(" var "); +is_len := "len(" var ", " var "); +is Located_in := "loc(" var ", " var "); +is_longer := "longer(" var ", " var "); +is_low_point := "low_point(" var ", " var "); +is_lower := "lower(" var ", " var "); +ismajor := "major(" var "); +is_mountain := "mountain(" var "); +is_next_to := "next_to(" var ", " var "); +is_place := "place(" var "); +is_populonl := "population(" var ", " var "); +is_river := "river(" var "); +is_size := "size(" var ", " var "); +is_state := "state(" var "); +is_traverse := "traverse(" var ", " var "); +largest := "largest(" var ", " goal "); +len := "len(" var "); +longest := "longest(" var ", " goal "); +lowest := "lowest(" var ", " goal "); +most := "most(" var ", " var ", " goal "); +shortest := "shortest(" var ", " goal "); +smallest := "smallest(" var ", " goal "); +statement := "answer(" var ", " goal "); +sum := "sum(" var ", " goal ", " var "); +count := "count(" var ", " goal ", " var "); +fewest := "fewest(" var ", " var ", " goal "); +highest := "highest(" var ", " goal "); +state := "stateid(" state_name.") +river := "riverid(" river_name.") +city := "cityid(" city_name", " state_abbrev.") +place := "placeid(" place_name.") +river := "riverid(" river_name.") +state_name := "Texas" | "illinois" | ... | "kentucky" +city_name := "albany" | "chicago" | ... | "columbus" +place_name := "mount mckinley" | ... | "death valley" +river_name := "ohio" | "colorado" | ... | "red" +state_bbbrev := "dc" | "sd" | ... | "me" +literal := "\theta" | 1.0 +``` + +Figure 5: The grammar rules that we induce for Prolog in Geo (G2). + +```txt +statement := expression +expression := abstraction | application | constant | variable +abstraction := ("lambda" variable_defined expression ) + +application := "( " function ) + +constant := "0:i" | "death_valley:lo" | "usa:co" | city +}| mountain | names | place | river | state +variable := "$0" | "$1" | "$2" | "$3" | "$4" +polyvariadic_expression := "" +variable-definition := "$0:e" | "$0:i" | "$1:e" | "$2:e" +function := "<:i,i,t>") expression expression + ":=:") expression expression + ":") expression expression + "And: " application polyvariadic_expression + "area: " expression + "argmax: , ) " expression expression + "argmin: , ) " expression expression + "capital2: ") " expression expression + "capital: ") " expression + "capital: ") " expression expression + "capital: ") " expression | "city:") " expression expression + "density: " expression + "Elevation: ") " expression expression + "Elevation: " expression + "equals: ") " expression expression + "exists: , t>" expression + "Forall: , t>" expression + "high_point: ") " expression expression + "high_point: e,e,l>" expression + "in: ") " expression expression + "lake: " expression | "len:r,i>") " expression + "loc: ") " expression expression + "major: " expression | "mountain:" expression + "name: e,e,n,t>") " expression expression + "next_to: ") " expression expression + "Not: " expression + "population: ") " expression expression + "population: " expression + "state: " expression + "sum: , ") " expression expression + "The:") " expression +state := "oklahoma:s" | "mississippi:s" | ... | "arkansas" +city := "albany_ny:c" | "chicago_il:c" | ... | "columbus_oh:c" +place := "mount_mckinley:p" | "mount_chinney:p" +river := "mississippi_river:r" | ... | "colorado_river:r" +mountain := "mount_mckinley:m" | ... | "mount_chinney:m" +name := "austin:n" | ... | "springfield:n" +``` + +Figure 6: The grammar rules that for Lambda Calculus in Geo (G1). + +![](images/ff07be0adfee70b2b73c0402abc4e2f1c35fdf9aa5ba47c62f1c83fbe881e590.jpg) +Figure 7: The grammar rules that for Lambda Calculus in Geo (G2). + +![](images/cf8ad24ee5c30942110089614dd25c8a99eb74c4dc45f9f768845ccbcb3f0118.jpg) +Figure 8: The grammar rules for FunQL in Geo induced by (Wong and Mooney, 2006) (G1). + +```autohotkey +answer := "answer(" predicate ")" +predicate := "exclude(" predicate ", " predicate ")" +| "intersection(" predicate ", " predicate ")") +collection | meta | object | relation +collection := all_capital_cities | all_cities | all_lakes +| allMountains | all Places | all_rivers | all_states +meta := count | fewest | highest | largest | largest_one_area +| largest_one_density | largest_one_population +| longest | lowest | most | shortest | smallest +| smallest_one_area | smallest_one_density +| smallest_one_population | sum +object := "countryid('usa')" | city | place | river | state +relation := is_area_state | is_capital | is_capital_city +| is_capital_country | is_city | is_density_place +| is_elevation_place | is_elevation_value +| is_high_point_place | is_high_point_state +| is_high_point_place_2 | is_lake | is_len | is_location_x +| is_location_y | is_longer | is_low_point_place +| is_low_point_state | is_lower_place_2 | ismajor +| is_mountain | is_next_to_state_1 | is_next_to_state_2 +| is_place | is_population | is_river | is_size +| is_state | is_traverse_river | is_traverse_state +all_capital_cities := "capital(all)" +all_cities := "city(all)" +all_lakes := "late(all)" +all_mountains := "mountain(all)" +all Places := "place(all)" +all_rivers := "river(all)" +all_states := "state(all)" +count := "count(" predicate ")" +fewest := "fewest(" predicate ")" +highest := "highest(" predicate ")" +largest := "largest(" predicate ")" +largest_one_area := "largest_one(area_1(" predicate *))" +| largest_one_density := "largest_one(area_1(" predicate ))" +| largest_one_population := "largest_one(population_1(" predicate ))" +| longest := "longest(" predicate ")" +lowest := "lowest(" predicate ")" +most := "most(" predicate ")" +shortest := "shortest(" predicate ")" +smallest := "smallest(" predicate ")" +smallest_one_area := "smallest_one(area_1(" predicate *))" +smallest_one_density := "smallest_one Density_1(" predicate *))" +smallest_one_population := "smallest_one(population_1(" predicate ))" +sum := "sum(" predicate ")" +city := "cityid(" city_name", "state_abbr ")" +state := "stateid(" state_name ")" +place := "placed(" place_name ")" +river := "riverid(" river_name ")" +is_area_state := "area_1(" predicate ")" +is_capital := "capital(" predicate ")" +is_capital_city := "capital_2(" predicate ")" +is_capital_country := "capital_1(" predicate ")" +is_city := "city(" predicate ")" +is_density_place := "density_1(" predicate ")" +is_elevation_place := "elevation_1(" predicate ")" +is_elevation_value := "elevation_2(" number ")" +is_high_point_place := "high_point_2(" predicate ")" +is_high_point_state := "high_point_1(" predicate ")" +is_higherness_place_2 := "higher_2(" predicate ")" +is_lake := "lake(" predicate ")" +is_len := "len(" predicate ")" +is_LOC_x := "loc_1(" predicate ")" +is_LOC_y := "loc_2(" predicate ")" +is_longer := "longer(" predicate ")" +is_low_point_place := "low_point_2(" predicate ")" +is_low_point_state := "low_point_1(" predicate ")" +is_lower_place_2 := "lower_2(" predicate ")" +is_major := "major(" predicate ")" +is_mountain := "mountain(" predicate ")" +is_next_to_state_1 := "next_to_1(" predicate ")" +is_next_to_state_2 := "next_to_2(" predicate ")" +is_place := "place(" predicate ")" +is_population := "population_1(" predicate ")" +is_river := "river(" predicate ")" +is_size := "size(" predicate ")" +is_state := "state(" predicate ")" +is_traverse_river := "traverse_1(" predicate ")" +is_traverse_state := "traverse_2(" predicate ")" +state_name := "Texas" | "illinois" | ... | "kentucky" +city_name := "albany" | "chicago" | ... | "columbus" +place_name := "mount mckinley" | ... | "death valley" +river_name := "ohio" | "colorado" | ... | "red" +state_abbrev = : dc" | sd" | ... | "me" +number = : 0" | 1.0" +``` + +Figure 9: The grammar rules that we induce for FunQL in Geo (G2). + +```txt +statement := mquery +mquery := select_clause from_clause groupby_clause having_clause orderby_clause limit +| select_clause from_clause groupby_clause having_clause orderby_clause +| select_clause from_clause groupby_clause having_clause +| select_clause from_clause groupby_clause having_clause +| select_clause from_clause groupby_clause orderby_clause +| select_clause from_clause groupby_clause +| select_clause from_clause groupby_clause +| select_clause from_clause orderby_clause limit +| select_clause from_clause orderby_clause +| select_clause from_clause where_groupby_clause having_clause orderby_clause limit +| select_clause from_clause where_groupby_clause having_clause +| select_clause from_clause where_groupby_clause having_clause +| select_clause from_clause where_groupby_clause having_clause +| select_clause from_clause where_groupby_clause orderby_clause limit +| select_clause from_clause where_groupby_clause orderby_clause +| select_clause from_clause where_groupby_clause +| select_clause from_clause where_groupby_clause +| select_clause from_clause where_groupby_clause +| select_clause from_clause where_groupby_clause +| select_clause from_clause where_groupby_clause +| select_clause from_clause where_groupby_clause +| select_clause from_clause where_groupby_clause +select clause := select_with_distinct select_results +select_with_distinct := "select distinct" | "select" +select_results := select_result "," select_results | select_result +select_result := subject "as" column_alias | subject selectop subject | subject +selectop := "+" | "-" | "/" +subject := col_ref | function +col_ref := column_name | table Alias "." column_name +function := fname ("distinct" col_ref ") | fname ("col_ref ")") +tablealias := "border_infoalias0" | ... | "statealias3" | "statealias4" | "statealias5" | "tmp" +table_name := "border_info" | "city" | "highlow" | "lake" | "mountain" | "river" | "state" +columnalias := "derived_fieldalias0" | "derived_fieldalias1" +column_name := "*" +fromClause := "from" source | "from" table_source joinClauses +source := single_source "," source | single_source +single_source := source_subq | table_source +source_subq := "(" mquery ") as" table Alias | "(" mquery ")" table_alias | "(" mquery ")" +table_source := table_name "as" table_alias | table_name +joinClauses := join_clause joinClauses | join_clause +join_clause := joinop table_source "on" join_conditionCLAuse +joinop := "join" | "left outer join" +join_conditionCLAuse := join_condition "and" join_conditionCLAuse | join_condition +join_condition := col_ref "=" col_ref +groupby_clause := "groupby" group_condition +group_condition := subject "," group_condition | subject +where_condition := "where" expr where_conj | "where" expr +where_conj := "and" expr where_conj | "and" expr | "or" expr where_conj | "or" expr +expr := subject "in ("mquery ")" | subject "not in(" mquery ")"" +| subject binaryop "(" mquery ")" | subject binaryop "all(" mquery ")"" +| subject binaryop "any(" mquery ")" | subject binaryop value +value := col_ref | nonLiteral_number | string +binaryop := "+" | "<" | "<=" | "<>" | "<>" | ">=" | "like" | "not like" +having_condition := "having" expr having_conj | "having" expr +having_conj := "and" expr having_conj | "and" expr | "or" expr having_conj | "or" expr +orderby_condition := "orderby" order_condition +orderable_condition := ordering_term ",," order_condition | ordering_term +ordering_term := subject ordering | subject +ordering := "asc" | "desc" +limit := "limit" nonLiteral_number +nonLiteral_number. := "150000" | "750" | "0" | "1" | "2" | "3" | "4" +``` + +Figure 10: The grammar rules that we adapt from (Bogin et al., 2019) for SQL Geo (G1). + +```txt +statement := mquery +mquery := query +query := select_core groupby_clause orderby_clause "limit 1" | select_core groupby_clause orderby_clause | select_core groupby_clause | select_core orderby_clause "limit 1" | select_core orderby_clause | select_core +select_core := select_with_distinct select_results from_clause where_clause | select_with_distinct select_results from_clause +select_with_distinct := "select distinct" | "select" +select_results := select_result"," select_results | select_result +select_result := col_ref selectop col_ref | col_ref | function "as" column alias | function selectop function | function +selectop := "+"| "-"|"/" +col_ref := column_name "as" column alias | column_name | tablealias"."column_name +function := fname "(distinct" arg_list_or_star)" | fname "(" arg_list_or_star ")") +fname := "all" | "avg" | "count" | "max" | "min" | "sum" +arg_list_or_star := "*|col_ref +column Alias := "derived_fieldalias0" | "derived_fieldalias1" +column_name := "*|area" | "border" | "capital" | ... | "population" | "river_name" | "state_name" +table alias := "border_infoalias0" | ... | "statealias3" | "statealias4" | "statealias5" | "tmp" +table_name := "border_info" | "city" | "highlow" | "lake" | "mountain" | "river" | "state" +from_clause := "from" source | "from" table_source joinClauses +table_source := table_name "as" table Alias +source := single_source ", source | single_source +single_source := ("mquery") as"table alias | table_source +joinClauses := join_clause joinClauses | join_clause +join_clause := joinop table_source "on" join_condition_clause +join_condition_clause := join_condition "and" join_condition_clause | join_condition +join_condition := col_ref "=" col_ref +joinop := "join" | "left outer join" +where_clause := "where" expr where_conj | "where" expr +where_conj := "and" expr where_conj | "and" expr | "or" expr where_conj | "or" expr +expr := col_ref "in" source_subq | col_ref "not in" source_subq | col_ref binaryop "all" source_subq | col_ref binaryop "any" source_subq | col_ref binaryop source_subq | col_ref binaryop value +source_subq := "(" query ")" +binaryop := !="|*"| "+"| "-"|"/" | "<" | "<>" | "<>" | ">}" | ">=" | "like" | not like" +value := col_ref | string +groupby_clause := "group by" group_clause having_clause | "group by" group_clause +group_clause := col_ref ",," group_clause | col_ref +having_clause := "having" having_expr having_conj | "having" having_expr +having_conj := "and" having_expr having_conj | "and" having_expr | "or" having_expr having_conj | "or" having_expr +having_expr := function "in" source_subq | function "notin" source_subq +function binaryop "all" source_subq | function binaryop "any" source_subq +function binaryop source_subq +orderby_clause := "orderby" order_clause +order_clause := ordering_term",," order_clause | ordering_term +ordering_term := ordering_expr ordering | ordering_expr +ordering := "asc" | "desc" +ordering_expr := col_ref | function +string := "'red'" | "'usa'" | city_name | digit_value | mountain_name | place | river_name | state_name +city_name := "\detroit\\"| ...|\"plano\\"|\"des moines\\" +digit_value := "750" | "0" | "150000" +mountain_name := "'mckinley'\"| ''whitney'%" +place := "'death valley'\"| ''mount mckinley'\"| ''guadalupe peak'%" +river_name := "'north platte'\"| ''chattahoochee'\"| ''rio grande'\"| ''potomac'%" +state_name := "'oregon'\"| ''georgia'\"| ...|''wisconsin'\"| ''montana'%" +``` + +Figure 11: The grammar rules that we induce for SQL Geo (G2). \ No newline at end of file diff --git a/benchmarkingmeaningrepresentationsinneuralsemanticparsing/images.zip b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..cce306c7df332c1c9ed96fd386ed593ef8f92189 --- /dev/null +++ b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3502dddde720b5f294c2757c03c88a559e221a7cce458bbed997be40148f9484 +size 943336 diff --git a/benchmarkingmeaningrepresentationsinneuralsemanticparsing/layout.json b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..364195498827027aa48c81a9dabb083653e98d0e --- /dev/null +++ b/benchmarkingmeaningrepresentationsinneuralsemanticparsing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03438329c4b38b2969c93b04b546b872528cb7d8fb0b4ea3f33dda7267df611b +size 507040 diff --git a/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_content_list.json b/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b1b6f3cec440f66b6398fc82053a2c81aa1a48e3 --- /dev/null +++ b/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:280ae0e170edf39d46a9ff56615eca442f775c38ac11a96c8e81d46a727df234 +size 70476 diff --git a/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_model.json b/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e5439111ef3202f634581c28099c9368737c4c99 --- /dev/null +++ b/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dcd7902ce2c43297180175b760380964f19852e5d5103133ca9596b9f7f7eac +size 84513 diff --git a/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_origin.pdf b/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7c6bc4305a8fa1802d2ede6a388a3f76a1f79c25 --- /dev/null +++ b/bertattackadversarialattackagainstbertusingbert/fc8eb6ed-b4de-43b7-8614-f23e196d0e52_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22a2f4de7d5fc71cdc943c3f65aeb968c906c389bdc1329b4770280e65607dfa +size 1093349 diff --git a/bertattackadversarialattackagainstbertusingbert/full.md b/bertattackadversarialattackagainstbertusingbert/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ab2453edf973d98346b0918d2b6d202cd63cac67 --- /dev/null +++ b/bertattackadversarialattackagainstbertusingbert/full.md @@ -0,0 +1,309 @@ +# BERT-ATTACK: Adversarial Attack Against BERT Using BERT + +Linyang Li, Ruotian Ma, Qipeng Guo, Xiangyang Xue, Xipeng Qiu* +Shanghai Key Laboratory of Intelligent Information Processing, Fudan University School of Computer Science, Fudan University 825 Zhangheng Road, Shanghai, China +{linyangli19, rtma19, qpguo16, xyxue, xpqiu}@fudan.edu.cn + +# Abstract + +Adversarial attacks for discrete data (such as texts) have been proved significantly more challenging than continuous data (such as images) since it is difficult to generate adversarial samples with gradient-based methods. Current successful attack methods for texts usually adopt heuristic replacement strategies on the character or word level, which remains challenging to find the optimal solution in the massive space of possible combinations of replacements while preserving semantic consistency and language fluency. In this paper, we propose BERT-Attack, a high-quality and effective method to generate adversarial samples using pre-trained masked language models exemplified by BERT. We turn BERT against its fine-tuned models and other deep neural models in downstream tasks so that we can successfully mislead the target models to predict incorrectly. Our method outperforms state-of-the-art attack strategies in both success rate and perturb percentage, while the generated adversarial samples are fluent and semantically preserved. Also, the cost of calculation is low, thus possible for large-scale generations. The code is available at https://github.com/LinyangLee/BERT-Attack. + +# 1 Introduction + +Despite the success of deep learning, recent works have found that these neural networks are vulnerable to adversarial samples, which are crafted with small perturbations to the original inputs (Goodfellow et al., 2014; Kurakin et al., 2016; Chakraborty et al., 2018). That is, these adversarial samples are imperceptible to human judges while they can mislead the neural networks to incorrect predictions. Therefore, it is essential to explore these adversarial attack methods since the ultimate goal is to make sure the neural networks are highly reliable + +and robust. While in computer vision fields, both attack strategies and their defense countermeasures are well-explored (Chakraborty et al., 2018), the adversarial attack for text is still challenging due to the discrete nature of languages. Generating of adversarial samples for texts needs to possess such qualities: (1) imperceptible to human judges yet misleading to neural models; (2) fluent in grammar and semantically consistent with original inputs. + +Previous methods craft adversarial samples mainly based on specific rules (Li et al., 2018; Gao et al., 2018; Yang et al., 2018; Alzantot et al., 2018; Ren et al., 2019; Jin et al., 2019; Zang et al., 2020). Therefore, these methods are difficult to guarantee the fluency and semantically preservation in the generated adversarial samples at the same time. Plus, these manual craft methods are rather complicated. They use multiple linguistic constraints like NER tagging or POS tagging. Introducing contextualized language models to serve as an automatic perturbation generator could make these rules designing much easier. + +The recent rise of pre-trained language models, such as BERT (Devlin et al., 2018), push the performances of NLP tasks to a new level. On the one hand, the powerful ability of a fine-tuned BERT on downstream tasks makes it more challenging to be adversarial attacked (Jin et al., 2019). On the other hand, BERT is a pre-trained masked language model on extremely large-scale unsupervised data and has learned general-purpose language knowledge. Therefore, BERT has the potential to generate more fluent and semantic-consistent substitutions for an input text. Naturally, both the properties of BERT motivate us to explore the possibility of attacking a fine-tuned BERT with another BERT as the attacker. + +In this paper, we propose an effective and high-quality adversarial sample generation method: BERT-Attack, using BERT as a language model + +to generate adversarial samples. The core algorithm of BERT-Attack is straightforward and consists of two stages: finding the vulnerable words in one given input sequence for the target model; then applying BERT in a semantic-preserving way to generate substitutes for the vulnerable words. With the ability of BERT, the perturbations are generated considering the context around. Therefore, the perturbations are fluent and reasonable. We use the masked language model as a perturbation generator and find perturbations that maximize the risk of making wrong predictions (Goodfellow et al., 2014). Differently from previous attacking strategies that require traditional single-direction language models as a constraint, we only need to inference the language model once as a perturbation generator rather than repeatedly using language models to score the generated adversarial samples in a trial and error process. + +Experimental results show that the proposed BERT-Attack method successfully fooled its finetuned downstream model with the highest attack success rate compared with previous methods. Meanwhile, the perturb percentage and the query number are considerably lower, while the semantic preservation is high. + +To summarize our main contributions: + +- We propose a simple and effective method, named BERT-Attack, to effectively generate fluent and semantically-preserved adversarial samples that can successfully mislead state-of-the-art models in NLP, such as fine-tuned BERT for various downstream tasks. +- BERT-Attack has a higher attacking success rate and a lower perturb percentage with fewer access numbers to the target model compared with previous attacking algorithms, while does not require extra scoring models therefore extremely effective. + +# 2 Related Work + +To explore the robustness of neural networks, adversarial attacks have been extensively studied for continuous data (such as images) (Goodfellow et al., 2014; Nguyen et al., 2015; Chakraborty et al., 2018). The key idea is to find a minimal perturbation that maximizes the risk of making wrong predictions. This minimax problem can be easily achieved by applying gradient descent over the continuous space of images (Miyato et al., 2017). + +However, adversarial attack for discrete data such as text remains challenging. + +# Adversarial Attack for Text + +Current successful attacks for text usually adopt heuristic rules to modify the characters of a word (Jin et al., 2019), and substituting words with synonyms (Ren et al., 2019). Li et al. (2018); Gao et al. (2018) apply perturbations based on word embeddings such as Glove (Pennington et al., 2014), which is not strictly semantically and grammatically coordinated. Alzantot et al. (2018) adopts language models to score the perturbations generated by searching for close meaning words in the word embedding space (Mrkšić et al., 2016), using a trial and error process to find possible perturbations, yet the perturbations generated are still not context-aware and heavily rely on cosine similarity measurement of word embeddings. Glove embeddings do not guarantee similar vector space with cosine similarity distance, therefore the perturbations are less semantically consistent. Jin et al. (2019) apply a semantically enhanced embedding (Mrkšić et al., 2016), which is context unaware, thus less consistent with the unperturbed inputs. Liang et al. (2017) use phrase-level insertion and deletion, which produces unnatural sentences inconsistent with the original inputs, lacking fluency control. To preserve semantic information, Glockner et al. (2018) replace words manually to break the language inference system (Bowman et al., 2015). Jia and Liang (2017) propose manual craft methods to attack machine reading comprehension systems. Lei et al. (2019) introduce replacement strategies using embedding transition. + +Although the above approaches have achieved good results, there is still much room for improvement regarding the perturbed percentage, attacking success rate, grammatical correctness and semantic consistency, etc. Moreover, the substitution strategies of these approaches are usually non-trivial, resulting in that they are limited to specific tasks. + +# Adversarial Attack against BERT + +Pre-trained language models have become mainstream for many NLP tasks. Works such as (Wallace et al., 2019; Jin et al., 2019; Pruthi et al., 2019) have explored these pre-trained language models from many different angles. Wallace et al. (2019) explored the possible ethical problems of learned knowledge in pre-trained models. + +# 3 BERT-Attack + +Motivated by the interesting idea of turning BERT against BERT, we propose BERT-Attack, using the original BERT model to craft adversarial samples to fool the fine-tuned BERT model. + +Our method consists of two steps: (1) finding the vulnerable words for the target model and then (2) replacing them with the semantically similar and grammatically correct words until a successful attack. + +The most-vulnerable words are the keywords that help the target model make judgments. Perturbations over these words can be most beneficial in crafting adversarial samples. After finding which words that we are aimed to replace, we use masked language models to generate perturbations based on the top-K predictions from the masked language model. + +# 3.1 Finding Vulnerable Words + +Under the black-box scenario, the logit output by the target model (fine-tuned BERT or other neural models) is the only supervision we can get. We first select the words in the sequence which have a high significance influence on the final output logit. + +Let $S = [w_0, \dots, w_i \dots]$ denote the input sentence, and $o_y(S)$ denote the logit output by the target model for correct label $y$ , the importance score $I_{w_i}$ is defined as + +$$ +I _ {w _ {i}} = o _ {y} (S) - o _ {y} \left(S _ {\backslash w _ {i}}\right), \tag {1} +$$ + +where $S_{\backslash w_i} = [w_0,\dots ,w_{i - 1},[\mathrm{MASK}],w_{i + 1},\dots ]$ is the sentence after replacing $w_{i}$ with [MASK]. + +Then we rank all the words according to the ranking score $I_{w_i}$ in descending order to create word list $L$ . We only take $\epsilon$ percent of the most important words since we tend to keep perturbations minimum. + +This process maximizes the risk of making wrong predictions, which is previously done by calculating gradients in image domains. The problem is then formulated as replacing these most vulnerable words with semantically consistent perturbations. + +# 3.2 Word Replacement via BERT + +After finding the vulnerable words, we iteratively replace the words in list $L$ one by one to find perturbations that can mislead the target model. Previous approaches usually use multiple human-crafted + +![](images/d66a6dc226fd810c086f9e84d8da00fe257ff7f9314f330b825550f32e46b811.jpg) +Figure 1: One step of our replacement strategy. + +rules to ensure the generated example is semantically consistent with the original one and grammatically correct, such as a synonym dictionary (Ren et al., 2019), POS checker (Jin et al., 2019), semantic similarity checker (Jin et al., 2019), etc. Alzantot et al. (2018) applies a traditional language model to score the perturbed sentence at every attempt of replacing a word. + +These strategies of generating substitutes are unaware of the context between the substitution positions (usually using language models to test the substitutions), thus are insufficient in fluency control and semantic consistency. More importantly, using language models or POS checkers in scoring the perturbed samples is costly since this trial and error process requires massive inference time. + +To overcome the lack of fluency control and semantic preservation by using synonyms or similar words in the embedding space, we leverage BERT for word replacement. The genuine nature of the masked language model makes sure that the generated sentences are relatively fluent and grammar-correct, also preserve most semantic information, which is later confirmed by human evaluators. Further, compared with previous approaches using rule-based perturbation strategies, the masked language model prediction is context-aware, thus dynamically searches for perturbations rather than simple synonyms replacing. + +Different from previous methods using complicated strategies to score and constrain the perturbations, the contextualized perturbation generator generates minimal perturbations with only one forward pass. Without running additional neural models to score the sentence, the time-consuming part is accessing the target model only. Therefore the process is extremely efficient. + +Algorithm 1 BERT-Attack +1: procedure WORD IMPORTANCE RANKING +2: $S = [w_0, w_1, \dots] //$ input: tokenized sentence +3: $Y \gets$ gold-label +4: for $w_i$ in $S$ do +5: calculate importance score $I_{w_i}$ using Eq. 1 +6: select word list $L = [w_{top-1}, w_{top-2}, \dots]$ +7: // sort $S$ using $I_{w_i}$ in descending order and collect top - K words +8: procedure REPLACEMENT USING BERT +9: $H = [h_0, \dots, h_n] //$ sub-word tokenized sequence of $S$ +10: generate top-K candidates for all sub-words using BERT and get $P^{\in n \times K}$ +11: for $w_j$ in $L$ do +12: if $w_j$ is a whole word then +13: get candidate $C = Filter(P^j)$ +14: replace word $w_j$ +15: else +16: get candidate $C$ using PPL ranking and Filter +17: replace sub-words $[h_j, \dots, h_{j+t}]$ +18: Find Possible Adversarial Sample +19: for $c_k$ in $C$ do +20: $S' = [w_0, \dots, w_{j-1}, c_k, \dots] //$ attempt +21: if $\text{argmax}(o_y(S')) != Y$ then +22: return $S^{adv} = S' //$ success attack +23: else +24: if $o_y(S') < o_y(S^{adv})$ then +25: $S^{adv} = [w_0, \dots, w_{j-1}, c, \dots] //$ do one perturbation +26: return None + +Thus, using the masked language model as a contextualized perturbation generator can be one possible solution to craft high-quality adversarial samples efficiently. + +# 3.2.1 Word Replacement Strategy + +As seen in Figure 1, given a chosen word $w$ to be replaced, we apply BERT to predict the possible words that are similar to $w$ yet can mislead the target model. Instead of following the masked language model settings, we do not mask the chosen word $w$ and use the original sequence as input, which can generate more semantic-consistent substitutes (Zhou et al., 2019). For instance, given a sequence "I like the cat.", if we mask the word $cat$ , it would be very hard for a masked language model to predict the original word $cat$ since it could be just as fluent if the sequence is "I like the dog." Further, if we mask out the given word $w$ , for each iteration we would have to rerun the masked language model prediction process which is costly. + +Since BERT uses Bytes-Pair-Encoding (BPE) + +to tokenize the sequence $S = [w_0, \dots, w_i, \dots]$ into sub-word tokens: $H = [h_0, h_1, h_2, \dots]$ , we need to align the chosen word to its corresponding sub-words in BERT. + +Let $\mathcal{M}$ denote the BERT model, we feed the tokenized sequence $H$ into the BERT $\mathcal{M}$ to get output prediction $P = \mathcal{M}(H)$ . Instead of using the argmax prediction, we take the most possible $K$ predictions at each position, where $K$ is a hyperparameter. + +We iterate words that are sorted by word importance ranking process to find perturbations. The BERT model uses BPE encoding to construct vocabularies. While most words are still single words, rare words are tokenized into sub-words. Therefore, we treat single words and sub-words separately to generate the substitutes. + +Single words For a single word $w_{j}$ , we make attempts using the corresponding top-K prediction candidates $P^{j}$ . We first filter out stop words collected from NLTK; for sentiment classifica + +tion tasks we filter out antonyms using synonym dictionaries (Mrkšić et al., 2016) since BERT masked language model does not distinguish synonyms and antonyms. Then for given candidate $c_k$ we construct a perturbed sequence $H' = [h_0, \dots, h_{j-1}, c_k, h_{j+1}, \dots]$ . If the target model is already fooled to predict incorrectly, we break the loop to obtain the final adversarial sample $H^{adv}$ ; otherwise, we select from the filtered candidates to pick one best perturbation and turn to the next word in word list $L$ . + +Sub-words For a word that is tokenized into subwords in BERT, we cannot obtain its substitutes directly. Thus we use the perplexity of sub-word combinations to find suitable word substitutes from predictions in the sub-word level. Given sub-words $[h_0,h_1,\dots ,h_t]$ of word $w$ , we list all possible combinations from the prediction $P^{\in t\times K}$ from $\mathcal{M}$ which is $K^{t}$ sub-word combinations, we can convert them back to normal words by reversing the BERT tokenization process. We feed these combinations into the BERT-MLM to get the perplexity of these combinations. Then we rank the perplexity of all combinations to get the top-K combinations to find the suitable sub-word combinations. + +Given the suitable perturbations, we replace the original word with the most likely perturbation and repeat this process by iterating the importance word ranking list to find the final adversarial sample. In this way, we acquire the adversarial samples $S^{adv}$ effectively since we only iterate the masked language model once and do perturbations using the masked language model without other checking strategies. + +We summarize the two-step BERT-Attack process in Algorithm 1. + +# 4 Experiments + +# 4.1 Datasets + +We apply our method to attack different types of NLP tasks in the form of text classification and natural language inference. Following Jin et al. (2019), we evaluate our method on 1k test samples randomly selected from the test set of the given task which are the same splits used by Alzantot et al. (2018); Jin et al. (2019). The GA method only uses a subset of 50 samples in the FAKE, IMDB dataset. + +Text Classification We use different types of text classification tasks to study the effectiveness of our method. + +- Yelp Review classification dataset, containing. Following Zhang et al. (2015), we process the dataset to construct a polarity classification task. +- IMDB Document-level movie review dataset, where the average sequence length is longer than the Yelp dataset. We process the dataset into a polarity classification task ${}^{1}$ . +- AG's News Sentence level news-type classification dataset, containing 4 types of news: World, Sports, Business, and Science. +- FAKE Fake News Classification dataset, detecting whether a news document is fake from Kaggle Fake News Challenge ${}^{2}$ . + +# Natural Language Inference + +- SNLI Stanford language inference task (Bowman et al., 2015). Given one premise and one hypothesis, and the goal is to predict if the hypothesis is entailment, neural, or contradiction of the premise. +- MNLI Language inference dataset on multi-genre texts, covering transcribed speech, popular fiction, and government reports (Williams et al., 2018), which is more complicated with diversified written and spoken style texts, compared with the SNLI dataset, including eval data matched with training domains and eval data mismatched with training domains. + +# 4.2 Automatic Evaluation Metrics + +To measure the quality of the generated samples, we set up various automatic evaluation metrics. The success rate, which is the counter-part of afterattack accuracy, is the core metric measuring the success of the attacking method. Meanwhile, the perturbed percentage is also crucial since, generally, less perturbation results in more semantic consistency. Further, under the black-box setting, queries of the target model are the only accessible information. Constant queries for one sample is less applicable. Thus query number per sample is also a key metric. As used in TextFooler (Jin et al., 2019), we also use Universal Sentence Encoder (Cer et al., 2018) to measure the semantic consistency between the adversarial sample and the original sequence. To balance between semantic preservation and attack success rate, we set up a threshold of semantic similarity score to filter the less similar examples. + +
DatasetMethodOriginal AccAttacked AccPerturb %Query NumberAvg LenSemantic Sim
FakeBERT-Attack(ours)97.815.51.115588850.81
TextFooler(Jin et al., 2019)19.311.744030.76
GA(Alzantot et al., 2018)58.31.128508-
YelpBERT-Attack(ours)95.65.14.12731570.77
TextFooler6.612.87430.74
GA31.010.16137-
IMDBBERT-Attack(ours)90.911.44.44542150.86
TextFooler13.66.111340.86
GA45.74.96493-
AGBERT-Attack(ours)94.210.615.4213430.63
TextFooler12.522.03570.57
GA5116.93495-
SNLIBERT-Attack(ours)89.4(H/P)7.4/16.112.4/9.316/308/180.40/0.55
TextFooler4.0/20.818.5/33.460/1420.45/0.54
GA14.7/-20.8/-613/--
MNLI matchedBERT-Attack(ours)85.1(H/P)7.9/11.98.8/7.919/4411/210.55/0.68
TextFooler9.6/25.315.2/26.578/1520.57/0.65
GA21.8/-18.2/-692/--
MNLI mismatchedBERT-Attack(ours)82.1(H/P)7/13.78.0/7.124/4312/220.53/0.69
TextFooler8.3/22.914.6/24.786/1620.58/0.65
GA20.9/-19.0/-737/--
+ +Table 1: Results of attacking against various fine-tuned BERT models. TextFooler is the state-of-the-art baseline. For MNLI task, we attack the hypothesis(H) or premises(P) separately. + +# 4.3 Attacking Results + +As shown in Table 1, the BERT-Attack method successfully fool its downstream fine-tuned model. In both text classification and natural language inference tasks, the fine-tuned BERTs fail to classify the generated adversarial samples correctly. + +The average after-attack accuracy is lower than $10\%$ , indicating that most samples are successfully perturbed to fool the state-of-the-art classification models. Meanwhile, the perturb percentage is less than $10\%$ , which is significantly less than previous works. + +Further, BERT-Attack successfully attacked all tasks listed, which are in diversified domains such as News classification, review classification, language inference in different domains. The results indicate that the attacking method is robust in different tasks. Compared with the strong baseline introduced by Jin et al. (2019)3 and Alzantot et al. (2018)4, the BERT-Attack method is more efficient + +and more imperceptible. The query number and the perturbation percentage of our method are much less. + +We can observe that it is generally easier to attack the review classification task since the perturb percentage is incredibly low. BERT-Attack can mislead the target model by replacing a handful of words only. Since the average sequence length is relatively long, the target model tends to make judgments by only a few words in a sequence, which is not the natural way of human prediction. Thus, the perturbation of these keywords would result in incorrect prediction from the target model, revealing the vulnerability of it. + +# 4.4 Human Evaluations + +For further evaluation of the generated adversarial samples, we set up human evaluations to measure the quality of the generated samples in fluency and grammar as well as semantic preservation. + +We ask human judges to score the grammar correctness of the mixed sentences of generated ad + +versarial samples and original sequences, scoring from 1-5 following Jin et al. (2019). Then we ask human judges to make predictions in a shuffled mix of original and adversarial texts. We use the IMDB dataset and the MNLI dataset, and for each task, we select 100 samples of both original and adversarial samples for human judges. We ask three human annotators to evaluate the examples. For label prediction, we take the majority class as the predicted label, and for semantic and grammar check we use an average score among the annotators. + +Seen in Table 2, the semantic score and the grammar score of the adversarial samples are close to the original ones. MNLI task is a sentence pair prediction task constructed by human crafted hypotheses based on the premises, therefore original pairs share a considerable amount of same words. Perturbations on these words would make it difficult for human judges to predict correctly therefore the accuracy is lower than simple sentence classification tasks. + +
DatasetAccuracySemanticGrammar
MNLIOriginal0.903.94.0
Adversarial0.703.73.6
IMDBOriginal0.914.13.9
Adversarial0.853.93.7
+ +# 4.5 BERT-Attack against Other Models + +The BERT-Attack method is also applicable in attacking other target models, not limited to its fine-tuned model only. As seen in Table 3, the attack is successful against LSTM-based models, indicating that BERT-Attack is feasible for a wide range of models. Under BERT-Attack, the ESIM model is more robust in the MNLI dataset. We assume that encoding two sentences separately gets higher robustness. In attacking BERT-large models, the performance is also excellent, indicating that BERT-Attack is successful in attacking different pre-trained models not only against its own fine-tuned downstream models. + +# 5 Ablations and Discussions + +# 5.1 Importance of Candidate Numbers + +The candidate pool range is the major hyperparameter used in the BERT-Attack algorithm. As seen in Figure 2, the attack rate is rising along with the candidate size increasing. Intuitively, a larger + +Table 2: Human-Evaluation Results. + +
DatasetModelOri AccAtk AccPerturb %
IMDBWord-LSTM89.810.22.7
BERT-Large98.212.42.9
YelpWord-LSTM96.01.14.7
BERT-Large97.98.24.1
MNLI matchedESIM76.29.621.7
BERT-Large86.413.27.4
+ +![](images/0946d7863c7365ad1c64b398cf32d8f4a7e16e08c1d2cbcfae6a7368188ea521.jpg) +Figure 2: Using different candidate number $K$ in the attacking process. + +$K$ would result in less semantic similarity. However, the semantic measure via Universal Sentence Encoder is maintained in a stable range, (experiments show that semantic similarities drop less than $2\%$ ), indicating that the candidates are all reasonable and semantically consistent with the original sentence. + +Further, a fixed candidate number could be rigid in practical usage, so we run a test using a threshold to cut off candidates that are less possible as a plausible perturbation. + +As seen in Table 4, when using a flexible threshold to cut off unsuitable candidates, the attacking process has a lower query number. This indicates that some candidates predicted by the masked language model with a lower prediction score may not be meaningful so skipping these candidates can save the unnecessary queries. + +Table 3: BERT-Attack against other models. + +
DatasetMethodOri AccAtk AccQueries %
IMDBFixed-K90.911.4454
With Threshold90.912.4440
+ +Table 4: Flexible Candidates Using a threshold to cut off unsuitable candidates. + +# 5.2 Importance of Sequence Length + +The BERT-Attack method is based on the contextualized masked language model. Thus the sequence length plays an important role in the high-quality perturbation process. As seen, instead of the previous methods focusing on attacking the hypothesis of the NLI task, we aim at premises whose average length is longer. This is because we believe that contextual replacement would be less reasonable when dealing with extremely short sequences. To avoid such a problem, we believe that many word-level synonym replacement strategies can be combined with BERT-Attack, allowing the BERT-Attack method to be more applicable. + +
DatasetMethodOri AccAtk AccPerturb %
MNLIBERT-Atk85.17.98.8
matched+Adv Train84.623.110.5
+ +Table 5: Adversarial training results. + +
DatasetModelLSTMBERT-baseBERT-large
IMDBWord-LSTM-0.780.75
BERT-base0.83-0.71
BERT-large0.870.86-
DatasetModelESIMBERT-baseBERT-large
MNLIESIM-0.590.60
BERT-base0.60-0.45
BERT-large0.590.43-
+ +# 5.3 Transferability and Adversarial Training + +To test the transferability of the generated adversarial samples, we take samples aimed at different target models to attack other target models. Here, we use BERT-base as the masked language model for all different target models. As seen in Table 6, samples are transferable in NLI task while less transferable in text classification. + +Meanwhile, we further fine-tune the target model using the generated adversarial samples from the train set and then test it on the test set used before. As seen in Table 5, generated samples used in fine-tuning help the target model become more robust while accuracy is close to the model trained with clean datasets. The attack becomes more difficult, + +indicating that the model is harder to be attacked. Therefore, the generated dataset can be used as additional data for further exploration of making neural models more robust. + +Table 6: Transferability analysis using attacked accuracy as the evaluation metric. The column is the target model used in attack, and the row is the tested model. + +
DatasetModelAtk AccPerturb %Semantic
YelpBERT-Atk5.14.10.77
w/o sub-word7.14.30.74
MNLIBERT-Atk11.97.90.68
w/o sub-word14.79.30.63
+ +# 5.4 Effects on Sub-Word Level Attack + +BPE method is currently the most efficient way to deal with a large number of words, as used in BERT. We establish a comparative experiment where we do not use the sub-word level attack. That is we skip those words that are tokenized with multiple sub-words. + +As seen in Table 7, using the sub-word level attack can achieve higher performances, not only in higher attacking success rate but also in less perturbation percentage. + +Table 7: Effects on sub-word level attack. + +
DatasetMethodAtk AccPerturb %Semantic
MNLI matchedMIR7.98.80.68
Random20.212.20.60
LIR27.215.00.60
+ +# 5.5 Effects on Word Importance Ranking + +Word importance ranking strategy is supposed to find keys that are essential to NN models, which is very much like calculating the maximum risk of wrong predictions in the FGSM algorithm (Goodfellow et al., 2014). When not using word importance ranking, the attacking algorithm is less successful. + +Table 8: Most Importance Ranking (MIR) vs Least Importance Ranking (LIR) + +
DatasetMethodRuntime(s/sample)
IMDBBERT-Attack(w/o BPE)14.2
BERT-Attack(w/ BPE)16.0
Textfooler(Jin et al., 2019)42.4
GA(Alzantot et al., 2018)2582.0
+ +Table 9: Runtime comparison. + +
DatasetLabel
MNLIOriSome rooms have balconies .HypothesisAll of the rooms have balconies off of them .Contradiction
AdvMany rooms have balconies .HypothesisAll of the rooms have balconies off of them .Neutral
IMDBOriit is hard for a lover of the novel northanger abbey to sit through thisbbc adaptation and to keep from throwing objects at the tv screen... why are so many facts concerning the tilney family and mrs . tilney ’ s death altered unnecessarily ? to make the story more ‘ horrible ? ’Negative
Advit is hard for a lover of the novel northanger abbey to sit through thisbbc adaptation and to keep from throwing objects at the tv screen... why are so many facts concerning the tilney family and mrs . tilney ’ s death altered unnecessarily ? to make the plot more ‘ horrible ? ’Positive
IMDBOrii first seen this movie in the early 80s .. it really had nice picture quality too . anyways , i ’m glad i found this movie again ... the part i loved best was when he hijacked the car from this poor guy... this is a movie i could watch over and over again . i highly recommend it .Positive
Advi first seen this movie in the early 80s .. it really had nice picture quality too . anyways , i ’m glad i found this movie again ... the part i loved best was when he hijacked the car from this poor guy... this is a movie i could watch over and over again . i inordinately recommend it .Negative
+ +Table 10: Some generated adversarial samples. Origin label is the correct prediction while label is adverse prediction. Only red color parts are perturbed. We only attack premises in MNLI task. Text in FAKE dataset and IMDB dataset is cut to fit in the table. Original text contains more than 200 words. + +# 5.6 Runtime Comparison + +Since BERT-Attack does not use language models or sentence encoders to measure the output sequence during the generation process, also, the query number is lower, therefore the runtime is faster than previous methods. As seen in Table 9, BERT-Attack is much faster than generic algorithm (Alzantot et al., 2018) and 3 times faster than Textfooler. + +# 5.7 Examples of Generated Adversarial Sentences + +As seen in Table 10, the generated adversarial samples are semantically consistent with its original input, while the target model makes incorrect predictions. In both review classification samples and language inference samples, the perturbations do not mislead human judges. + +# 6 Conclusion + +In this work, we propose a high-quality and effective method BERT-Attack to generate adversarial samples using BERT masked language model. Experiment results show that the proposed method achieves a high success rate while maintaining a minimum perturbation. Nevertheless, candidates generated from the masked language model can sometimes be antonyms or irrelevant to the original words, causing a semantic loss. Thus, enhancing language models to generate more semantically related perturbations can be one possible solution to perfect BERT-Attack in the future. + +# Acknowledgments + +We would like to thank the anonymous reviewers for their valuable comments. We are thankful for the help of Demin Song, Hang Yan and Pengfei Liu. This work was supported by the National Natural Science Foundation of China (No. 61751201, 62022027 and 61976056), Shanghai Municipal Science and Technology Major Project (No. 2018SHZDZX01) and ZJLab. + +# References + +Moustafa Alzantot, Yash Sharma, Ahmed Elgohary, Bo-Jhang Ho, Mani B. Srivastava, and Kai-Wei Chang. 2018. Generating natural language adversarial examples. CoRR, abs/1804.07998. +Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. 2015. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326. +Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, et al. 2018. Universal sentence encoder. arXiv preprint arXiv:1803.11175. +Anirban Chakraborty, Manaar Alam, Vishal Dey, Anupam Chattopadhyay, and Debdeep Mukhopadhyay. 2018. Adversarial attacks and defences: A survey. arXiv preprint arXiv:1810.00069. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805. + +Ji Gao, Jack Lanchantin, Mary Lou Soffa, and Yanjun Qi. 2018. Black-box generation of adversarial text sequences to evade deep learning classifiers. In 2018 IEEE Security and Privacy Workshops (SPW), pages 50-56. +Max Glockner, Vered Shwartz, and Yoav Goldberg. 2018. Breaking nli systems with sentences that require simple lexical inferences. arXiv preprint arXiv:1805.02266. +Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. 2014. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572. +Robin Jia and Percy Liang. 2017. Adversarial examples for evaluating reading comprehension systems. arXiv preprint arXiv:1707.07328. +Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. 2019. Is BERT really robust? natural language attack on text classification and entailment. CoRR, abs/1907.11932. +Alexey Kurakin, Ian Goodfellow, and Samy Bengio. 2016. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533. +Qi Lei, Lingfei Wu, Pin-Yu Chen, Alexandros G Dimakis, Inderjit S Dhillon, and Michael Witbrock. 2019. Discrete adversarial attacks and submodular optimization with applications to text classification. Systems and Machine Learning (SysML). +Jinfeng Li, Shouling Ji, Tianyu Du, Bo Li, and Ting Wang. 2018. Textbugger: Generating adversarial text against real-world applications. arXiv preprint arXiv:1812.05271. +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. +Takeru Miyato, Shin ichi Maeda, Masanori Koyama, and Shin Ishii. 2017. Virtual adversarial training: A regularization method for supervised and semi-supervised learning. volume 41, pages 1979-1993. +Nikola Mrkšić, Diarmuid O Seaghdha, Blaise Thomson, Milica Gašić, Lina Rojas-Barahona, PeiHao Su, David Vandyke, Tsung-Hsien Wen, and Steve Young. 2016. Counter-fitting word vectors to linguistic constraints. arXiv preprint arXiv:1603.00892. +Anh Nguyen, Jason Yosinski, and Jeff Clune. 2015. Deep neural networks are easily fooled: High confidence predictions for recognizable images. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 427-436. +Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. Glove: Global vectors for word representation. In Proceedings of the conference on empirical methods in natural language processing, pages 1532-1543. + +Danish Pruthi, Bhuwan Dhingra, and Zachary C Lipton. 2019. Combating adversarial misspellings with robust word recognition. arXiv preprint arXiv:1905.11268. +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. +Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. 2019. Universal adversarial triggers for attacking and analyzing NLP. Empirical Methods in Natural Language Processing. +Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1112-1122. +Puyudi Yang, Jianbo Chen, Cho-Jui Hsieh, Jane-Ling Wang, and Michael I Jordan. 2018. Greedy attack and gumbel attack: Generating adversarial examples for discrete data. arXiv preprint arXiv:1805.12316. +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. +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. +Wangchunshu Zhou, Tao Ge, Ke Xu, Furu Wei, and Ming Zhou. 2019. BERT-based lexical substitution. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3368-3373, Florence, Italy. Association for Computational Linguistics. \ No newline at end of file diff --git a/bertattackadversarialattackagainstbertusingbert/images.zip b/bertattackadversarialattackagainstbertusingbert/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1cb528b33befd1a23fdf90509a130a9bc4e65878 --- /dev/null +++ b/bertattackadversarialattackagainstbertusingbert/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:956e89186592fb1c80b5d54e66d7b110e29146612bde8f0fac73f3abf645aacf +size 448527 diff --git a/bertattackadversarialattackagainstbertusingbert/layout.json b/bertattackadversarialattackagainstbertusingbert/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8ad2c93ae23527e3fc40a48fe6afb316fe96002f --- /dev/null +++ b/bertattackadversarialattackagainstbertusingbert/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63c5bac5f4d317370621555055fad0b9fa6a2b90ffdc6491ae71ef2c8135d5fd +size 326181 diff --git a/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_content_list.json b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..f0106bc7c2cd183aa89e6224196dd6d27da0375e --- /dev/null +++ b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20b928f4fdc34e6136e063ce282a880703ab97f2a3e111ce5dd069b5cc483c7d +size 70045 diff --git a/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_model.json b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..6c09bd3896c965d11303fb026f7c14aa29b5f10e --- /dev/null +++ b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd223ccc7dda042595249dc19e196012deb05459e4accee27c152939bbc0e066 +size 81982 diff --git a/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_origin.pdf b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f4450f3290059201c1fd5e2d02a904795d1da451 --- /dev/null +++ b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/1e1a241c-5ecf-456a-bdef-5bbac9bfb63f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f6a784ab2a8f9934e041e20031a7836d979eac58db1711eb1531c964c503c37 +size 782183 diff --git a/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/full.md b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/full.md new file mode 100644 index 0000000000000000000000000000000000000000..63668ab51e48f65eceba764184c7c2875c05bf0d --- /dev/null +++ b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/full.md @@ -0,0 +1,324 @@ +# BERT-EMD: Many-to-Many Layer Mapping for BERT Compression with Earth Mover's Distance + +Jianquan Li $^{1*}$ , Xiaokang Liu $^{1*}$ , Honghong Zhao $^{1}$ , Ruifeng Xu $^{2}$ , Min Yang $^{3\dagger}$ , Yaohong Jin $^{1}$ + +1Beijing Ultrapower Software Co.,Ltd., China + +$^{2}$ Harbin Institute of Technology (Shenzhen), China + +3Shenzhen Key Laboratory for High Performance Data Mining, + +Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences, China + +{lijianquan2, liuxiaokang1, zhaohonghong1, jinyaohong}@ultrapower.com.cn + +xuruifeng@hit.edu.cn, min.yang@siat.ac.cn + +# Abstract + +Pre-trained language models (e.g., BERT) have achieved significant success in various natural language processing (NLP) tasks. However, high storage and computational costs obstruct pre-trained language models to be effectively deployed on resource-constrained devices. In this paper, we propose a novel BERT distillation method based on many-to-many layer mapping, which allows each intermediate student layer to learn from any intermediate teacher layers. In this way, our model can learn from different teacher layers adaptively for various NLP tasks. In addition, we leverage Earth Mover's Distance (EMD) to compute the minimum cumulative cost that must be paid to transform knowledge from teacher network to student network. EMD enables the effective matching for many-to-many layer mapping. Furthermore, we propose a cost attention mechanism to learn the layer weights used in EMD automatically, which is supposed to further improve the model's performance and accelerate convergence time. Extensive experiments on GLUE benchmark demonstrate that our model achieves competitive performance compared to strong competitors in terms of both accuracy and model compression. For reproducibility, we release the code and data at https://github.com/lxk00/BERT-EMD. + +# 1 Introduction + +In recent years, pre-trained language models, such as GPT (Radford et al., 2018), BERT (Devlin et al., 2018), XL-Net (Yang et al., 2019), have been proposed and applied to many NLP tasks, yielding state-of-the-art performances. However, the promising results of the pre-trained language models come with the high costs of computation + +and memory in inference, which obstruct these pre-trained language models to be deployed on resource-constrained devices and real-time applications. For example, the original BERT-base model, which achieved great success in many NLP tasks, has 12 layers and about 110 millions parameters. + +It is therefore critical to effectively accelerate inference time and reduce the computational workload while maintaining accuracy. This research issue has attracted increasing attention (Wang et al., 2019; Shen et al., 2019; Tang et al., 2019), of which knowledge distillation (Tang et al., 2019) is considered to be able to provide a practical way. Typically, knowledge distillation techniques train a compact and shallow student network under the guidance of a complicated larger teacher network with a teacher-student strategy (Watanabe et al., 2017). Once trained, this compact student network can be directly deployed in real-life applications. + +So far, there have been several studies, such as DistilBERT (Tang et al., 2019), BERT-PKD (Sun et al., 2019), TinyBERT (Jiao et al., 2019), which attempt to compress the original BERT into a lightweight student model without performance sacrifice based on knowledge distillation. For example, BERT-PKD (Sun et al., 2019) and TinyBERT (Jiao et al., 2019) are two representative BERT compression approaches, which encourage the student model to extract knowledge from both the last layer and the intermediate layers of the teacher network. + +Despite the effectiveness of previous studies, there are still several challenges for distilling comprehensive knowledge from the teacher model, which are not addressed well in prior works. First, existing compression methods learn one-to-one layer mapping, where each student layer is guided by only one specific teacher layer. For example, BERT-PKD uses the 2, 4, 6, 8, 10 teacher layers to guide the 1 to 5 student layers, respectively. How- + +ever, these one-to-one layer mapping strategies are assigned based on empirical observations without theoretical guidance. Second, as revealed in (Clark et al., 2019), different BERT layers could learn different levels of linguistic knowledge. The one-to-one layer mapping strategy cannot learn an optimal, unified compressed model for different NLP tasks. In addition, most previous works do not consider the importance of each teacher layer and use the same layer weights among various tasks, which create a substantial barrier for generalizing the compressed model to different NLP tasks. Therefore, an adaptive compression model should be designed to transfer knowledge from all teacher layers dynamically and effectively for different NLP tasks. + +To address the aforementioned issues, we propose a novel BERT compression approach based on many-to-many layer mapping and Earth Mover's Distance (EMD) (Rubner et al., 2000), called BERT-EMD. First, we design a many-to-many layer mapping strategy, where each intermediate student layer has the chance to learn from all the intermediate teacher layers. In this way, BERT-EMD can learn from different intermediate teacher layers adaptively for different NLP tasks, motivated by the intuition that different NLP tasks require different levels of linguistic knowledge contained in the intermediate layers of BERT. Second, to learn an optimal many-to-many layer mapping strategy, we leverage EMD to compute the minimum cumulative cost that must be paid to transform knowledge from teacher network to student network. EMD is a well-studied optimization problem and provides a suitable solution to transfer knowledge from the teacher network in a holistic fashion. + +We summarize our main contributions as follows. (1) We propose a novel many-to-many layer mapping strategy for compressing the intermediate layers of BERT in an adaptive and holistic fashion. (2) We leverage EMD to formulate the distance between the teacher and student networks, and learn an optimal many-to-many layer mapping based on a solution to the well-known transportation problem. (3) We propose a cost attention mechanism to learn the layer weights used in EMD automatically, which can further improve the model's performance and accelerate convergence time. (4) Extensive experiments on GLUE tasks show that BERT-EMD achieves better performance than the state-of-the-art BERT distillation methods. + +# 2 Related Work + +Language models pre-trained on large-scale corpora can learn universal language representations, which have proven to be effective in many NLP tasks (Mikolov et al., 2013; Pennington et al., 2014; Joulin et al., 2016). Early efforts mainly focus on learning good word embeddings, such as word2vec (Mikolov et al., 2013) and GloVe (Pennington et al., 2014). Although these pre-trained embeddings can capture semantic meanings of words, they are context-free and fail to capture higher-level concepts in context, such as syntactic structures and polysemous disambiguation. Subsequently, researchers have shifted attention to contextual word embeddings learning, such as ELMo (Peters et al., 2018), ULMFit (Howard and Ruder, 2018), GPT (Radford et al., 2018), BERT (Devlin et al., 2018), ENRIE (Zhang et al., 2019), XL-Net (Yang et al., 2019), RoBERTa (Liu et al., 2019). For example, Devlin et al. (2018) released the BERT-base of 110 million parameters and BERT-large of 330 million parameters, which achieved significantly better results than previous methods on GLUE tasks. + +However, along with high-performance, the pretrained language models (e.g., BERT) usually have a large number of parameters, which require a high cost of computation and memory in inference. Recently, many attempts have been made to reduce the computation overhead and model storage of pre-trained language models without performance sacrifice. Existing compression techniques can be divided into three categories: low-rank matrix factorization (Wang et al., 2019), quantization (Shen et al., 2019), and knowledge distillation (Tang et al., 2019). Next, we mainly review the related works that use knowledge distillation to compress the BERT model. + +Knowledge distillation using the teacher-student strategy learns a lightweight student network under the guidance of a large and complicated teacher network. Mukherjee and Awadallah (2019) distilled BERT into an LSTM network via both hard and soft distilling methods. Sun et al. (2019) proposed the BERT-PKD model to transfer the knowledge from both the final layer and the intermediate layers of the teacher network. Jiao et al. (2019) proposed the TinyBERT model, which performed the Transformer distillation at both pre-training and fine-tuning processes. Xu et al. (2020) proposed the BERT-of-Theseus model to learn a compact student network by replacing the teacher layers with + +their substitutes. Sun et al. (2020) introduced the MobileBERT model, which has the same number of layers with the teacher network, but was much narrower via adopting bottleneck structures. Wang et al. (2020) distilled the self-attention module of the last Transformer layer of the teacher network. + +However, the aforementioned BERT compression approaches struggle to find an optimal layer mapping between the teacher and student networks. Each student layer merely learns from a single teacher layer, which may lose rich linguistic knowledge contained in the teacher network. Different from previous methods, we propose a many-to-many layer mapping method for BERT distillation, where each intermediate student layer can learn from any intermediate teacher layers adaptively. In addition, an Earth Mover's Disepstance is applied to learn the optimal many-to-many layer mapping solution. + +# 3 Methodology + +In this section, we propose a novel BERT compression method based on many-to-many layer mapping and Earth Mover's Distance (called BERT-EMD). In addition, we also propose a cost attention mechanism to learn the layer weights used in EMD automatically. + +# 3.1 Overview of BERT-EMD + +The main idea behind BERT-EMD is to transfer knowledge from a large teacher network $T$ (large BERT) to a small student network $S$ (BERT-EMD). Both the student and teacher networks are implemented with an embedding layer, several Transformer layers, and a prediction layer. We assume that the teacher network has $M$ Transformer layers and the student network has $N$ Transformer layers. Each Transformer layer contains an attention layer and a hidden layer. + +Similar to TinyBERT (Jiao et al., 2019), our method also includes three primary distillation components: the embedding-layer distillation, the Transformer distillation, and the prediction-layer distillation. Concretely, both the embedding-layer distillation and the prediction-layer distillation employ the one-to-one layer mapping as in TinyBERT and BERT-PKD, where the two student layers are guided by the corresponding teacher layers, respectively. However, different from the previous works, we propose to exploit the many-to-many layer mapping for Transformer (intermediate lay + +ers) distillation (attention-based distillation and hidden states based distillation), where each student attention layer (resp. hidden layer) can learn from any teacher attention layers (resp. hidden layers). In this way, BERT-EMD can learn from different intermediate teacher layers adaptively for different NLP tasks, motivated by the intuition that different NLP tasks require different levels of linguistic knowledge contained in the attention and hidden layers of BERT. Next, we will describe the four distillation strategies of BERT-EMD in detail. + +# 3.2 Embedding-layer Distillation + +Word embeddings are vital in NLP tasks and have been extensively studied in recent years. Better representations of words have come at the cost of huge memory footprints. Compressing embedding matrices without sacrificing model performance is essential for real-world applications. To this end, we minimize the mean squared error (MSE) between the embedding layers of the teacher and student networks: + +$$ +\mathcal {L} _ {\mathrm {e m b}} = \operatorname {M S E} \left(\mathbf {E} ^ {S} \mathbf {W} _ {e}, \mathbf {E} ^ {T}\right) \tag {1} +$$ + +where the matrices $\mathbf{E}^S$ and $\mathbf{E}^T$ represent the embeddings of student and teacher networks, which have the same shape. $\mathbf{W}_e$ is a projection parameter to be learned. + +# 3.3 Prediction-layer Distillation + +The student network also learns from the probability logits provided by teacher network. We minimize the prediction-layer distillation function as: + +$$ +\mathcal {L} _ {\mathrm {p r e d}} = - \operatorname {s o f t m a x} (\mathbf {z} ^ {\mathrm {T}}) \cdot \log_ {-} \operatorname {s o f t m a x} (\mathbf {z} ^ {\mathrm {S}} / \mathrm {t}) (2) +$$ + +where $\mathbf{z}^T$ and $\mathbf{z}^S$ represent the probability logits predicted by the teacher and student, respectively. $t$ indicates a temperature value. + +# 3.4 Transformer Distillation with Earth Mover's Distance + +Instead of imposing one-to-one layer mapping as in previous works (Sun et al., 2019; Jiao et al., 2019), our Transformer distillation approach allows many-to-many layer mapping and is capable of generalizing to various NLP tasks. The Earth Mover's Distance (EMD) is proposed to measure the dissimilarity (distance) between the teacher and student networks as the minimum cumulative cost + +![](images/8c500479a6d8e3866e5a1dc77172c9af1cc23c9ac2008645a13c21d8d39432f6.jpg) +Figure 1: An overview of the proposed BERT-EMD method, which distills comprehensive knowledge from a large teacher $(T)$ with $M$ -layer Transformer to a small student $(S)$ with $N$ -layer Transformer. $w_{T_i}$ and $w_{S_j}$ are the weight of $i$ -th teacher layer and $j$ -th student layer used in EMD. Here, $l$ denotes the length of the input sequence. $h$ denotes the head number. $d$ and $d'$ are the hidden sizes of student and teacher Transformers, respectively. + +of transforming knowledge from the teacher network to student network. The key insight is to view network layers as distributions, and the desired transformation should make the two distributions (teacher and student layers) close. + +Attention-based Distillation We use the attention-based distillation to transform the linguistic knowledge from the teacher network to the student network based on EMD. Formally, let $\mathbf{A}^T = \{(\mathbf{A}_1^T,w_{T_1}^{\mathbf{A}}),\ldots ,(\mathbf{A}_M^T,w_{T_M}^{\mathbf{A}})\}$ be the teacher attention layers and $\mathbf{A}^{S} = \{(\mathbf{A}_{1}^{S},w_{S_{1}}^{\mathbf{A}}),\ldots ,(\mathbf{A}_{N}^{S},w_{S_{N}}^{\mathbf{A}})\}$ be the student attention layers, where $M$ and $N$ represent the numbers of the attention layers in the teacher and student networks, respectively. Each $\mathbf{A}_i^T$ (resp. $\mathbf{A}_i^S$ ) represents the $i$ -th teacher (resp. student) attention layer and $w_{T_i}^{\mathbf{A}}$ (resp. $w_{S_i}^{\mathbf{A}}$ ) indicates corresponding layer weight that is initialized as $\frac{1}{M}$ (resp. $\frac{1}{N}$ ). We also define a "ground" distance matrix $\mathbf{D}^{\mathbf{A}} = [d_{ij}^{\mathbf{A}}]$ , where $d_{ij}^{\mathbf{A}}$ represents the cost of transferring the attention knowledge from $\mathbf{A}_i^T$ to $\mathbf{A}_j^S$ . Here, we use MSE to calculate the distance $d_{ij}^{\mathbf{A}}$ as: + +$$ +d _ {i j} ^ {\mathbf {A}} = \operatorname {M S E} \left(\mathbf {A} _ {i} ^ {S}, \mathbf {A} _ {j} ^ {T}\right) \tag {3} +$$ + +Then, we attempt to find a mapping flow $\mathbf{F}^{\mathbf{A}} = [f_{ij}^{\mathbf{A}}]$ , with $f_{ij}^{\mathbf{A}}$ the mapping flow between $\mathbf{A}_i^T$ and $\mathbf{A}_j^S$ , that minimizes the cumulative cost required to transform knowledge from the teacher attention + +layers $\mathbf{A}^T$ to the student attention layers $\mathbf{A}^{S}$ + +$$ +\operatorname {W O R K} \left(\mathbf {A} ^ {T}, \mathbf {A} ^ {S}, \mathbf {F} ^ {\mathbf {A}}\right) = \sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {A}} d _ {i j} ^ {\mathbf {A}} \tag {4} +$$ + +subject to the following constraints: + +$$ +f _ {i j} ^ {\mathbf {A}} \geq 0 \quad 1 \leq i \leq M, 1 \leq j \leq N \tag {5} +$$ + +$$ +\sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {A}} \leq w _ {T _ {i}} ^ {\mathbf {A}} \quad 1 \leq i \leq M \tag {6} +$$ + +$$ +\sum_ {i = 1} ^ {M} f _ {i j} ^ {\mathbf {A}} \leq w _ {S _ {j}} ^ {\mathbf {A}} \quad 1 \leq j \leq N \tag {7} +$$ + +$$ +\sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {A}} = \min \left(\sum_ {i = 1} ^ {M} w _ {T _ {i}} ^ {\mathbf {A}}, \sum_ {j = 1} ^ {N} w _ {S _ {j}} ^ {\mathbf {A}}\right) \tag {8} +$$ + +where the first constraint forces the mapping flow to be positive. The second constraint limits the amount of attention information that can be sent by $\mathbf{A}^T$ to their weights. The third constraint limits the attention information that can be received by $\mathbf{A}^S$ . The fourth constraint limits the amount of total flow. + +The above optimization is a well-studied transportation problem (Hitchcock, 1941), which can be solved by previously developed methods (Rachev, 1985). Once the optimal mapping flow $\mathbf{F}^{\mathbf{A}}$ is learned, we can define the Earth Mover's Distance as the work normalized by the total flow: + +$$ +\operatorname {E M D} \left(\mathbf {A} ^ {S}, \mathbf {A} ^ {T}\right) = \frac {\sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {A}} d _ {i j} ^ {\mathbf {A}}}{\sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {A}}} \tag {9} +$$ + +Finally, the objective function for the attention-based distillation can be defined by the EMD between $\mathbf{A}^T$ and $\mathbf{A}^S$ : + +$$ +\mathcal {L} _ {\mathrm {a t t n}} = \operatorname {E M D} \left(\mathbf {A} ^ {S}, \mathbf {A} ^ {T}\right) \tag {10} +$$ + +Hidden States-based Distillation Similar to attention-based distillation, we also learn the hidden layer mapping based on EMD. Formally, let $\mathbf{H}^T = \{(\mathbf{H}_1^T,w_{T_1}^{\mathbf{H}}),\ldots ,(\mathbf{H}_M^T,w_{T_M}^{\mathbf{H}})\}$ be the teacher hidden layers and $\mathbf{H}^{S} = \{(\mathbf{H}_{1}^{S},w_{S_{1}}^{\mathbf{H}}),\dots ,(\mathbf{H}_{N}^{S},w_{S_{N}}^{\mathbf{H}})\}$ be the student hidden layers, where $M$ and $N$ represent the numbers of the hidden layers in the teacher and student networks, respectively. Each $\mathbf{H}_i^T$ represents the $i$ -th hidden layer and $w_{T_i}^{\mathbf{H}}$ indicates corresponding layer weight that is initialized as $\frac{1}{M}$ . We also define a "ground" distance matrix $\mathbf{D}^{\mathbf{H}} = [d_{ij}^{\mathbf{H}}]$ , where $d_{ij}^{\mathbf{H}}$ represents the cost of transferring the hidden states knowledge from $\mathbf{H}_i^T$ to $\mathbf{H}_j^S$ and we use a learnable projection parameter as $\mathbf{W}_h$ . MSE is applied to calculate the distance $d_{ij}^{\mathbf{H}}$ : + +$$ +d _ {i j} ^ {\mathbf {H}} = \operatorname {M S E} \left(\mathbf {H} _ {i} ^ {S} \mathbf {W} _ {h}, \mathbf {H} _ {j} ^ {T}\right) \tag {11} +$$ + +Then, a mapping flow $\mathbf{F}^{\mathbf{H}} = [f_{ij}^{\mathbf{H}}]$ , with $f_{ij}^{\mathbf{H}}$ the mapping flow between $\mathbf{H}_i^T$ and $\mathbf{H}_j^S$ , is learned by minimizing the cumulative cost required to transform knowledge from $\mathbf{H}^T$ to $\mathbf{H}^S$ : + +$$ +\operatorname {W O R K} \left(\mathbf {H} ^ {T}, \mathbf {H} ^ {S}, \mathbf {F} ^ {\mathbf {H}}\right) = \sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {H}} d _ {i j} ^ {\mathbf {H}} \tag {12} +$$ + +subject to the following constraints: + +$$ +f _ {i j} ^ {\mathbf {H}} \geq 0 \quad 1 \leq i \leq M, 1 \leq j \leq N \tag {13} +$$ + +$$ +\sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {H}} \leq w _ {T _ {i}} ^ {\mathbf {H}} \quad 1 \leq i \leq M \tag {14} +$$ + +$$ +\sum_ {i = 1} ^ {M} f _ {i j} ^ {\mathbf {H}} \leq w _ {S _ {j}} ^ {\mathbf {H}} \quad 1 \leq j \leq N \tag {15} +$$ + +$$ +\sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {H}} = \min \left(\sum_ {i} ^ {M} w _ {T _ {i}} ^ {\mathbf {H}}, \sum_ {i} ^ {N} w _ {S _ {i}} ^ {\mathbf {H}}\right) \tag {16} +$$ + +After solving the above optimization problem, we obtain the optimal mapping flow $\mathbf{F}^{\mathrm{H}}$ . The earth mover's distance can be then defined as the work normalized by the total flow: + +$$ +\operatorname {E M D} \left(\mathbf {H} ^ {S}, \mathbf {H} ^ {T}\right) = \frac {\sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {H}} d _ {i j} ^ {\mathbf {H}}}{\sum_ {i = 1} ^ {M} \sum_ {j = 1} ^ {N} f _ {i j} ^ {\mathbf {H}}} \tag {17} +$$ + +Finally, the objective function for the hidden states-based distillation can be defined by the earth mover's distance between $\mathbf{H}^T$ and $\mathbf{H}^S$ : + +$$ +\mathcal {L} _ {\text {h i d d e n}} = \operatorname {E M D} \left(\mathbf {H} ^ {S}, \mathbf {H} ^ {T}\right) \tag {18} +$$ + +# 3.5 Weight Update with Cost Attention + +In the EMD defined in Section 3.4, each teacher layer (resp. student layer) is assigned an equal weight $w_{T} = \frac{1}{M}$ (resp. $w_{S} = \frac{1}{N}$ ). Since different attention and hidden layers of BERT can learn different levels of linguistic knowledge, these layers should have different weights for various NLP tasks. Therefore, we propose a cost attention mechanism to assign weights for each attention and hidden layers automatically. + +The main idea behind the cost attention is to make the teacher and student Transformer networks be as close as possible. That is, we could reduce the overall cost of EMD by increasing the weights of the layers with low flow cost, while the weights of the layers with high flow cost should be decreased adaptively. + +We take the weight updating process of the teacher network as an example. The cost attention mechanism can be performed by three steps after learning the optimal solution (flow matrices $\mathbf{F}^{\mathbf{A}}$ and $\mathbf{F}^{\mathbf{H}}$ in EMD). First, we learn the transferring cost between each teacher and student layers (unit transferring cost). Formally, let $C_{T_i}^{\bar{\mathbf{A}}}$ and $C_{T_i}^{\bar{\mathbf{H}}}$ be the unit transferring cost of each attention and hidden layers respectively, which can be computed as: + +$$ +C _ {T _ {i}} ^ {\overline {{\mathbf {A}}}} = \frac {\sum_ {j = 1} ^ {N} d _ {i j} ^ {\mathbf {A}} f _ {i j} ^ {\mathbf {A}}}{w _ {T _ {i}}} \tag {19} +$$ + +$$ +C _ {T _ {i}} ^ {\mathbf {H}} = \frac {\sum_ {j = 1} ^ {N} d _ {i j} ^ {\mathbf {H}} f _ {i j} ^ {\mathbf {H}}}{w _ {T _ {i}}} \tag {20} +$$ + +Second, we update the weights $(w_{T_i}^{\mathbf{A}}$ and $w_{T_i}^{\mathbf{H}})$ of the teacher attention and hidden layers based on the learned unit transferring cost. Specifically, we compute the updated weights $w_{T_i}^{\mathbf{A}}$ and $w_{T_i}^{\mathbf{H}}$ as the inverse ratio of the transferring costs: + +$$ +w _ {T _ {i}} ^ {\mathbf {\bar {A}}} = \frac {\sum_ {j = 1} ^ {M} C _ {j} ^ {\mathbf {\bar {A}}}}{C _ {T _ {i}} ^ {\mathbf {\bar {A}}}} \tag {21} +$$ + +$$ +w _ {T _ {i}} ^ {\mathbf {H}} = \frac {\sum_ {j = 1} ^ {M} C _ {T _ {j}} ^ {\mathbf {H}}}{C _ {T _ {i}} ^ {\mathbf {H}}} \tag {22} +$$ + +Finally, we normalize the updated layer weights used in EMD via softmax, and introduce a temperature coefficient $\tau$ to smooth the results. In particular, we update weight $w_{T_i}$ of the $i$ -th Transformer layer used in EMD by averaging the corresponding weights of attention and hidden layers: + +$$ +w _ {\bar {T} _ {i}} = \frac {1}{2} \left(\operatorname {s o f t m a x} \left(w _ {\bar {T} _ {i}} ^ {\mathbf {A}} / \tau\right) + \operatorname {s o f t m a x} \left(w _ {\bar {T} _ {i}} ^ {\mathbf {H}} / \tau\right)\right) \tag {23} +$$ + +It is noteworthy that the learned new weights are leveraged as the constrains to optimize the EMD problem in the next batch. Specifically, we initialize the $i$ -th teacher attention and hidden layer weights $(w_{T_i}^{\mathbf{A}}$ and $w_{T_i}^{\mathbf{H}})$ in the $\eta$ -th batch with the updated weight $w_{T_i}$ learned in the $\eta - 1$ -th batch. In this way, we can further improve the performance of BERT-EMD and accelerate convergence time. + +# 3.6 Overall Learning Objective + +Finally, we combine the embedding-layer distillation, attention-based distillation, hidden states-based distillation, prediction-layer distillation objectives to form the overall knowledge distillation objective as follows: + +$$ +\mathcal {L} _ {\text {d i s t i l l}} = \beta \left(\mathcal {L} _ {\text {e m b}} + \mathcal {L} _ {\text {a t t n}} + \mathcal {L} _ {\text {h i d d e n}}\right) + \mathcal {L} _ {\text {p r e d}} \tag {24} +$$ + +where $\beta$ is a factor that controls the weights of the three distillation objectives $(\mathcal{L}_{\mathrm{emb}},\mathcal{L}_{\mathrm{attn}},\mathcal{L}_{\mathrm{hidden}})$ + +# 4 Experimental Setup + +# 4.1 Experimental Data + +We evaluate our BERT-EMD model on the General Language Understanding Evaluation (GLUE) (Wang et al., 2018) benchmark, which is a collection of nine diverse sentence-level classification tasks. Concretely, GLUE consists of (i) Microsoft Research Paraphrase Matching (MRPC), Quora Question Pairs (QQP) and Semantic Textual Similarity Benchmark (STS-B) for paraphrase similarity matching; (ii) Stanford Sentiment Treebank (SST-2) for sentiment classification; (iii) Multi-Genre Natural Language Inference Matched (MNLI-m), Multi-Genre Natural Language Inference Mismatched (MNLI-mm), Question Natural Language Inference (QNLI) and Recognizing Textual Entailment (RTE) for natural language inference task; and (iv) the Corpus of Linguistic Acceptability (CoLA) for linguistic acceptability. + +# 4.2 Evaluation Metrics + +Following previous works (Sun et al., 2019; Jiao et al., 2019), we use classification accuracy as the evaluation metric for SST-2, MNLI-m, MNLI-mm, QNLI, and RTE datasets. For a fair comparison with TinyBERT (Jiao et al., 2019), the F1 metric is adopted for MRPC and QQP datasets, the Spearman correlation is adopted for STS-B, and the Matthew's correlation is adopted for CoLA. The results reported for the test set of GLUE are in the same format as on the official leaderboard. + +# 4.3 Implementation Details + +Similar to TinyBERT, our BERT-EMD method also contains a general distillation and a task-specific distillation. In particular, we initialize our student model with the general distillation model provided by TinyBERT1. The teacher model is implemented as a 12-layer BERT model (BERTBASE12”), which is fine-tuned for each task to perform knowledge distillation. + +We employ the grid search algorithm on the validation set to tune the hyper-parameters. Since there are many hyper-parameter combinations, we first do the grid search on $\beta$ and the learning rate. Then, we fix the values of these two hyperparameters and tune the values of the other hyperparameters. Specifically, the batch size is 32, the learning rate is tuned from $\{5e - 5,2e - 5,1e - 5\}$ , the parameter $t$ defined in Eq. (2) is tuned from $\{1,3,7,10\}$ , the temperature coefficient $\tau$ is tuned from $\{1,2,5,10\}$ , and $\beta$ is tuned from $\{0.01,0.001,0.005\}$ . + +# 4.4 Baseline Methods + +In this paper, we compare our BERT-EMD with several state-of-the-art BERT compression approaches, including the original 4/6-layer BERT models (Devlin et al., 2018), DistilBERT (Tang et al., 2019), BERT-PKD (Sun et al., 2019), TinyBERT (Jiao et al., 2019), BERT-of-Theseus (Xu et al., 2020). However, the original TinyBERT employs a data augmentation strategy in the training process, which is different from the other baseline models. For a fair comparison, we re-implement the TinyBERT model by eliminating the data augmentation strategy. + +It is noteworthy that we do not compare BERT-EMD with the recent MobileBERT (Sun et al., 2020) and MiniLM (Wang et al., 2020), since + +
ModelParamsInferenceMNLI-mMNLI-mmQQPSST-2CoLAQNLIMRPCRTESTS-b
NumTime(393k)(393k)(364k)(67k)(8.5k)(108k)(3.5k)(2.5k)(5.7k)
BERTBASE12-G110M×184.683.471.293.552.190.588.966.485.8
BERTBASE12-T110M×184.483.371.693.452.890.588.166.985.2
BERTSMALL414.5M-75.474.966.587.619.584.883.262.677.1
DistillBERT452.2M×3.078.978.068.591.432.885.282.454.176.1
BERT-PKD452.2M×3.079.979.370.289.424.885.182.662.379.8
TinyBERT414.5M×9.481.280.368.990.025.386.285.463.980.4
BERT-EMD414.5M×9.482.180.669.391.025.687.287.666.282.3
BERT-PKD666.0M×1.981.581.070.792.043.589.085.065.581.6
BERT-of-Theseus666.0M-82.482.171.692.247.889.687.666.284.1
TinyBERT666.0M×1.984.483.171.392.646.189.888.069.783.9
BERT-EMD666.0M×1.984.783.572.093.347.590.789.871.786.8
+ +Table 1: Experimental results on the GLUE test set. The subscript within each model name represents the number of Transformer layers. AVE represents the average score over all tasks. $\mathrm{BERT}_{\mathrm{BASE}12}$ -G and $\mathrm{BERT}_{\mathrm{BASE}12}$ -T indicate the results of the fine-tuned BERT-base from (Devlin et al., 2018) and in our implementation, respectively. + +
MethodMNLI-mQQPRTESTS-b
BERT-EMD482.169.366.282.3
w/o CA481.669.065.181.6
w/o EMD480.767.764.180.7
BERT-EMD684.772.071.786.8
w/o CA684.571.671.085.3
w/o EMD684.271.270.484.7
+ +Table 2: Ablation test results in terms of removing EMD (w/o EMD) and cost attention (w/o CA). + +MiniLM does not report the results on the GLUE test set and the MobileBERT model employs the Transformer block with different architectures. + +# 5 Experimental Results + +# 5.1 Main Results + +We summarize the experimental results on the GLUE test sets in Table 1. The number below each task denotes the number of training instances. Following previous works (Sun et al., 2019,?), we also report the average values of these nine tasks (the "AVE" column). From the results, we can observe that BERT-EMD substantially outperforms state-of-the-art baseline methods by a noticeable margin on most tasks. + +Among all the 4-layer BERT approaches, our BERT-EMD $_4$ method achieves the best results on almost all the tasks except SST-2 and CoLA. First, BERT-EMD $_4$ achieves significantly better results than BERT $_{\text{SMALL}_4}$ on all the GLUE tasks with a large improvement of $4.48\%$ on average. Second, BERT-EMD $_4$ also outperforms DistilBERT $_4$ and BERT-PKD $_4$ by a substantial margin, even with only $30\%$ parameters and inference time. Furthermore, BERT-EMD $_4$ exceeds the TinyBERT model (the best competitor) by $2.3\%$ accuracy on RTE, $2.2\%$ F1 on MRPC, and $1.9\%$ Spearman correlation on STS-B. This verifies the + +effectiveness of our BERT-EMD model in improving the performance of small BERT-based methods on various language understanding tasks. + +We can observe similar trends in the 6-layer BERT models. Table 1 shows that the proposed BERT-EMD $_6$ method can effectively compress $\mathrm{BERT}_{\mathrm{BASE}_{12}}$ into a 6-layer BERT model without performance sacrifice. Specifically, BERT-EMD $_6$ performs better than the 12-layer BERT $\mathrm{BERT}_{\mathrm{BASE}_{12}}$ model on 7 out of 9 tasks, with only about $50\%$ parameters and inference time of the original $\mathrm{BERT}_{\mathrm{BASE}_{12}}$ model. For example, BERT-EMD achieves a noticeable improvement of $5.3\%$ accuracy on RTE and $1\%$ Spearman correlation on STS-B, over the $\mathrm{BERT}_{\mathrm{BASE}_{12}}$ model. + +# 5.2 Ablation Study + +To verify the effectiveness of EMD and the cost attention mechanism, we perform ablation test of BERT-EMD on two large datasets (MNLI and QQP) and two small datasets (MRPC and RTE) in terms of removing EMD (denoted as w/o EMD) and cost attention (w/o CA), respectively. In particular, for the method of removing EMD, we retain the many-to-many layer mapping by simply replacing the EMD with the mean squared error when measuring the distance between the teacher and student layers. + +The ablation test results are summarized in Table 2. Generally, both EMD and cost attention contribute noticeable improvement to our method. The performances decrease sharply, especially on the STS-B task, when removing the EMD module. This is within our expectation since the EMD module formulates the distance between the teacher and student networks as an optimal transport prob + +![](images/0d8a1778908414d031b17835ca1df99f0f26972923787e37064675eddc387bc5.jpg) +Figure 2: The visualization of flow matrices $(\mathbf{F})$ and distance matrices $(\mathbf{D})$ in developing BERT-EMD $_4$ (above) and BERT-EMD $_6$ (below) for two examples from MNLI and RTE tasks, respectively. The abscissa represents the Transformer layers of BERT $_{\mathrm{BASE}_{12}}$ , and the ordinate represents the Transformer layers of BERT-EMD $_4$ /BERT-EMD $_6$ . The color depth represents the values (weights) of the layers. + +lem, which helps to learn an optimal many-to-many layer mapping. The cost attention also contributes to the effectiveness of BERT-EMD. This verifies that the cost attention can further improve the many-to-many layer mapping by learning the importance of each teacher layer in guiding the student network. It is noteworthy that when removing the EMD module in the many-to-many lay mapping process, our w/o $\mathrm{EMD}_4$ performs slightly worse than TinyBERT $_4$ on the MNLI and QQP tasks. This is because we cannot automatically control the information flow during the many-to-many layer mapping without using EMD, which further verifies the effectiveness of EMD in the many-to-many layer mapping process. + +# 5.3 Visualization of Compression Process + +To better understand the many-to-many layer mapping process, we illustrate the flow matrices $\mathbf{F}$ and cost (distance) matrices $\mathbf{D}$ in developing BERT-EMD $_4$ (above) and BERT-EMD $_6$ (below) for two examples from MNLI and RTE tasks, respectively. In Figure 2, we report the averaged values of the flow and cost matrices of the entire epoch that achieves the best performance on the validation set with heat maps. + +From the results in Figure 2, we have several key observations. First, different tasks could emphasize different teacher layers in compressing the Transformer. The diagonal positions of the matrices are almost always important for the MNLI + +task, which exhibits similar trends with TinyBERT with the one-to-one "Skip" layer mapping strategy. However, for the RTE task, each student Transformer layer can learn from any teacher Transformer layers. The previous one-to-one layer mapping methods cannot take full advantage of the teacher network. This argument can be verified by the quantitative results in Table 1, where our BERT-EMD has a much larger improvement on RTE than on MNLI over TinyBERT. Second, comparing $\mathrm{BERT - EMD_4}$ and $\mathrm{BERT - EMD_6}$ , we can observe that $\mathrm{BERT - EMD_4}$ usually needs to learn more comprehensive information from skipped teacher Transformer layers, resulting in more divergent many-to-many layer mappings. + +# 6 Conclusion + +In this paper, we propose a novel BERT compression method based on many-to-many layer mapping by Earth Mover's Distance (EMD). To our knowledge, BERT-EMD is the first work that allows each intermediate student layer to learn from any intermediate teacher layers adaptively. In addition, a cost attention mechanism is designed to further improve the model's performance and accelerate convergence time by learning the layer weights used in EMD automatically. Extensive experiments on GLUE tasks show that BERT-EMD can achieve competitive performances with the large BERT-Base model while significantly reducing the model size and inference time. + +# Acknowledgement + +Min Yang was partially supported by National Natural Science Foundation of China (No. 61906185), the Natural Science Foundation of Guangdong Province of China (No. 2019A1515011705, 2018A030313943), the Youth Innovation Promotion Association of CAS. + +# References + +Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D Manning. 2019. What does bert look at? an analysis of bert's attention. arXiv preprint arXiv:1906.04341. +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. +Frank L Hitchcock. 1941. The distribution of a product from several sources to numerous localities. Journal of mathematics and physics, 20(1-4):224-230. +Jeremy Howard and Sebastian Ruder. 2018. Universal language model fine-tuning for text classification. arXiv preprint arXiv:1801.06146. +Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. 2019. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351. +Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2016. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759. +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. +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. In NIPS, pages 3111-3119. +Subhabrata Mukherjee and Ahmed Hassan Awadallah. 2019. Distilling transformers into simple neural networks with unlabeled transfer data. arXiv preprint arXiv:1910.01769. +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 (EMNLP), pages 1532-1543. +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. + +Svetlozar T Rachev. 1985. The monge-kantorovich mass transference problem and its stochastic applications. Theory of Probability & Its Applications, 29(4):647-676. +Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. 2018. Improving language understanding by generative pre-training. URL https://s3-us-west-2. amazonaws. com/openai-assets/researchcovers/languageunsupervised/language understanding paper.pdf. +Yossi Rubner, Carlo Tomasi, and Leonidas J Guibas. 2000. The earth mover's distance as a metric for image retrieval. International journal of computer vision, 40(2):99-121. +Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W Mahoney, and Kurt Keutzer. 2019. Q-bert: Hessian based ultra low precision quantization of bert. arXiv preprint arXiv:1909.05840. +Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. 2019. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355. +Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. 2020. Mobilebert: a compact task-agnostic bert for resource-limited devices. arXiv preprint arXiv:2004.02984. +Raphael Tang, Yao Lu, Linqing Liu, Lili Mou, Olga Vechtomova, and Jimmy Lin. 2019. Distilling task-specific knowledge from bert into simple neural networks. arXiv preprint arXiv:1903.12136. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. 2018. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461. +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. +Ziheng Wang, Jeremy Wohlwend, and Tao Lei. 2019. Structured pruning of large language models. arXiv preprint arXiv:1910.04732. +Shinji Watanabe, Takaaki Hori, Jonathan Le Roux, and John R Hershey. 2017. Student-teacher network learning with enhanced features. In ICASSP, pages 5275-5279. IEEE. +Canwen Xu, Wangchunshu Zhou, Tao Ge, Furu Wei, and Ming Zhou. 2020. Bert-of-theseus: Compressing bert by progressive module replacing. arXiv preprint arXiv:2002.02925. +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 5754-5764. +Zhengyan Zhang, Xu Han, Zhiyuan Liu, Xin Jiang, Maosong Sun, and Qun Liu. 2019. Ernie: Enhanced language representation with informative entities. arXiv preprint arXiv:1905.07129. \ No newline at end of file diff --git a/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/images.zip b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ba93de178ddae072e7052848f0f6a2fa6ee9f683 --- /dev/null +++ b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0a2d3e8ecd519880e0c496f1b4e2826656f9e5226896faa70bb44a3b8636096 +size 445818 diff --git a/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/layout.json b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c2eb168641a9fb392cd9df246f80b176aa0ac01c --- /dev/null +++ b/bertemdmanytomanylayermappingforbertcompressionwithearthmoversdistance/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2fb994768cb759d1dd2af546bc225afec99936f80fef6e982abacdcdc1b0d938 +size 377286 diff --git a/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_content_list.json b/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..e822fbc1ba86f96a0bdb74162c173802fcc82e7b --- /dev/null +++ b/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd99c48c439a880bce12384305f939300be8ec6da4939baa52354ec778160424 +size 95602 diff --git a/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_model.json b/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_model.json new file mode 100644 index 0000000000000000000000000000000000000000..07aa2641390db69cc3b8c48ac28c5da4f9a221ff --- /dev/null +++ b/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:197eb030f227f7ca9c432c660a191778946f05d4d70b027f26ba5fd2326e81c6 +size 110857 diff --git a/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_origin.pdf b/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ff327fa95a1b1ae64f2863af22a2f247e31c28a7 --- /dev/null +++ b/bertenhancedrelationalsentenceorderingnetwork/654994e9-73ec-49d3-b20f-3847b09fcea8_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9983f6f34633e43cdbbd4e67f470d62aa061324f51ee037f40d1da41994d963b +size 632020 diff --git a/bertenhancedrelationalsentenceorderingnetwork/full.md b/bertenhancedrelationalsentenceorderingnetwork/full.md new file mode 100644 index 0000000000000000000000000000000000000000..36235a981e413ad9158145c7ea4a01af934a3ab7 --- /dev/null +++ b/bertenhancedrelationalsentenceorderingnetwork/full.md @@ -0,0 +1,430 @@ +# BERT-enhanced Relational Sentence Ordering Network + +Baiyun Cui $^{1}$ , Yingming Li $^{1*}$ , and Zhongfei Zhang $^{2}$ + +1College of Information Science and Electronic Engineering, Zhejiang University, China + +$^{2}$ Computer Science Department, Binghamton University, Binghamton, NY, USA + +baiyunc@yahoo.com, yingming@zju.edu.cn, zhang@binghamton.edu + +# Abstract + +In this paper, we introduce a novel BERT-enhanced Relational Sentence Ordering Network (referred to as BERSON) by leveraging BERT for capturing a better dependency relationship among sentences to enhance the coherence modeling for the entire paragraph. In particular, we develop a new Relational Pointer Decoder (referred as RPD) by incorporating the relative ordering information into the pointer network with a Deep Relational Module (referred as DRM), which utilizes BERT to exploit the deep semantic connection and relative ordering between sentences. This enables us to strengthen both local and global dependencies among sentences. Extensive evaluations are conducted on six public datasets. The experimental results demonstrate the effectiveness and promise of BERSON, showing a significant improvement over the state-of-the-art by a wide margin. + +# 1 Introduction + +Coherence modeling is one of the essential aspects of natural language processing (Xu et al., 2019; Mesgar et al., 2019; Moon et al., 2019; Farag and Yannakoudakis, 2019). A coherent text can facilitate understanding and avoid the confusion for reading comprehension. The Sentence Ordering task (Barzilay and Lapata, 2008) aims to reconstruct a coherent paragraph from an unordered set of sentences and has shown to be beneficial to improve the coherence in many NLP tasks including multi-document summarization (Barzilay and Elhadad, 2002; Nallapati et al., 2017), conversational analysis (Zeng et al., 2018), and text generation (Konstas and Lapata, 2013; Holtzman et al., 2018). Table 1 shows an example of this task. + +In recent years, several approaches based on ranking or sorting frameworks have been devel + +
An unordered set of sentencesCoherent paragraph
1Dan was walking during the night.1Dan was walking during the night.
3They tried to steal his book bag.2A group of thieves surrounded him.
4A bystander noticed them.3They tried to steal his book bag.
2A group of thieves surrounded him.4A bystander noticed them.
5But she continued to walk away.5But she continued to walk away.
+ +Table 1: Illustration of the sentence ordering task. It aims to reorganize an unordered set of sentences into a coherent paragraph. + +oped to deal with this task. RankTxNet (Kumar et al., 2020) computes a score for each sentence and sorts these scores with ranking based loss functions. Pairwise Model (Chen et al., 2016) adopts a pairwise ranking algorithm to learn the relative order of each sentence pair. B-TSort (Prabhumoye et al., 2020) predicts the constraint between two sentences and uses the topological sort technique to find the ordering. + +On the other hand, to better capture the global coherence, pointer network (Vinyals et al., 2015) has been gradually used for the decoder of the ordering model. It is able to capture the paragraph-level contextual information for generating an ordered sequence with the highest coherence probability (Gong et al., 2016; Logeswaran et al., 2018; Cui et al., 2018; Yin et al., 2019). Further, HAN (Wang and Wan, 2019) and TGCM (Oh et al., 2019) introduce the attention mechanism (Vaswani et al., 2017), and FUDecoder (Yin et al., 2020) proposes pairwise ordering prediction modules to enhance the traditional pointer network. + +Despite having achieved great successes, pairwise ranking and pointer network-based ordering approaches have a few problems. The former focuses on learning the local relationship between sentence pairs, but may have trouble in capturing the global interactions among all the sentences. The latter overlooks the importance of learning relative order between sentence pairs through the encoder-decoder, and lacks enough local interac + +![](images/e36d4f3fac46a4bec74f2886885565023d5b85cdb5dbb6e42732f4abaf5c7726.jpg) +Hierarchical Relational Sentence Encoder +Figure 1: The architecture of the proposed BERSON. Given an unordered set of sentences, our BERT-based Hierarchical Relational Sentence Encoder first builds the high-level representation for each input sentence. Then, a self-attention based paragraph encoder is employed for paragraph encoding. Finally, the proposed Relational Pointer Decoder generates an ordered out sequence. For the sentence generation at the 3rd timestep in the decoder, $s_1$ and $s_2$ are the previous sorted sentences, and $s_3$ , $s_4$ , and $s_5$ are the unsorted ones. Here, we use the candidate sentence $s_3$ as an example to illustrate how to encode the relative ordering information for it in the pointer network based on Deep Relational Module. Please refer to Section 2.4 for more details of the decoder. + +tions among sentences. + +To address the above limitations, in this paper, we propose a novel BERT-enhanced Relational Sentence Ordering Network (referred to as BERSON) by integrating BERT (Devlin et al., 2019) with the pointer network to fully exploit the pairwise relationships between sentences for a better coherence modeling. Specifically, we first introduce a BERT-based Hierarchical Relational Sentence Encoder, which uses sentence pairs as the input to the model and learns the high-level representation for each sentence. Next, a Self-Attention based Paragraph Encoder is adopted for paragraph encoding. + +Building upon the above pairwise sentence and paragraph encoding, a novel Relational Pointer Decoder (referred to as RPD) is developed by incorporating the informative relative ordering information into the pointer network with a Deep Relational Module (referred to as DRM). This module leverages the Next Sentence Prediction objective of BERT to learn the relative ordering between sentences and constructs a pairwise relationship representation for each sentence pair, which helps RPD not only exploit the global orientation information among unordered sentences but also consider the local coherence between the candidate sentence and the previously sorted ones. Thus, RPD is able to generate a more coherent order assignment for the input sentences. In addition, the pairwise ordering prediction loss is also + +added as the auxiliary objective to guide the coherence modeling in the training procedure. The overall architecture of our model is presented in Figure 1. + +Extensive experiments are conducted on six public datasets in different domains to evaluate the performances of BERSON. The results show that BERSON significantly outperforms the existing approaches by a wide margin and achieves a state-of-the-art performance on all the datasets and under all the evaluation measurements. + +# 2 Relational Sentence Ordering Network + +In this section, we start by formulating the sentence ordering problem and then present the proposed model BERSON, which is composed of a BERT-based Hierarchical Relational Sentence Encoder, a Self-Attention based Paragraph Encoder, and a Relational Pointer Decoder enhanced by a new Deep Relational Module to model the text coherence in a more effective way. + +# 2.1 Problem Definition + +Given an out-of-order version set of $N$ sentences $\mathbf{s} = [s_1,s_2,\dots ,s_N]$ , and $s_i = [w_{i1},w_{i2},\dots ,w_{il_i}]$ where $l_{i}$ is the number of words in sentence $s_i$ The model aims to recover the correct order $\mathbf{o} = [o_1,o_2,\dots ,o_N]$ for these sentences. + +# 2.2 Hierarchical Relational Sentence Encoder + +The sentence encoder is designed based on BERT with sentence pairs in the set as input, and further adopts two-level attention layers to encode the hierarchical semantic concepts and contextual information of the sentence. + +Formally, for the given $N$ sentences in the set, all the pair of sentences can be denoted as: + +$$ +P = \left\{P _ {i j} | i \in [ 1, N ], j \in [ 1, N ], i \neq j \right\} \tag {1} +$$ + +where $P_{ij}$ represents the sentence pair $(s_i, s_j)$ . The total number of sentence pairs is $|P| = A_N^2$ . These sentence pairs are sent into BERT to not only learn the sentence representation but also capture the pairwise relationship between sentences. + +As shown in the left part of Figure 1, given a sentence pair $P_{ij} = (s_i,s_j)$ , the input sequence of this pair to the BERT model consists of a [CLS] token, the first sentence $s_i$ in the pair, a separator token [SEP], and the second sentence $s_j$ . The BERT model encodes the representation for this pair as: + +$$ +\left\{C _ {i j}, h _ {i 1} ^ {P _ {i j}}, \dots , h _ {i l _ {i}} ^ {P _ {i j}}, S _ {i j}, h _ {j 1} ^ {P _ {i j}}, \dots , h _ {j l _ {j}} ^ {P _ {i j}} \right\} \tag {2} +$$ + +where $C_{ij}$ and $S_{ij}$ are the final hidden states of the [CLS] and [SEP] tokens, and $\left\{h_{i1}^{P_{ij}}, \dots, h_{il_i}^{P_{ij}}\right\}$ and $\left\{h_{j1}^{P_{ij}}, \dots, h_{jl_j}^{P_{ij}}\right\}$ are the output word representations of sentence $s_i$ and $s_j$ in this pair with the sequence length $l_i$ and $l_j$ respectively. + +After the BERT encoder, we compose a fixed-dimensional representation for each sentence. + +For sentence $s_i$ in pair $P_{ij}$ , the representations $\left\{h_{i1}^{P_{ij}}, \dots, h_{il_i}^{P_{ij}}\right\}$ of each word are combined together with an attention mechanism to obtain its sentence representation $h_i^{P_{ij}}$ : + +$$ +\begin{array}{l} u _ {i k} = \tanh \left(W _ {w} h _ {i k} ^ {P _ {i j}}\right), \alpha_ {i k} = \frac {\exp \left(v _ {w} u _ {i k}\right)}{\sum_ {k = 1} ^ {l _ {i}} \exp \left(v _ {w} u _ {i k}\right)} \\ h _ {i} ^ {P _ {i j}} = \sum_ {k = 1} ^ {l _ {i}} \alpha_ {i k} h _ {i k} ^ {P _ {i j}} \tag {3} \\ \end{array} +$$ + +where $W_{w}$ and $v_{w}$ are learnable parameters. Attention allows the model to concentrate on the informative words for coherence and helps build a better semantic representation. Similarly, we also compute the representation $h_{j}^{P_{ij}}$ for $s_{j}$ in pair $P_{ij}$ . + +Further, all the sentence pairs related to sentence $s_i$ can be described as: $P_{i} = \{P_{ij}|j\in [1,N],j\neq i\} \cup \{P_{ki}|k\in [1,N],k\neq i\}$ + +The number of pairs is $2N - 2$ . The corresponding sentence representations of $s_i$ obtained from these pairs are given as: $h_i = \left\{h_i^{P_{ij}}|j\in [1,N],j\neq i\right\} \cup \left\{h_i^{P_{ki}}|k\in [1,N],k\neq i\right\}$ . We denote $h_i = \{h_i^1,\dots ,h_i^{2N - 2}\}$ for simplification. + +Since the sentence embeddings of $s_i$ in different pairs capture different context features, to reward the most salient features that contribute highly to the overall contextual meaning of the sentence, a high-level attention mechanism is adopted to establish the final representation $x_i$ for sentence $s_i$ : + +$$ +\begin{array}{l} u _ {i} ^ {t} = \tanh \left(W _ {s} h _ {i} ^ {t}\right), \alpha_ {i} ^ {t} = \frac {\exp \left(v _ {s} u _ {i} ^ {t}\right)}{\sum_ {t = 1} ^ {2 N - 2} \exp \left(v _ {s} u _ {i} ^ {t}\right)} \\ x _ {i} = \sum_ {t = 1} ^ {2 N - 2} a _ {i} ^ {t} h _ {i} ^ {t} \tag {4} \\ \end{array} +$$ + +where $W_{s}$ and $\nu_{s}$ are also trainable weights. Essentially, as all the related sentence pairs are fairly considered, it is ensured that this representation being invariant to the input sentence order and being logically reliable to be used in our model. + +# 2.3 Paragraph Encoder + +After the sentence encoder, a self-attention based paragraph encoder is employed to capture the global dependency for all the sentences. + +Specifically, the sentence representations obtained from the sentence encoder are packed together into a paragraph matrix $X = [x_{1},\dots ,x_{N}]$ as $X^{(1)}$ , which is then sent to $L$ self-attention layers (Vaswani et al., 2017). For the $l$ -th layer, the output matrix $X^{(l)}$ is computed as: + +$$ +\widetilde {X} ^ {(l)} = \mathrm {L N} \left(X ^ {(l - 1)} + \operatorname {M u l t i H e a d} \left(X ^ {(l - 1)}\right)\right) \tag {5} +$$ + +$$ +X ^ {(l)} = \operatorname {L N} \left(\widetilde {X} ^ {(l)} + \operatorname {F F N} \left(\widetilde {X} ^ {(l)}\right)\right) \tag {6} +$$ + +where MultiHead $(\cdot)$ is multi-head attention function, $\mathrm{FFN}(\cdot)$ denotes the fully-connected feedforward network, and $\mathrm{LN}(\cdot)$ is the layer normalization operation (Ba et al., 2016). + +The final paragraph vector $m$ is generated by averaging the output matrix $X^{(L)}$ from the last self-attention layer: $m = \frac{1}{N}\sum_{n=1}^{N}X_{n}^{(L)}$ , where $X_{n}^{(L)}$ is the $n$ -th row in $X^{(L)}$ . This vector will then be used as the initial state of our decoder. + +# 2.4 Relational Pointer Decoder + +In this section, we propose a Relational Pointer Decoder (RPD), which utilizes the useful relative ordering information to enhance pointer network with a Deep Relational Module (DRM). In the following, we first describe the new module DRM + +and then incorporate it into the pointer network to strengthen the coherence modeling in the decoder. + +# 2.4.1 Deep Relational Module + +Our Deep Relational Module is based on BERT model, which aims to capture a better dependency relationship between sentences. The architecture of this module is shown in the middle part of Figure 1. + +In particular, as illustrated in Section 2.2, given the sentence pair $P_{ij}$ , the embedding of the [CLS] symbol from the top layer of BERT is denoted as $C_{ij}$ . Owing to the Next Sentence Prediction pretraining objective of BERT, this vector $C_{ij}$ is able to aggregate the semantic relations for the input sentence pair and is capable of identifying the relative order between two sentences. Therefore, we take full advantages of this vector to exploit the latent dependency for sentences. + +Further, a probability distribution $P(r|s_i,s_j)$ is generated, $r\in \{\mathrm{before, after}\}$ , which measures the probability of $s_i$ occurring before or after $s_j$ : + +$$ +P \left(r \mid s _ {i}, s _ {j}\right) = \operatorname {s o f t m a x} \left(W _ {c} C _ {i j}\right) \tag {7} +$$ + +where $W_{c}$ denotes the learnable weights. + +In order to obtain the richer pairwise relation information for the sentence pair, we combine the above semantic feature $C_{ij}$ and the probability distribution together: + +$$ +R _ {i j} = \left[ C _ {i j}; P (r | s _ {i}, s _ {j}) \right] \tag {8} +$$ + +This new vector $R_{ij}$ is considered as the relational representation for this sentence pair $(s_i, s_j)$ , which is then leveraged to provide the relative order information for the pointer network. We compute such pairwise relational representation for all the sentence pairs in the paragraph, and utilize the subset of them at each step of the decoder. + +Different from the previous method of using the learned sentence vectors to calculate the pairwise relationship between sentences (Yin et al., 2020), DRM employs the whole sequence of the sentence pair as the input to BERT. It allows us to directly relate words from different sentences together, which is more straightforward to exploit the intrinsic relations and coherence between sentences. Further, instead of relying on the modules trained from scratch to control the pairwise ordering predictions (Yin et al., 2020), DRM adopts BERT as the main building block to obtain a pairwise relationship representation for the sentence + +pair. Intuitively, being pre-trained on the large corpus in BERT, this representation encodes more reliable and accurate relative ordering information, and thus is more effective to help determine the pairwise ordering predictions in the decoder. + +# 2.4.2 Integrating DRM with Pointer Network + +As illustrated in the right part of Figure 1, Relational Pointer Decoder (RPD) incorporates Deep Relational Module into the pointer network to promote the coherence modeling among sentences. + +Formally, the conditional coherence probability of a predicted order $\widehat{\mathbf{o}}$ for the given out-of-order sentence set $\mathbf{s}$ can be computed as: + +$$ +P (\widehat {\mathbf {o}} | \mathbf {s}) = \prod_ {i = 1} ^ {N} P (\widehat {\sigma} _ {i} | \widehat {\mathbf {o}} _ {< i}, \mathbf {s}) \tag {9} +$$ + +A higher probability indicates a more coherent sentences assignment. We employ an LSTM-based pointer network as the basis of our decoder, and the mathematical formulation for the $i$ -th step in the decoder is: + +$$ +h _ {i} ^ {D} = \operatorname {L S T M} \left(h _ {i - 1} ^ {D}, x _ {\hat {o} _ {i - 1}}\right) \tag {10} +$$ + +$$ +P (\widehat {\boldsymbol {\sigma}} _ {i} | \widehat {\mathbf {0}} _ {< i}, \mathbf {s}) = \mathrm {s o f t m a x} (g ^ {T} \mathrm {t a n h} (W _ {q} h _ {i} ^ {D} + W _ {k} Z _ {i})) +$$ + +where $g$ , $W_{q}$ , and $W_{k}$ are all learnable parameters, $h_{i}^{D}$ is the hidden state in the decoder with size $d$ , $h_0^D = m$ , and $x_{\widehat{O}_{i - 1}}$ is the embedding of the previous predicted sentence $s_{\widehat{o}_{i - 1}}$ at step $i - 1$ . The softmax function produces an output distribution over all unordered sentences (candidate sentences). The one that yields the highest probability from the distribution will be selected at position $i$ . + +The matrix $Z_{i}$ encodes the relationship representation information of the candidate sentence with the other sentences in the set. For one candidate sentence, the other sentences can be divided into two groups: previously sorted subset and unsorted subset. The relative ordering information between the candidate sentence and the two group sentences are captured by the proposed DRM with its two versions: Ordered Module and Unordered Module, respectively. On the one hand, such modeling helps evaluate the local coherence between the previously sorted sentences and the candidate sentence for investigating the rationality of each candidate choice. On the other hand, the global relative orientation information of other unsorted sentences with respect to the candidate one also provides further clues for the current prediction. Thus, both the local dependency information and the global orientation are fully exploited in RPD. + +For the Ordered Module, the pairwise relationships between the predicted sentence $s_{\widehat{o}_{i-1}}$ at step $i - 1$ and the candidate sentence $s_c$ can be effectively measured by our deep relational module with the following relational representation: + +$$ +R _ {\widehat {O} _ {i - 1} c} = \left[ C _ {\widehat {O} _ {i - 1} c}; P \left(r \mid s _ {\widehat {O} _ {i - 1}}, s _ {c}\right) \right] \tag {11} +$$ + +which not only encodes the semantic relations between two sentences, but also includes the probability of whether sentence $s_c$ truly appears after $s_{\widehat{o}_{i-1}}$ or not. In similar ways, the relational embedding generated with the previous ordered sentences can be described as $\{R_{\widehat{o}_1c}, \dots, R_{\widehat{o}_{i-1}c}\}$ . Then, we compose a high-level local coherence representation $e_l(s_c)$ for this candidate sentence by integrating these relational embeddings to summarize the overall local dependency for $s_c$ . + +For the Unordered Module, the relative orientation of another unordered sentence $s_g$ with respect to the candidate sentence $s_c$ can also be captured by our relational embedding as: + +$$ +R _ {c g} = \left[ C _ {c g}; P \left(r \mid s _ {c}, s _ {g}\right) \right] \tag {12} +$$ + +Considering all the other unsorted sentences, a hierarchical global orientation representation $e_g(s_c)$ for $s_c$ can be obtained, which is formulated as: + +$$ +e _ {g} \left(s _ {c}\right) = \frac {1}{\left| S _ {c} \right|} \sum_ {s _ {g} \in S _ {c}} R _ {c g} \tag {13} +$$ + +where $S_{c}$ is the unordered sentence set except $s_c$ . + +Subsequently, to leverage the relative ordering information encoded by Ordered and Unordered Modules simultaneously, the representation $e_{l}(s_{c})$ and $e_{g}(s_{c})$ are integrated together, which allows us to build a more informative relational vector $e_{r}(s_{c})$ for sentence $s_{c}$ . Finally, a new representation for this candidate sentence $s_{c}$ is obtained by combining its sentence embedding and relational vector $e_{r}(s_{c})$ together: + +$$ +z \left(s _ {c}\right) = \left[ x _ {c}; e _ {r} \left(s _ {c}\right) \right] \tag {14} +$$ + +Such representation is generated for all unsorted sentences, which are then packed into matrix $Z_{i}$ for order predictions. During inference, we use beam search to select sentences sequentially. + +# 2.5 Model Training + +Assume that there are $Q$ paragraphs in the training set $Q = \{(\mathbf{s},\mathbf{o})\}$ . Following the existing ordering networks (Gong et al., 2016; Oh et al., 2019), the model is trained to maximize the coherence probability by minimizing the loss function as follows: + +
DatasetLength statisticsData splitVocabulary
meanmaxtrainvalidtest
NIPS abstract615242740837711505
AAN abstract5208569962262634485
NSF abstract8.940960701018521580334090
arXiv abstract5.383588491211061411061564557
SIND55401554990505530861
ROCStory55785299816981733903
+ +Table 2: Summary of datasets used in our experiments. + +$$ +L _ {c} = - \frac {1}{| Q |} \sum_ {(\mathbf {s}, \mathbf {0}) \in Q} \log P (\mathbf {o} | \mathbf {s}; \theta) + \frac {\lambda}{2} \| \theta \| _ {2} ^ {2} \tag {15} +$$ + +where $\theta$ denotes all the trainable parameters. + +To further exploit the correct relative order information, we add the Pairwise Ordering Prediction Loss (Ploss) as an auxiliary objective $L_{p}$ . It is defined as the cross-entropy loss function optimized by minimizing the negative log-likelihood of each pair's ground-truth relative ordering label $y_{ij} \in [0,1]$ , given the networks prediction $\widehat{y}_{ij}$ : + +$$ +\begin{array}{l} L _ {p} = - \frac {1}{| Q |} \frac {1}{| P |} \sum_ {(\mathbf {s}, \mathbf {0}) \in Q} \sum_ {P _ {i j} \in P} (- y _ {i j} \log P (\widehat {y} _ {i j} | P _ {i j}) \\ - (1 - y _ {i j}) P (1 - \widehat {y} _ {i j} | P _ {i j})) \\ \end{array} +$$ + +The final training objective of our model can be formulated as: + +$$ +L = L _ {C} + \alpha L _ {p} \tag {16} +$$ + +where $\alpha$ is the coefficient that makes a balance between the influences of the two loss functions. + +# 3 Experiments + +In this section, we empirically evaluate the effectiveness of BERSON in the sentence ordering task. + +# 3.1 Datasets + +The experiments are conducted on six public datasets in different domains: + +NIPS abstract, AAN abstract, NSF abstract, arXiv abstract: These datasets contain abstracts of research papers. NIPS abstract1 is from conference papers in NIPS, where papers in years 2005-2013/2014/2015 for training/validation/testing (Logeswaran et al., 2018). AAN abstract (Logeswaran et al., 2018) is collected from ACL Anthology Network corpus. ACL papers published up to year 2010 for training, year 2011 for validation and 2012-2013 for testing. NSF abstract (Logeswaran et al., 2018) is from NSF Research Award abstract dataset, where abstracts in years 1990-1999/2000/2001-2003 for + +
Datasetlearning ratebatch sizeepochscoefficient α
NIPS abstract5e-58200.2
AAN abstract5e-532100.4
NSF abstract2e-516100.4
arXiv abstract2e-532100.8
SIND2e-58101.0
ROCStory2e-516100.6
+ +Table 3: Hyper-parameter settings of our model on each dataset. + +training/validation/testing. ArXiv abstract (Gong et al., 2016; Chen et al., 2016) is from arXiv website2. The validation and test sets of this dataset are the first and last $10\%$ abstracts from the shuffled data, and the remaining data are for training. + +SIND, ROCStory: SIND is a visual storytelling dataset3 (Huang et al., 2016), which is released as training/validation/testing following the 8:1:1 split. ROCStory is a commonsense story dataset4 (Wang and Wan, 2019; Mostafazadeh et al., 2016). It is randomly split by 8:1:1 for the training/validation/test sets. Both of two datasets consist of 5 sentences in each story text. + +Table 2 shows the details of all the datasets. + +# 3.2 Evaluation Metrics + +Following the existing work (Oh et al., 2019), we employ the three most commonly used metrics in this task to assess the model performance: + +Accuracy (Acc): This metric calculates the ratio of sentences whose absolute positions are correctly predicted (Logeswaran et al., 2018). + +Perfect Match Ratio (PMR): It measures the percentage of the exactly matching orders across all the paragraphs: $\mathrm{PMR} = \frac{1}{Q}\sum_{i = 1}^{Q}\mathbb{1}(\widehat{\mathbf{o}}^i = \mathbf{o}^i)$ , where $\widehat{\mathbf{o}}^i$ and $\mathbf{o}^i$ are the predicted and correct order of the $i$ -th paragraph respectively (Chen et al., 2016). + +Kendall's tau $(\tau)$ : For a paragraph containing $N$ sentences, $\tau$ is defined as: $\tau = 1 - 2 \times (\# \text{ inversions}) / \binom{N}{2}$ , where $\# \text{ inversions}$ denotes the number of pairs in the predicted sequence with the incorrect relative order (Lapata, 2003). The score ranges from -1 (the worst) to 1 (the best). + +A higher score indicates a better performance for all the metrics. + +# 3.3 Experimental Setup + +We adopt the $\mathrm{BERT}_{\mathrm{BASE}}$ in the experiment and fine-tune it on each dataset. The paragraph en + +coder has 2 self-attention layers with 8 heads. The hidden size is 768 and beam size is 16. Adam is employed as the optimizer. To search for the optimal hyper-parameters, we adopt the grid search strategy for learning rate from $\{2\mathrm{e} - 5,5\mathrm{e} - 5\}$ , batch size from $\{8,16,32\}$ , the number of epochs from $\{5,10,20\}$ , and the coefficient $\alpha$ in the loss function from $\{0.2,0.4,0.6,0.8,1.0\}$ . The model with the best performance on the validation set is selected for each setting. The recommended hyperparameter configuration of the model on each dataset are presented in Table 3. To diminish the effects of randomness in training, the results of our model are averaged with 5 random initializations. For data preprocessing, we use the tokenizer from BERT to preprocess the sentences. The experiments are conducted on GeForce GTX 1080Ti GPU with PyTorch framework. + +# 3.4Baselines + +To demonstrate that BERSON truly improves the sentence ordering performance, we compare it with the state-of-the-art methods in this task, which can be categorized into two classes: + +(1) Ranking or Sorting frameworks: Pairwise Model (Chen et al., 2016); RankTxD (Kumar et al., 2020); B-TSort (Prabhumoye et al., 2020). (2) Pointer network based models: HAN (Wang and Wan, 2019); LSTM+PtrNet (Gong et al., 2016); V-LSTM+PtrNet (Logeswaran et al., 2018); ATTOrderNet (Cui et al., 2018); SE-Graph (Yin et al., 2019); FUDecoder (Yin et al., 2020); TGCM (Oh et al., 2019). + +In addition to the above existing approaches, we also investigate three variants of BERSON. + +BertSenPD: This model replaces the ranking module in RankTxNet with the traditional pointer network decoder (PD). Please note that it uses the single sentence rather than sentence pair as the input to BERT to obtain the sentence vector. + +BertPairPD, HRSEPD: These two models employ the sentence pair encoding strategy with BERT and utilize PD instead of our RPD as the decoder. HRSEPD adopts the proposed Hierarchical Relational Sentence Encoder (HRSE), while BertPairPD does not have two-level attention layers in the encoder. They aim to investigate the impact of both the Hierarchical Relational Sentence Encoder and the Relational Pointer Decoder. + +
ModelsNIPS abstractAAN abstractNSF abstractarXiv abstractSINDROCStory
AccPMRτAccPMRτAccPMRτAccPMRτAccPMRτAccPMRτ
Pairwise Model----------33.430.66------
LSTM+PtrNet50.87-0.6758.20-0.6932.45-0.52-40.440.72-12.340.48---
V-LSTM+PtrNet51.55-0.7258.06-0.7328.33-0.51---------
ATTOperateNet56.09-0.7263.24-0.7337.72-0.55-42.190.73-14.010.49---
HAN----------44.550.75-15.010.50-39.620.73
SE-Graph57.27-0.7564.64-0.78----44.330.75-16.220.52---
FUDecoder----------46.580.77-17.370.53-46.000.77
TGCM59.4331.440.7565.1636.690.7542.6722.350.5558.3144.280.7538.7115.180.53---
RankTxNet-24.130.75-39.180.77-9.780.58-43.440.77-15.480.57-38.020.76
B-TSort61.4832.590.8169.2250.760.8335.2110.440.66---52.2320.320.60---
BertSenPD64.3631.300.7970.3445.450.8045.7617.410.6469.7246.260.7852.1219.190.5875.0552.560.81
BertPairPD67.6532.890.8173.9950.530.8346.8818.760.6571.0348.980.7954.3623.860.6078.0160.390.83
HRSEPD67.9935.540.8375.4553.270.8447.0119.020.6571.6549.910.8056.2225.220.6379.8161.930.84
BERSON73.8748.010.8578.0359.790.8550.0223.070.6775.0856.060.8358.9131.690.6582.8668.230.88
+ +Table 4: Comparison results for different models on sentence ordering task. The best and second-best results are in bold and underlined respectively. + +# 3.5 Main Results + +The experimental results7 are reported in Table 4. As we see, BERSON achieves the state-of-the-art performance on all the datasets and under all the evaluation metrics. + +The results show that BERSON significantly outperforms all the existing methods by a large margin. BERSON shows remarkable improvements over the existing best systems of $12.39\%$ and $16.77\%$ accuracy score on NIPS and arXiv datasets, and with $15.42\%$ , $11.37\%$ , and even $22.23\%$ gains in PMR score on NIPS, SIND, and ROCStory datasets respectively, which strongly demonstrates the effectiveness of our model8. + +Compared with the existing ranking approaches, our BertSenPD baseline performs much better than RankTxNet with stable improvements, which confirms the superiority of the traditional pointer network to the ranking module used in their model. This could be due to that RankTxNet only computes a score for each sentence in parallel, which overlooks the coherence of the whole predicted sequence and may have trouble in generating a more coherent order assignment. Besides, although B-TSort outperforms RankTxNet with clear improvements, it only considers the sentence-pair interactions and does not take the entire paragraph into account. Therefore, B-TSort is limited by the lack of a global structure and + +falls behind other baselines for Acc and PMR scores on the large dataset NSF abstract. In contrast, BERSON not only captures the local coherence between every two sentences but also obtains the paragraph-level contextual information for the global dependency, hence being more competitive in the sentence ordering. + +In addition, among the pointer network based ordering models, FUDecoder exhibits a better performance. However, the ordering prediction modules of FUDecoder are built based on two nonlinear layers trained from scratch and with the learned sentence vectors as the input, which is still difficult to fully explore the latent dependency among sentences. Once these modules are not sufficiently trained especially on small datasets, they may mislead the decoder with the wrong relative orientation information. Our BERSON overcomes the limitation of FUDecoder by utilizing BERT model as the main building block of our DRM to improve the pairwise ordering strategy. As shown in Table 4, BERSON achieves to outperform FUDecoder with significant improvements of about $14.32\%$ and $22.23\%$ PMR score on SIND and ROCStory respectively, which proves the promise of incorporating more reliable ordering module into the decoder to ensure the more accurate relative ordering information. + +Moreover, for the variants of our model, Bert-PairPD and HRSEPD perform better than Bert-SenPD on all the datasets. This shows that with the sentence pair instead of single sentence as the input to BERT, the model directly builds the inter + +
ModelsarXiv abstractROCStory
AccPMRτAccPMRτ
BertPairPD71.0348.980.7978.0160.390.83
HRSEPD71.6549.910.8079.8161.930.84
BERSON75.0856.060.8382.8668.230.88
- Ordered Module73.6254.510.8281.1466.610.86
- Unordered Module72.5750.490.8080.3562.470.85
- Ploss73.9954.890.8281.6366.920.87
+ +![](images/45c9b0e5e1a9211d606e581db657451d062d2683ff5888e841f5d25934ae78eb.jpg) +Figure 2: Results of varying the coefficient $\alpha$ for Pairwise Ordering Prediction Loss in our model. + +actions between words from different sentences, which is capable of capturing the rich contextual information for each sentence and is more beneficial to modeling the relations among sentences. Besides, HRSEPD outperforms BertPairPD with stable improvements, which reflects the strength of our Hierarchical Relational Sentence Encoder. Furthermore, by adopting our Relational Pointer Decoder to replace the traditional pointer network, BERSON achieves further improvements across the datasets, which demonstrates the advantage of enhancing the pointer network with DRM to reach a superior performance. + +# 3.6 Ablation Study + +Further, to better understand the contributions of different components in our Relational Pointer Decoder, we conduct ablation study on arXiv and ROCStory datasets, which are both the largest datasets in the two domains for providing more reliable analysis. The results are reported in Table 5. + +Effect of Ordered and Unordered Modules: It is observed that the removal of two modules hurts the model performance dramatically though they still outperform our baseline models BertPairPD and HRSEPD. Compared with Ordered Module, the lack of Unordered Module leads noticeable drops, which indicates that the relative orientations between unsorted sentences are more important for + +Table 5: Ablation studies on arXiv and ROCStory datasets. We remove various modules and explore their influences to our model. + +
ModelsarXiv abstractSIND
headtailheadtail
Pairwise Model84.8562.37--
LSTM+PtrNet90.4766.4974.6653.30
ATTOrderNet91.0068.0876.0054.42
SE-Graph92.2870.4578.1256.68
FUDecoder92.7671.4978.0857.32
TGCM92.4669.4578.9856.24
RankTxNet92.9769.1380.3259.68
BertSenPD93.3872.5781.4661.02
BertPairPD94.0173.9982.3762.24
BERSON94.7576.6984.9564.87
+ +Table 6: Accuracy of predicting the first and the last sentences on arXiv and SIND datasets. + +order predictions. The superior performance of BERSON over these two variants shows the necessity of having both modules in RPD to leverage the global orientation and local dependency information simultaneously for a better coherence model. + +Effect of Pairwise Ordering Prediction Loss: As shown in Table 5, removing the Pairwise Ordering Prediction Loss (Ploss) in the training procedure causes a performance degradation on both datasets. This proves the benefit of encouraging the accurate relative ordering information through the loss function. As the coefficient $\alpha$ in Equation 16 directly controls the impact of Ploss, we further study how the value of this coefficient affects the performance of BERSON. Figure 3 shows the results of accuracy score on arXiv and ROCStory datasets. It is shown that $\alpha = 0.8$ , 0.6 is superior to other settings for arXiv and ROCStory respectively. Thus, it is essential to have an appropriate value to balance the importance of Ploss and the original training objective for BERSON. + +# 3.7 Analysis + +In this section, we delve into further analysis to investigate the stability and adaptability of the proposed model. + +# 3.7.1 Prediction of First and Last Sentences + +Previous studies (Oh et al., 2019; Yin et al., 2019) have mentioned that both the first and last sentences play crucial roles in a paragraph due to their special positions. Thus, we also report the performances of our models in correctly predicting these two sentences on arXiv and SIND datasets. As summarized in Table 6, both of the two variants BertSenPD and BertPairPD outperform the existing state-of-the-arts. BERSON achieves fur + +
ModelsWin=1Win=2Win=3Win=1Win=2Win=3
NIPS abstractSIND
B-TSort87.5995.5998.1182.6795.0199.09
BERSON91.9896.8499.2984.0195.1199.10
NSF abstractAAN abstract
B-TSort61.4175.5283.8790.5696.7898.71
BERSON70.0880.2986.4693.3197.5799.09
+ +Table 7: Analysis of the displacement of sentences on four datasets. Win denotes the Window size. + +
ModelsAccPMRτLCSRouge-S
NIPS abstract
B-TSort39.430.000.7471.6883.26
BertPairPD43.756.670.7572.5987.44
BERSON50.8913.330.7674.9687.94
AAN abstract
B-TSort36.860.000.6972.0178.52
BertPairPD40.753.450.7173.8785.77
BERSON47.386.900.7376.5386.48
+ +Table 8: Performance for paragraphs containing more than 10 sentences in NIPS and AAN datasets. + +ther boosts and reaches the best performances on both datasets. For identifying the last sentence, BERSON obtains significant improvements over RankTxNet of $7.56\%$ and $5.19\%$ gain on arXiv and SIND datasets respectively, which also indicates the benefits of the proposed model. + +# 3.7.2 Sentence Displacement Analysis + +Additionally, we analyze the displacement of sentences in the predicted orders by calculating the percentage of sentences whose predicted location is within one, two or three positions from their original location (Prabhumoye et al., 2020). The higher score is better, which denotes less displacement of sentences. As summarized in Table 7, BERSON also achieves a better performance than B-TSort across the datasets and on all the window sizes especially for the smaller ones. BERSON even reaches $99\%$ percent when the window size is 3 on NIPS, AAN, and SIND datasets, which clearly demonstrates the promise of BERSON. + +# 3.7.3 Performance on Longer Paragraphs + +Following the prior approach (Prabhumoye et al., 2020), we also evaluate the model performance on paragraphs longer than 10 sentences, which are much challenging for the order prediction. In addition to the three metrics adopted in the previous sections, here we also utilize two other metrics: + +Longest Common Subsequence (LCS) and Rouge-S for a more comprehensive comparison9. Table 8 reports the results on NIPS and AAN datasets. BERSON significantly outperforms B-TSort with all the metrics, showing more than $10\%$ gain in accuracy score on both datasets. Besides, the results of PMR score indicate that it is difficult for B-TSort to exactly match orders for all the sentences, while our BERSON consistently shows a good potential on these longer paragraphs, which proves the stronger ability of BERSON in modeling the long-range dependency across the sentences. + +# 4 Conclusion + +In this work, we develop a new BERT-enhanced Relational Sentence Ordering Network (BERSON) by integrating BERT with the pointer network for a better coherence modeling. In particular, a novel Relational Pointer Decoder is developed to incorporate the relative ordering information into the pointer network with a Deep Relational Module, which leverages BERT to fully exploit the pairwise relationships between sentences helping generate an ordered sequence. The experiments on six datasets demonstrate the superiority of BERSON to the baselines, which achieves the state-of-the-art performance across the datasets. + +# Acknowledgments + +This work is supported in part by Science and Technology Innovation 2030-New Generation Artificial Intelligenc" Major Project No.(2018AAA0100904), National Key R&D Program of China (No. 2018YFB1403600), NSFC (No. 61672456, 61702448, U19B2043), Artificial Intelligence Research Foundation of Baidu Inc., the funding from HIKVision and Horizon Robotics, and ZJU Converging Media Computing Lab. We thank all reviewers for their valuable comments. + +# References + +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. 2016. Layer normalization. arXiv preprint arXiv:1607.06450. +Regina Barzilay and Noemie Elhadad. 2002. Inferring strategies for sentence ordering in multidocument news summarization. Journal of Artificial Intelligence Research, 17:35-55. + +Regina Barzilay and Mirella Lapata. 2008. Modeling local coherence: An entity-based approach. Computational Linguistics, 34(1):1-34. +Xinchi Chen, Xipeng Qiu, and Xuanjing Huang. 2016. Neural sentence ordering. arXiv preprint arXiv:1607.06952. +Baiyun Cui, Yingming Li, Ming Chen, and Zhongfei Zhang. 2018. Deep attentive sentence ordering network. In EMNLP, pages 4340-4349. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding. In *NAACL*, pages 4171–4186. +Youmna Farag and Helen Yannakoudakis. 2019. Multi-task learning for coherence modeling. In ACL, pages 629-639. +Jingjing Gong, Xinchi Chen, Xipeng Qiu, and Xu-anjing Huang. 2016. End-to-end neural sentence ordering using pointer network. arXiv preprint arXiv:1611.04953. +Ari Holtzman, Jan Buys, Maxwell Forbes, Antoine Bosselut, David Golub, and Yejin Choi. 2018. Learning to write with cooperative discriminators. In ACL, pages 1638-1649. +Ting-Hao Kenneth Huang, Francis Ferraro, Nasrin Mostafazadeh, Ishan Misra, Aishwarya Agrawal, Jacob Devlin, Ross Girshick, Xiaodong He, Pushmeet Kohli, Dhruv Batra, et al. 2016. Visual storytelling. In NAACL, pages 1233-1239. +Ioannis Konstas and Mirella Lapata. 2013. Inducing document plans for concept-to-text generation. In EMNLP, pages 1503-1514. +Pawan Kumar, Dhanajit Brahma, Harish Karnick, and Piyush Rai. 2020. Deep attentive ranking networks for learning to order sentences. In AAAI, pages 8115-8122. +Mirella Lapata. 2003. Probabilistic text structuring: Experiments with sentence ordering. In ACL, pages 545-552. Association for Computational Linguistics. +Lajanugen Logeswaran, Honglak Lee, and Dragomir Radev. 2018. Sentence ordering and coherence modeling using recurrent neural networks. In AAAI. +Mohsen Mesgar, Sebastian Bucker, and Iryna Gurevych. 2019. A neural model for dialogue coherence assessment. arXiv preprint arXiv:1908.08486. +Han Cheol Moon, Muhammad Tasnim Mohiuddin, Shafiq Joty, and Chi Xu. 2019. A unified neural coherence model. In EMNLP-IJCNLP, pages 2262-2272. + +Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. 2016. A corpus and cloze evaluation for deeper understanding of commonsense stories. In *NAACL*, pages 839-849. +Ramesh Nallapati, Feifei Zhai, and Bowen Zhou. 2017. Summarunner: A recurrent neural network based sequence model for extractive summarization of documents. In AAAI, pages 3075-3081. +Byungkook Oh, Seungmin Seo, Cheolheon Shin, Eunju Jo, and Kyong-Ho Lee. 2019. Topic-guided coherence modeling for sentence ordering by preserving global and local information. In EMNLP-IJCNLP, pages 2273-2283. +Shrimai Prabhumoye, Ruslan Salakhutdinov, and Alan W Black. 2020. Topological sort for sentence ordering. In ACL, pages 2783-2792, 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 NIPS, pages 6000-6010. +Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. 2015. Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391. +Tianming Wang and Xiaojun Wan. 2019. Hierarchical attention networks for sentence ordering. In AAAI, volume 33, pages 7184-7191. +Peng Xu, Hamidreza Saghir, Jin Sung Kang, Teng Long, Avishek Joey Bose, Yanshuai Cao, and Jackie Chi Kit Cheung. 2019. A cross-domain transferable neural coherence model. In ACL, pages 678-687. +Yongjing Yin, Fandong Meng, Jinsong Su, Yubin Ge, Linfeng Song, Jie Zhou, and Jiebo Luo. 2020. Enhancing pointer network for sentence ordering with pairwise ordering predictions. In AAAI, pages 9482-9489. +Yongjing Yin, Linfeng Song, Jinsong Su, Jiali Zeng, Chulun Zhou, and Jiebo Luo. 2019. Graph-based neural sentence ordering. In *IJCAI*, pages 5387-5393. +Xingshan Zeng, Jing Li, Lu Wang, Nicholas Beauchamp, Sarah Shugars, and Kam-Fai Wong. 2018. Microblog conversation recommendation via joint modeling of topics and discourse. In NAACL, pages 375-385. + +# A Appendix + +# A.1 Case Study + +Table 9 reports the sentence ordering results for two examples produced by different models. For the baseline FUDecoder and B-TSort, we ran the public code provided by the authors to generate + +the order predictions. As we see, in the first example, BERSON achieves to exact match orders for all the sentences while all the baseline methods have some incorrect order predictions. For the second input paragraph, BERSON is able to correctly predict the order for the most of sentences which also shows a better performance than the competing models. + +# A.2 Two other metrics used in the Analysis + +Longest Common Subsequence (LCS): It calculates the percentage of longest correct subsequence between the predicted order and the gold order (Gong et al., 2016). The consecutiveness is not necessary for it10. + +Rouge-S: This metric (Chen et al., 2016; Gong et al., 2016) measures the fraction of pairs of sentences whose predicted relative order is the same as the ground truth order11. It allows for any arbitrary gaps between two sentences as long as their relative order is correctly identified. + +A higher score is better for both metrics. + +# A.3 Discussion of Topic Shift Problem + +BERSON captures both global and local coherence among sentences, which is effective in reorganizing texts with multiple topics. In particular, the paragraph encoder is able to model the global topic information for all the sentences, which helps guide the order prediction process for the decoder. In addition, building upon the Next Sentence Prediction pre-training objective of BERT, the Deep Relational Module captures the local dependency relationship between each pair of sentences and identifies the tight semantic connections for sentence ordering, especially identifying the sentences containing topic shift clues of the whole text and acting as a link between the preceding and the following topics. Further, the Relational Pointer Decoder leverages both the topical context flows from the previously predicted sequences and from the unsorted sentences to generate an accurate order prediction for these topic-linking sentences and their neighboring ones. Therefore, BERSON is capable of generating a logically consistent output sequence for texts including texts with topic shift. + +
Example 1
(4) The reception began with the bride and groom dancing. +(2) The bride and groom wrote their own wedding vows. +(5) Then, family pictures were taken with the bride and groom. +(1) We gathered at the church to celebrate the marriage. +(3) They make a handsome couple.
Ground Truth(1) (2) (3) (4) (5)
FUDecoder(1) (2) (5) (4) (3)
B-TSort(2) (4) (3) (1) (5)
BertPairPD(1) (3) (2) (4) (5)
BERSON(1) (2) (3) (4) (5)
Example 2
(4) The first one extracts relevant noun phrases as a heading. +(6) Finally, the last one uses nominalization to propose titles. +(3) Our application relies on three different tilting methods. +(1) This paper deals with an application of automatic tilting. +(5) And the second one selects words appearing in the text. +(2) It aims to attribute a title for a given text. +(7) Experiments show that our methods provide relevant titles.
Ground Truth(1) (2) (3) (4) (5) (6) (7)
FUDecoder(2) (1) (3) (4) (6) (5) (7)
B-TSort(1) (2) (4) (5) (6) (3) (7)
BertPairPD(1) (2) (3) (4) (6) (7) (5)
BERSON(1) (2) (3) (4) (5) (7) (6)
+ +Table 9: Ordering prediction examples generated by different approaches. The prediction in blue indicates the wrong order assignment. + +
DatasetBERSONBertPairPD
Runtime# ParamsRuntime# Params
NIPS abstract58s129M47s127M
AAN abstract1min26s129M1min15s127M
NSF abstract57min59s129M48min40s127M
arXiv abstract2h44min23s129M2h31min10s127M
SIND3min33s129M2min58s127M
ROCStory6min31s129M5min28s127M
+ +# A.4 Further Experimental Results + +For the more detailed experimental results, Table 10 summarizes the runtime on the validation set and the number of parameters for BERSON and BertPairPD. The validation results of BERSON on all the datasets are reported in Table 11. + +Table 10: The runtime on the validation set and the total number of parameters for BERSON and baseline model BertPairPD. + +
DatasetValidation Results
AccPMRτ
NIPS abstract68.6539.460.82
AAN abstract76.7558.840.85
NSF abstract51.7123.390.68
arXiv abstract74.8455.750.82
SIND58.8431.700.65
ROCStory82.5567.630.87
+ +Table 11: The validation performance of BERSON. \ No newline at end of file diff --git a/bertenhancedrelationalsentenceorderingnetwork/images.zip b/bertenhancedrelationalsentenceorderingnetwork/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..f6fd9d0df86588ff353dc13f502ad9fd4ee345fb --- /dev/null +++ b/bertenhancedrelationalsentenceorderingnetwork/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:848b21fa85209289d4d21b5bf35cbadbf6e1e0e6d6bb4fdde952960048c6a2c4 +size 716331 diff --git a/bertenhancedrelationalsentenceorderingnetwork/layout.json b/bertenhancedrelationalsentenceorderingnetwork/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..85d5f0ad6548de9d62b7fc32787c6a25a635073c --- /dev/null +++ b/bertenhancedrelationalsentenceorderingnetwork/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdd75b083704eeb3e7828fe3cc640abd735c406fb8968c77a418b1099b7a21b5 +size 471721 diff --git a/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_content_list.json b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..fe9f93eadd241da7474d01fcef77df5c398f4d50 --- /dev/null +++ b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f1fe038ee7a7e67a80d3265d9dec64472d0d2575afd59bb52d5cc01e79596d2 +size 106566 diff --git a/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_model.json b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7058e61894ed660aca101253c8ba2866953aeb2a --- /dev/null +++ b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e271fb77acd4ad9a09c853af8c4a9e0b07d4a24b614aea4382d5d2e466f4bf61 +size 128603 diff --git a/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_origin.pdf b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fe8aca4d1e53099902766a53fe2c2f505af824c4 --- /dev/null +++ b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/3c871d1e-c47d-46b8-8b41-c6e8ae57b38f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6cbb3205033a02431981207792c5ff65bbb3b864cbbe6e84c7e872fd2c68e838 +size 930265 diff --git a/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/full.md b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..9563b95ab659398eefe3c4640fc14b502ada90c3 --- /dev/null +++ b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/full.md @@ -0,0 +1,347 @@ +# BERT Knows Punta Cana is not just beautiful, it's gorgeous: Ranking Scalar Adjectives with Contextualised Representations + +Aina Garí Soler + +Université Paris-Saclay + +CNRS, LIMSI + +91400 Orsay, France + +aina.gari@limsi.fr + +Marianna Apidianaki + +Department of Digital Humanities + +University of Helsinki + +Helsinki, Finland + +marianna.apidianaki@helsinki.fi + +# Abstract + +Adjectives like pretty, beautiful and gorgeous describe positive properties of the nouns they modify but with different intensity. These differences are important for natural language understanding and reasoning. We propose a novel BERT-based approach to intensity detection for scalar adjectives. We model intensity by vectors directly derived from contextualised representations and show they can successfully rank scalar adjectives. We evaluate our models both intrinsically, on gold standard datasets, and on an Indirect Question Answering task. Our results demonstrate that BERT encodes rich knowledge about the semantics of scalar adjectives, and is able to provide better quality intensity rankings than static embeddings and previous models with access to dedicated resources. + +# 1 Introduction + +Scalar adjectives describe a property of a noun at different degrees of intensity. Identifying the scalar relationship that exists between their meaning (for example, the increasing intensity between pretty, beautiful and gorgeous) is useful for text understanding, for both humans and automatic systems. It can serve to define the sentiment and subjectivity of a text, perform inference and textual entailment (Van Tiel et al., 2016; McNally, 2016), build question answering and recommendation systems (de Marneffe et al., 2010), and assist language learners in distinguishing between semantically similar words (Sheinman and Tokunaga, 2009). + +We investigate the knowledge that the pretrained BERT model (Devlin et al., 2019) encodes about the intensity expressed on an adjective scale. Given that this property is acquired by humans during language learning, we expect a language model (LM) exposed to massive amounts of text data during training to have also acquired some + +![](images/7fd5f16062af78b007a8bf2a6759a32a606f19f090dd68f7a819a747ab259414.jpg) +Figure 1: Full scale of adjectives describing positive and negative sentiment at different degrees from the SO-CAL dataset (Taboada et al., 2011). + +notion of adjective intensity. In what follows, we explore this hypothesis using representations extracted from different layers of this deep neural model. Since the scalar relationship between adjectives is context-dependent (Kennedy and McNally, 2005) (e.g., what counts as tall may vary from context to context), we consider the contextualised representations produced by BERT to be a good fit for this task. We also propose a method inspired by gender bias work (Bolukbasi et al., 2016; Dev and Phillips, 2019) for detecting the intensity relationship of two adjectives on the fly. We view intensity as a direction in the semantic space which, once identified, can serve to determine the intensity of new adjectives. + +Our work falls in the neural network interpretation paradigm which explores the knowledge about language encoded in the representations of deep learning models (Voita et al., 2019a; Clark et al., 2019; Voita et al., 2019b; Tenney et al., 2019; Talmor et al., 2019). The bulk of this interpretation work addresses structural aspects of language such as syntax, word order, or number agreement (Linzen et al., 2016; Hewitt and Manning, 2019; Hewitt and Liang, 2019; Rogers et al., 2020); shallow semantic phenomena closely related to syntax such as semantic role labelling and coreference (Tenney et al., 2019; Kovaleva et al., 2019); or the symbolic reasoning potential of language model representations (Talmor et al., 2019). Our + +work makes a contribution towards the study of the knowledge pre-trained LMs encode about word meaning, generally overlooked until now in interpretation work. + +We evaluate the representations generated by BERT against gold standard adjective intensity estimates (de Melo and Bansal, 2013; Wilkinson, 2017; Cocos et al., 2018) and apply them directly to a question answering task (de Marneffe et al., 2010). Our results show that BERT clearly encodes the intensity variation between adjectives on scales describing different properties. Our proposed method can be easily applied to new datasets and languages where scalar adjective resources are not available. $^{1}$ + +# 2 Related Work + +The analysis of scalar adjective relationships in the literature has often been decomposed into two steps: Grouping related adjectives together and ranking adjectives in the same group according to intensity. The first step can be performed by distributional clustering approaches (Hatzivassiloglou and McKeown, 1993; Pang et al., 2008) which can also address adjectival polysemy. Hot, for example, can be on the TEMPERATURE scale (a warm $\rightarrow$ hot $\rightarrow$ scalding drink), the ATTRACTIVENESS (a pretty $\rightarrow$ hot $\rightarrow$ sexy person) or the INTEREST scale (an interesting $\rightarrow$ hot topic), depending on the attribute it modifies. + +Other works (Sheinman and Tokunaga, 2009; de Melo and Bansal, 2013; Wilkinson, 2017) directly address the second step, ranking groups of semantically related adjectives from lexicographic resources (e.g., WordNet) (Fellbaum, 1998). This ranking is the focus of this work. We show that BERT contextualised representations encode rich information about adjective intensity, and can provide high quality rankings of adjectives in a scale. + +Adjective ranking has been traditionally performed using pattern-based approaches which extract lexical or syntactic patterns indicative of an intensity relationship from large corpora (Sheinman and Tokunaga, 2009; de Melo and Bansal, 2013; Sheinman et al., 2013; Shivade et al., 2015). For example, the patterns "X, but not Y" and "not just X but Y" provide evidence that X is an adjective less intense than Y. Another common approach is lexicon-based and draws upon a resource that maps adjectives to scores encoding sentiment po + +larity (positive or negative) and intensity. Such resources can be manually created, like the SO-CAL lexicon (Taboada et al., 2011), or automatically compiled by mining adjective orderings from star-valued product reviews where people's comments have associated ratings (de Marneffe et al., 2010; Rill et al., 2012; Sharma et al., 2015; Ruppenhofer et al., 2014). Cocos et al. (2018) combine knowledge from lexico-syntactic patterns and the SO-CAL lexicon with paraphrases in the Paraphrase Database (PPDB) (Ganitkevitch et al., 2013; Pavlick et al., 2015). + +Our approach is novel in that it does not need specified patterns or access to lexicographic resources. It, instead, relies on the knowledge about intensity encoded in scalar adjectives' contextualised representations. Our best performing method is inspired by work on gender bias which relies on simple vector arithmetic to uncover gender-related stereotypes. A gender direction is determined (for example, by comparing the embeddings of she and he, or woman and man) and the projection of the vector of a potentially biased word on this direction is then calculated (Bolukbasi et al., 2016; Zhao et al., 2018). We extend this method to scalar adjectives and BERT representations. + +Kim and de Marneffe (2013) also consider vector distance in the semantic space to encode scalar relationships between adjectives. They specifically examine a small set of word pairs, and observe that the middle point in space between the word2vec (Mikolov et al., 2013) embeddings of two antonyms (e.g., furious and happy) falls close to the embedding of a mid-ranked word in their scale (e.g., unhappy). Their experiments rely on antonym pairs extracted from WordNet. We show that contextualised representations are a better fit for this task than static embeddings, encoding rich information about adjectives' meaning and intensity. + +# 3 Data + +We experiment with three scalar adjective datasets. + +DEMELO (de Melo and Bansal, 2013).² Adjective sets were extracted from WordNet 'dumbbell' structures (Gross and Miller, 1990). The sets represent full-scales (e.g., from horrible to awesome) and are partitioned into half-scales (from horrible to bad, and from good to awesome) based on pattern-based evidence in the Google N-Grams cor + +
DatasetAdjective scale
DEMELO[soft → quiet → inaudible → silent] [thick → dense → impenetrable]
CROWD[fine → remarkable → spectacular] [scary || frightening → terrifying]
WILKINSON[damp → moist → wet] [dumb → stupid → idiotic]
+ +Table 1: Examples of scales in each dataset. $\left| \right|$ ’ denotes a tie between adjectives of the same intensity. + +pus (Brants and Franz, 2006). The dataset contains 87 half-scales with 548 adjective pairs, manually annotated for intensity relations $(<, >$ , and $=$ ). + +CROWD (Cocos et al., 2018). The dataset consists of a set of adjective scales with high coverage of the PPDB vocabulary. It was constructed by a three-step process: Crowd workers were first asked to determine whether pairs of adjectives describe the same attribute (e.g., TEMPERATURE) and should, therefore, belong to the same scale. Sets of same-scale adjectives were then refined over multiple rounds. Finally, workers ranked the adjectives in each set by intensity. The final dataset includes 330 adjective pairs along 79 half-scales. + +WILKINSON (Wilkinson and Oates, 2016). This dataset was generated through crowdsourcing. Crowd workers were presented with small seed sets (e.g., huge, small, microscopic) and were asked to propose similar adjectives, resulting in twelve adjective sets. Sets were automatically cleaned for consistency, and then annotated for intensity by the crowd workers. The original dataset contains full scales. We use its division in 21 half-scales (with 61 adjective pairs) proposed by Cocos et al. (2018). + +In the rest of the paper, we use the term "scale" to refer to the half-scales contained in these datasets. Table 1 shows examples from each one of them. + +# 4 BERT Contextualised Representations + +# 4.1 Sentence Collection + +To explore the knowledge BERT has about relationships in an adjective scale $s$ , we generate a contextualised representation for each $a \in s$ in the same context. Since such cases are rare in running text, we construct two sentence sets that satisfy this condition using the ukWaC corpus (Baroni et al., + +2009) $^5$ and the Flickr 30K dataset (Young et al., 2014). $^6$ For every $s \in D$ , a dataset from Section 3, and for each $a \in s$ , we collect 1,000 instances (sentences) from each corpus. $^7$ We substitute each instance $i$ of $a \in s$ , with each $b \in s$ where $b \neq a$ , creating $|s| - 1$ new sentences. $^8$ For example, for an instance of thick from the scale [thick $\rightarrow$ dense $\rightarrow$ impenetrable] in Table 1, we generate two new sentences where thick is substituted by each of the other adjectives in the same context. + +# 4.2 Sentence Cleaning + +Hearst patterns We filter out sentences where substitution should not take place, such as cases of specialisation or instantiation. In this way, we avoid replacing deceptive with fraudulent and false in sentences like "Viruses and other deceptive software", "Deceptive software such as viruses", "Deceptive software, especially viruses".9 We parse the sentences with stanza (Qi et al., 2020) to reveal their dependency structure, and use Hearst lexico-syntactic patterns (Hearst, 1992) to identify sentences describing is-a relationships between nouns in a text. More details about this filtering are given in Appendix A. + +Language Modelling criteria Adjectives that belong to the same scale might not be replaceable in all contexts. Polysemy can also influence their substitutability (e.g., warm weather is a bit hot, but a warm smile is friendly). In order to select contexts where $\forall a\in s$ fit, we measure the fluency of the sentences generated through substitution. We use a score assigned to each sentence by context2vec (Melamud et al., 2016) which reflects how well an $a\in s$ fits a context by measuring the cosine similarity between $a$ and the context representation. We also experimented with calculating the + +perplexity assigned by BERT to a sentence generated through substitution, and with replacing the original $a$ instance with the [MASK] token and getting the BERT probability for each $a \in s$ as a filler for that slot. context2vec was found to make better substitutability estimates. $^{10}$ + +We use a 600-dimensional context2vec model in our experiments, pre-trained on ukWaC.11 We calculate the context2vec score for all sentences generated for a scale $s$ through substitution, and keep the ten with the lowest standard deviation (STD). Low STD for a sentence means that $\forall a\in s$ are reasonable choices in this context. For comparison, we also randomly sample ten sentences from all the ukWaC sentences collected for each scale. We call the sets of sentences ukWaC, Flickr and Random SENT-SETs. + +We extract the contextualised representation for each $a \in s$ in the ten sentences retained for scale $s$ , using the pre-trained bert-base-uncased model. This results in $|s| * 10$ BERT representations for each scale. We repeat the procedure for every BERT layer. Examples of the obtained sentences are given in Appendix B. + +# 5 Scalar Adjectives Ranking + +# 5.1 Ranking with a Reference Point + +In our first ranking experiment, we explore whether BERT encodes adjective intensity relative to a reference point, that is the adjective with the highest intensity $(a_{ext})$ in a scale $s$ . + +Method We rank $\forall a\in s$ where $a\neq a_{ext}$ by intensity by measuring the cosine similarity between their representation and that of $a_{ext}$ in the ten ukWaC sentences retained for $s$ , and in every BERT layer. For example, to rank [pretty, beautiful, gorgeous] we measure the similarity of the representations of pretty and beautiful to that of gorgeous. We then average the similarities obtained for each $a$ and use these values for ranking. We refer to this method as BERTSIM. + +We evaluate the quality of the ranking for a scale by measuring its correlation with the gold stan + +
DatasetMetricBERTSIMFREQSENSE
DEMELOP-ACC0.591110.5710.493
τ0.364110.3040.192
ρavg0.389110.3090.211
CROWDP-ACC0.646110.6080.570
τ0.498110.4040.428
ρavg0.494110.4990.537
WILKINSONP-ACC0.91390.73990.7399
τ0.82690.4780.586
ρavg0.72490.3450.493
+ +Table 2: BERTSIM results on each dataset using contextualised representations from the ukWaC SENT-SET. Subscripts denote the best-performing BERT layer. + +![](images/e6d395155c3fe38f657d212200e178c13bcf73c59bbc000e3227dbee2c674977.jpg) + +![](images/7592c029f9fdc04513fd10307472a94ebbed5491431bacc8b25ac2a71174c9ae.jpg) + +![](images/d2f95441353b9d74915264f527b21b0cf08a11a250e865a573bcc6ede0a97e55.jpg) +Figure 2: Examples of BERTSIM ranking predictions across layers using ukWaC sentences for four adjective scales: (a) [big $\rightarrow$ large $\rightarrow$ enormous $\rightarrow$ huge $\rightarrow$ gigantic], (b) [good $\rightarrow$ great $\rightarrow$ wonderful $\rightarrow$ awesome], (c) [cute $\rightarrow$ pretty $\rightarrow$ lovely $\rightarrow$ lovelier $\rightarrow$ breathtaking], (d) [pleased $\rightarrow$ happy $\rightarrow$ excited $\rightarrow$ delighted $\rightarrow$ overwhelmed]. (a) and (b) are from WILKINSON, (c) and (d) are from CROWD. + +![](images/c80b9c0bb98f796a8ce791db723b6094bb4d914ba8b54d464b900ea7bf75cd17.jpg) + +dard ranking in the corresponding dataset $D$ using Kendall's $\tau$ and Spearman's $\rho$ correlation coefficients.13 We also measure the model's pairwise accuracy (P-ACC) which shows whether it correctly predicted the relative intensity $(<, >, =)$ for each pair $a_{i} - a_{j} \in s$ with $i \neq j$ . During evaluation, we do not take into account scales where only one adjective is left ( $|s| = 1$ ) after removing $a_{ext}$ (26 out of 79 scales in CROWD; 9 out of 21 scales in WILKINSON). + +Baselines We compare the BERTSIM method to two baselines which rank adjectives by frequency (FREQ) and number of senses (SENSE). We make + +the assumption that words with low intensity (e.g., good, old) are more frequent and polysemous than their extreme counterparts on the same scale (e.g., awesome, ancient). This assumption relies on the following two intuitions which we empirically validate: (a) Extreme adjectives tend to restrict the denotation of a noun to a smaller class of referents than low intensity adjectives (Geurts, 2010). We hypothesise that extreme adjectives denote more exceptional and less frequently encountered properties of nouns than low intensity adjectives on the same scale. This is also reflected in the directionality of their entailment relationship (e.g., awesome $\rightarrow$ good, good $\nrightarrow$ awesome); low intensity adjectives should thus be more frequently encountered in texts. We test this assumption using frequency counts in Google Ngrams (Brants and Franz, 2006), and find that the least intense adjective is indeed more frequent than the most extreme adjective in $75\%$ of the scales; (b) Since frequent words tend to be more polysemous (Zipf, 1945), we also expect that low intensity adjectives would have more senses than extreme ones. This is confirmed by their number of senses in WordNet: in $67\%$ of the scales, the least intense adjective has a higher number of senses than its extreme counterpart. + +Results We present the results of this evaluation in Table 2. Overall, similarities derived from BERT representations encode well the notion of intensity, as shown by the moderate to high accuracy and correlation in the three datasets. The good results obtained by the FREQ and SENSE baselines (especially on CROWD) highlight the relevance of frequency and polysemy for scalar adjective ranking, and further validate our assumptions. + +Figure 2 shows ranking predictions made by BERTSIM in different layers of the model. Predictions are generally stable and reasonable across layers, despite not always being correct. For example, the similarly-intense happy and pleased are inverted in some layers but are not confused with adjectives further up the scale (excited, delighted). Note that happy and pleased are in adjacent positions in the CROWD ranking, and form a tie in the DEMELO dataset. + +# 5.2 Ranking without Specified Boundaries + +In real life scenarios, scalar adjective interpretation is performed without concrete reference points (e.g., $a_{ext}$ ). We need to recognize that a great book is better than a well-written one, without necessar- + +ily detecting their relationship to brilliant. + +Method Our second adjective ranking method draws inspiration from word analogies in gender bias work, where a gender subspace is identified in word-embedding space by calculating the main direction spanned by the differences between vectors of gendered word pairs (e.g., $\overrightarrow{he} - \overrightarrow{she}$ , $\overrightarrow{man} - \overrightarrow{woman}$ ) (Bolukbasi et al., 2016; Dev and Phillips, 2019; Ravfogel et al., 2020; Lauscher et al., 2020). + +We propose to obtain an intensity direction by subtracting the representation of a mild intensity adjective $a_{\text{mild}}$ from that of an extreme adjective $a_{\text{ext}}$ on the same scale. By subtracting pretty from gorgeous, for example, which express a similar core meaning (they are both on the BEAUTY scale) but with different intensity, we expect the resulting $\overrightarrow{dVec} = \overrightarrow{gorgeous} - \overrightarrow{pretty}$ embedding to represent this notion of intensity (or degree). We can then compare other adjectives' representations to $\overrightarrow{dVec}$ , and rank them according to their cosine similarity14 to this intensity vector: the closer an adjective is to $\overrightarrow{dVec}$ , the more intense it is. + +We calculate the $\overrightarrow{dVec}$ for each $s \in D$ (a dataset from Section 3) using the most extreme $(a_{ext})$ and the mildest $(a_{mild})$ words in $s$ . We experiment with BERT embeddings from the SENT-SETs generated through substitution as described in Section 4, and with static word2vec embeddings (Mikolov et al., 2013) trained on Google News. We build a $\overrightarrow{dVec}$ from every sentence (context) $c$ in the set of ten sentences $C$ for a scale $s$ by subtracting the BERT representation of $a_{mild}$ in $c$ from that of $a_{ext}$ in $c$ . We average the ten $dVec$ 's obtained for $s$ and construct a global $\overrightarrow{dVec}$ for the dataset $D$ by averaging the vectors of $\forall s \in D$ . For a fair evaluation, we perform a lexical split in the data used for deriving $\overrightarrow{dVec}$ and the data used for testing. When evaluating on CROwD, we calculate a $\overrightarrow{dVec}$ vector on DEMELO (DIFFVEC-DM) and one on WILKINSON (DIFFVEC-WK), omitting all scales where $a_{ext}$ or $a_{mild}$ are present in CROwD. We do the same for the other datasets. + +To obtain the $dVec$ of a $s$ with static embeddings, we simply calculate the difference between the word2vec embeddings of $a_{ext}$ and $a_{mild}$ in $s$ . + +Results For evaluation, we use the same metrics as in Section 5.1. We compare our results to the + +
DEMELO (DM)CROWD (CD)WILKINSON (WK)
MethodP-ACCτρavgP-ACCτρavgP-ACCτ
BERTukWaCDIFFVEC-DM---0.739120.674120.753120.91860.8366
DIFFVEC-CD0.64680.43180.5098---0.869110.73811
DIFFVEC-WK0.58490.30390.313100.706100.60390.6879--
FlickrDIFFVEC-DM---0.730120.667120.705100.93490.8699
DIFFVEC-CD0.620100.377100.46610---0.90270.8037
DIFFVEC-WK0.57910.29410.32110.70280.60880.6778--
RandomDIFFVEC-DM---0.739120.673120.743120.91860.8366
DIFFVEC-CD0.62680.38880.4668---0.836120.67212
DIFFVEC-WK0.55790.24690.28460.70380.59880.6768--
word2vecDIFFVEC-DM---0.6570.4930.5430.7870.574
DIFFVEC-CD0.6330.3980.444---0.8030.607
DIFFVEC-WK0.5930.3230.4130.6180.4130.457--
BaselineFREQ0.5750.2710.2830.6060.3860.4520.7540.508
SENSE0.4930.1630.1650.6580.4980.5950.7210.586
Cocos et al. '180.6530.633-0.6390.495-0.7540.638
+ +Table 3: Results of our DIFFVEC adjective ranking method on the DEMELO, CROWD, and WILKINSON datasets. We report results with contextualised (BERT) representations obtained from different SENT-SETS (ukWaC, Flickr, Random) and with static (word2vec) vectors. We compare to the frequency (FREQ) and number of senses (SENSE) baselines, and to results from previous work (Cocos et al., 2018). Results for a dataset are missing (-) when the dataset was used for building the $dVec$ intensity vector. + +FREQ and SENSE baselines, and to the best results obtained by Cocos et al. (2018) who use information obtained from lexico-syntactic patterns, a lexicon annotated with intensity (SO-CAL) (Taboada et al., 2011), and paraphrases from PPDB. $^{16}$ Results are presented in Table 3. The DIFFVEC method gets remarkably high performance compared to previous results, especially when $dVec$ is calculated with BERT embeddings. With the exception of Kendall's $\tau$ and pairwise accuracy on the DEMELO dataset, DIFFVEC outperforms results from previous work and the baselines across the board. We believe the lower correlation scores on the DEMELO dataset to be due to the large amount of ties present in this dataset: $44\%$ of scales in DEMELO contain ties, versus $30\%$ in CROWD and $0\%$ in WILKINSON, where we obtain better results. Our models cannot easily predict ties using similarities which are continuous values. To check whether our assumption is correct, we make a simple adjustment to DIFFVEC so that it can propose ties if the vectors of two adjectives are similarly close to $dVec$ . Overall, this results in a small decrease in pairwise accuracy and a slight increase in correlation in DEMELO and CROWD. Complete results of this additional evaluation are given in Appendix C. + +The composition of the SENT-SETS used for building BERT representations also plays a role on model performance. Overall, the selection method described in Section 4 offers a slight advantage over random selection, with ukWaC and Flickr sentences improving performance on different datasets. Note, however, that results for Flickr are calculated on the scales for which sentences were available (96.56% of DEMELO scales and 86.08% from CROWD). + +The best-performing BERT layers are generally situated in the upper half of the Transformer network. The only exception is DIFFVEC-WK with the Flickr SENT-SET on DEMELO, where all layers perform similarly. The FREQ and SENSE baselines get lower performance than our method with BERT embeddings. SENSE manages to give results comparable to DIFFVEC with static embeddings and to previous work (Cocos et al., 2018) in one dataset (CROWD), but is still outperformed by DIFFVEC with contextualised representations. + +We can also compare our results to those obtained by a purely pattern-based method on the same datasets, reported by Cocos et al. (2018). This method performs well on DEMELO $(\tau = 0.663)$ because of its high coverage on this dataset, which was compiled by finding adjective pairs that also match lexical patterns. The performance of the pattern-based method is much lower than that of our models in the other two datasets $(\tau = 0.203$ on CROWD, $\tau = 0.441$ on WILKINSON), and its + +
DEMELO
# ScalesP-ACCτρavg
BERTukWAc1 (+)0.65390.43890.48911
1 (-)0.611100.350100.42411
50.650100.430100.51410
Flickr1 (+)0.65680.44980.5048
1 (-)0.60030.32430.3755
50.647120.426120.49811
Random1 (+)0.659110.451110.49311
1 (-)0.608120.340120.42110
50.653110.442110.53810
word2vec1 (+)0.6020.3340.364
1 (-)0.6130.3590.412
50.6410.4150.438
+ +
CROWD
# ScalesP-ACCτρavg
BERTukWaC1 (+)0.709120.611120.67012
1 (-)0.648100.4770.50710
50.700110.595100.67310
Flickr1 (+)0.676120.55280.6128
1 (-)0.64190.47090.5029
50.692110.587110.64011
Random1 (+)0.691110.570110.65811
1 (-)0.655100.490100.51412
50.694110.582110.65311
word2vec1 (+)0.6240.4190.479
1 (-)0.6610.5060.559
50.6880.5590.601
+ +Table 4: Results of DIFFVEC on DEMELO and on CROWD using a single positive $(1(+))$ or negative (1 $(-))$ $a_{ext} - a_{mild}$ pair, and five pairs (5). + +coverage goes down to $11\%$ on CROWD. This highlights the limitations of the approach, as well as the efficiency of our model which combines high performance and coverage. + +# 5.3 Further Exploration of DIFFVEC + +Given the high performance of the DIFFVEC method in the ranking task, we carry out additional experiments to explore the impact that the choice of scales and sentences has on the intensity vector quality. We test the method with a $\overrightarrow{dVec}$ vector built from a single $a_{ext} - a_{mild}$ pair of either positive (awesome-good) or negative (horrible-bad) polarity, that we respectively call DIFFVEC-1 (+)/(-). We also experiment with increasing the number of scales, adding ancient-old, gorgeous-pretty and hideous-ugly to form DIFFVEC-5. The scales are from WILKINSON, so we exclude this dataset from the evaluation. + +Results are given in Table 4. We observe that a + +small number of word pairs is enough to build a $\overrightarrow{dVec}$ with competitive performance. Interestingly, DIFFVEC-1 (+) with random sentences obtains the best pairwise accuracy on DEMELO. The fact that the method performs so well with just a few pairs (instead of a whole dataset as in Table 3) is very encouraging, making our approach easily applicable to other datasets and languages. + +A larger number of scales is beneficial for the method with static word2vec embeddings, which seem to better capture intensity on the negative scale. For BERT, instead, intensity modeled using a positive pair gives best results across the board. The use of five pairs of mixed polarity improves results over a single negative pair, and has comparable performance to the single positive one. + +Finally, we compare the performance of DIFFVEC-1 $(+)/(-)$ and DIFFVEC-5 when the contextualised representations are extracted from a single sentence instead of ten. Our main observation is that reducing the number of sentences harms performance, especially when the sentence used is randomly selected. Detailed results are included in Appendix D. + +# 6 Indirect Question Answering + +We conduct an additional evaluation in order to assess how useful DIFFVEC adjective rankings can be in a real application. As in Cocos et al. (2018), we address Indirect Question Answering (QA) (de Marneffe et al., 2010). The task consists in interpreting indirect answers to YES/NO questions involving scalar adjectives. These do not straightforwardly convey a YES or NO answer, but the intended reply can be inferred. For example, if someone is asked "Was it a good ad?" and replies "It was a great ad", the answer is YES. This makes Indirect QA a good fit for scalar adjective ranking evaluation since it allows to directly assess a model's capability to detect the difference in intensity and direction (positive or negative) in an adjective pair. + +We use the de Marneffé et al. (2010) dataset for evaluation, which consists of 125 QA pairs manually annotated with their implied answers (YES or NO). We adopt a decision procedure similar to the one proposed by de Marneffé et al. (2010). We compute the BERT embeddings of the adjective in the question $(a_q)$ and the adjective in the answer $(a_a)$ . If $a_a$ (e.g., great) has the same or higher intensity than $a_q$ (e.g., good) the prediction + +
MethodAccPRF
BERTukWaC DIFFVEC-1 (+)100.7150.6770.6920.685
DIFFVEC-DM120.7070.6700.6890.678
DIFFVEC-CD120.6750.6350.6480.642
DIFFVEC-WK110.7400.7120.7390.725
DIFFVEC-1 (+)90.6990.6630.6800.672
DIFFVEC-DM110.6990.6590.6730.666
DIFFVEC-CD100.6910.6530.6670.660
DIFFVEC-WK50.6830.6460.6610.654
RandomDIFFVEC-1 (+)90.7150.6770.6920.685
DIFFVEC-DM100.7240.6910.7130.702
DIFFVEC-CD120.6670.6290.6420.636
DIFFVEC-WK110.6990.6670.6880.677
word2vecDIFFVEC-1 (+)0.6670.6330.6500.641
DIFFVEC-DM0.6020.5540.5590.557
DIFFVEC-CD0.5930.5480.5530.551
DIFFVEC-WK0.5850.5430.5470.545
BaselinesFREQ0.5930.5480.5530.551
SENSE0.5930.5600.5680.564
MAJ0.6910.3460.5000.409
Previous10.6100.5970.5940.596
Previous20.7280.6980.7140.706
Previous30.6420.7100.6830.684
+ +Table 5: Results of our DIFFVEC method with contextualised (BERT) and static (word2vec) embeddings on the indirect QA task. We compare to the frequency, polysemy and majority baselines, and to results from previous work. $Previous_{1}$ stands for de Marneffe et al. (2010), $Previous_{2}$ for Kim and de Marneffe (2013) (the only result on 125 pairs), $Previous_{3}$ for Cocos et al. (2018). + +is YES; otherwise, the prediction is NO. If the answer contains a negation, we switch YES to NO, and NO to YES. In previous work, indirect QA evaluation was performed on 123 or 125 examples, depending on whether cases labelled as "uncertain" were included (de Marneffe et al., 2010; Kim and de Marneffe, 2013; Cocos et al., 2018). We report all available results from previous work, and our scores on the 123 YES/NO examples as in the most recent work by Cocos et al. (2018). We report results using DIFFVEC with the adjustment for ties, where two adjectives are considered to be of the same intensity if they are similarly close to $\overrightarrow{dVec}$ ( $\text{diffsim} = \text{sim}(\overrightarrow{dVec}, \overrightarrow{a_q}) - \text{sim}(\overrightarrow{dVec}, \overrightarrow{a_a})$ ). If the absolute value of $\text{diffsim} < 0.01$ , we count them as a tie. We compare our method to previous results, to FREQ and SENSE, and to a baseline predicting always the majority label (YES). Results of this evaluation are given in Table 5. DIFFVEC with BERT embeddings outperforms the baselines and all previous approaches, and presents a clear advantage over DIFFVEC with static word2vec representations. Best performance is obtained when $\overrightarrow{dVec}$ + +is obtained from the Wilkinson dataset (DIFFVEC-WK). The $\overrightarrow{dVec}$ obtained from CROWD seems to be of lower quality. DIFFVEC-CD and DIFFVEC-DM improve over the baselines but do not achieve higher performance than the model of Kim and de Marneffe (2013). + +# 7 Discussion + +Our initial exploration of the knowledge encoded in BERT representations about scalar adjectives using BERTSIM (Section 5.1) showed they can successfully rank them by intensity. Then our DIFFVEC method (Sections 5.2 and 5.3) outperformed BERTSIM, providing even better ranking predictions with as few resources as a single adjective pair. This difference can be due to the composition of the vectors in the two cases. The $a_{ext}$ representation in BERTSIM contains information about the meaning of the extreme adjective alongside its intensity, while the $\overrightarrow{dVec}$ vector is a cleaner representation of intensity: The subtraction of $\overrightarrow{a_{mild}}$ from $\overrightarrow{a_{ext}}$ removes the common core meaning expressed by their scale (e.g., BEAUTY, TEMPERATURE, SIZE). Consequently, $\overrightarrow{dVec}$ is a pure and general representation of intensity which can successfully serve to rank adjectives from any scale, as shown by our results. The DIFFVEC method can estimate adjectives' relative intensity on the fly, and performs better than the BERTSIM model which needs a reference point to propose a ranking. It does not use any external knowledge source - a requirement in previous approaches - and one of its highest performing variations (DIFFVEC-1 (+)) makes best quality predictions with a single adjective pair example. + +Our assumption concerning the need for the sentences used for extracting BERT representations to be a good semantic fit for adjectives in a scale, has not been confirmed by our evaluation. Precisely, differences between our methods when relying on carefully vs randomly selected sentences are minor. This might be due to several reasons: One is that although BERT representations are contextualised, they also encode knowledge about the meaning and intensity of words acquired through pre-training, independent of the new context of use. Another possible explanation is that due to the skewed distribution of word senses (Kilgarriff, 2004; McCarthy et al., 2004), a high proportion of our randomly selected sentences might contain instances of the adjectives in their most frequent sense. If this is + +also the meaning of the corresponding scale, then the sentences are a good fit. + +The DIFFVEC-1 (+) method, which uses a vector derived from a single positive pair, yields consistently better results than DIFFVEC-1 (-) which relies on a single negative pair. To better understand this difference in performance, we examine the composition of DEMELO and CROWD, specifically whether there is an imbalance in terms of polarity as reflected in the frequency of positive vs negative adjectives in the two datasets. We check the polarity of the adjectives in two sentiment lexicons: SO-CAL (Taboada et al., 2011) and AFINN-165 (Nielsen, 2011). The two lexicons cover a portion of the adjectives in DEMELO and CROWD: $68\%$ and $79\%$ , respectively. The DEMELO dataset is well-balanced in terms of positive and negative adjectives: $51\%$ and $49\%$ of the covered adjectives fall in each category. In CROWD, we observe a slight skew towards positive: $61\%$ vs $39\%$ . According to this analysis, the difference in performance between the two methods could only partially be explained by an imbalance in terms of polarity. + +We perform an additional analysis based on the Google Ngram frequency of the positive and negative words that were used for deriving DIFFVEC. The adjectives good (276M) and awesome (10M) are more frequent than bad (65M) and horrible (4M). In fact, we find that the 1,000 most frequent positive words in SO-CAL and AFINN are, on average, much more frequent (18M) than the 1,000 most frequent negative words (8M). Word frequency has a direct impact on word representations, since having access to sparse information about a word's usages does not allow the model to acquire rich information about its linguistic properties as in the case of frequent words. The high frequency of good and awesome results in better quality representations than the ones obtained for their antonyms, and could explain to some extent the improved performance of DIFFVEC-1 (+) compared to DIFFVEC-1 (-) with BERT embeddings. However, this analysis does not explain the difference in the performance of DIFFVEC (+) and (-) between BERT and word2vec. This would require a better understanding of how words with different polarity (antonyms) are represented in BERT's space compared to word2vec, and how negation affects their representations. We leave these explorations for future work. + +Regarding the performance of different BERT + +![](images/b25b73167d14f122a272f44ecaa0f439b5f9fdab428012701092057225ffe458.jpg) +Performance of DIFFVEC-1 (+) by layer + +![](images/c0f91548d999b66024664fda00dcc6b3a4a1593f72418e8398fdbad34613bacc.jpg) +Figure 3: Performance of DIFFVEC-1 (+) with ukWaC sentences across BERT layers. + +layers, we observe that knowledge relevant for scalar adjective ranking is situated in the last layers of the Transformer network. Figure 3 shows how the performance of DIFFVEC-1 (+) changes across different BERT layers: model predictions improve after layer 3, and performance peaks in one of the last four layers. This is in accordance with the findings of Tenney et al. (2019) that semantic information is mainly located in the upper layers of the model, but is more spread across the network than syntactic information which is contained in a few middle layers. + +# 8 Conclusion + +We have shown that BERT representations encode rich information about the intensity of scalar adjectives which can be efficiently used for their ranking. Although our method is simple and resource-light, solely relying on an intensity vector which can be derived from as few as a single example, it clearly outperforms previous work on the scalar adjective ranking and Indirect Question Answering tasks. Our performance analysis across BERT layers highlights that the lexical semantic knowledge needed for these tasks is mostly located in the higher layers of the BERT model. + +In future work, we plan to extend our methodology to new languages, and experiment with multilingual and language specific BERT models. To create scalar adjective resources in new languages, we could either translate the English datasets or mine adjective scales from starred product reviews as in de Marneffte et al. (2010). Our intention is also to address adjective ranking in full scales (instead of half-scales) and evaluate the capability of contextualised representations to detect polarity. + +# Acknowledgements + +![](images/3b52d70f33842412618580c9f79a26554b0726917bc008e09b7886eef640fc9c.jpg) + +This work has been supported by the French National Research Agency under project ANR-16-CE33-0013. The work is also part of the FoTran project, funded by the European Research Coun + +cil (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No 771113). We thank the reviewers for their thoughtful comments and valuable suggestions. + +# References + +Marco Baroni, Silvia Bernardini, Adriano Ferraresi, and Eros Zanchetta. 2009. The WaCky wide web: a collection of very large linguistically processed web-crawled corpora. Journal of Language Resources and Evaluation, 43(3):209-226. +Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. 2016. Man is to Computer Programmer as Woman is to Homemaker? Debiasing Word Embeddings. In Advances in Neural Information Processing Systems 29, pages 4349-4357. Barcelona, Spain. +Thorsten Brants and Alex Franz. 2006. Web 1T 5-gram Version 1. In LDC2006T13, Philadelphia, Pennsylvania. Linguistic Data Consortium. +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. +Anne Cocos, Skyler Wharton, Ellie Pavlick, Marianna Apidianaki, and Chris Callison-Burch. 2018. Learning Scalar Adjective Intensity from Paraphrases. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1752-1762, Brussels, Belgium. Association for Computational Linguistics. +Sunipa Dev and Jeff M Phillips. 2019. Attenuating Bias in Word Vectors. In Proceedings of the 22nd International Conference on Artificial Intelligence and Statistics (AISTATS), Naha, Okinawa, Japan. +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. + +Christiane Fellbaum, editor. 1998. WordNet: An Electronic Lexical Database. Language, Speech, and Communication. MIT Press, Cambridge, MA. +Juri Ganitkevitch, Benjamin Van Durme, and Chris Callison-Burch. 2013. PPDB: The Paraphrase Database. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 758-764, Atlanta, Georgia. Association for Computational Linguistics. +Bart Geurts. 2010. Quantity implicatures. Cambridge University Press. +Derek Gross and Katherine J Miller. 1990. Adjectives in WordNet. International Journal of lexicography, 3(4):265-277. +Vasileios Hatzivassiloglou and Kathleen R. McKeown. 1993. Towards the Automatic Identification of Adjectival Scales: Clustering Adjectives According to Meaning. In 31st Annual Meeting of the Association for Computational Linguistics, pages 172-182, Columbus, Ohio, USA. Association for Computational Linguistics. +Marti A. Hearst. 1992. Automatic Acquisition of Hyponyms from Large Text Corpora. In COLING 1992 Volume 2: The 15th International Conference on Computational Linguistics. +John Hewitt and Percy Liang. 2019. Designing and Interpreting Probes with Control Tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2733-2743, Hong Kong, China. Association for Computational Linguistics. +John Hewitt and Christopher D. Manning. 2019. A Structural Probe for Finding Syntax in Word Representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138, Minneapolis, Minnesota. Association for Computational Linguistics. +Christopher Kennedy and Louise McNally. 2005. Scale Structure and the Semantic Typology of Gradable Predicates. Language, 81:345-381. +Adam Kilgarriff. 2004. How Dominant Is the Commonest Sense of a Word? Lecture Notes in Computer Science (vol. 3206), Text, Speech and Dialogue, Sojka Petr, Kopeček Ivan, Pala Karel (eds.), pages 103-112. Springer, Berlin, Heidelberg. +Joo-Kyung Kim and Marie-Catherine de Marneffe. 2013. Deriving Adjectival Scales from Continuous Space Word Representations. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1625-1630, Seattle, Washington, USA. Association for Computational Linguistics. + +Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. 2019. Revealing the Dark Secrets of BERT. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 4365-4374, Hong Kong, China. Association for Computational Linguistics. +Gerhard Kremer, Katrin Erk, Sebastian Padó, and Stefan Thater. 2014. What Substitutes Tell Us - Analysis of an "All-Words" Lexical Substitution Corpus. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 540-549, Gothenburg, Sweden. Association for Computational Linguistics. +Anne Lauscher, Goran Glavas, Simone Paolo Ponzetto, and Ivan Vulic. 2020. A General Framework for Implicit and Explicit Debiasing of Distributional Word Vector Spaces. In Proceedings of the 34th AAAI Conference on Artificial Intelligence, New York City, NY, USA. +Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. 2016. Assessing the Ability of LSTMs to Learn Syntax-Sensitive Dependencies. Transactions of the Association for Computational Linguistics, 4:521-535. +Marie-Catherine de Marneffe, Christopher D. Manning, and Christopher Potts. 2010. "Was It Good? It Was Provocative." Learning the Meaning of Scalar Adjectives". In Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics, pages 167-176, Uppsala, Sweden. Association for Computational Linguistics. +Diana McCarthy, Rob Koeling, Julie Weeds, and John Carroll. 2004. Finding Predominant Word Senses in Untagged Text. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), pages 279–286, Barcelona, Spain. +Louise McNally. 2016. Scalar alternatives and scalar inference involving adjectives: A comment on van Tiel, et al. 2016. In Ruth Kramer Jason Ostrove and Joseph Sabbagh, editors, Asking the Right Questions: Essays in Honor of Sandra Chung, pages 17-28. +Oren Melamud, Jacob Goldberger, and Ido Dagan. 2016. context2vec: Learning Generic Context Embedding with Bidirectional LSTM. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, pages 51-61, Berlin, Germany. Association for Computational Linguistics. +Gerard de Melo and Mohit Bansal. 2013. Good, Great, Excellent: Global Inference of Semantic Intensities. Transactions of the Association for Computational Linguistics, 1:279-290. + +Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient Estimation of Word Representations in Vector Space. arXiv preprint:1301.3781v3. +Finn Årup Nielsen. 2011. A new ANEW: Evaluation of a word list for sentiment analysis in microblogs. In Proceedings of the ESWC 2011 Workshop on 'Making Sense of Microposts: Big things come in small packages', volume 718 in CEUR Workshop Proceedings, pages 93-98. +Bo Pang, Lillian Lee, et al. 2008. Opinion mining and sentiment analysis. Foundations and Trends in Information Retrieval, 2(1-2):1-135. +Ajay Patel, Alexander Sands, Chris Callison-Burch, and Marianna Apidianaki. 2018. Magnitude: A Fast, Efficient Universal Vector Embedding Utility Package. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 120-126, Brussels, Belgium. Association for Computational Linguistics. +Ellie Pavlick, Pushpendre Rastogi, Juri Ganitkevitch, Benjamin Van Durme, and Chris Callison-Burch. 2015. PPDB 2.0: Better paraphrase ranking, finegrained entailment relations, word embeddings, and style 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 2: Short Papers), pages 425-430, Beijing, China. Association for Computational Linguistics. +Peng Qi, Yuhao Zhang, Yuhui Zhang, Jason Bolton, and Christopher D Manning. 2020. Stanza: A Python Natural Language Processing Toolkit for Many Human Languages. arXiv preprint arXiv:2003.07082. +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. +Sven Rill, J. vom Scheidt, Johannes Drescher, Oliver Schütz, Dirk Reinel, and Florian Wogenstein. 2012. A generic approach to generate opinion lists of phrases for opinion mining applications. In Proceedings of the First International Workshop on Issues of Sentiment Discovery and Opinion Mining (WISDOM), pages 1-8, Beijing, China. +Anna Rogers, Olga Kovaleva, and Anna Rumshisky. 2020. A Primer in BERTology: What we know about how BERT works. arXiv preprint:2002.12327v1. +Josef Ruppenhofer, Michael Wiegand, and Jasper Brandes. 2014. Comparing methods for deriving intensity scores for adjectives. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, volume 2: Short + +Papers, pages 117-122, Gothenburg, Sweden. Association for Computational Linguistics. +Raksha Sharma, Mohit Gupta, Astha Agarwal, and Pushpak Bhattacharyya. 2015. Adjective Intensity and Sentiment Analysis. In Proceedings of the 2015 Conference on Empirical Methods for Natural Language Processing, pages 2520-2526, Lisbon, Portugal. Association for Computational Linguistics. +Vera Sheinman, Christiane Fellbaum, Isaac Julien, Peter Schulam, and Takenobu Tokunaga. 2013. Large, huge or gigantic? Identifying and encoding intensity relations among adjectives in WordNet. Language resources and evaluation, 47(3):797-816. +Vera Sheinman and Takenobu Tokunaga. 2009. AdjScales: Visualizing Differences between Adjectives for Language Learners. IEICE Transactions on Information and Systems, 92-D:1542-1550. +Chaitanya Shivade, Marie-Catherine de Marneffe, Eric Fosler-Lussier, and Albert M. Lai. 2015. Corpus-based discovery of semantic intensity scales. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 483-493, Denver, Colorado. Association for Computational Linguistics. +Maite Taboada, Julian Brooke, Milan Tofiloski, Kimberly Voll, and Manfred Stede. 2011. Lexicon-based methods for sentiment analysis. Computational linguistics, 37(2):267-307. +Alon Talmor, Yanai Elazar, Yoav Goldberg, and Jonathan Berant. 2019. oLMpics – On what Language Model Pre-training Captures. arXiv preprint arXiv:1912.13283v1. +Ian Tenney, Dipanjan Das, and Ellie Pavlick. 2019. BERT Rediscover 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. +Bob Van Tiel, Emiel Van Miltenburg, Natalia Zevakhina, and Bart Geurts. 2016. Scalar Diversity. Journal of semantics, 33(1):137-175. +Elena Voita, Rico Senrich, and Ivan Titov. 2019a. The Bottom-up Evolution of Representations in the Transformer: A Study with Machine Translation and Language Modeling Objectives. 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 4396-4406, Hong Kong, China. Association for Computational Linguistics. +Elena Voita, David Talbot, Fedor Moiseev, Rico Senrich, and Ivan Titov. 2019b. 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. +Bryan Wilkinson. 2017. Identifying and Ordering Scalar Adjectives Using Lexical Substitution. Ph.D. thesis, University of Maryland, Baltimore County. +Bryan Wilkinson and Tim Oates. 2016. A Gold Standard for Scalar Adjectives. In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 2669-2675, Porto Roz, Slovenia. European Language Resources Association (ELRA). +Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. 2016. Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv preprint:1609.08144. +Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. 2014. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Transactions of the Association for Computational Linguistics, 2:67-78. +Jieyu Zhao, Yichao Zhou, Zeyu Li, Wei Wang, and Kai-Wei Chang. 2018. Learning gender-neutral word embeddings. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4847–4853, Brussels, Belgium. Association for Computational Linguistics. +George KingsleyZipf.1945.The meaning-frequency relationship of words.Journal of General Psychology,33(2):251-256. + +# A Hearst Patterns + +Figure 4 illustrates the dependency structure of the following Hearst patterns: + +- [NP] and other [NP] +- [NP] or other [NP] +- [NP] such as [NP] +- Such [NP] as [NP] +- [NP], including [NP] +- [NP], especially [NP] +- [NP] like [NP] + +![](images/988749d9e77333156ca94b9958e337b30c3c06e8edbdfc6bc72deed62e8b9cac.jpg) +Figure 4: Dependency structure of Hearst patterns. + +We use these patterns to detect sentences where adjective substitution should not take place, as described in Section 4.2 of the paper. We remove these sentences from our ukWaC and Flickr datasets.[17] + +# B Evaluation of Sentence Selection Methods + +To identify the most appropriate method for selecting sentences where all adjectives in a scale fit, we + +use data from the Concepts in Context (CoInCo) corpus (Kremer et al., 2014). CoInCo contains sentences where content words have been manually annotated with substitutes which come with a frequency score indicating the number of annotators who proposed each substitute. We collect instances of adjectives, nouns and verbs in their base form. $^{18}$ For a word $w$ , we form instance pairs $(w_{i} - w_{j}$ with $i \neq j$ ) with similar meaning as reflected in their shared substitutes. We allow for up to two unique substitutes per instance, which we assign to the other instance in the pair with zero frequency. We keep instances with $n$ substitutes, where $2 \leq n \leq 8$ (the lowest and highest number of adjectives in a scale). This results in 5,954 pairs. + +We measure the variation in an instance pair in terms of substitutes using the coefficient of variation (VAR). VAR is the ratio of the standard deviation to the mean and is, therefore, independent from the unit used. A higher VAR indicates that not all substitutes are good choices in a context. We keep the 500 pairs with the highest VAR difference, where one sentence is a better fit for all substitutes than the other. For example, private, individual and person were proposed as substitutes for personal in "personal insurance lines", but private was the preferred choice for "personal reasons". The tested methods must identify which sentence in a pair is a better fit for all substitutes. + +For sentence selection, we experiment with the three fluency calculation methods presented in Section 4.2: BERTPROB (the BERT probability of each substitute to be used in the place of the [MASK] token); BERTPPX (the perplexity assigned by BERT to the sentence generated through substitution); and CONTEXT2VEC (the cosine similarity between the context2vec representations of a substitute and the context). + +We also test VAR and standard deviation (STD) as metrics for measuring variation in the fluency scores assigned to a sentence pair by the three methods. We evaluate the sentence selection methods and variation metrics on the 500 pairs retained from CoInCo. We report their accuracy, calculated as the proportion of pairs where a method correctly guesses the instance in a pair with the lowest variation. We compare results to those of a baseline that always proposes the first instance in a pair. The results in Table 6 show that the task is difficult for + +
MethodVariation MetricAccuracy
BERTPROBSTD0.524
VAR0.488
BERTPPXSTD0.518
VAR0.536
CONTEXT2VECSTD0.594
VAR0.588
1st sentence Baseline0.506
+ +Table 6: Accuracy of the three fluency calculation methods on the 500 sentence pairs collected from CoInCo. Comparison to a first sentence baseline. + +all methods. Their accuracy is slightly higher than the baseline accuracy, which outperforms BERTPROB with VAR. The combination that gives best accuracy is CONTEXT2VEC with STD (0.594). We use this combination of metrics in our experiments. + +Table 7 shows examples of sentences retained after this filtering for two adjective scales. CONTEXT2VEC tends to favour sentences where all adjectives in a scale fit well. We also give an example of a sentence randomly selected from ukWaC (Random) for a scale. These sentences usually reflect a frequent sense of a word in the scale. + +# C Adjustment for Ties + +Table 8 contains results of the DIFFVEC method with the adjustment for ties. For two adjacent adjectives $(a_{i},a_{j})$ in the ranking proposed by DIFFVEC, we check if their cosine similarities to $\overrightarrow{dVec}$ are very close (diffsim = sim(dVec, $\overrightarrow{a_i}$ ) - sim(dVec, $\overrightarrow{a_j}$ ). If the absolute value of diffsim < 0.01, we count them as a tie, meaning that $a_{i}$ and $a_{j}$ are considered to be situated at the same intensity level. Note that this procedure may give different results when the pairwise comparison starts at different ends of the proposed ranking. We establish ties starting from the $a$ with lowest intensity in the ranking proposed by DIFFVEC. + +# D DIFFVEC with a Single Sentence + +Table 9 contains results for DIFFVEC-1 $(+)/(-)$ and DIFFVEC-5 when using a single sentence for building $dVec$ . + +Scale: wrong $\rightarrow$ immoral $\rightarrow$ sinful $\rightarrow$ evil + +
MethodCorpusSentences
context2vec-STDukWaCI believe that war is immoral.
FlickrThis boy was on the wrong end of this snowball fight.
RandomukWaCThe author saw him and let him thru but not his mate as he had queued the wrong way.
Scale: old → obsolete || outdated
MethodCorpusSentences
context2vec-STDukWaC(...) Chekhov was misunderstood and frequently seen by critics as merely an irreverent recorder of an obsolete way of life (...)
FlickrTwo preschool aged boys are looking at an old locomotive.
RandomukWaC(...) rustic dialogue and good old fashioned laughter (...)
+ +Table 7: Examples of sentences from our SENT-SETs selected with the context2vec-STD method compared to sentences randomly selected from ukWaC. + +
DEMELO (DM)CROWD (CD)WILKINSON (WK)
MethodP-ACCτρavgP-ACCτρavgP-ACCτ
BERTukWaCDIFFVEC-DM---0.73380.67380.749120.88560.83011
DIFFVEC-CD0.64480.45280.5188---0.820100.72111
DIFFVEC-WK0.54660.29560.32460.72170.627100.69810--
FlickrDIFFVEC-DM---0.746120.685120.71880.90290.8519
DIFFVEC-CD0.605110.388110.46511---0.83680.7467
DIFFVEC-WK0.54120.29610.29910.70280.64780.7108--
RandomDIFFVEC-DM---0.72490.65290.71980.885110.8186
DIFFVEC-CD0.61980.41280.4888---0.819120.76510
DIFFVEC-WK0.52220.25160.28560.712100.61490.6809--
word2vecDIFFVEC-DM---0.6480.5080.5500.7540.583
DIFFVEC-CD0.6040.4030.446---0.8030.656
DIFFVEC-WK0.5680.3290.4020.6060.4140.445--
+ +Table 8: Results of our DIFFVEC adjective ranking method on the DEMELO, CROWD and WILKINSON datasets with the adjustment for ties. We report results with contextualised (BERT) representations obtained from different SENT-SETS (ukWaC, Flickr, Random) and with static (word2vec) vectors. + +
DEMELOCROWD
# ScalesP-ACCτρavgP-ACCτρavg
BERTukWaC1 (+)0.651100.433100.501100.682100.553100.6227
1 (-)0.59710.31510.35210.639120.458120.54312
50.65570.44370.53070.691110.575110.67511
Flickr1 (+)0.63990.41090.43290.67680.55080.6048
1 (-)0.60230.32930.37230.62940.44340.4794
50.624110.380110.452110.683110.562110.60612
Random1 (+)0.631110.401110.451110.67680.53680.5898
1 (-)0.61190.35690.44490.648110.479110.50011
50.62240.37140.41730.68570.55970.5887
word2vec1 (+)0.6020.3340.3640.6240.4190.479
1 (-)0.6130.3590.4120.6610.5060.559
50.6410.4150.4380.6880.5590.601
+ +Table 9: Results of DIFFVEC using a single positive $(1 (+))$ or negative $(1 (-))$ adjective pair, and five pairs (5). These are results obtained with a $dVec$ built from only one sentence (instead of ten in Table 4 of the paper). \ No newline at end of file diff --git a/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/images.zip b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..1303a3111a825d3ceadb24eb48039a9b76274285 --- /dev/null +++ b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a23a78b991baf2bb906e75867bfab479c18b1ba9a12369e5bd6ca1e9e3569e5 +size 789471 diff --git a/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/layout.json b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..2d8f009355b00054b07b2fc7fbaa7af833fe621d --- /dev/null +++ b/bertknowspuntacanaisnotjustbeautifulitsgorgeousrankingscalaradjectiveswithcontextualisedrepresentations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7478a08e7d6429ea56e65e011f790e70195e944190df32ea3f04af760a248d95 +size 532434 diff --git a/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_content_list.json b/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..ecd6b28084ee198e0cc05ec149ad9f388f152db6 --- /dev/null +++ b/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:278694c3a7ccd40912ebe6873c351fecc4eb852a8ceb9f01394b8ef800eebdd5 +size 75678 diff --git a/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_model.json b/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..f67afc6c01273b2c6de2fa193df33ac05dd7996e --- /dev/null +++ b/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0f5ac37baab4a3e361e089a3c54ca3b3ceefe56763bc7131fe2cd9efe039ec0 +size 92656 diff --git a/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_origin.pdf b/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..41202c900707a83caddfa473a1182b905cf8a3ff --- /dev/null +++ b/bertoftheseuscompressingbertbyprogressivemodulereplacing/8a9984ee-f9a4-45da-82f8-d0e8f560eff2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c37febef65ba3e93cc158907c457226555a31cdd807fb9dbbf04ba9f621633b +size 718601 diff --git a/bertoftheseuscompressingbertbyprogressivemodulereplacing/full.md b/bertoftheseuscompressingbertbyprogressivemodulereplacing/full.md new file mode 100644 index 0000000000000000000000000000000000000000..1092b03f470f2dd4b7c0178a07032ebbf293c5c6 --- /dev/null +++ b/bertoftheseuscompressingbertbyprogressivemodulereplacing/full.md @@ -0,0 +1,303 @@ +# BERT-of-Theseus: Compressing BERT by Progressive Module Replacing + +Canwen Xu $^{1*}$ , Wangchunshu Zhou $^{2*}$ , Tao Ge $^{3}$ , Furu Wei $^{3}$ , Ming Zhou $^{3}$ + +1 University of California, San Diego 2 Beihang University 3 Microsoft Research Asia + +$^{1}$ cxu@ucsd.edu $^{2}$ zhouwangchunshu@buaa.edu.cn + +3{tage,fuwei,mingzhou}@microsoft.com + +# Abstract + +In this paper, we propose a novel model compression approach to effectively compress BERT by progressive module replacing. Our approach first divides the original BERT into several modules and builds their compact substitutes. Then, we randomly replace the original modules with their substitutes to train the compact modules to mimic the behavior of the original modules. We progressively increase the probability of replacement through the training. In this way, our approach brings a deeper level of interaction between the original and compact models. Compared to the previous knowledge distillation approaches for BERT compression, our approach does not introduce any additional loss function. Our approach outperforms existing knowledge distillation approaches on GLUE benchmark, showing a new perspective of model compression. + +# 1 Introduction + +With the prevalence of deep learning, many huge neural models have been proposed and achieve state-of-the-art performance in various fields (He et al., 2016; Vaswani et al., 2017). Specifically, in Natural Language Processing (NLP), pretraining and fine-tuning have become the new norm of most tasks. Transformer-based pretrained models (Devlin et al., 2019; Liu et al., 2019b; Yang et al., 2019; Song et al., 2019; Dong et al., 2019) have dominated the field of both Natural Language Understanding (NLU) and Natural Language Generation (NLG). These models benefit from their "overparameterized" nature (Nakkiran et al., 2020) and contain millions or even billions of parameters, making it computationally expensive and inefficient considering both memory consumption and + +high latency. This drawback enormously hinders the applications of these models in production. + +To resolve this problem, many techniques have been proposed to compress a neural network. Generally, these techniques can be categorized into Quantization (Gong et al., 2014), Weights Pruning (Han et al., 2016) and Knowledge Distillation (KD) (Hinton et al., 2015). Among them, KD has received much attention for compressing pretrained language models. KD exploits a large teacher model to "teach" a compact student model to mimic the teacher's behavior. In this way, the knowledge embedded in the teacher model can be transferred into the smaller model. However, the retained performance of the student model relies on a well-designed distillation loss function which forces the student model to behave as the teacher. Recent studies on KD (Sun et al., 2019; Jiao et al., 2019) even leverage more sophisticated model-specific distillation loss functions for better performance. + +Different from previous KD studies which explicitly exploit a distillation loss to minimize the distance between the teacher model and the student model, we propose a new genre of model compression. Inspired by the famous thought experiment "Ship of Theseus" in Philosophy, where all components of a ship are gradually replaced by new ones until no original component exists, we propose Theseus Compression for BERT (BERT-of-Theseus), which progressively substitutes modules of BERT with modules of fewer parameters. We call the original model and compressed model predecessor and successor, in correspondence to the concepts of teacher and student in KD, respectively. As shown in Figure 1, we first specify a substitute (successor module) for each predecessor module (i.e., modules in the predecessor model). Then, we randomly replace each predecessor module with its + +corresponding successor module by a probability and make them work together in the training phase. After convergence, we combine all successor modules to be the successor model for inference. In this way, the large predecessor model can be compressed into a compact successor model. + +Theseus Compression shares a similar idea with KD, which encourages the compressed model to behave like the original, but holds many merits. First, we only use the task-specific loss function in the compression process. However, KD-based methods use task-specific loss, together with one or multiple distillation losses as its optimization objective. Also, selecting various loss functions and balancing the weights of each loss for different tasks and datasets can be laborious (Sun et al., 2019; Sanh et al., 2019). Second, different from recent work (Jiao et al., 2019), Theseus Compression does not use Transformer-specific features for compression thus is potential to compress a wide spectrum of models. Third, instead of using the original model only for inference in KD, our approach allows the predecessor model to work in association with the compressed successor model, enabling a possible gradient-level interaction. Moreover, the different module permutations mixing both predecessor and successor modules may add extra regularization, similar to Dropout (Srivastava et al., 2014). With a Curriculum Learning (Bengio et al., 2009) driven replacement scheduler, our approach achieves promising performance compressing BERT (Devlin et al., 2019), a large pretrained Transformer model. + +To summarize, our contribution is two-fold: (1) We propose a novel approach, Theseus Compression, revealing a new pathway to model compression, with no additional loss function. (2) Our compressed BERT model is $1.94 \times$ faster while retaining more than $98\%$ performance of the original model, outperforming other KD-based compression baselines. + +# 2 Related Work + +Model Compression Model compression aims to reduce the size and computational cost of a large model while retaining as much performance as possible. Conventional explanations (Denil et al., 2013; Zhai et al., 2016) claim that the large number of weights is necessary for the training of deep neural network but a high degree of redundancy exists after training. Recent work (Frankle and + +Carbin, 2019) proposes The Lottery Ticket Hypothesis claiming that dense, randomly initialized and feed-forward networks contain subnetworks that can be recognized and trained to get a comparable test accuracy to the original network. Quantization (Gong et al., 2014) reduces the number of bits used to represent a number in a model. Weights Pruning (Han et al., 2016; He et al., 2017) conducts a binary classification to decide which weights to be trimmed from the model. Knowledge Distillation (KD) (Hinton et al., 2015) aims to train a compact model which behaves like the original one. FitNets (Romero et al., 2015) demonstrates that "hint" learned by the large model can benefit the distillation process. Born-Again Neural Network (Furlanello et al., 2018) reveals that assembling multiple identical-parameterized students can outperform a teacher model. LIT (Koratana et al., 2019) introduces block-wise intermediate representation training. Liu et al. (2019a) distilled knowledge from ensemble models to improve the performance of a single model on NLU tasks. Tan et al. (2019) exploited KD for multi-lingual machine translation. Different from KD-based methods, our proposed Theseus Compression is the first approach to mix the original model and compact model for training. Also, no additional loss is used throughout the whole compression procedure, which simplifies the implementation. + +Faster BERT Very recently, many attempts have been made to speed up a large pretrained language model (e.g., BERT (Devlin et al., 2019)). Michel et al. (2019) reduced the parameters of a BERT model by pruning unnecessary heads in the Transformer. Shen et al. (2020) quantized BERT to 2-bit using Hessian information. Also, substantial modification has been made to Transformer architecture. Fan et al. (2020) exploited a structure dropping mechanism to train a BERT-like model which is resilient to pruning. ALBERT (Lan et al., 2020) leverages matrix decomposition and parameter sharing. However, these models cannot exploit ready-made model weights and require a full retraining. Tang et al. (2019) used a BiLSTM architecture to extract task-specific knowledge from BERT. DistilBERT (Sanh et al., 2019) applies a naive Knowledge Distillation on the same corpus used to pretrain BERT. Patient Knowledge Distillation (PKD) (Sun et al., 2019) designs multiple distillation losses between the module hidden states of the teacher and student models. Pretrained Distilla + +![](images/b1579b874ccca1ea34a4b73cea66dac6135fd482599a5222735793f58edb0677.jpg) +(a) Compression Training + +![](images/b43810fd8465288582259e113983483bc7ba66ffddf5b4d79c848b0e8213e623.jpg) +(b) Successor Finetuning and Inference +Figure 1: The workflow of BERT-of-Theseus. In this example, we compress a 6-layer predecessor $P = \{ prd_1, \ldots, prd_3 \}$ to a 3-layer successor $S = \{ scc_1, \ldots, scc_3 \}$ . $prd_i$ and $scc_i$ contain two and one layer, respectively. (a) During module replacing training, each predecessor module $prd_i$ is replaced with corresponding successor module $scc_i$ by the probability of $p$ . (b) During successor fine-tuning and inference, all successor modules $scc_{1\dots 3}$ are combined for calculation. + +tion (Turc et al., 2019) pretrains the student model with a self-supervised masked LM objective on a large corpus first, then performs a standard KD on supervised tasks. TinyBERT (Jiao et al., 2019) conducts the Knowledge Distillation twice with data augmentation. MobileBERT (Sun et al., 2020) devises a more computationally efficient architecture and applies knowledge distillation with a bottom-to-top layer training procedure. PABEE (Zhou et al., 2020b) exploits early exiting to dynamically accelerate the inference of BERT. + +# 3 BERT-of-Theseus + +In this section, we introduce module replacing, the technique proposed for BERT-of-Theseus. Further, we introduce a Curriculum Learning driven scheduler to obtain better performance. The workflow is shown in Figure 1. + +# 3.1 Module Replacing + +The basic idea of Theseus Compression is very similar to KD. We want the successor model to act like a predecessor model. KD explicitly defines a loss to measure the similarity of the teacher and student. However, the performance vastly relies on the design of the loss function (Hinton et al., 2015; Sun et al., 2019; Jiao et al., 2019). This loss function needs to be combined with task-specific loss (Sun et al., 2019; Koratana et al., 2019). Different from KD, Theseus Compression only requires one task + +specific loss function (e.g., Cross Entropy), which closely resembles a fine-tuning procedure. Inspired by Dropout (Srivastava et al., 2014), we propose module replacing, a novel technique for model compression. We call the original model and the target model predecessor and successor, respectively. First, we specify a successor module for each module in the predecessor. For example, in the context of BERT compression, we let one Transformer layer be the successor module for two Transformer layers. Consider a predecessor model $P$ which has $n$ modules and a successor model $S$ which has $n$ predefined modules. Let $P = \{ prd_{1}, \ldots, prd_{n} \}$ denote the predecessor model, $prd_{i}$ and $scc_{i}$ denote the the predecessor modules and their corresponding substitutes, respectively. The output vectors of the $i$ -th module is denoted as $y_{i}$ . Thus, the forward operation can be described in the form of: + +$$ +\mathbf {y} _ {i + 1} = p r d _ {i} \left(\mathbf {y} _ {i}\right) \tag {1} +$$ + +During compression, we apply module replacing. First, for $(i + 1)$ -th module, $r_{i + 1}$ is an independent Bernoulli random variable which has probability $p$ to be 1 and $1 - p$ to be 0. + +$$ +r _ {i + 1} \sim \operatorname {B e r n o u l l i} (p) \tag {2} +$$ + +Then, the output of the $(i + 1)$ -th model is calculated as: + +$$ +y _ {i + 1} = r _ {i + 1} * \operatorname {s c c} _ {i} (\mathbf {y} _ {i}) + (1 - r _ {i + 1}) * p r d _ {i} (\mathbf {y} _ {i}) \tag {3} +$$ + +where $*$ denotes the element-wise multiplication, $r_{i+1} \in \{0,1\}$ . In this way, the predecessor modules and successor modules work together in the training. Since the permutation of the hybrid model is random, it adds extra noises as a regularization for the training of the successor, similar to Dropout (Srivastava et al., 2014). + +During training, similar to a fine-tuning process, we optimize a regular task-specific loss, e.g., Cross Entropy: + +$$ +L = - \sum_ {j \in | X |} \sum_ {c \in C} [ \mathbb {1} [ \mathbf {z} _ {j} = c ] \cdot \log P (\mathbf {z} _ {j} = c | \mathbf {x} _ {j}) ] \tag {4} +$$ + +where $\mathbf{x}_j\in X$ is the $i$ -th training sample; $\mathbf{z}_j$ is its corresponding ground-truth label; $c$ and $C$ denote a class label and the set of class labels, respectively. For back-propagation, the weights of all predecessor modules are frozen. For both the embedding layer and output layer of the predecessor model are weight-frozen and directly adopted for the successor model in this training phase. In this way, the gradient can be calculated across both the predecessor and successor modules, allowing deeper interaction. + +# 3.2 Successor Fine-tuning and Inference + +To make the training and inference processes as close as possible, we further carry out a post-replacement fine-tuning phase to allow all successor modules to work together. After the replacing compression converges, we collect all successor modules and combine them to be the successor model $S$ : + +$$ +S = \{s c c _ {1}, \dots , s c c _ {n} \} +$$ + +$$ +\mathbf {y} _ {i + 1} = s c c _ {i} (\mathbf {y} _ {i}) \tag {5} +$$ + +Since each $scc_{i}$ is smaller than $prd_{i}$ in size, the predecessor model $P$ is in essence compressed into a smaller model $S$ . Then, we fine-tune the successor model by optimizing the same loss of Equation 4. The whole procedure including module replacing and successor fine-tuning is illustrated in Figure 2(a). Finally, we use the fine-tuned successor for inference as Equation 5. + +# 3.3 Curriculum Replacement + +Although setting a constant replacement rate $p$ can meet the need for compressing a model, we further highlight a Curriculum Learning (Bengio et al., 2009) driven replacement scheduler, which coordinates the progressive replacement of the modules. + +![](images/02e6b5513b4db47d8012fe245fa34c52a4aad5a3756ce5e61491e63cf8d703d6.jpg) +Figure 2: The replacing curves of a constant module replace rate and a replacement scheduler. We use different shades of gray to mark the two phases of Theseus Compression: (1) Module replacing. (2) Successor fine-tuning. + +![](images/63bbfdb7b9f6ed42915ac2bb9721ef827e24c2512930a582527f608e1ca51acd.jpg) + +Similar to (Morerio et al., 2017; Zhou et al., 2020a), we devise a replacement scheduler to dynamically tune the replacement rate $p$ . + +Here, we leverage a simple linear scheduler $\theta(t)$ to output the dynamic replacement rate $p_d$ for step $t$ . + +$$ +p _ {d} = \min (1, \theta (t)) = \min (1, k t + b) \tag {6} +$$ + +where $k > 0$ is the coefficient and $b$ is the basic replacement rate. The replacing rate curve with a replacement scheduler is illustrated in Figure 2(b). + +In this way, we unify the two previously separated training stages and encourage an end-to-end easy-to-hard learning process. First, with more predecessor modules present, the model would more likely to correctly predict thus have a relatively small cross-entropy loss, which is helpful for smoothing the learning process. Then, at a later time of compression, more modules can be present together, encouraging the model to gradually learn to predict with less guidance from the predecessor and steadily transit to the successor fine-tuning stage. + +Second, at the beginning of the compression, when $\theta (t) < 1$ , considering the average learning rate for all $n$ successor modules, the expected number of replaced modules is $n\cdot p_d$ and the expected average learning rate is: + +$$ +l r ^ {\prime} = \left(n p _ {d} / n\right) l r = (k t + b) l r \tag {7} +$$ + +where $lr$ is the constant learning rate set for the compression and $lr'$ is the equivalent learning rate considering all successor modules. Thus, when applying a replacement scheduler, a warm-up mechanism (Popel and Bojar, 2018) is essentially adopted at the same time, which helps the training of a Transformer. + +# 4 Experiments + +In this section, we introduce the experiments of Theseus Compression for BERT (Devlin et al., 2019) compression. We compare BERT-of-Theseus with other compression methods and further conduct experiments to analyze the results. + +# 4.1 Datasets + +We evaluate our proposed approach on the GLUE benchmark (Wang et al., 2019; Dolan and Brockett, 2005; Conneau and Kiela, 2018; Socher et al., 2013; Williams et al., 2018; Rajpurkar et al., 2016; Warstadt et al., 2019). Note that we exclude WNLI (Levesque, 2011) following the original BERT paper (Devlin et al., 2019). + +The accuracy is used as the metric for SST-2, MNLI-m, MNLI-mm, QNLI and RTE. The F1 and accuracy are used for MRPC and QQP. The Pearson correlation and Spearman correlation are used for STS-B. Matthew's correlation is used for CoLA. The results reported for the test set of GLUE are in the same format as on the official leaderboard. For the sake of comparison with (Sanh et al., 2019), on the development set of GLUE, the result of MNLI is an average on MNLI-m and MNLI-mm; the results on MRPC and QQP are reported with the average of F1 and accuracy; the result reported on STS-B is the average of the Pearson and Spearman correlation. + +# 4.2 Experimental Settings + +We test our approach under a task-specific compression setting (Sun et al., 2019; Turc et al., 2019) instead of a pretraining compression setting (Sanh et al., 2019; Sun et al., 2020). That is to say, we use no external unlabeled corpus but only the training set of each task in GLUE to compress the model. The reason behind this decision is that we intend to straightforwardly verify the effectiveness of our generic compression approach. The fast training process of task-specific compression (e.g., no longer than 20 GPU hours for any task of GLUE) computationally enables us to conduct more analytical experiments. For comparison, DistilBERT (Sanh et al., 2019) takes 720 GPU hours to train. Plus, in real-world applications, this setting provides with more flexibility when selecting from different pretrained LMs (e.g., BERT, RoBERTa (Liu et al., 2019b)) for various downstream tasks and it is easy to adopt a newly released model, without a time-consuming pretraining com + +pression. We will also discuss the possibility to use an MNLI model for a general purpose with intermediate transfer learning (Pruksachatkun et al., 2020). + +Formally, we define the task of compression as trying to retain as much performance as possible when compressing the officially released BERT-base (uncased)3 to a 6-layer compact model with the same hidden size, following the settings in (Sanh et al., 2019; Sun et al., 2019; Turc et al., 2019). Under this setting, the compressed model has 24M parameters for the token embedding (identical to the original model) and 42M parameters for the Transformer layers and obtains a $1.94 \times$ speed-up for inference. + +# 4.3 Training Details + +We fine-tune BERT-base as the predecessor model for each task with the batch size of 32, the learning rate of $2 \times 10^{-5}$ , and the number of epochs as 4. As a result, we are able to obtain a predecessor model with comparable performance with that reported in previous studies (Sanh et al., 2019; Sun et al., 2019; Jiao et al., 2019). + +Afterward, for training successor models, following (Sanh et al., 2019; Sun et al., 2019), we use the first 6 layers of BERT-base to initialize the successor model since the over-parameterized nature of Transformer (Vaswani et al., 2017) could cause the model unable to converge while training on small datasets. During module replacing, We fix the batch size as 32 for all evaluated tasks to reduce the search space. All $r$ variables only sample once for a training batch. The maximum sequence length is set to 256 on QNLI and 128 for the other tasks. We perform grid search over the sets of learning rate $lr$ as {1e-5, 2e-5}, the basic replacing rate $b$ as {0.1, 0.3}, the scheduler coefficient $k$ making the dynamic replacing rate increase to 1 within the first {1000, 5000, 10000, 30000} training steps. We apply an early stopping mechanism and select the model with the best performance on the development set. We conduct our experiments on a single Nvidia V100 16GB GPU. The peak memory usage is approximately identical to fine-tuning a BERT-base, since there would be at most 12 layers training at the same time. The training time for each task varies depending on the different sizes of training sets. For example, it takes 20 hours to + +
Method# Layer# Param.Loss FunctionExternal Data Used?Model-Agnostic?
BERT-base (2019)12110MCEMLM + CENSP--
Fine-tuning666MCETASKX
Vanilla KD (2015)666MCEKD + CETASKX
BERT-PKD (2019)666MCEKD + PTKD + CETASKX
DistilBERT (2019)666MCEKD + CosKD + CEMLM✓ (unlabeled)
PD-BERT (2019)666MCEMLM + CEKD + CETASK✓ (unlabeled)
TinyBERT (2019)415MMSEattn + MSEhidn + MSEembd + CEKD✓ (unlabeled + labeled)X
MobileBERT (2020)2425MFMT+AT+PKT+CEKD+CEMLM✓ (unlabeled)X
BERT-of-Theseus (Ours)666MCETASKX
+ +Table 1: Comparison of different BERT compression approaches. "CE" and "MSE" stand for Cross Entropy and Mean Square Error, respectively. "KD" indicates the loss is for Knowledge Distillation. "CETASK", "CEMLM" and "CENSP" indicate Cross Entropy calculated on downstream tasks, Masked LM pretraining and Next Sentence Prediction, respectively. Other loss functions are described in their corresponding papers. + +train on MNLI but less than 30 minutes on MRPC. + +# 4.4Baselines + +As shown in Table 1, we compare the layer numbers, parameter numbers, loss function, external data usage and model agnosticism of our proposed approach to existing methods. We set up a baseline of vanilla Knowledge Distillation (Hinton et al., 2015) as in (Sun et al., 2019). Additionally, we directly fine-tune a truncated 6-layer BERT model (the bottom 6 layers of the original $\mathrm{BERT})^4$ on GLUE tasks to obtain a natural fine-tuning baseline. Under the setting of compressing 12-layer BERT-base to a 6-layer compact model, we choose BERT-PKD (Sun et al., 2019), PD-BERT (Turc et al., 2019), and DistilBERT (Sanh et al., 2019) as strong baselines. Note that DistilBERT (Sanh et al., 2019) is not directly comparable here since it uses a pretraining compression setting. Both PD-BERT and DistilBERT use external unlabeled corpus. Additionally, we use LayerDrop (Fan et al., 2020) on BERT weights to prune the model on downstream tasks. We do not include TinyBERT (Jiao et al., 2019) since it conducts distillation twice and leverages extra augmented data for GLUE tasks. We also exclude MobileBERT (Sun et al., 2020), due to its redesigned Transformer block and different model size. Besides, in these two studies, the loss functions are not architecture-agnostic thus limit their applications on other types of models. + +# 4.5 Experimental Results + +We report the experimental results on the development set of GLUE in Table 2 and submit our predictions to the GLUE test server and obtain the + +results from the official leaderboard as shown in Table 3. Note that DistilBERT does not report on the test set. The BERT-base performance reported on GLUE development set is the predecessor finetuned by us. The results of BERT-PKD on the development set are reproduced by us using the official implementation. In the original paper of BERT-PKD, the results of CoLA and STS-B on the test set are not reported, thus we reproduce these two results. Fine-tuning and Vanilla KD baselines are both implemented by us. All other results are from the original papers. The macro scores here are calculated in the same way as the official leaderboard but are not directly comparable with GLUE leaderboard since we exclude WNLI from the calculation. + +Overall, our BERT-of-Theseus retains $98.4\%$ and $98.3\%$ of the BERT-base performance on GLUE development set and test set, respectively. On every task of GLUE, our model dramatically outperforms the fine-tuning baseline, indicating that with the same loss function, our proposed approach can effectively transfer knowledge from the predecessor to the successor. Also, our model obviously outperforms the vanilla KD (Hinton et al., 2015) and Patient Knowledge Distillation (PKD) (Sun et al., 2019), showing its supremacy over the KD-based compression approaches. On MNLI, our model performs better than BERT-PKD but slightly lower than PD-BERT (Turc et al., 2019). However, PD-BERT exploits an additional corpus which provides much more samples for knowledge transferring. Also, we would like to highlight that + +
MethodCoLA (8.5K)MNLI (393K)MRPC (3.7K)QNLI (105K)QQP (364K)RTE (2.5K)SST-2 (67K)STS-B (5.7K)Macro Score
BERT-base (2019)54.383.589.591.289.871.191.588.982.5
DistilBERT (2019)43.679.087.585.384.959.990.781.276.5
PD-BERT (2019)-83.087.289.089.166.791.1--
Fine-tuning43.480.186.086.987.862.189.681.977.2
Vanilla KD (2015)45.180.186.288.088.164.990.584.978.5
BERT-PKD (2019)45.581.385.788.488.466.591.386.279.2
LayerDrop (2020)45.480.785.988.488.365.290.785.778.8
BERT-of-Theseus51.182.389.089.589.668.291.588.781.2
+ +Table 2: Experimental results (median of 5 runs) on the development set of GLUE. The numbers under each dataset indicate the number of training samples. All models listed above (except BERT-base) have 66M parameters, 6 layers and $1.94 \times$ speed-up. + +
MethodCoLA (8.5K)MNLI-m/mm (393K)MRPC (3.7K)QNLI (105K)QQP (364K)RTE (2.5K)SST-2 (67K)STS-B (5.7K)Macro Score
BERT-base (2019)52.184.6 / 83.488.9 / 84.890.571.2 / 89.266.493.587.1 / 85.880.0
PD-BERT (2019)-82.8 / 82.286.8 / 81.788.970.4 / 88.965.391.8--
Fine-tuning41.580.4 / 79.785.9 / 80.286.769.2 / 88.263.690.782.1 / 80.075.6
Vanilla KD (2015)42.980.2 / 79.886.2 / 80.688.370.1 / 88.864.791.582.1 / 80.376.4
BERT-PKD (2019)43.581.5 / 81.085.0 / 79.989.070.7 / 88.965.592.083.4 / 81.677.0
BERT-of-Theseus47.882.4 / 82.187.6 / 83.289.671.6 / 89.366.292.285.6 / 84.178.6
+ +Table 3: Experimental results on the test set from the GLUE server. All models listed above (except BERT-base) have 66M parameters, 6 layers and $1.94 \times$ speed-up. + +on RTE, our model achieves nearly identical performance to BERT-base and on QQP our model even outperforms BERT-base. To analyze, a moderate model size may help generalize and prevent overfitting on downstream tasks. Notably, on both large datasets with more than 350K samples (e.g., MNLI and QQP) and small datasets with fewer than 4K samples (e.g., MRPC and RTE), our model can consistently achieve good performance, verifying the robustness of our approach. + +# 4.6 Intermediate-Task Transfer Learning + +Although our approach achieves good performance under a task-specific setting, it requires more computational resources to fine-tune a full-size predecessor than a compact BERT (e.g., DistilBERT (Sanh et al., 2019)). Pruksachatkun et al. (2020) found that models trained on some datasets can be used for a second-round fine-tuning. Thus, we use MNLI as the intermediate task and release our compressed model by conducting compression on MNLI to facilitate downstream applications. After compression, we fine-tune the successor model on other sentence classification tasks and compare the results with DistilBERT (Sanh et al., 2019) in Table 4. Our model achieves an identi- + +cal performance on MRPC and outperforms DistilBERT on the other sentence-level tasks. Also, our intermediate-task transfer results also outperform PD-BERT (Turc et al., 2019) on three tasks, indicating that our task-specific model is also competitive for a general purpose through the intermediate-task transfer learning approach. + +# 5 Analysis + +In this section, we conduct extensive experiments to analyze our BERT-of-Theseus. + +# 5.1 Impact of Module Replacement + +As pointed out in previous work (Fan et al., 2020), different layers of a Transformer play imbalanced roles for inference. To explore the effect of different module replacements, we iteratively use one compressed successor module (constant replacing rate, without successor fine-tuning) to replace its corresponding predecessor module on QNLI, MNLI and QQP, as shown in Table 5. Our results show that the replacement of the last two modules have limited influence on the overall performance while the replacement of the first module significantly harms the performance. To analyze, the linguistic features are mainly extracted by the first + +
MethodMNLIMRPCQNLIQQPRTESST-2STS-B
BERT-base (2019)83.589.591.289.871.191.588.9
DistilBERT (2019)79.087.585.384.959.990.781.2
PD-BERT (2019)83.087.289.089.166.791.1-
BERT-of-Theseus_MNLI82.187.588.888.870.191.887.8
+ +Table 4: Experimental results of intermediate-task transfer learning on GLUE-dev. + +
ReplacementQNLI(Δ)MNLI(Δ)QQP(Δ)
Predecessor91.8784.5489.48
prd1 → scc188.50 (-3.37)81.89 (-2.65)88.58 (-0.90)
prd2 → scc290.54 (-1.33)83.33 (-1.21)88.43 (-1.05)
prd3 → scc390.76 (-1.11)83.27 (-1.27)88.86 (-0.62)
prd4 → scc490.46 (-1.41)83.34 (-1.20)88.86 (-0.62)
prd5 → scc590.74 (-1.13)84.16 (-0.38)89.09 (-0.39)
prd6 → scc690.57 (-1.30)84.09 (-0.45)89.06 (-0.42)
+ +Table 5: Impact of the replacement for different modules on GLUE-dev. $prd_{i} \rightarrow scc_{i}$ indicates the replacement of the $i$ -th module from the predecessor. + +few layers. Therefore, the reduced representation capability becomes the bottleneck for the following layers. + +# 5.2 Impact of Replacing Rate + +We attempt to adopt different replacing rates on GLUE tasks. First, we fix the batch size to be 32 and learning rate $lr$ to be $2 \times 10^{-5}$ and conduct compression on each task. On the other hand, as we analyzed in Section 3.3, the equivalent learning rate $lr'$ is affected by the replacing rate. To further eliminate the influence of the learning rate, we fix the equivalent learning rate $lr'$ to be $2 \times 10^{-5}$ and adjust the learning rate $lr$ for different replacing rates by $lr = lr' / p$ . + +We illustrate the results with different replacing rates on two representative tasks (MRPC and RTE) in Figure 3. The trivial gap between two curves in both figures indicate that the effect of different replacing rates on equivalent learning rate is not the main factor for the performance differences. A replacing rate in the range between 0.5 and 0.7 can always lead to a satisfying performance on all GLUE tasks. However, a significant performance drop can be observed on all tasks if the replacing rate is too small (e.g., $p = 0.1$ ). On the other hand, the best replacing rate differs across tasks. + +# 5.3 Impact of Replacement Scheduler + +To study the impact of our curriculum replacement strategy, we compare the results of BERT + +![](images/c09d13ecce0d4bc6f44d5f91c0b347c4d28b4506b77f4d73525a8d0fc88298c6.jpg) +(a) MRPC + +![](images/8af02d2cf48321b6c85b765cdd34f058b73ce77f01b1fbfbdfbfa72208efbd24.jpg) +(b) RTE +Figure 3: Performance of different replacing rate on MRPC and RTE. "LR" and "ELR" denote that the learning rate and equivalent learning rate are fixed, respectively. + +of-Theseus compressed with a constant replacing rate and with a replacement scheduler. The constant replacing rate for the baseline is searched over $\{0.5, 0.7, 0.9\}$ . Additionally, we implement an "anti-curriculum" baseline, similar to the one in (Morio et al., 2017). For each task, we adopt the same coefficient $k$ and basic replacing rate $b$ to calculate the $p_d$ as Equation 6 for both curriculum replacement and anti-curriculum. However, we use $1 - p_d$ as the dynamic replacing rate for anti-curriculum baseline. Thus, we can determine whether the improvement of curriculum replacement is simply due to an inconstant replacing rate or an easy-to-hard curriculum design. + +As shown in Table 6, our model compressed with curriculum scheduler consistently outperforms a model compressed with a constant replacing rate. In contrast, a substantial performance drop is observed on the model compressed with an anticurriculum scheduler, which further verifies the effectiveness and importance of the curriculum replacement strategy. + +# 5.4 Impact of Predecessor Layers + +We further replace different numbers of Transformer layers with one layer to verify the effectiveness of Theseus Compression under different settings. We replace 3/4 layers with one Transformer layer, resulting in a 4/3-layer BERT model. + +
StrategyCoLA(Δ)MNLI(Δ)MRPC(Δ)QNLI(Δ)QQP(Δ)RTE(Δ)SST-2(Δ)STS-B(Δ)
Constant Rate44.481.987.188.588.666.490.688.4
Anti-curriculum42.8 (-1.6)79.8 (-2.1)85.6 (-1.5)87.8 (-0.7)87.6 (-1.0)62.4 (-4.0)88.8 (-1.8)85.4 (-3.0)
Curriculum51.1 (+6.7)82.3 (+0.4)89.0 (+1.9)89.5 (+1.0)89.6 (+1.0)68.2 (+1.8)91.5 (+0.9)88.7 (+0.3)
+ +Table 6: Comparison of models compressed with a constant replacing rate, a curriculum replacement scheduler and its corresponding anti-curriculum scheduler on GLUE-dev. + +
Method#LayerSpeed-upCoLA (8.5K)MNLI (393K)MRPC (3.7K)QNLI (105K)QQP (364K)RTE (2.5K)SST-2 (67K)STS-B (5.7K)Macro Score
BERT-base (2019)121.00×54.383.589.591.289.871.191.588.982.5
Fine-tuning61.94×43.480.186.086.987.862.189.681.977.2
BERT-of-Theseus61.94×51.182.389.089.589.668.291.588.781.2
Fine-tuning42.82×33.978.486.082.387.158.287.278.473.9
BERT-of-Theseus42.82×41.380.087.586.188.761.989.182.577.2
Fine-tuning33.66×27.578.181.980.486.557.785.976.871.9
BERT-of-Theseus33.66×35.078.884.382.187.359.587.278.974.1
+ +Table 7: Experimental results of replacing different numbers of layers with one layer on GLUE-dev. “#Layer” indicates the number of layers in the compressed models. + +The results are shown in Table 7. BERT-of-Theseus consistently outperforms the fine-tuned truncated BERT baselines, demonstrating its effectiveness under different settings. + +# 6 Discussion + +In this paper, we propose Theseus Compression, a novel model compression approach. We use this approach to compress BERT to a compact model that outperforms other models compressed by Knowledge Distillation. Our work highlights a new genre of model compression and reveals a new path towards model compression. + +For future work, we would like to explore the possibility of applying Theseus Compression on heterogeneous network modules. First, many developed in-place substitutes (e.g., ShuffleNet unit (Zhang et al., 2018) for ResBlock (He et al., 2016), Reformer Layer (Kitaev et al., 2020) for Transformer Layer (Vaswani et al., 2017)) are natural successor modules that can be directly adopted in Theseus Compression. Also, it is possible to use a feed-forward neural network to map features between the hidden spaces of different sizes (Jiao et al., 2019) to enable replacement between modules with different input and output sizes. Although our model has achieved good performance compressing BERT, it would be interesting to explore its possible applications in other neural models. As summarized in Table 1, our model does not rely on any model-specific features to compress BERT. + +Therefore, it is potential to apply Theseus Compression to other large models (e.g., ResNet (He et al., 2016) in Computer Vision). In addition, we would like to conduct Theseus Compression on more types of neural networks including Convolutional Neural Networks and Graph Neural Networks. We will also investigate the combination of our compression-based approach with recently proposed dynamic acceleration method (Zhou et al., 2020b) to further improve the efficiency of pretrained language models. + +# Acknowledgments + +We are grateful for the insightful comments from the anonymous reviewers. Tao Ge is the corresponding author. + +# References + +Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. 2009. Curriculum learning. In ICML. +Alexis Conneau and Douwe Kiela. 2018. Senteval: An evaluation toolkit for universal sentence representations. In LREC. +Misha Denil, Babak Shakibi, Laurent Dinh, Marc'Aurelio Ranzato, and Nando de Freitas. 2013. Predicting parameters in deep learning. In NeurIPS. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of + +deep bidirectional transformers for language understanding. In NAACL-HLT. +William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In IWP@IJCNLP. +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 NeurIPS. +Angela Fan, Edouard Grave, and Armand Joulin. 2020. Reducing transformer depth on demand with structured dropout. In ICLR. +Jonathan Frankle and Michael Carbin. 2019. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In ICLR. +Tommaso Furlanello, Zachary Chase Lipton, Michael Tschannen, Laurent Itti, and Anima Anandkumar. 2018. Born-again neural networks. In ICML. +Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. 2014. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115. +Song Han, Huizi Mao, and William J. Dally. 2016. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. In ICLR. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. Deep residual learning for image recognition. In CVPR. +Yihui He, Xiangyu Zhang, and Jian Sun. 2017. Channel pruning for accelerating very deep neural networks. In ICCV. +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. 2015. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531. +Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. 2019. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351. +Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. 2020. Reformer: The efficient transformer. In ICLR. +Animesh Koratana, Daniel Kang, Peter Bailis, and Matei Zaharia. 2019. LIT: Learned intermediate representation training for model compression. In ICML. +Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. In ICLR. + +Hector J. Levesque. 2011. The winograd schema challenge. In AAAI Spring Symposium: Logical Formalizations of Commonsense Reasoning. +Xiaodong Liu, Pengcheng He, Weizhu Chen, and Jianfeng Gao. 2019a. Improving multi-task deep neural networks via knowledge distillation for natural language understanding. arXiv preprint arXiv:1904.09482. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Paul Michel, Omer Levy, and Graham Neubig. 2019. Are sixteen heads really better than one? In NeurIPS. +Pietro Morerio, Jacopo Cavazza, Riccardo Volpi, René Vidal, and Vittorio Murino. 2017. Curriculum dropout. In ICCV. +Preetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang, Boaz Barak, and Ilya Sutskever. 2020. Deep double descent: Where bigger models and more data hurt. In *ICLR*. +Martin Popel and Ondrej Bojar. 2018. Training tips for the transformer model. The Prague Bulletin of Mathematical Linguistics, 110(1):43-70. +Yada Pruksachatkun, Jason Phang, Haokun Liu, Phu Mon Htut, Xiaoyi Zhang, Richard Yuanzhe Pang, Clara Vania, Katharina Kann, and Samuel R. Bowman. 2020. Intermediate-task transfer learning with pretrained language models: When and why does it work? In ACL. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: 100,000+ questions for machine comprehension of text. In EMNLP. +Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. 2015. Fitnets: Hints for thin deep nets. In ICLR. +Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108. +Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W. Mahoney, and Kurt Keutzer. 2020. Q-BERT: hessian based ultra low precision quantization of BERT. In AAAI. +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 EMNLP. + +Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, and Tie-Yan Liu. 2019. MASS: masked sequence to sequence pre-training for language generation. In ICML. +Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. 2014. Dropout: a simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15(1):1929-1958. +Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. 2019. Patient knowledge distillation for BERT model compression. In EMNLP-IJCNLP. +Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. 2020. Mobilebert: a compact task-agnostic BERT for resource-limited devices. In ACL. +Xu Tan, Yi Ren, Di He, Tao Qin, Zhou Zhao, and TieYan Liu. 2019. Multilingual neural machine translation with knowledge distillation. In ICLR. +Raphael Tang, Yao Lu, Linqing Liu, Lili Mou, Olga Vechtomova, and Jimmy Lin. 2019. Distilling task-specific knowledge from bert into simple neural networks. arXiv preprint arXiv:1903.12136. +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 NeurIPS. +Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR. +Alex Warstadt, Amanpreet Singh, and Samuel R. Bowman. 2019. Neural network acceptability judgments. TACL, 7:625-641. +Adina Williams, Nikita Nangia, and Samuel R. Bowman. 2018. A broad-coverage challenge corpus for sentence understanding through inference. In *NAACL-HLT*. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime G. Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In NeurlPS. +Shuangfei Zhai, Yu Cheng, Zhongfei (Mark) Zhang, and Weining Lu. 2016. Doubly convolutional neural networks. In NeurIPS. +Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. 2018. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In CVPR. + +Wangchunshu Zhou, Tao Ge, Ke Xu, Furu Wei, and Ming Zhou. 2020a. Scheduled drophead: A regularization method for transformer models. arXiv preprint arXiv:2004.13342. +Wangchunshu Zhou, Canwen Xu, Tao Ge, Julian McAuley, Ke Xu, and Furu Wei. 2020b. Bert loses patience: Fast and robust inference with early exit. In NeurIPS. \ No newline at end of file diff --git a/bertoftheseuscompressingbertbyprogressivemodulereplacing/images.zip b/bertoftheseuscompressingbertbyprogressivemodulereplacing/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..54da46c1342fb431c58b9407be9a4b752b8c09f9 --- /dev/null +++ b/bertoftheseuscompressingbertbyprogressivemodulereplacing/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:547c4acd22c79ba5b524933560a77e39e23f8b03dd384c14e6c1ed69bc97d822 +size 449237 diff --git a/bertoftheseuscompressingbertbyprogressivemodulereplacing/layout.json b/bertoftheseuscompressingbertbyprogressivemodulereplacing/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..f63b404eef08318ca2fb7b4aca11d9d4608ffebe --- /dev/null +++ b/bertoftheseuscompressingbertbyprogressivemodulereplacing/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a86bbd9aff342a199d86167569f46b008953034cbe42eb3aea3c9eeb83f9ba81 +size 360866 diff --git a/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_content_list.json b/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..85f239370143952ccbc8e9d77f20534b539d5e1d --- /dev/null +++ b/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce8477a822b1f3a3e7b2a7f98b1f52b38d59e7421ee292db316452668cef9192 +size 135913 diff --git a/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_model.json b/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c52561ea3678c855be872389b020847099f7ec32 --- /dev/null +++ b/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a361488817b5dd208f9eb7a755fe828f5003950aa241048e76d9b5d3f6cfa9f0 +size 195238 diff --git a/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_origin.pdf b/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..49c255ad04047c7cae9f52bfd739ad0b9e02f2aa --- /dev/null +++ b/betterhighlightingcreatingsubsentencesummaryhighlights/56da7d13-4c3c-46b4-9081-32cf8bddf18a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13f6bf1fc7060420fba58fd22dd8d1f8dddbcabbbd60c8474fc8a437f769a0b2 +size 1000597 diff --git a/betterhighlightingcreatingsubsentencesummaryhighlights/full.md b/betterhighlightingcreatingsubsentencesummaryhighlights/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f120f029b7e1c74af4f34ddc1607b6a23c7656c0 --- /dev/null +++ b/betterhighlightingcreatingsubsentencesummaryhighlights/full.md @@ -0,0 +1,587 @@ +# Better Highlighting: Creating Sub-Sentence Summary Highlights + +Sangwoo Cho, $^{\dagger}$ Kaiqiang Song, $^{\dagger}$ Chen Li, $^{\S}$ , Dong Yu $^{\S}$ , Hassan Foroosh $^{\dagger}$ , Fei Liu $^{\dagger}$ + +†Computer Science Department, University of Central Florida +§Tencent AI Lab, Bellevue, WA, USA + +{swcho,kqsong}@knights.ucf.edu {ailabchenli,dyu}@tencent.com {foroosh,feiliu}@cs.ucf.edu + +# Abstract + +Amongst the best means to summarize is highlighting. In this paper, we aim to generate summary highlights to be overlaid on the original documents to make it easier for readers to sift through a large amount of text. The method allows summaries to be understood in context to prevent a summarizer from distorting the original meaning, of which abstractive summarizers usually fall short. In particular, we present a new method to produce self-contained highlights that are understandable on their own to avoid confusion. Our method combines determinantal point processes and deep contextualized representations to identify an optimal set of sub-sentence segments that are both important and non-redundant to form summary highlights. To demonstrate the flexibility and modeling power of our method, we conduct extensive experiments on summarization datasets. Our analysis provides evidence that highlighting is a promising avenue of research towards future summarization. + +# 1 Introduction + +A summary is reliable only if it is true-to- original. Abstractive summarizers are considered to be less reliable despite their impressive performance on benchmark datasets, because they can hallucinate facts and struggle to keep the original meanings intact (Kryscinski et al., 2019; Lebanoff et al., 2019). In this paper, we seek to generate summary highlights to be overlaid on the original documents to allow summaries to be understood in context and avoid misdirecting readers to false conclusions. This is especially important in areas involving legislation, political speeches, public policies, social media, and more (Sadeh et al., 2013; Kornilova and Eidelman, 2019). Highlighting is most commonly used in education to make important information stand out and bring attention of readers to the essential topics (Rello et al., 2014). + +# Original Document and Summary Highlights + +Afghan opium kills 100,000 people every year worldwide – more than any other drug – and the opiate heroin kills five times as many people in NATO countries each year than the eight-year total of NATO troops killed in Afghan combat, the United Nations said Wednesday. About 15 million people around the world use heroin, opium or morphine, fueling a $65 billion market for the drug and also fueling terrorism and insurgencies... Drug money is funding insurgencies in Central Asia, which has huge energy reserves, Costa said... Europe and Russia together consume just under half of the heroin coming out of Afghanistan, the United Nations concluded, and Iran is by far the single largest consumer of Afghan opium. + +Table 1: An example of sub-sentence highlights overlaid on the original document; the highlights are self-contained. + +The characteristics of summary highlights are: saliency, i.e., highlights must give the main points of the documents, and non-redundancy, suggesting that redundant content should not appear in a summary (Nenkova and McKeown, 2011). Importantly, a highlighted text should be self-contained, i.e., understandable on its own, without the need for specific information from surrounding context. Table 1 provides an example of sub-sentence highlights. In contrast, "New Jersey is located in" hardly constitutes a good highlight because the information it contains is incomplete and may confuse readers. To date, there has not been any unified framework to account for all these characteristics to generate highlights. We overcome the challenge by identifying self-contained sub-sentence segments from the documents, then combining determinantal point processes and deep contextualized representations to produce highlights. + +Determinantal point process belongs to a class of optimization methods that have had considerable success in summarizing text and video (Kulesza and Taskar, 2012; Gong et al., 2014; Sharghi et al., 2018). It selects a diverse subset from a ground set of items, where an item is a candidate text segment in the context of generating summary highlights. An item is characterized by a quality score that indicates the salience of the segment and a diversity + +score that models pairwise repulsion, suggesting that two segments carrying similar meaning cannot both be included in the summary to avoid redundancy. The quality and diversity decomposition of DPP allows it to identify an optimal subset from a collection of candidate segments. + +We study sub-sentence segments as they strike a balance between the quality and amount of highlights. Whole sentences often contain excessive or unwanted details; keywords are succinct but less informative. We conjecture that sub-sentence segments can be identified from a document similar to salient objects are identified from an image using bounding boxes (Girshick et al., 2014). To best estimate the size of segments, we present a novel method to "overgenerate" a rich set of self-contained, partially-overlapping sub-sentence segments from any sentence based on contextualized representations (Yang et al., 2019; Devlin et al., 2019), then leverage determinantal point processes to identify an essential subset based on saliency and non-redundancy criteria. Our contributions of this work are summarized as follows. + +- We propose to generate sub-sentence summary highlights to be overlaid on source documents to enable users to quickly navigate through content. Comparing to keywords or whole sentences, subsentence segments allow us to attain a good balance between quality and amount of highlights. +- Importantly, sub-sentence segments are designed to be self-contained, and for which we introduce a new algorithm based on deep contextual representations to obtain self-contained text segments. All candidate segments are fed to determinantal point processes to identify an optimal subset containing informative, non-redundant, and self-contained sub-sentence highlights. +- We perform experiments on benchmark summarization datasets to demonstrate the flexibility and modeling power of our approach. Our analysis provides further evidence that highlighting offers a promising avenue of research. $^{1}$ + +# 2 Related Work + +An abstract failing to retain the original meaning poses a substantial risk of harm to applications. Abstractive summarizers can copy words from source documents or generate new words (See et al., 2017; + +# Original Sentence + +- Some interstates are closed and hundreds of flights have been canceled as winter storms hit during one of the year's busiest travel weeks. + +# Self-Contained Segments + +- Some interstates are closed +- hundreds of flights have been canceled as winter storms hit +- flights have been canceled as winter storms hit +- winter storms hit during one of the year's busiest travel weeks + +# Non-Self-Contained Segments + +- Some interstates are +- closed and hundreds of flights have been +- been canceled as winter storms hit during one of +- hit during one of the year's + +Table 2: Examples of self-contained and non-self-contained segments extracted from a document sentence. + +Tan et al., 2017; Chen and Bansal, 2018; Narayan et al., 2018; Gehrmann et al., 2018; Liu and Lapata, 2019; Laban et al., 2020). With greater flexibility comes increased risk. Failing to accurately convey the original meaning can hinder the deployment of summarization techniques in real-world scenarios, as inaccurate and untruthful summaries can lead the readers to false conclusions (Cao et al., 2018; Falke et al., 2019; Lebanoff et al., 2019). We aim to produce summary highlights in this paper, which will be overlaid on source documents to allow summaries to be interpreted in context. + +Generation of summary highlights is of crucial importance to tasks such as producing informative snippets from search outputs (Kaisser et al., 2008), summarizing viewpoints in opinionated text (Paul et al., 2010; Amplayo and Lapata, 2020), and annotating website privacy policies to assist users in answering important questions (Sadeh et al., 2013). Determining the most appropriate textual unit for highlighting, however, has been an understudied problem. Extractive summarization selects whole sentences from documents; a sentence can contain 20 to 30 words on average (Kamigaito et al., 2018). Keyphrases containing two to three words are much less informative (Hasan and Ng, 2014). Neither are ideal solutions. There is a rising need for other forms of highlighting, and we explore subsentence highlights that strike a balance between the amount and quality of emphasized content. + +It is best for highlighted segments to remain self-contained. In fact, multiple partially-overlapping and self-contained segments can exist in a sentence, as illustrated in Table 2. Identifying self-contained segments has not been thoroughly investigated in previous studies. Woodsend and Lapata (2010) propose to generate story highlights by selecting and combining phrases. Li et al. (2016) explore elemen + +tary discourse units generated using an RST parser as selection units. Spala et al. (2018) present a crowdsourcing method for workers to highlight sentences and compare systems. Arumae et al. (2019) propose to align human abstracts and source articles to create ground-truth highlight annotations. Importantly, and distinguishing our work from earlier literature, we make a first attempt to generate self-contained highlights, drawing on the successes of deep contextualized representations and their extraordinary ability of encoding syntactic structure (Clark et al., 2019; Hewitt and Manning, 2019). We next discuss our method in greater detail. + +# 3 Our Method + +We present a new method to identify self-contained segments, then select important and non-redundant segments to form a summary, as text fragments containing incomplete and disorganized information are hardly successful summary highlights. + +# 3.1 Self-Contained Segments + +A self-contained segment is, in a sense, a miniature sentence. Any text segment containing incomplete or ungrammatical constructions is incomprehensible to humans. Table 2 presents examples of self-contained and non-self-contained segments. Since its very inception (Vladutz, 1983), the concept of "semantically self-contained segment" has not been sufficiently examined in the literature and lacks an universal definition. We assume in this paper that a self-contained segment shall conform to certain syntactic validity constraints and there exists only weak dependencies between words that belong to the segment and those do not. + +The automatic identification of self-contained segments requires more than segmentation or parsing sentences into tree structures (Dozat and Manning, 2018). Self-contained segments do not necessarily correspond to constituents of the tree and further, there is no guarantee that tree constituents are self-contained. In this paper, we define a segment to be a consecutive sequence of words, excluding segments formed by concatenating non-adjacent words from consideration. We perform exhaustive search to analyze every segment of a given sentence to determine if it is self-contained or not. + +Let $\mathbf{x} = [x_1, \ldots, x_N]$ be a document sentence. We present a method to estimate whether an arbitrary segment $\mathbf{x}_{i:j}$ of the sentence is semantically self-contained or not. Our method is inspired by + +![](images/4740ace479483f5b4e0d2386060ccb7c8dcace88c22157d2ac09f2a5cfe29e75.jpg) +Figure 1: The XLNet architecture with two-stream attention mechanism is leveraged to estimate whether a segment is self-contained or not. A self-contained segment is assumed to be preceded and followed by end-of-sentence markers (eos). + +XLNet (Yang et al., 2019) that introduces a novel architecture with two-stream attention mechanism for autoregressive language modeling. Pretrained contextualized representations such as BERT and XLNet have demonstrated remarkable success on language understanding tasks. We expect the representations to encode the syntactic validity of segments, as similar findings are seen in recent structural probings (Hewitt and Manning, 2019). + +We hypothesize that a self-contained segment, similar to a miniature sentence, can be preceded and followed by end-of-sentence (eos) markers without sacrificing grammatical correctness. We follow the convention of Clark et al. (2019) to define end-of-sentence markers (eos) to include periods and commas. Our method inserts hypothetical tokens $x_{\mathrm{s}}$ and $x_{\mathrm{e}}$ to the beginning and end positions of a segment $\mathbf{x}_{i:j}$ , then constructs contextualized representations for these positions, denoted by $\mathbf{g}(\mathbf{x}_{i:j}, p_{\mathrm{start}})$ and $\mathbf{g}(\mathbf{x}_{i:j}, p_{\mathrm{end}})$ , based on which we estimate how likely $x_{\mathrm{s}}$ is an end-of-sentence marker $p(x_{\mathrm{s}} = \mathrm{eos} | \mathbf{x}_{i:j})$ , similarly for $p(x_{\mathrm{e}} = \mathrm{eos} | \mathbf{x}_{i:j})$ . Their average probability indicates self-containedness. A higher score of $p(z | \mathbf{x}_{i:j})$ suggests $\mathbf{x}_{i:j}$ has a higher likelihood of being self-contained. + +$$ +\begin{array}{l} p (z | \mathbf {x} _ {i: j}) = \frac {1}{2} \left(p \left(x _ {\mathrm {s}} = \mathrm {e o s} | \mathbf {x} _ {i: j}\right) + p \left(x _ {\mathrm {e}} = \mathrm {e o s} | \mathbf {x} _ {i: j}\right)\right) \\ p (x _ {\mathrm {s}} = \mathbf {e o s} | \mathbf {x} _ {i: j}) = \frac {\exp (\mathbf {e} (x _ {\mathrm {s}}) ^ {\top} \mathbf {g} (\mathbf {x} _ {i : j} , p _ {\mathrm {s t a r t}}))}{\sum_ {x ^ {\prime}} \exp (\mathbf {e} (x ^ {\prime}) ^ {\top} \mathbf {g} (\mathbf {x} _ {i : j} , p _ {\mathrm {s t a r t}}))} \\ \end{array} +$$ + +It is important to induce contextualized representations for the augmented segment without using the content of hypothetical tokens $x_{\mathrm{s}}$ and $x_{\mathrm{e}}$ . We leverage XLNet with two-stream attention mechanism for this purpose, as illustrated in Figure 1. For the $k$ -th position ( $k = \{\mathrm{i}:\mathrm{j}, \text{start}, \text{end}\}$ ) of the $l$ -th layer, a content stream builds representation $\mathbf{h}_{k}^{(l)}$ + +![](images/9560339a6313f126ea20ebea6e1a57c4529d46362c41adca98b1d91712d096eb.jpg) +Figure 2: DPP selects a set of summary segments (marked yellow) based on the quality and pairwise dissimilarity of segments. + +by attending to all tokens of the segment, whereas a query stream builds representation $\mathbf{g}_k^{(l - 1)}$ simultaneously without incorporating the content of the current token $x_{k}$ , following the equations given below. Our method builds on the pretrained XLNet model without fine-tuning. It relies on two-stream attention to construct deep contextualized representations $\mathbf{g}(\mathbf{x}_{i:j},p_{\mathrm{start}})$ and $\mathbf{g}(\mathbf{x}_{i:j},p_{\mathrm{end}})$ , respectively for the beginning and end positions. + +$$ +\begin{array}{l} \mathbf {h} _ {k} ^ {(l)} = \text {A t t e n t i o n} (\mathrm {Q} = \mathbf {h} _ {k} ^ {(l - 1)}, \mathrm {K V} = \mathbf {h} _ {i: j} ^ {(l - 1)}) \\ \mathbf {g} _ {k} ^ {(l)} = \mathrm {A t t e n t i o n} (\mathbf {Q} = \mathbf {g} _ {k} ^ {(l - 1)}, \mathbf {K V} = \mathbf {h} _ {i: j \backslash k} ^ {(l - 1)}) \\ \end{array} +$$ + +Our method is the first attempt to extract semantically self-contained segments from whole sentences. Segments that do not resemble "miniature sentences" will be given low probabilities by the method. E.g., "closed and hundreds of flights have been" is scored low, not only because an end-of-sentence marker rarely occurs after "have been," but also the syntactic structure of the segment does not resemble that of a well-formed sentence. + +We split a sentence at punctuation and extract a number of segments from each sentence chunk. A segment is discarded if its start (or end) probability is lower than the upper quartile value, indicating an inappropriate start (or end) point. The remaining segments are ordered according to the average probability. This process produces a collection of self-contained and partially-overlapping segments from a set of documents. Next, we assess the informativeness of the segments and leverage DPP to identify a subset to form the summary highlights. + +# 3.2 Segment Selection with DPP + +We employ the modeling framework proposed by Cho et al. (2019a) for modeling determinantal point processes. DPP (Kulesza and Taskar, 2012) defines a probability measure $\mathcal{P}$ over all subsets $(2^{|Y|})$ of a ground set containing a collection of $\mathsf{N}$ segments $\mathcal{V} = \{1,2,\dots ,\mathsf{N}\}$ . The probability of an extractive summary, containing a subset of the segments $Y\subseteq \mathcal{V}$ , is defined by Eq. (1), where $\operatorname*{det}(\cdot)$ is the determinant of a matrix; $L\in \mathbb{R}^{N\times N}$ is a positive + +semi-definite matrix and $L_{ij}$ indicates the correlation between segments $i$ and $j$ ; $L_{Y}$ is a submatrix of $L$ containing only entries indexed by elements in $Y$ ; $I$ is the identity matrix. This definition suggests that the probability of a summary $\mathcal{P}(Y;L)$ is proportional to the determinant of $L_{Y}$ . + +$$ +\mathcal {P} (Y; L) = \frac {\det \left(L _ {Y}\right)}{\det (L + I)}, \tag {1} +$$ + +$$ +\mathcal {L} (\boldsymbol {\theta}) = \sum_ {i = 1} ^ {N} \log \mathcal {P} \left(\hat {Y} ^ {(i)}; L ^ {(i)} (\boldsymbol {\theta})\right) \tag {2} +$$ + +A decomposition exists for the $L$ -ensemble matrix: $L_{ij} = q_i \cdot S_{ij} \cdot q_j$ where $q_i \in \mathbb{R}^+$ is a quality score of the $i$ -th segment and $S_{ij}$ is a pairwise similarity score between segments $i$ and $j$ . If $q$ and $S$ are available, $\mathcal{P}(Y)$ can be computed using Eq. (1). Estimating the pairwise similarity $S$ is trivial, we refer the reader to (Cho et al., 2019b) for details. In this paper, we present a inverted pyramid method to estimate the quality of segments $q$ . The quality model is parameterized by $\theta$ , thus the L-ensemble is parameterized the same, denoted by $L^{(i)}(\theta)$ for the $i$ -th instance of the dataset. $\hat{Y}^{(i)}$ represents the ground-truth summary (Eq. (2)). The model is optimized by maximizing the log-likelihood, where parameters $\theta$ are learned during training. As illustrated in Figure 2, DPP allows us to identify a set of salient and non-redundant summary segments. + +Inverted pyramid We describe a classifier to predict if a segment of text is summary-worthy or not according to the inverted pyramid principle.2 It is a way of front loading a story so that the reader can get the most important information first. E.g., the most newsworthy information such as who, what, when, where, etc. heads the article, followed by important details, and finally other general and background information. The inverted pyramid explains the common observation that lead baselines consisting of the first few sentences of an article perform strongly in the news domain. + +Our classifier assigns a high score to a segment if its content is relevant to the lead paragraph, and a low score if its content overlaps with the bottom paragraph of a news article, which usually contains trivial details. Importantly, the classifier is trained using CNN/DM (See et al., 2017), rather than any multi-document summarization data. + +During training, we obtain the ground-truth summary of each article. A summary sentence is paired with the lead paragraph of the article that contains the top-5 sentences to form a positive instance and similarly, with bottom-5 sentences to form a negative instance. If a summary sentence appears as-is in the top or bottom paragraph, we exclude the sentence from the paragraph to avoid overfitting the classifier. At test time, the classifier learns to distill the essential content of the segment and assigns a high score to it if its content is similar to the lead paragraph, indicating the segment is relevant and summary-worthy. + +For each instance, we obtain deep contextualized representation for it using the BERT architecture, where a segment and a lead (or bottom) paragraph is used as the input and the top layer hidden vector of the [CLS] token is extracted as the representation. It is fed to a feedforward, a dropout and a softmax layer to predict a binary label for the segment. Once the model is trained, we apply it to a segment and its lead paragraph to produce a vector which is used as part of the features for computing $q$ . + +DPP training. We obtain feature representations for the $i$ -th segment by concatenating the previous vector and a number of surface features extracted for segment $i$ . The features include the length and position of the segment within a document, the cosine similarity between the segment and document TF-IDF vectors (Kulesza and Taskar, 2011). We abstain from using sophisticated features to avoid model overfitting. The feature parameters $\theta$ are to be learned during DPP training. + +DPP is trained on multi-document summarization data by maximizing log-likelihood. At each iteration, we project the L-ensemble onto the positive semi-definite (PSD) cone to ensure that it satisfies the PSD property (§3.2). This is accomplished in two steps, where $L'$ is the new L-ensemble. + +$$ +L = \sum_ {i = 0} ^ {n} \lambda_ {i} v _ {i} v _ {i} ^ {\top} (\text {E i g e n v a l u e d e c o m p o s i t i o n}) +$$ + +$$ +L ^ {\prime} = \sum_ {i = 0} ^ {n} \max \left\{\lambda_ {i}, 0 \right\} v _ {i} v _ {i} ^ {\top} \quad (\text {P S D p r o j e c t i o n}) +$$ + +
DUC-04 Test SetR-1R-2R-SU4
DPP-BERT (Cho et al., 2019b)39.0510.2314.35
DPP (Kulesza and Taskar, 2012)38.109.1413.40
SumBasic (Vanderwende et al., 2007)29.484.258.64
KLSumm(Haghighi et al., 2009)31.046.0310.23
LexRank (Erkan and Radev, 2004)34.447.1111.19
Centroid (Hong et al., 2014)35.497.8012.02
ICSISumm (Gillick and Favre, 2009)37.319.3613.12
Opinosis (Ganesan et al., 2010)27.075.038.63
Pointer-Gen (See et al., 2017)31.436.0310.01
CopyTrans (Gehrmann et al., 2018)28.546.387.22
Hi-MAP (Fabbri et al., 2019)35.788.9011.43
HL-TreeSegs (Our work)39.1810.3014.37
HL-XLNetSegs (Our work)39.2610.7014.47
+ +Table 3: Results on DUC-04 dataset evaluated by ROUGE. + +# 4 Experiments + +# 4.1 Data Sets + +Our data comes from NIST. We use them to investigate the feasibility of the proposed multi-document summarization method. Particularly, we use DUC03/04 (Over and Yen, 2004) and TAC-08/09/10/11 datasets (Dang and Owczarzak, 2008), which contain 60/50/48/44/46/44 document sets respectively. These datasets are previously used as benchmarks for multi-document summarization competitions.3 Our task is to generate a summary of less than 100 words from a set of 10 news documents, where a summary contains a set of selected text segments. There are four human reference summaries for each document set, created by NIST evaluators. + +A system summary is evaluated against human reference summaries using ROUGE (Lin, 2004), where R-1, R-2, and R-SU4 respectively measure the overlap of unigrams, bigrams and skip bigrams (with a maximum gap of 4 words) between system and reference summaries. In the following sections, we report results on DUC-04 (trained on DUC-03) and TAC-11 (trained on TAC-08/09/10) as they are the standard test sets (Hong et al., 2014). + +# 4.2 Experimental Settings + +Our method of estimating self-containedness uses the pretrained XLNet-LARGE (Yang et al., 2019) to estimate the probability of end-of-sentence markers. We require a candidate segment to contain five or more words. Our classifier is based on the BERT-BASE model and it is fine-tuned for two epochs on + +# Human Abstract + +- Exxon and Mobil discuss combining business operations. +- A possible Exxon-Mobil merger would reunite 2 parts of Standard Oil broken up by the Supreme Court in 1911. +- Low crude oil prices and the high cost of exploration are motives for a merger that would create the world's largest oil company. + +- As Exxon-Mobil merger talks continue, stocks of both companies surge. + +- The merger talks show that corporate mergers are back in vogue. +- Antitrust lawyers, industry analysts, and government officials say a merger would require divestitures. +- A Mobil employee worries that a merger would put thousands out of work, but notes that his company's stock would go up. + +# Highlighting (Tree Segments) + +- Whether or not the talks between Exxon and Mobil lead to a merger or some other business combination, America's economic history is already being rewritten. +The boards of Exxon Corp. and Mobil Corp. are expected to meet Tuesday to consider a possible merger agreement that would form the world's largest oil company, a source close to the negotiations said Friday. +- Exxon Corp. and Mobil Corp. have held discussions about combining their business operations, a person involved in the talks said Wednesday. +- News that Exxon and Mobil, two giants in the energy patch, were in merger talks last week is the biggest sign yet that corporate marriages are back in vogue. (Rest omitted.) + +# Highlighting (XLNet Segments) + +- Whether or not the talks between Exxon and Mobil lead to a merger or some other business combination, America's economic history is already being rewritten. +- Still, it boggles the mind to accept the notion that hardship is driving profitable Big Oil to either merge, as British Petroleum and Amoco have already agreed to do, or at least to consider the prospect, as Exxon and Mobil are doing. +- Oil stocks led the way as investors soaked up the news of continuing talks between Exxon and Mobil on a merger that would create the world's largest oil company. +- Although the companies only confirmed that they were discussing the possibility of a merger, a person close to the discussions said the boards of both Exxon and Mobil were expected to meet Tuesday to consider an agreement. +- Analysts predicted that there would be huge cuts in duplicate staff from both companies, which employ 122,700 people. (Rest omitted.) + +Table 4: Example system outputs for a topic in DUC-04. Our highlighting method is superior to sentence extraction as it allows readers to quickly skim through a large amount of text to grasp the main points. XLNet segments are better than tree segments. Not only can they aid reader comprehension but they are also self-contained and more concise. + +
TAC-11 Test SetR-1R-2R-SU4
DPP-BERT (Cho et al., 2019b)38.5911.0614.65
DPP (Kulesza and Taskar, 2012)36.959.8313.57
SumBasic (Vanderwende et al., 2007)31.586.0610.06
KLSumm (Haghighi et al., 2009)31.237.0710.56
LexRank (Erkan and Radev, 2004)33.107.5011.13
Opinosis (Ganesan et al., 2010)25.155.128.12
Pointer-Gen (See et al., 2017)31.446.4010.20
HL-XLNetSegs (Our work)36.509.7613.34
HL-TreeSegs (Our work)37.2410.0413.49
+ +Table 5: ROUGE results on the TAC-11 dataset. + +the training data. The maximum sequence length of the model is 512 tokens and the batch size is set to 16. We use the Adam optimizer with an initial learning rate of $5e^{-5}$ , a warm-up period of 24,400 steps, corresponding to $10\%$ of the training data, and linear decay after that. + +# 4.3 Ground-Truth Segments + +Our DPP framework is fully supervised and ground-truth summary segments are required for training the DPP. In an ideal scenario, we would have human annotators to label the ground-truth summary segments for each document set. It is akin to label bounding boxes for objects, which allows an object + +detector to be trained on millions of training examples (Girshick et al., 2014). Nonetheless, human annotation is tedious, expensive and time-consuming. We cannot afford to have human annotators to label a large number of segments. + +We introduce an approximation method instead. First, we greedily select a set of summary sentences from a document set that achieve the highest R-2 F-score with human reference summaries. Secondly, for every summary sentence, we identify a single segment from a collection of over-generated and self-contained segments (§3.1), such that the selected attains the highest R-2 F-score with human summaries. Such segments are labelled as positive. This two-step process allows for easy generation of ground-truth summary segments. + +# 4.4 Summarization Results + +We compare our method with strong extractive and abstractive summarization systems for multi-document summarization, results are shown in Tables 3 and 5. DPP (Kulesza and Taskar, 2012) and variant DPP-BERT (Cho et al., 2019b) use determinantal point processes to extract whole sentences from a set of documents. SumBasic (Vanderwende et al., 2007) is an extractive approach leveraging the + +![](images/16d5eb87bcca7b0e5d8201e2ada28918b16229441735431d82fb5bf0d529e06f.jpg) +Figure 3: Example of a constituent parse tree, from which tree segments are extracted. + +
Segments and Scores of Self-Containedness
1.0.646 winter storms hit during one of the year's busiest travel weeks
2.0.644 storms hit during one of the year's busiest travel weeks
3.0.584 of the year's busiest travel weeks
4.0.525 one of the year's busiest travel weeks
······
10.0.132 and hundreds of flights have been canceled as winter storms hit during one of the year's busiest travel weeks
11.0.122 and hundreds of flights have been canceled as winter storms hit
······
150.0.0019 of flights have been canceled as winter
151.0.0014 Some interstates are closed and hundreds of flights have been canceled as winter
152.0.0013 hundreds of flights have been canceled as winter
153.0.0008 are closed and hundreds of flights have been canceled as winter
+ +fact that frequently occurring words are more likely to be included in the summary. KL-Sum (Haghighi and Vanderwende, 2009) is a greedy approach that iteratively adds sentences to the summary to minimize KL divergence. LexRank (Erkan and Radev, 2004) is a graph-based approach estimating sentence importance based on eigenvector centrality. All of these methods extract whole sentences rather than segments from a set of documents. + +We further consider abstractive summarization methods. Opinosis (Ganesan et al., 2010) creates a word co-occurrence graph and searches for a graph path to generate an abstract. PointerGen (See et al., 2017) learns to reuse source words or predict new words. The documents are concatenated to serve as input. CopyTrans (Gehrmann et al., 2018) uses a 4-layer Transformer for the encoder and decoder. HiMAP (Fabbri et al., 2019) introduces an end-to-end hierarchical attention model to generate abstracts from multi-document inputs. + +We explore two variants of our proposed method, called HL-XLNetSegs and HL-TreeSegs, focusing on highlighting summary segments. The former utilizes XLNet to extract a set of partially-overlapping segments from a sentence; the latter decomposes a sentence constituent parse tree into subtrees and + +Table 6: Examples of segments generated by XLNet and their scores of self-containedness. + +
DUCTAC
# Words per XLNet segment9.558.05
# XLNet segments per sentence2.482.49
# Total segments per document set398352
# Summary segments per document set9.629.09
# Words per tree segment12.8913.94
# Tree segments per sentence3.313.33
# Total segments per document set549478
# Summary segments per document set13.6816.56
+ +Table 7: Statistics of text segments generated by XLNet and the constituent parse tree method on DUC/TAC datasets. + +collect text segments governed by the subtrees. An illustration is shown in Figure 3. Constituent parse trees are obtained using the Stanford parser (Manning et al., 2014). In both cases, the segments are passed to DPP, which identifies a set of important and non-redundant segments as highlights. + +As shown in Tables 3 and 5, we find both methods to perform competitively with state-of-the-art extractive and abstractive systems, while producing summary segments with simpler structure. Our $HL$ -XLNetSegs method achieves the highest scores on DUC-04 and it performs comparable to other systems on TAC-11. It is important to note that breaking a sentence into smaller segments dramatically increases the search space, making it a challenging task to accurately identify summary segments, yet extracting segments remains necessary as whole sentences may contain excessive and unwanted details. The degree of difficulty involved in generating sub-sentence highlights is thus beyond that of sentence selection. A similar finding is reported by (Cheng and Lapata, 2016). + +Table 7 presents a direct comparison of XLNet and tree segments on DUC and TAC datasets. We find that XLNet segments are more concise than + +![](images/80004831f3f90cdb17a829a68f4521e0618826261584b41ac70f0072b2234c1f.jpg) +Figure 4: Absolute position of the whole sentence among all segments sorted by XLNet scores of self-containedness. + +tree segments. A tree segment contains 13 tokens on average, while an XLNet segment contains 9.6 tokens on DUC-04. Both methods produce a large number of candidate segments, ranging from 350 to 550 segments per document set, with only 9 to 17 ground-truth summary segments per document set. The small ratio poses a substantial challenge for DPP. Not only must it identify salient content but it has to accurately identify the segments worthy of being included in the summary. In Table 4, we show example highlights produced by both methods; more examples are in supplementary. + +Segments generated by XLNet are sorted according to their scores of self-containedness, $p(z|\mathbf{x}_{i:j})$ . In Table 6, we provide examples of segments and their scores. The higher the score, the more likely the segment resembles a "miniature sentence." We are particularly interested in understanding where the original sentence is placed according to XLNet scores; results are shown in Figure 4. We observe that in $60\%$ of the cases, the original sentence is placed among the top-10 candidates, suggesting the effectiveness of the XLNet model. As segments are shorter and occur more often in natural language texts, it is possible that they are considered more self-contained than the original sentence. + +Segments extracted from subtrees are sorted by the depth of tree nodes. The higher nodes are informative constituents denoting complex noun phrases and sentential clauses (Hwa, 1999). An important caveat of the tree segments is their lack of coverage. E.g., "4,645 people died" is a valid self-contained segment, but it does not belong to a tree constituent, as seen in Figure 3. Given that drawback, we focus on segments created by XLNet in our experiments.[6] + +
XLNetSelf-Containedness Score
≥3(%)≥4(%)=5(%)Average
All Segments54.8630.0010.682.80
Top-5 Segments55.2530.2410.782.81
Top-3 Segments61.0434.0412.422.95
+ +Table 8: Human evaluation of the self-containedness of text segments. The top-3 segments of XLNet exhibit a high degree of self-containedness: $61\%$ of them have an average score of 3 or above, $34\%$ have $\geq 4$ score, and $12\%$ receive the full score. + +[Original Sentence] District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. + +- District Attorney David Roger agreed to drop charges including kid-napping, armed robbery, assault with a deadly weapon and conspiracy against both men. (4.0) +- District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. (3.8) +- District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. (3.6) + +Table 9: Example text segments produced by the XLNet algorithm. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. Human evaluation suggests that text segments generated by our model demonstrate a high degree of self-containedness. + +# 4.5 Self-Containedness + +We perform further analysis to investigate the effectiveness of our method on generating self-contained segments (§3.1). It is impractical to create a gold-standard by asking human annotators to judge all available sentence segments, as the number of segments is polynomial in sentence length. Instead, we perform post-hoc evaluation on segments generated by our XLNet algorithm, which are used as input to DPP. We sample 20 topics from TAC-11, extract 3 sentences from each document for a total of 585 sentences and 1,792 system-generated segments. A human annotator is given the original sentence and its segments and asked to score each segment on a Likert scale of 1 (worst) to 5 (best) for self-containedness. A Likert scale is necessary to accommodate potentially ambiguous cases. We employ 5 human annotators to judge each segment, their average scores are reported in Table 8. + +We observe that $61\%$ of top-3 segments have an average score of $\geq 3$ ; $34\%$ have a score $\geq 4$ ; and $12\%$ receive the full score. The human annotators are able to achieve a moderate level of agreement. The standard deviation of their scores is $0.95$ ; $44\%$ of the segments have their majority score agreed by three or more annotators. Table 9 presents example segments and their human assessment scores (more in supplementary). While our summary highlights + +have been evaluated using both standard automatic metrics for assessing the informativeness of the summary and human assessment for judging the well-formedness of individual segments, we hope to explore other methods in future work, including human evaluation of highlights for the entire document set. The task is nontrivial. It requires a well-designed, intuitive graphical user interface for evaluators to read through all source documents and their accompanying summaries/highlights (El-hadad, 2006). Our method constitutes the preliminary step of generating summary highlights. This form of summarization allows readers to grasp the main points while remaining succinct and accessible, offering a promising avenue of research. + +# 5 Conclusion + +We make a first attempt to create sub-sentence summary highlights that are understandable and require minimum information from the surrounding context. Highlighting is important to help readers sift through a large amount of texts and quickly grasp the main points. We describe a novel methodology to generate a rich set of self-contained segments from the documents, then use determinantal point processes to identify summary highlights. The method can be extended to other text genres such as public policies to aid reader comprehension, which will be our future work to explore. + +# Acknowledgments + +We are grateful to the anonymous reviewers for their insightful feedback. We thank Chris Wiggins for discussion on the inverted pyramid principle. This research was supported in part by the National Science Foundation grant IIS-1909603. + +# References + +Reinald Kim Amplayo and Mirella Lapata. 2020. Unsupervised opinion summarization with noising and denoising. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1934-1945, Online. Association for Computational Linguistics. +Kristjan Arumae, Parminder Bhatia, and Fei Liu. 2019. Towards annotating and creating summary highlights at sub-sentence level. In Proceedings of the 2nd Workshop on New Frontiers in Summarization, pages 64-69, Hong Kong, China. Association for Computational Linguistics. +Michele Banko, Michael J. Cafarella, Stephen Soderland, Matt Broadhead, and Oren Etzioni. 2007. + +Open information extraction from the web. In Proceedings of the 20th International Joint Conference on Artificial Intelligence, IJCAI'07, page 2670-2676, San Francisco, CA, USA. +Ziqiang Cao, Furu Wei, Wenjie Li, and Sujian Li. 2018. Faithful to the original: Fact aware neural abstractive summarization. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI). +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. +Jianpeng Cheng and Mirella Lapata. 2016. Neural summarization by extracting sentences and words. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 484-494, Berlin, Germany. Association for Computational Linguistics. +Sangwoo Cho, Logan Lebanoff, Hassan Foroosh, and Fei Liu. 2019a. Improving the similarity measure of determinantal point processes for extractive multi-document summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1027-1038, Florence, Italy. Association for Computational Linguistics. +Sangwoo Cho, Chen Li, Dong Yu, Hassan Foroosh, and Fei Liu. 2019b. Multi-document summarization with determinantal point processes and contextualized representations. In Proceedings of the 2nd Workshop on New Frontiers in Summarization, pages 98-103, Hong Kong, China. 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. +Hoa Trang Dang and Karolina Owczarzak. 2008. Overview of the TAC 2008 update summarization task. In Proceedings of Text Analysis Conference. +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. +Timothy Dozat and Christopher D. Manning. 2018. Simpler but more accurate semantic dependency + +Parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 484-490, Melbourne, Australia. Association for Computational Linguistics. +Noemie Elhadad. 2006. User-Sensitive Text Summarization: Application to the Medical Domain. Ph.D. thesis, USA. +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. +Tobias Falke, Leonardo F. R. Ribeiro, Prasetya Ajie Utama, Ido Dagan, and Iryna Gurevych. 2019. Ranking generated summaries by correctness: An interesting but challenging application for natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2214-2220, Florence, Italy. Association for Computational Linguistics. +Kavita Ganesan, ChengXiang Zhai, and Jiawei Han. 2010. Opinosis: A graph-based approach to abstractive summarization of highly redundant opinions. In Proceedings of the International Conference on Computational Linguistics (COLING). +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. +Dan Gillick and Benoit Favre. 2009. A scalable global model for summarization. In Proceedings of the NAACL Workshop on Integer Linear Programming for Natural Language Processing. +Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. 2014. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition, CVPR '14, pages 580-587, Washington, DC, USA. IEEE Computer Society. +Boqing Gong, Wei-Lun Chao, Kristen Grauman, and Fei Sha. 2014. Diverse sequential subset selection for supervised video summarization. In Proceedings of Neural Information Processing Systems (NIPS). + +Aria Haghighi and Lucy Vanderwende. 2009. Exploring content models for multi-document summarization. In Proceedings of the North American Chapter of the Association for Computational Linguistics (NAACL). +Kazi Saidul Hasan and Vincent Ng. 2014. Automatic keyphrase extraction: A survey of the state of the art. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1262-1273, Baltimore, Maryland. Association for Computational Linguistics. +John Hewitt and Christopher D. Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138, Minneapolis, Minnesota. Association for Computational Linguistics. +Kai Hong, John M Conroy, Benoit Favre, Alex Kulesza, Hui Lin, and Ani Nenkova. 2014. A repository of state of the art and competitive baseline summaries for generic news summarization. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC). +Rebecca Hwa. 1999. Supervised grammar induction using training data with limited constituent information. In Proceedings of the 37th Annual Meeting of the Association for Computational Linguistics, pages 73-79, College Park, Maryland, USA. Association for Computational Linguistics. +Michael Kaisser, Marti A. Hearst, and John B. Lowe. 2008. Improving search results quality by customizing summary lengths. In Proceedings of ACL-08: HLT, pages 701-709, Columbus, Ohio. Association for Computational Linguistics. +Hidetaka Kamigaito, Katsuhiko Hayashi, Tsutomu Hirao, and Masaaki Nagata. 2018. Higher-order syntactic attention network for longer sentence compression. 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 1716-1726, New Orleans, Louisiana. Association for Computational Linguistics. +Anastassia Kornilova and Vladimir Eidelman. 2019. *BillSum: A corpus for automatic summarization of US legislation*. In *Proceedings of the 2nd Workshop on New Frontiers in Summarization*, pages 48-56, Hong Kong, China. Association for Computational Linguistics. +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. +Alex Kulesza and Ben Taskar. 2011. Learning determinantal point processes. In Proceedings of the Conference on Uncertainty in Artificial Intelligence (UAI). +Alex Kulesza and Ben Taskar. 2012. Determinantal Point Processes for Machine Learning. Now Publishers Inc. +Philippe Laban, Andrew Hsi, John Canny, and Marti A. Hearst. 2020. The summary loop: Learning to write abstractive summaries without examples. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5135-5150, 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. +Junyi Jessy Li, Kapil Thadani, and Amanda Stent. 2016. The role of discourse units in near-extractive summarization. In Proceedings of the 17th Annual Meeting of the Special Interest Group on Discourse and Dialogue, pages 137-147, Los Angeles. Association for Computational Linguistics. +Chin-Yew Lin. 2004. ROUGE: a package for automatic evaluation of summaries. In Proceedings of ACL Workshop on Text Summarization Branches Out. +Yang Liu and Mirella Lapata. 2019. Hierarchical transformers for multi-document summarization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5070-5081, Florence, Italy. Association for Computational Linguistics. +Christopher D Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J Bethard, and David McClosky. 2014. The stanford CoreNLP natural language processing toolkit. In Proceedings of the Association for Computational Linguistics (ACL) System Demonstrations. +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. +Ani Nenkova and Kathleen McKeown. 2011. Automatic summarization. Foundations and Trends in Information Retrieval. + +Paul Over and James Yen. 2004. An introduction to DUC-2004. National Institute of Standards and Technology. +Michael Paul, ChengXiang Zhai, and Roxana Girju. 2010. Summarizing contrastive viewpoints in opinionated text. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 66-76, Cambridge, MA. Association for Computational Linguistics. +Luz Rello, Horacio Saggion, and Ricardo Baeza-Yates. 2014. Keyword highlighting improves comprehension for people with dyslexia. In Proceedings of the 3rd Workshop on Predicting and Improving Text Readability for Target Reader Populations (PITR), pages 30-37, Gothenburg, Sweden. Association for Computational Linguistics. +Norman Sadeh, Alessandro Acquisti, Travis D. Breaux, Lorrie Faith Cranor, Aleecia M. McDonald, Joel R. Reidenberg, Noah A. Smith, Fei Liu, N. Cameron Russell, Florian Schaub, and Shomir Wilson. 2013. The usable privacy policy project. Technical Report, CMU-ISR-13-119, Carnegie Mellon University. +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. +Aidean Sharghi, Ali Borji, Chengtao Li, Tianbao Yang, and Boqing Gong. 2018. Improving sequential determinantal point processes for supervised video summarization. In Proceedings of the European Conference on Computer Vision (ECCV). +Sasha Spala, Franck Dernoncourt, Walter Chang, and Carl Dockhorn. 2018. A web-based framework for collecting and assessing highlighted sentences in a document. In Proceedings of the 27th International Conference on Computational Linguistics: System Demonstrations, pages 78-81, Santa Fe, New Mexico. Association for Computational Linguistics. +Gabriel Stanovsky, Jessica Ficler, Ido Dagan, and Yoav Goldberg. 2016. Getting more out of syntax with props. +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. +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. + +G. Vladutz. 1983. Natural language text segmentation techniques applied to the automatic compilation of printed subject indexes and for online database access. In First Conference on Applied Natural Language Processing, pages 136-142, Santa Monica, California, USA. Association for Computational Linguistics. +Kristian Woodsend and Mirella Lapata. 2010. Automatic generation of story highlights. In Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics, pages 565-574, Uppsala, Sweden. Association for Computational Linguistics. +Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. 2019. Xlnet: Generalized autoregressive pretraining for language understanding. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 5753-5763. Curran Associates, Inc. + +# A Example System Outputs + +We present example system outputs contrasting our highlighting method with traditional sentence extraction and human abstraction. Highlighting helps readers quickly skim through a large amount of text to grasp the main points. We observe that the XLNet segments are better than those obtained using the subtree method—not only can they aid reader comprehension but they are also self-contained and more concise. Further, we show example text segments produced by our XLNet algorithm, accompanied by their scores of self-containedness judged by five human evaluators, whose average scores are reported. Results of human evaluation suggest that text segments produced by our model demonstrate a high degree of self-containedness. + +# Human Abstract + +- Exxon and Mobil discuss combining business operations. +- A possible Exxon-Mobil merger would reunite 2 parts of Standard Oil broken up by the Supreme Court in 1911. +- Low crude oil prices and the high cost of exploration are motives for a merger that would create the world's largest oil company. +- As Exxon-Mobil merger talks continue, stocks of both companies surge. +- The merger talks show that corporate mergers are back in vogue. +- Antitrust lawyers, industry analysts, and government officials say a merger would require divestitures. +- A Mobil employee worries that a merger would put thousands out of work, but notes that his company's stock would go up. + +# Extractive Summary + +The boards of Exxon Corp. and Mobil Corp. are expected to meet Tuesday to consider a possible merger agreement that would form the world's largest oil company, a source close to the negotiations said Friday. +Exxon and Mobil, the nation's two largest oil companies, confirmed Friday that they were discussing a possible merger, and antitrust lawyers, industry analysts and government officials predicted that any deal would require the sale of important large pieces of such a new corporate behemoth. +- The reported talks between Exxon, whose annual revenue exceeds that of General Electric Co., and Mobil, the No. 2 U.S. oil company, came as oil prices sank to their lowest in almost 12 years. + +# Highlighting (Tree Segments) + +- Whether or not the talks between Exxon and Mobil lead to a merger or some other business combination, America's economic history is already being rewritten. +The boards of Exxon Corp. and Mobil Corp. are expected to meet Tuesday to consider a possible merger agreement that would form the world's largest oil company, a source close to the negotiations said Friday. +- Exxon Corp. and Mobil Corp. have held discussions about combining their business operations, a person involved in the talks said Wednesday. +- News that Exxon and Mobil, two giants in the energy patch, were in merger talks last week is the biggest sign yet that corporate marriages are back in vogue. +- Shares of Exxon, the biggest U.S. oil company, rose $1.6875, or 2.3 percent, to $74.375. +Some analysts said that if the two giants reached an agreement, it was likely to be in the form of a takeover by Exxon of Mobil. +- Exxon was then known as Standard Oil of New Jersey, and Mobil consisted of two companies: Standard Oil of New York and Vacuum Oil. +- Which is why Mobil and Exxon are considering combining into the world's largest oil company. + +# Highlighting (XLNet Segments) + +- Whether or not the talks between Exxon and Mobil lead to a merger or some other business combination, America's economic history is already being rewritten. +- Still, it boggles the mind to accept the notion that hardship is driving profitable Big Oil to either merge, as British Petroleum and Amoco have already agreed to do, or at least to consider the prospect, as Exxon and Mobil are doing. +- Oil stocks led the way as investors soaked up the news of continuing talks between Exxon and Mobil on a merger that would create the world's largest oil company. +- Although the companies only confirmed that they were discussing the possibility of a merger, a person close to the discussions said the boards of both Exxon and Mobil were expected to meet Tuesday to consider an agreement. +- Analysts predicted that there would be huge cuts in duplicate staff from both companies, which employ 122,700 people. +- They said the transaction would probably be an exchange of Mobil shares for Exxon shares. +- But this has been a particularly unsettling year for the oil industry, and there is little prospect that crude oil prices will recover soon. +- The merger discussions come against a backdrop of particularly severe pressure on Lucio Noto, the chairman, president and chief executive of Mobil, to find new reserves of oil and natural gas and to keep big projects profitable at a time of a deep decline in crude oil prices. +- If there is a reason this merger might get extra attention, it will be because Exxon and Mobil have not been terribly friendly toward either the Clinton administration's or the European Union's positions on global warming. + +Table 10: Example system outputs for a topic in DUC-04. Highlighting allows readers to quickly sift through a large amount of text to grasp the main points. XLNet segments perform better than tree segments. Not only can they aid reader comprehension but they are also self-contained and more concise. + +# Human Abstract + +- After years of civil war, Congo in October 1998 was again in turmoil as rebel forces fought to overthrow the government of President Kabila. +- The rebels, ethnic Tutsis, disenchanted members of Kabila's army and his political opponents, were said to be supported by Rwandan and Ugandan forces while Kabila was backed by Angola, Zimbabwe, Namibia, Sudan and Ugandan rebels. +- Ugandan forces while Kabila was backed by Angola, Zimbabwe, Namibia, Sudan and Ugandan rebels. +- At first the rebels advanced to the outskirts of the capital, Kinshasa, but foreign troops pushed them back to the extreme eastern part of the country. +- The rebels then launched a counter offensive but by mid-October it was not clear who would prevail. + +# Extractive Summary + +- After a day of fighting, Congolese rebels said Sunday they had entered Kindu, the strategic town and airbase in eastern Congo used by the government to halt their advances. +- rebels in eastern Congo on Saturday said they shot down a passenger jet ferrying 40 government soldiers into a strategic airport facing a rebel assault. +- A rebel defeat, on the other hand, would put the coalition of ethnic Tutsis, disenchanted members of the Congolese army and opposition politicians on the defensive and give a boost to Kabila's efforts to fend off the rebellion launched Aug. 2. Rebel commander Richard Mondo said troops had fired artillery rounds into Kindu Monday and early Tuesday, sending the population fleeing out of town. +- On Saturday, the rebels said they shot down a Congolese Boeing 727 which was attempting to land at Kindu air base with 40 troops and ammunition. + +# Highlighting (Tree Segments) + +- Rebels attacked a village in western Uganda and killed six civilians before soldiers drove them off, a military spokesman said Thursday. +- Congolese rebels have taken their two-month campaign to oust President Laurent Kabila to the Internet. +- A day after shooting down a jetliner, Congolese rebels and their Rwandan allies pushed Sunday through government defense lines, showing the confidence of a victor in a week-old battle for a strategic air base. +- After a day of fighting, Congolese rebels said Sunday they had entered Kindu, the strategic town and airbase in eastern Congo used by the government to halt their advances. +- Rebels in eastern Congo on Saturday said they shot down a passenger jet ferrying 40 government soldiers into a strategic airport facing a rebel assault. +- A day after shooting down a jetliner carrying 40 people, rebels clashed with government troops near a strategic airstrip in eastern Congo on Sunday. +- Kabila has turned Kindu into a launching pad for a counteroffensive against rebel positions in eastern Congo. + +# Highlighting (XLNet Segments) + +- Congolese rebels have taken their two-month campaign to oust President Laurent Kabila to the Internet. +- The bloody bandages of injured rebels trucked back to this rear base Wednesday offered evidence that the three-day battle for the strategic air base at Kindu was not going well for those fighting to oust Congolese President Laurent Kabila. +- rebels in eastern Congo on Saturday said they shot down a passenger jet ferrying 40 government soldiers into a strategic airport facing a rebel assault. +- After trekking several hundred kilometers through dense tropical forest, thousands of rebel fighters have gathered 19 kilometers outside Kindu, where troops loyal to President Laurent Kabila have used an air base as a launching pad for offensives. +- On Saturday, the rebels said they shot down a Congolese Boeing 727 which was attempting to land at Kindu air base with 40 troops and ammunition. +- President Yoweri Museveni insists they will remain there until Ugandan security is guaranteed, despite Congolese President Laurent Kabila's protests that Uganda is backing Congolese rebels attempting to topple him. +- The rebels see Kindu as a major prize in their two-month revolt against President Laurent Kabila, whom they accuse of mismanagement, corruption and wormongering among Congo's 400 tribes. +- Both countries say they have legitimate security interests in eastern Congo and accuse Kabila of failing to rid the common border area of Rwandan and Ugandan rebels. +- The rebels say they now control one-third of Kindu and are poised to overrun the rest of the town. + +Table 11: Example system outputs for a topic in DUC-04. Highlighting allows readers to quickly sift through a large amount of text to grasp the main points. XLNet segments perform better than tree segments. Not only can they aid reader comprehension but they are also self-contained and more concise. Our method further allows multiple segments, denoted by $\square$ and $\square$ , to be selected from the same sentence. + +# Human Abstract + +- Eleven countries were to adopt a common European currency, the euro, on Dec. 31, 1998. +- In November and December there were various reactions. +- France made moves toward a pan-European equity market. +- Ten of the countries quickly cut interest rates causing fear of overheating in some economies. +- In Denmark, which had earlier rejected the euro, a majority was now in favor. +- And in faraway China, the euro was permitted in financial exchanges. +- Whatever the outcome, the euro's birthday, Dec. 31, 1998, would be an historical date. +- Some saw it as a step towards political union while others already considered themselves as citizens of Europe. + +# Extractive Summary + +- In a surprise move, nations adopting the new European currency, the euro, dropped key interest rates Thursday, effectively setting the rate that will be adopted throughout the euro zone on Jan. 1. +- The annual inflation rate in the 11 nations that adopt the euro as their shared currency on Jan. 1 fell to 0.9 percent in November, the European Union's statistics agency reported Wednesday. +- Wim Duisenberg, the head of the new European Central Bank, said in an interview published Wednesday that he won't step down after completing half his term as earlier agreed. +- Ten of the 11 countries adopting the euro dropped their interest rate to 3 percent. +- Duisenberg was named this spring as head of the new European Central Bank, which will govern the policies of the euro, the new single currency which goes into effect Jan. 1. + +# Highlighting (Tree Segments) + +- Two days before the new euro currency goes into effect for 11 European Union members, a growing number of Danes believe their country should take part, according to a poll published Tuesday. +- Wim Duisenberg, the head of the new European Central Bank, said in an interview published Wednesday that he won't step down after completing half his term as earlier agreed. +- In a surprise move, nations adopting the new European currency, the euro, dropped key interest rates Thursday, effectively setting the rate that will be adopted throughout the euro zone on Jan. 1. +- Making their first collective decision about monetary policy, the 11 European nations launching a common currency on Jan. 1 cut interest rates Thursday in a surprise move that won market confidence. +- In a surprise move, nations adopting the new European currency, the euro, dropped key interest rates Thursday, effectively setting the rate that will be adopted throughout the euro zone on Jan. 1. +- China made trading in the euro official Monday, announcing authorization for the European common currency's use in trade and financial dealings starting Jan. 1. +- The annual inflation rate in the 11 nations that adopt the euro as their shared currency on Jan. 1 fell to 0.9 percent in November, the European Union's statistics agency reported Wednesday. +The year 1999 is the official start-up date of the euro, the common European currency that will unite 11 countries monetarily. + +# Highlighting (XLNet Segments) + +- Two days before the new euro currency goes into effect for 11 European Union members, a growing number of Danes believe their country should take part, according to a poll published Tuesday. +- Making their first collective decision about monetary policy, the 11 European nations launching a common currency on Jan. 1 cut interest rates Thursday in a surprise move that won market confidence. +- The annual inflation rate in the 11 nations that adopt the euro as their shared currency on Jan. 1 fell to 0.9 percent in November, the European Union's statistics agency reported Wednesday. +- French authorities said Thursday that the Paris stock exchange would join an alliance between London and Frankfurt that is seen as the precursor of a pan-European market. +- Ten of the 11 countries joining European economic union dropped their key interest rate to 3 percent, with Portugal making the most significant plunge, from 3.75 percent. +- Not only that, the notion of a Europe-wide exchange raises technical questions about the compatibility not just of trading systems but also of the regulations governing stock market operations in the countries that will use the euro beginning in January. + +Table 12: Example system outputs for a topic in DUC-04. Highlighting allows readers to quickly sift through a large amount of text to grasp the main points. XLNet segments perform better than tree segments. Not only can they aid reader comprehension but they are also self-contained and more concise. + +# Human Abstract + +- Boeing 737-400 plane with 102 people on board crashed into a mountain in the West Sulawesi province of Indonesia, on Monday, January 01, 2007, killing at least 90 passengers, with 12 possible survivors. +The plane was Adam Air flight KI-574, departing at 12:59 pm from Surabaya on Java bound for Manado in northeast Sulawesi. +- There were three Americans on board, it is not known if they survived. +- The cause of the crash is not known at this time but it is possible bad weather was a factor. + +# Extractive Summary + +- Three Americans were among the 102 passengers and crew on board an Adam Air plane which crashed into a remote mountainous region of Indonesia, an airline official said Tuesday. +- Rescue teams Tuesday found the smoldering wreckage of an Indonesian jetliner that went missing over Indonesia's Sulawesi island during a storm. +- The Indonesian rescue team Tuesday arrived at the mountainous area in West Sulawesi province where a passenger plane with 102 people onboard crashed Monday, finding at least 90 bodies at the scene. +- The Indonesian Navy (TNI AL) has sent two Cassa planes to carry the bodies of five of its members who were killed in a plane crash in the Indonesian island of Sulawesi late Monday. + +# Highlighting (Tree Segments) + +- An Indonesian passenger plane carrying 102 people disappeared in stormy weather on Monday, and rescue teams were sent to search an area where military aviation officials feared the Boeing 737-400 aircraft may have crashed. +- Indonesian Transportation Ministry's air transportation director general M. Ichsan Tatang said the weather in Polewali of Sulawesi province was bad when the plane took off from Surabaya. +- Three Americans were among the 102 passengers and crew on board an Adam Air plane which crashed into a remote mountainous region of Indonesia, an airline official said Tuesday. +- An Indonesian passenger plane carrying 102 people disappeared in stormy weather on Monday, and rescue teams were sent to search an area where military aviation officials feared the Boeing 737-400 aircraft may have crashed. +- Rescue teams Tuesday found the smoldering wreckage of an Indonesian jetliner that went missing over Indonesia's Sulawesi island during a storm, officials said. +- Chinese Foreign Minister Li Zhaoxing on Tuesday sent a message of condolences to his Indonesian counterpart Hassan Wirayuda over Monday's plane crash. + +# Highlighting (XLNet Segments) + +- An Indonesian passenger plane carrying 102 people disappeared in stormy weather on Monday, and rescue teams were sent to search an area where military aviation officials feared the Boeing 737-400 aircraft may have crashed. +- Three Americans were among the 102 passengers and crew on board an Adam Air plane which crashed into a remote mountainous region of Indonesia, an airline official said Tuesday. +- Indonesian President Susilo Bambang Yudhoyono said Tuesday he was deeply concerned with the crash of a passenger plane and the sinking of a ferry in the last few days that might have killed hundreds of people. +- Chinese Foreign Minister Li Zhaoxing on Tuesday sent a message of condolences to his Indonesian counterpart Hassan Wirayuda over Monday's plane crash. +- The Indonesian Navy (TNI AL) has sent two Cassa planes to carry the bodies of five of its members who were killed in a plane crash in the Indonesian island of Sulawesi late Monday. +- An Indonesian passenger plane carrying 102 people disappeared in stormy weather on Monday, and rescue teams were sent to search an area where military aviation officials feared the Boeing 737-400 aircraft may have crashed. +- In the message, Li said he was "shocked" to learn of the tragedy and expressed deep condolences to the victims of the accident. +- In 1960s, some planes and helicopters crashed on Masalombo area after they were absorbed by air pockets. Martono likened Masalombo area to Bermuda Triangle where many ships and airplanes went missing. +- Latest reports said at least 12 passengers including five children survived the accident but they were in critical condition and sent to a nearby hospital in Polewali. + +Table 13: Example system outputs for a topic in TAC-11. Highlighting allows readers to quickly sift through a large amount of text to grasp the main points. XLNet segments perform better than tree segments. Not only can they aid reader comprehension but they are also self-contained and more concise. + +# Human Abstract + +- Internet security needs a global approach because it is a global problem. +- Pakistan tried to block a riot-sparking video and accidentally blocked world YouTube access. +- Internet sabotage shut down digital infrastructure in Estonia and Bangladesh. +Overseas hackers accessed confidential information from South Korea. +- China and Taiwan are both accused of Internet attacks to steal secret data. +- The U.S. considered including cyberspace regulation in rules of international warfare. +- South Korea's real-name system authenticates identity information on applications for online accounts. +- The UAE is establishing a computer emergency response team. +- Computer whizzes sell security vulnerability information to both software vendors and criminals. + +# Extractive Summary + +- Telecoms and computer executives, legal officials and UN agencies on Friday warned that the world needs to take a global approach to tackling cybercrime and security issues on the Internet. +- Taiwan's Internet market has matured over the past 10 years, but the ratio of Internet users worried about Internet security has risen significantly, according the results of a telephone survey released Sunday by the Ministry of Transportation and Communications (MOTC). +- The National Security Bureau (NSB) has never permitted hacking activities nor any other attack on computer and Internet systems at home or abroad, the NSB said in a news release issued Thursday. +- Since the adoption by the South Korean government in 2005 of the Internet real-name system, people's privacy, reputation and economic rights are better protected, according to the Ministry of Information and Telecommunication. + +# Highlighting (Tree Segments) + +- South Korea's presidential mansion, the Blue House, has come under cyber-attack from overseas hackers who accessed some confidential information, officials said Tuesday. +The National Security Bureau (NSB) has never permitted hacking activities nor any other attack on computer and Internet systems at home or abroad, the NSB said in a news release issued Thursday. +- Since the adoption by the South Korean government in 2005 of the Internet real-name system, people's privacy, reputation and economic rights are better protected, according to the Ministry of Information and Telecommunication. +- Telecoms and computer executives, legal officials and UN agencies on Friday warned that the world needs to take a global approach to tackling cybercrime and security issues on the Internet. +- Bangladesh on Tuesday launched an investigation after the country's Internet link was sabotaged, disrupting communications nationwide for most of the day. +- Since the adoption by the South Korean government in 2005 of the Internet real- name system, people's privacy, reputation and economic rights are better protected, according to the Ministry of Information and Telecommunication. + +# Highlighting (XLNet Segments) + +- Taiwan's Internet market has matured over the past 10 years, but the ratio of Internet users worried about Internet security has risen significantly, according the results of a telephone survey released Sunday by the Ministry of Transportation and Communications (MOTC). +- Since the adoption by the South Korean government in 2005 of the Internet real- name system, people's privacy, reputation and economic rights are better protected, according to the Ministry of Information and Telecommunication. +- Telecoms and computer executives, legal officials and UN agencies on Friday warned that the world needs to take a global approach to tackling cybercrime and security issues on the Internet. +- The attacks were discovered about two weeks after they happened when the entire computer network underwent a security check in early March, the Blue House said in a statement. +The National Security Bureau (NSB) has never permitted hacking activities nor any other attack on computer and Internet systems at home or abroad, the NSB said in a news release issued Thursday. +- When Estonian authorities began removing a bronze statue of a World War II-era Soviet soldier from a park in this bustling Baltic seaport last month, they expected violent street protests by Estonians of Russian descent. +- Cox News Service WASHINGTON - The United States must protect its interests in cyberspace and outer space against threats from China and other nations, Sen. Bill Nelson said at a hearing Wednesday. +- Taiwan's Internet market has matured over the past 10 years, but the ratio of Internet users worried about Internet security has risen significantly, according the results of a telephone survey released Sunday by the Ministry of Transportation and Communications (MOTC). +- What followed was what some here describe as the first war in cyberspace, a monthlong campaign that has forced Estonian authorities to defend their pint-size Baltic nation from a data flood that they say was set off by orders from Russia or ethnic Russian sources in retaliation for the removal of the statue. + +Table 14: Example system outputs for a topic in TAC-11. Highlighting allows readers to quickly sift through a large amount of text to grasp the main points. XLNet segments perform better than tree segments. Not only can they aid reader comprehension but they are also self-contained and more concise. + +[Original Sentence] District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. + +- District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. (4.0) +- District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. (3.8) +- District Attorney David Roger agreed to drop charges including kidnapping, armed robbery, assault with a deadly weapon and conspiracy against both men. (3.6) + +Table 15: Example text segments produced by the XLNet model. The scores of self-containedness are shown in parentheses. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. Human evaluation suggests that text segments generated by our model demonstrate a high degree of self-containedness. + +[Original Sentence] "I can't imagine anyone saying no," the 21-year-old college student said last week as, teary-eyed, she met 8-month-old Allison Brown, carefully cuddling the wide-eyed baby so as not to bump each other's healing incisions. + +"I can't imagine anyone saying no," the 21-year-old college student said last week as, teary-eyed, she met 8-month-old Allison Brown, carefully cuddling the wide-eyed baby so as not to bump each other's healing incisions. (3.0) +"I can't imagine anyone saying no," the 21-year-old college student said last week as, teary-eyed, she met 8-month-old Allison Brown, carefully cuddling the wide-eyed baby so as not to bump each other's healing incisions. (3.8) +"I can't imagine anyone saying no," the 21-year-old college student said last week as, teary-eyed, she met 8-month-old Allison Brown, carefully cuddling the wide-eyed baby so as not to bump each other's healing incisions. (3.6) +"I can't imagine anyone saying no," the 21-year-old college student said last week as, teary-eyed, she met 8-month-old Allison Brown, carefully cuddling the wide-eyed baby so as not to bump each other's healing incisions. (4.0) + +Table 16: Example text segments produced by the XLNet model. The scores of self-containedness are shown in parentheses. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. Human evaluation suggests that text segments generated by our model demonstrate a high degree of self-containedness. + +[Original Sentence] Madoff is charged with stealing as much as $50 billion, in part to cover a pattern of massive losses, even as he cultivated a reputation as a financial mastermind and prominent philanthropist. + +- Madoff is charged with stealing as much as $50 billion, in part to cover a pattern of massive losses, even as he cultivated a reputation as a financial mastermind and prominent philanthropist. (3.6) +- Madoff is charged with stealing as much as $50 billion, in part to cover a pattern of massive losses, even as he cultivated a reputation as a financial mastermind and prominent philanthropist. (2.0) +- Madoff is charged with stealing as much as $50 billion, in part to cover a pattern of massive losses, even as he cultivated a reputation as a financial mastermind and prominent philanthropist. (3.0) +- Madoff is charged with stealing as much as $50 billion, in part to cover a pattern of massive losses, even as he cultivated a reputation as a financial mastermind and prominent philanthropist. (2.8) + +Table 17: Example text segments produced by the XLNet model. The scores of self-containedness are shown in parentheses. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. Human evaluation suggests that text segments generated by our model demonstrate a high degree of self-containedness. + +[Original Sentence] Almost 1 million people were marooned by floodwater in about 10 districts in northern, northeastern and central parts of the country, as floodwater triggered by incessant monsoon rains have destroyed houses, submerged paddy fields and disrupted road transport in many places. + +- Almost 1 million people were marooned by floodwater in about 10 districts in northern, northeastern and central parts of the country, as floodwater triggered by incessant monsoon rains have destroyed houses, submerged paddy fields and disrupted road transport in many places. (2.8) +- Almost 1 million people were marooned by floodwater in about 10 districts in northern, northeastern and central parts of the country, as floodwater triggered by incessant monsoon rains have destroyed houses, submerged paddy fields and disrupted road transport in many places. (3.2) +- Almost 1 million people were marooned by floodwater in about 10 districts in northern, northeastern and central parts of the country, as floodwater triggered by incessant monsoon rains have destroyed houses, submerged paddy fields and disrupted road transport in many places. (2.8) +- Almost 1 million people were marooned by floodwater in about 10 districts in northern, northeastern and central parts of the country, as floodwater triggered by incessant monsoon rains have destroyed houses, submerged paddy fields and disrupted road transport in many places. (4.4) +- Almost 1 million people were marooned by floodwater in about 10 districts in northern, northeastern and central parts of the country, as floodwater triggered by incessant monsoon rains have destroyed houses, submerged paddy fields and disrupted road transport in many places. (4.0) + +Table 18: Example text segments produced by the XLNet model. The scores of self-containedness are shown in parentheses. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. Human evaluation suggests that text segments generated by our model demonstrate a high degree of self-containedness. + +# [Original Sentence] It said the US States District Court for the Southern District of New York granted the application and appointed Irving H. Picard as trustee for the liquidation of the brokerage firm, while it named the law firm of Baker; Hostetler LLP as counsel to Picard. + +- It said the US States District Court for the Southern District of New York granted the application and appointed Irving H. Picard as trustee for the liquidation of the brokerage firm, while it named the law firm of Baker; Hostetler LLP as counsel to Picard. (3.6) +- It said the US States District Court for the Southern District of New York granted the application and appointed Irving H. Picard as trustee for the liquidation of the brokerage firm, while it named the law firm of Baker; Hostetler LLP as counsel to Picard. (2.4) +- It said the US States District Court for the Southern District of New York granted the application and appointed Irving H. Picard as trustee for the liquidation of the brokerage firm, while it named the law firm of Baker; Hostetler LLP as counsel to Picard. (2.4) +- It said the US States District Court for the Southern District of New York granted the application and appointed Irving H. Picard as trustee for the liquidation of the brokerage firm, while it named the law firm of Baker; Hostetler LLP as counsel to Picard. (2.4) + +Table 19: Example text segments produced by the XLNet model. The scores of self-containedness are shown in parentheses. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. Human evaluation suggests that text segments generated by our model demonstrate a high degree of self-containedness. + +# [Original Sentence] But just in the last month, a so-called Floating Eyeballs toy made in China was recalled after it was found to be filled with kerosene, sets of toy drums and a toy bear were also recalled because of lead paint and an infant wrist rattle was recalled because of a choking hazard. + +- But just in the last month, a so-called Floating Eyeballs toy made in China was recalled after it was found to be filled with kerosene, sets of toy drums and a toy bear were also recalled because of lead paint and an infant wrist rattle was recalled because of a choking hazard. (2.4) +- But just in the last month, a so-called Floating Eyeballs toy made in China was recalled after it was found to be filled with kerosene, sets of toy drums and a toy bear were also recalled because of lead paint and an infant wrist rattle was recalled because of a choking hazard. (1.8) +- But just in the last month, a so-called Floating Eyeballs toy made in China was recalled after it was found to be filled with kerosene, sets of toy drums and a toy bear were also recalled because of lead paint and an infant wrist rattle was recalled because of a choking hazard. (2.6) +- But just in the last month, a so-called Floating Eyeballs toy made in China was recalled after it was found to be filled with kerosene, sets of toy drums and a toy bear were also recalled because of lead paint and an infant wrist rattle was recalled because of a choking hazard. (1.4) +- But just in the last month, a so-called Floating Eyeballs toy made in China was recalled after it was found to be filled with kerosene, sets of toy drums and a toy bear were also recalled because of lead paint and an infant wrist rattle was recalled because of a choking hazard. (2.0) + +Table 20: Example text segments produced by the XLNet model. The scores of self-containedness are shown in parentheses. Each segment is judged by five human evaluators on a scale of 1 (worst) to 5 (best) and we report their average scores. This example is among the worst cases; we use it to illustrate the difficulty of finding self-contained segments in a polynomial space. \ No newline at end of file diff --git a/betterhighlightingcreatingsubsentencesummaryhighlights/images.zip b/betterhighlightingcreatingsubsentencesummaryhighlights/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ed71fc7af220652a2387e78948afc47e10225f07 --- /dev/null +++ b/betterhighlightingcreatingsubsentencesummaryhighlights/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1acbd3f76ce5e1c66afe2a2e2f0ba97d6a3d8bd86f143fcbe31d39825ad14694 +size 403053 diff --git a/betterhighlightingcreatingsubsentencesummaryhighlights/layout.json b/betterhighlightingcreatingsubsentencesummaryhighlights/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..cf140ab044988a3e216d8641ade501849a199da6 --- /dev/null +++ b/betterhighlightingcreatingsubsentencesummaryhighlights/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5edbddd1bd8ed00444a148822ae9a09efeaff3ba92b3ca4246aff52c08b3314 +size 726500 diff --git a/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_content_list.json b/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..9fd1db6e85ec7714f2087823a6ec5bd2a75540e6 --- /dev/null +++ b/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:daef65e1b1fadea313a278b8241311f8c81200749159e9c7a8dbb53e8bc853b5 +size 46092 diff --git a/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_model.json b/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_model.json new file mode 100644 index 0000000000000000000000000000000000000000..c74331966be3f5e6c4ca882b5744f833557caa03 --- /dev/null +++ b/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ccb0e5256ad1cc03e89921404c5cb63f599c15f940833764b9abf654aba2c55 +size 55285 diff --git a/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_origin.pdf b/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0eade014216d59e5e9ef75c27a8f20a5cc96825d --- /dev/null +++ b/beyondclsthroughrankingbygeneration/a0d76c72-109a-4b0f-a5a3-8fd1a5bd3859_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09f6c55fd2e8c11a9c6a844d1a50a577062b5c8be586644a93de8970f9c0efe9 +size 305325 diff --git a/beyondclsthroughrankingbygeneration/full.md b/beyondclsthroughrankingbygeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2e65ebfd79e6f2715d4ff43f7bf08f695f7057f8 --- /dev/null +++ b/beyondclsthroughrankingbygeneration/full.md @@ -0,0 +1,182 @@ +# Beyond [CLS] through Ranking by Generation + +Cicero Nogueira dos Santos, Xiaofei Ma, Ramesh Nallapati, Zhiheng Huang and Bing Xiang + +AWS AI + +New York City, NY + +{cicnog, xiaofeim, rnallapa, zhiheng, bxiang}@amazon.com + +# Abstract + +Generative models for Information Retrieval, where ranking of documents is viewed as the task of generating a query from a document's language model, were very successful in various IR tasks in the past. However, with the advent of modern deep neural networks, attention has shifted to discriminative ranking functions that model the semantic similarity of documents and queries instead. Recently, deep generative models such as GPT2 and BART have been shown to be excellent text generators, but their effectiveness as rankers have not been demonstrated yet. In this work, we revisit the generative framework for information retrieval and show that our generative approaches are as effective as state-of-the-art semantic similarity-based discriminative models for the answer selection task. Additionally, we demonstrate the effectiveness of unlikelihood losses for IR. + +# 1 Introduction + +Most recent approaches for ranking tasks in Information Retrieval (IR) such as passage ranking and retrieval of semantically related questions have focused primarily on discriminative methods using neural networks that learn a similarity function to compare questions and candidate answers (Severyn and Moschitti, 2015; dos Santos et al., 2015; Tan et al., 2016; Tay et al., 2017, 2018). On the other hand, classical literature on probabilistic models for IR showed that language modeling, a type of simple generative model, can be effective for document ranking (Zhai, 2008; Lafferty and Zhai, 2001; Ponte and Croft, 1998). The key idea consists of first training a unique language model $lm_{i}$ for each candidate document $d_{i}$ , then using the likelihood of generating the input query using $lm_{i}$ , denoted by $P(q|lm_{i})$ , as the ranking score for document $d_{i}$ . + +Recent advances in neural language models (NLMs) have led to impressive improvements in + +the quality of automatically generated text (Radford et al., 2019). However, to the best of our knowledge, there is no existing work on exploring the effectiveness of modern generative models such as GPT2, for complex ranking tasks such as answer selection. In this work, we intend to fill this gap by demonstrating that large pretrained generative models can be very effective rankers. Unlike classic LM based approaches for IR that employ separate LMs for each document, our proposed method uses a single global LM that applies to all documents. The global pretrained generator is fine-tuned on the task of query generation conditioned on document content as the context. Additionally, in order to leverage both positive and negative examples, we propose the use of (1) unlikely loss on negative examples and (2) ranking loss on the likelihood of positive and negative examples. At inference time, given an input query, our method scores each candidate document using the likelihood of generating the query given the document, as estimated by our fine-tuned global LM. + +We focus our experiments on the task of answer selection (a.k.a passage ranking). In this task, given an input question and a set of candidate passages, the goal is to rank the candidate passages so that passages containing the correct answer appear at the top of the ranked list. Considerable body of work exists on the use of NNs for this task (Feng et al., 2015; Severyn and Moschitti, 2015; Tan et al., 2016; dos Santos et al., 2016; Rao et al., 2016; Wang et al., 2017), where the most recent ones use BERT-based models that perform discrimination based on the special [CLS] token (Nogueira and Cho, 2019; Li et al., 2019; Xu et al., 2019). A contemporaneous work by Nogueira et al. (2020) also proposes a generative approach for the passage ranking task. However, while their approach decides the relevance of a passage by generating a single keyword (e.g. true or false), our method + +![](images/9be4381367e5219a460f067f27f5a9421c639b474e8c5e73a0ec596d2a7c559b.jpg) +Figure 1: Illustration of the inference step of our ranking by generation approach. Each candidate passage $a_{k}$ is ranked based on the likelihood of generating the question $q$ conditioned on the passage, $p_{\theta}(q|a_k)$ . + +uses the conditional likelihood of generating the question given the passage as a relevance score. + +We perform extensive experiments using GPT2 (Radford et al., 2019) and BART (Lewis et al., 2019), which are Transformer-based LMs (Vaswani et al., 2017) that were pretrained using large volumes of textual data. The LMs are fine-tuned on four different passage ranking datasets separately: WikipassageQA, WikiQA, InsuranceQA_V2, and YahooQA. Our experimental results indicate that our generative approaches are as effective as state-of-the-art discriminative-based approaches for answer selection. + +# 2 Ranking by Generation + +# 2.1 Background + +The goal in language modeling is to learn the probability distribution $p(x)$ over variable-length token sequences $x = (x_{1}, x_{2}, \dots, x_{|x|})$ , where the tokens come from a fixed size vocabulary, $x_{i} \in V$ . When training an LM with causal objective, which consists of predicting the next token by looking at the past only, we can represent this distribution by the conditional probability of the next token given the previous ones (Bengio et al., 2003): + +$$ +p (x) = \prod_ {i = 1} ^ {| x |} p \left(x _ {i} \mid x _ {< i}\right) \tag {1} +$$ + +GPT2 (Radford et al., 2019) is an example of a state-of-the-art neural LM trained with causal objective. The usual approach to train an LM using a neural network with parameters $\theta$ consists on performing maximum likelihood estimation (MLE) by minimizing the negative log-likelihood over a large text corpus $D = \{x^{1}, x^{2}, \dots, x^{|D|}\}$ , where each $x_{k}$ is a document of length $|x_{k}|$ : + +$$ +\mathcal {L} (D) = - \sum_ {k = 1} ^ {| D |} \sum_ {i = 1} ^ {| x ^ {k} |} \log p _ {\theta} \left(x _ {i} ^ {k} \mid x _ {< i} ^ {k}\right) \tag {2} +$$ + +Conditional LMs are a simple extension of regular LMs where the generation is conditioned on some additional context $c$ (Keskar et al., 2019): + +$$ +p (x \mid c) = \prod_ {i = 1} ^ {| x |} p \left(x _ {i} \mid x _ {< i}, c\right) \tag {3} +$$ + +# 2.2 Proposed Ranking Approach + +Our proposed approach for passage ranking by generation consists of first fine-tuning a pretrained large LM on the task of question generation conditioned on the passage, using the conditional LM approach shown in Eq. 3. In practice, each input for the fine-tuning step is as follows: + + passage question + +where the passage is considered as a prompt, and the log-likelihood used in the training comes only from the tokens starting after the keyword $$ , since we use the passage as a conditioning context. In other words, at training time, we minimize the negative conditional log-likelihood $-\log P(q|a)$ where $a$ is a passage relevant to the query $q$ . At inference time, given a query $q$ , our conditional LM scores each candidate passage $a_{k}$ using the likelihood of generating the question conditioned on the passage, $s(a_{k}) = p_{\theta}(q|a_{k})$ . Fig. 1 illustrates the inference step of our proposed approach. + +# 2.3 Unlikelihood Loss for Ranking + +Datasets for training passage rankers normally contain both positive and negative examples. Therefore, it is natural to use both types of examples in order to leverage all the available data. Let $D$ be the set of examples $(q,a,y)$ , where $y$ is 1 if the passage $a$ is a positive answer for $q$ , or 0 otherwise. We fine-tune the LM using the following loss function: + +$$ +\begin{array}{l} \mathcal {L} (D) = - \sum_ {(q, a, y) \in D} \sum_ {i = 1} ^ {| q |} y \log \left(p _ {\theta} \left(q _ {i} \mid q _ {< i}, a\right)\right) \tag {4} \\ + (1 - y) \log (1 - p _ {\theta} (q _ {i} | q _ {< i}, a)) \\ \end{array} +$$ + +The second term in Eq. 4 resembles the unlikelihood training objective of Welleck et al. (2019). However, while we use an unlikelihood objective with the aim of teaching the LM which questions are unlikely given the passage, Welleck et al. (2019) use an unlikelihood objective with the aim of improving text generation. We use the acronym $LUL$ to refer to the loss function in Eq. 4, which performs likelihood and unlikelihood estimation. + +We experimented an additional loss function to fine-tuning the LMs which consists on imposing a pairwise ranking loss on the likelihood (RLL) of positive and negative examples as follows: + +$$ +\begin{array}{r c l} \mathcal {L} (D) & = & \sum_ {(q, a +, a -) \in D} \max \left\{0, \lambda - \log p _ {\theta} (q | a ^ {+}) \right. \\ & + & \left. \log p _ {\theta} (q | a ^ {-}) \right\} \end{array} \tag {5} +$$ + +The use of unlikelihood losses to penalize negative examples is a natural choice for fine-tuning generative models. Note that Eq. 4 is an extension of the regular cross-entropy loss where we just added the unlikelihood term, while Eq. 5 is its ranking-based (hinge loss) version. The unlikelihood term in Eq. 4 can also be seen as a regularizer, which makes the ranking model less overconfident when computing query likelihoods. + +# 3 Experiments and Discussion + +# 3.1 Datasets + +We use four different publicly available answer selection datasets in our experiments: WikipassageQA (Cohen et al.), WikiQA (Yang et al., 2015), InsuranceQA_V2 (Feng et al., 2015), and YahooQA (Tay et al., 2017). Statistics about the datasets are shown in Table 1. The four datasets also provide validation sets, which have size similar to the respective test sets. + +
DatasetTrain: #Q (#P/Q)Test: #Q (#P/Q)
WikiQA873 (9)243 (9)
WikipassageQA3,332 (58.3)416 (57.6)
InsuranceQA12,889 (500)2,000 (500)
YahooQA50,112 (5)6,283 (5)
+ +Table 1: Dataset statistics. #Q stands for number of questions and #P/Q is the average number of passages per question + +# 3.2 Language Model Setup + +We use pretrained GPT2-base (12 layers, 117M parameters), GPT2-large (24 layers, 345M params), BART-base (6 layers encoder and 6 layers decoder, 139M params) and BART-large (12 layers encoder + +and 12 layers decoder, 406M params) models in our experiments. We adopted the implementation and pretrained models from Wolf et al. (2019). We fine-tune GPT2 and BART on each training dataset separately. We perform a maximum of 10 finetuning epochs and adopt early stopping using the validation sets. Most of the hyperparameters used for fine-tuning are the default ones from Wolf et al. $(2019)^{1}$ , except for learning rate for BART, which we set to $1e - 5$ . + +In the experiments presented below, the subscript $MLE$ corresponds to models fine-tuned using just maximum likelihood estimation (Eq. 2), which means that only positive examples are used. The subscript $LUL$ corresponds to models fine-tuned using maximum likelihood and unlikelihood estimation (Eq. 4), while $RLL$ are models fine-tuned using the ranking loss in Eq. 5. For $MLE$ and $LUL$ , we use a mini-batch size of 64 for InsuranceQA and 32 for the other 3 datasets. The number of negative examples per positive examples is set to 5 in the case of $LUL$ . + +When fine-tuning with $RLL$ loss (Eq. 5), we use a batch size of 8. During training, when processing a question we randomly sample 15 negative passages from the set of negative passages of the question. However, only the negative passage with the highest score is used to update the model. Early experiments demonstrated that this strategy performs similarly to the usual pairwise approach. + +# 3.3 Ranking Results + +In Table 2 we present the experimental results for our proposed generative approach and four state-of-the-art discriminative baselines, which are based on BERT (Devlin et al., 2019) and BART. Both BERT-Sel (Li et al., 2019) and BERT-PR (Xu et al., 2019) fine-tuned BERT-base using a ranking loss on the score computed with [CLS] token. We trained a BERT-large model using [CLS]-based scoring + ranking loss (rows 3). We additionally trained a discriminative version of BART-large (row 4) where the input for the encoder and the decoder are the passage and the question, respectively. As it is normally adopted in BART for classification (Lewis et al., 2019), we take the representation generated by the decoder for the last token and use it to create a score by applying a linear layer. Such as the discriminative BERT models, we also optimize + +
IDDatasetYahooQAWikiQAWikipassageQAInsuranceQA
MAPMRRP@1MAPMRRP@1MAPMRRP@1MAPMRRP@1
Discriminative Approaches
1BERTSel-base (Li et al., 2019).942.942-.753.77-------
2BERT-PR-base (Xu et al., 2019)------.735.809.702.413.496.401
3BERT-PR-large.965.965.939.844.856.765.775.838.748.410.492.394
4BART-large.967.967.943.845.861.765.803.866.789.435.518.423
Generative Approaches
5GPT2-base [no fine-tuning].499.499.265.516.522.337.215.250.132.050.071.034
6GPT2-baseMLE.768.768.631.550.555.354.654.738.632.430.516.428
7GPT2-baseLUL (ours).905.905.905.690.701.547.723.807.716.427.512.422
8GPT2-baseRLL (ours).958.958.928.774.792.683.735.810.704.414.494.397
9BART-baseLUL (ours).928.928.876.778.788.658.738.813.719.440.526.434
10BART-baseRLL (ours).961.961.934.775.792.654.761.834.743.422.503.408
11GPT2-largeLUL (ours).917.917.857.736.742.609.755.825.738.444.532.439
12GPT2-largeRLL (ours).954.954.922.819.834.733.755.831.728.408.489.389
13BART-largeLUL (ours).949.949.911.802.815.712.789.848.764.465.553.461
14BART-largeRLL (ours).970.970.948.849.861.769.808.867.791.444.529.433
+ +BART-large using a ranking loss. The performance of the passage ranking models is assessed using the metrics Mean Average Precision (MAP), Mean Reciprocal Rank (MRR) and Precision at 1 $(\mathrm{P}@\mathrm{1})$ . Scores are computed with the official trec_eval tool. + +In the middle part of Table 2, we compare GPT2-base without any fine-tuning (row 5), and finetuned with either MLE (6), LUL (7) or RLL (8). When the pretrained model only is used (no fine-tuning) the results are very poor. Which is understandable, given that the pattern of having a passage followed by a question might not be very recurrent in the data used to pretrain GPT2. Comparing MLE (row 6) with LUL (row 7), we see that the inclusion of the unlikelihood term (Eq. 4) has a significant positive impact for all datasets but InsuranceQA. We believe the unlikelihood loss does not help on InsuranceQA because this dataset was not human curated and therefore contains a significant number of false-negative examples, which can hurt performance when used to compute the unlikelihood loss. Compared to BERT-base models, GPT2-baseLUL is very competitive for most of the datasets except WikiQA, while GPT2-base $R_{LL}$ demonstrates more robust results across the different datasets. In rows 9 and 10 we show results for BART-base, where we see similar trends to GPT2-base with regard to LUL and RLL losses. BART-base $R_{LL}$ is overall better than BART-base $L_{UL}$ and GPT2-base models. + +In the bottom part of Table 2, we also show results for GPT2-large and BART-large using $LUL$ and $RLL$ (rows 11 to 14). Overall, the larger generative models do a better job than the smaller ones, as expected. Among the generative approaches, BART-large $_{RLL}$ (row 14) is the model that performs the best for most of the datasets. We be + +lieve that BART-based generative models outperform GPT2-based models due to 1) the larger number of pretraining tasks used in BART and 2) the use of bidirectional attention in the encoder side (which processes the passage). Comparing BART-large $_{RLL}$ with discriminative BART-large (row 4), we can see that BART-large $_{RLL}$ produces better results for InsuranceQA, while achieving similar performance for YahooQA, WikiQA and WikipassageQA. Overall, our proposed generative approach produces state-of-the-art results on the four tested datasets in all metrics. + +Table 2: Experimental results for different passage ranking models and datasets. + +
ModelLikelihoodMAPMRRP@1
GPT2-baseLULpθ(q|a).723.807.716
GPT2-baseLULpθ(a|q).414.464.259
GPT2-baseRLLpθ(q|a).735.810.704
GPT2-baseRLLpθ(a|q).531.617.478
+ +Table 3: Experimental results on using passage vs. question as the conditional context. Results are computed on the WikipassageQA dataset + +# 3.4 Ranking with Passage Likelihood + +A different setup that can be used for our approach is to compute the likelihood of the passage given the question, where the score for a candidate passage $a^k$ is given by $s(a_k) = p_\theta(a_k|q)$ , and the score needs to be normalized by the passage length $|a_k|$ . This setup is inherently more difficult because the passage is normally much longer than the question and might contain many tokens that are not relevant for the question. + +In Table 3, we present experimental results where we compare the use of either passage or question as the conditional context. As expected, using the likelihood of the passage given the question $(p_{\theta}(a_k|q))$ as the score results in worse perfor + +
PassageThis phenomenon happens usually in the winter. In 2013, Sao Paulo was the most populous city in Brazil and in South America. According to the 2010 IBGE Census, there were 11,244,369 people residing in the city of Sao Paulo. The census found 6,824,668 White people , 3,433,218 Pardo people , 736,083 Black people , 246,244 Asian people and 21,318 Amerindian people . In 2010, the city had 2,146,077 opposite-sex couples and 7,532 same-sex couples. The population of Sao Paulo was 52.6% female and 47.4% male.
Generated QuestionsHow diverse are the demographics of the city of Sao Paulo? How diverse is the population of the city of Sao Paulo? Why are people living in the city of Sao Paulo?
PassageThe presidential electors cast their ballots for President and Vice President, and Congress tallied these votes on January 8, 2009. The voter turnout for this election was broadly predicted to be high by American standards, and a record number of votes were cast. The final tally of total votes counted was 131.3 million, compared to 122.3 million in 2004 . .... Another estimate puts the eligible voter population at 213,313,508, resulting in a turnout rate of 61.6%, which would be the highest turnout rate since 1968.
Generated QuestionsWhat are the demographics and voting trends of the US presidential elections? What is a voter turnout like in the U.S. presidential elections? What factors contributed to high voter turnout in 2008? Why might voters have difficulty voting?
+ +Table 4: Examples of automatically generated questions using the GPT2-large ${}_{LUL}$ model fine-tuned on the WikipassageQA dataset with likelihood ${p}_{\theta }\left( {q \mid a}\right)$ . The passages were extracted from the test set. + +
QuestionWhat was the election turnout for 2008?
Generated PassageThe turnout in the 2008 general election was the highest in the United Kingdom since the 1920s, and the highest turnout in the history of the UK. The turnout was higher than that for the general election of the previous year. +The 2008 general election was a close contest, with the Conservatives winning a majority of seats and the Labour Party winning a majority of seats in Parliament. The Conservative Party won the largest majority in Parliament, with 332 of 538 seats, and the Liberal Democrats gained the largest number of seats in the House of Commons, winning 232...
Generated PassageThe turnout was higher in the two states that had been held for the presidency by Barack Obama. The Democratic Party won the state of New Hampshire, the state that Obama won by more than 2 million votes, and the Republican Party won the state of Ohio by nearly 2.5 million votes. In the 2008 presidential election, Obama defeated Mitt Romney by more than 3 million votes, winning 332 of the 435 electoral votes. The election was the second of four presidential elections. The results of the election were announced on November 4. The election was the first in ...
+ +Table 5: Examples of automatically generated passages using the GPT2-large ${}_{LUL}$ model fine-tuned on the WikipassageQA dataset with likelihood ${p}_{\theta }\left( {a \mid q}\right)$ . The question was extracted from the test set. + +mance for both fine-tuning approaches: LUL and RLL. + +# 3.5 Question and Passage Generation + +A good side effect of using generative models to perform ranking is that we can use the trained model to generate new questions given a passage and vice-versa (depending on the conditioning context used for fine-tuning). This type of synthetically generated data could be used as additional training data to improve discriminative models such as BERT-PR (Xu et al., 2019). In Tables 4 and 5, we present some examples of questions and passages, respectively, that were generated using our fine-tuned GPT2-large $_{LUL}$ LM. In both cases we use a mixture of top k-sampling (Fan et al., 2018) and nucleus sampling (Holtzman et al., 2019) to generate the samples. Please note that the passages in Table 4 were extracted from the test set and are not present in the training set. The same applies for the question used in Table 5. + +In Table 4, we can see that the generated questions are very fluent and, for most questions (except for the ones in italic), the input passage contains the answer for the question. In Table 5, we can + +observe that the generated passages are quite related to the input question. However, the content is normally not factual and contains inconsistencies and some repetitions. + +# 4 Conclusion + +We have proposed a new generative approach for IR based on large pretrained neural language models, and demonstrated their effectiveness as rankers by providing robust experimental results on four different datasets. Additionally, we demonstrated that unlikelihood-based losses are effective for allowing the use of negative examples in generative-based information retrieval. We believe that our approach can also be effectively used for text classification problems, where the score of a class label $c$ is computed as the likelihood of generating the class label $c$ given the document $d$ , $p(c|d)$ . + +# References + +Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Janvin. 2003. A neural probabilistic language model. J. Mach. Learn. Res., 3:1137-1155. + +Daniel Cohen, Liu Yang, and W. Bruce Croft. Wikipas- + +sageqa: A benchmark collection for research on non-factoid answer passage retrieval. In 41st International ACM SIGIR Conference. +Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL, Minneapolis, Minnesota. +Angela Fan, Mike Lewis, and Yann N. Dauphin. 2018. Hierarchical neural story generation. CoRR, abs/1805.04833. +Minwei Feng, Bing Xiang, Michael R. Glass, Lidan Wang, and Bowen Zhou. 2015. Applying deep learning to answer selection: A study and an open task. In IEEE Workshop on Automatic Speech Recognition and Understanding ASRU, pages 813-820. +Ari Holtzman, Jan Buys, Maxwell Forbes, and Yejin Choi. 2019. The curious case of neural text degeneration. CoRR, abs/1904.09751. +Nitish Shirish Keskar, Bryan McCann, Lav R. Varshney, Caiming Xiong, and Richard Socher. 2019. Ctrl: A conditional transformer language model for controllable generation. +John Lafferty and Chengxiang Zhai. 2001. Document language models, query models, and risk minimization for information retrieval. In 24th Annual International ACM SIGIR Conference, SIGIR '01. +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. +Dongfang Li, Yifei Yu, Qingcai Chen, and Xinyu Li. 2019. Bertsel: Answer selection with pre-trained models. CoRR, abs/1905.07588. +Rodrigo Nogueira and Kyunghyun Cho. 2019. Passage re-ranking with bert. arXiv preprint arXiv:1901.04085. +Rodrigo Nogueira, Zhiying Jiang, and Jimmy Lin. 2020. Document ranking with a pretrained sequence-to-sequence model. +Jay M. Ponte and W. Bruce Croft. 1998. A language modeling approach to information retrieval. In 21st Annual International ACM SIGIR Conference, SIGIR '98, pages 275-281. ACM. +Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. +Jinfeng Rao, Hua He, and Jimmy Lin. 2016. Noise-contrastive estimation for answer selection with deep neural networks. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, page 1913-1916. + +Cicero dos Santos, Luciano Barbosa, Dasha Bogdanova, and Bianca Zadrozny. 2015. Learning hybrid representations to retrieve semantically equivalent questions. In ACL, pages 694-699. +Cicero dos Santos, Ming Tan, Bing Xiang, and Bowen Zhou. 2016. Attentive pooling networks. +Aliaksei Severyn and Alessandro Moschitti. 2015. Learning to rank short text pairs with convolutional deep neural networks. In ACM SIGIR Conference, pages 373-382. +Ming Tan, Cicero dos Santos, Bing Xiang, and Bowen Zhou. 2016. Lstm-based deep learning models for non-factoid answer selection. In ICLR - Workshop Track. +Yi Tay, Minh C. Phan, Luu Anh Tuan, and Siu Cheung Hui. 2017. Learning to rank question answer pairs with holographic dual LSTM architecture. In ACM SIGIR Conference, pages 695-704. +Yi Tay, Luu Anh Tuan, and Siu Cheung Hui. 2018. Hyperbolic representation learning for fast and efficient neural question answering. In International Conference on Web Search and Data Mining, pages 583-591. +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. +Zhiguo Wang, Wael Hamza, and Radu Florian. 2017. Bilateral multi-perspective matching for natural language sentences. CoRR, abs/1702.03814. +Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. 2019. Neural text generation with unlikelihood training. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Peng Xu, Xiaofei Ma, Ramesh Nallapati, and Bing Xiang. 2019. Passage ranking with weak supervision. CoRR, abs/1905.05910. +Yi Yang, Wen-tau Yih, and Christopher Meek. 2015. WikiQA: A challenge dataset for open-domain question answering. In EMNLP, pages 2013-2018. +ChengXiang Zhai. 2008. Statistical language models for information retrieval: a critical review. Found. Trends Inf. Retr., 2(3):137-213. \ No newline at end of file diff --git a/beyondclsthroughrankingbygeneration/images.zip b/beyondclsthroughrankingbygeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..329db22dc71bcba03503009870b430ffd74c0c90 --- /dev/null +++ b/beyondclsthroughrankingbygeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:405154abde9e6ad035d0b5798ff040bfa95d4de914035ed47ff739d45bd4cf48 +size 460982 diff --git a/beyondclsthroughrankingbygeneration/layout.json b/beyondclsthroughrankingbygeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d64acf1361fc60b1625514aeb0556e5c3f5f14d2 --- /dev/null +++ b/beyondclsthroughrankingbygeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe4743fa76471ab4e29d117098ee66e9143eb9ce4b75f0520ccbb9af439da804 +size 219883 diff --git a/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_content_list.json b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..6ac3f50c18dfade00fd8cad1087fca46e9fa2f1d --- /dev/null +++ b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f551c30c64b677d904ca90376459522d9c12d8fd4c4592034c51f5025339d30 +size 71404 diff --git a/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_model.json b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2642ce89077b14e18e4940d03bac09eb8804d68e --- /dev/null +++ b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a054b58fd77d66f01da7d61ceb12648f9a43c0928065521173de496ca68c150b +size 89100 diff --git a/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_origin.pdf b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8f071a85c7eefddd8ef4d4bf7f5338babe1050b8 --- /dev/null +++ b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/60317340-dfdd-43ad-ac8f-e4ae0cf24718_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98b8cc2a9654c8c1a46ca63d37fdaf00ddb7dbcabab799828fefdb2423e6a6d6 +size 644058 diff --git a/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/full.md b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/full.md new file mode 100644 index 0000000000000000000000000000000000000000..34fb9465eff12b4248ebc2fa0a508b7155c2b2e0 --- /dev/null +++ b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/full.md @@ -0,0 +1,281 @@ +# Beyond Instructional Videos: Probing for More Diverse Visual-Textual Grounding on YouTube + +Jack Hessel + +Allen Institute for AI + +jackh@allenai.org + +Zhenhai Zhu + +Bo Pang + +Radu Soricut + +Google Research + +{zhenhai,bopang,rsoricut}@google.com + +# Abstract + +Pretraining from unlabelled web videos has quickly become the de-facto means of achieving high performance on many video understanding tasks. Features are learned via prediction of grounded relationships between visual content and automatic speech recognition (ASR) tokens. However, prior pretraining work has been limited to only instructional videos; a priori, we expect this domain to be relatively "easy:" speakers in instructional videos will often reference the literal objects/actions being depicted. We ask: can similar models be trained on more diverse video corpora? And, if so, what types of videos are "grounded" and what types are not? We fit a representative pretraining model to the diverse YouTube8M dataset, and study its success and failure cases. We find that visual-textual grounding is indeed possible across previously unexplored video categories, and that pretraining on a more diverse set results in representations that generalize to both non-instructional and instructional domains. + +# 1 Introduction + +Self-supervised pretraining approaches have recently been adapted to web videos (Sun et al., 2019a,b; Miech et al., 2019, 2020; Zhu and Yang, 2020; Amrani et al., 2020); the resulting models have achieved state-of-the-art performance on a wide range of video understanding tasks, e.g., dense caption generation, action localization, etc. + +In general, the pretraining step requires a large, unlabelled corpus of web videos. The training objective aligns visual content (i.e., video segments) with automatic speech recognition (ASR) tokens, and the resulting representations are fine-tuned for downstream tasks. The assumption underlying this family of approaches is that, in the pretraining corpus, spoken words have some consistent, + +grounded relationship with the temporally corresponding visual content. + +However, in contrast to the highly diverse corpora utilized for text-based pretraining (Wikipedia, Commoncrawl, etc.), pretraining for web videos (so far) has been limited to instructional videos. This domain restriction is motivated by the commonly accepted notion that "procedural knowledge tends to be inherently multimodal" (Malmaud et al., 2015). We expect that the semantic information in video frames and ASR tokens is readily correlated in instructional videos. But corpus diversity brings significant benefits: in the text-only case, models can effectively represent diverse real-world entities (Roberts et al., 2020) precisely because pretraining is not restricted to, e.g., only fictional stories (Zhu et al., 2015). + +In search of more general representations, our main question is: does video-ASR pretraining "work" for more diverse pretraining corpora? + +Are certain categories of non-instructional videos "groundable," thus enabling diverse representation learning? Or are some types too difficult, only acting as training noise? We conclude that: 1) grounding is indeed possible in a wide range of yet-to-be-computationally-exploited YouTube video categories, e.g., walk-throughs, vehicles, tech reviews, etc., with some harder than others; 2) transferable representations can be successfully learned by training on a more diverse set, which may provide more versatility. + +# 2 Related Work + +ASR is known to be a useful signal source in various instructional video understanding tasks (Gupta et al., 2017; Huang et al., 2017; Huang* et al., 2018; Moriya et al., 2019), e.g., action detection/classification (Yu et al., 2014; Alayrac et al., 2017; Chang et al., 2019; Kuehne et al., 2019), + +segmentation/captioning (Sener et al., 2015), and instruction alignment (Malmaud et al., 2015; Alayrac et al., 2016). A number of multimodal instructional video datasets have been proposed (Wang et al., 2019; Tang et al., 2019; Sanabria et al., 2018). A notable recent example of work addressing a non-instructional video corpus is Ignat et al. (2019), who analyze grounded-ness in lifestyle vlogs. Fouhey et al. (2018) highlight the difference between keyword search vs. implicitly mining action data of interest from a broader corpus (e.g., Bregler (1997); Gu et al. (2018)). + +Operational grounding. Our work builds upon prior operational notions of grounding: if an algorithm is able to consistently predict specific visual-textual relationships, then that relationship is said to be "grounded" (Lu et al., 2008; Berg et al., 2010; Parikh and Grauman, 2011; Hill and Korhonen, 2014; Hessel et al., 2018). Yanai and Barnard (2005), for example, examine an image+text corpus and rank "strings of text by how well their occurrence can be predicted from visual features." One shortcoming of any model-based operationalization of "grounding" is that only positive instances of groundedness can be identified: if one model fails to ground something, perhaps a better model could have. + +# 3 Video-ASR pretraining + our model + +Recent work in designing pretraining objectives: 1) assumes that ASR tokens have, on average, some correspondence to temporally co-occurring video frames within the same video; and 2) ignores clips that lack ASR. We consider a model that encapsulates both of these assumptions. The model is a slight simplification of Miech et al. (2019), where a joint embedding for the visual content and ASR tokens is learned. While more sophisticated methods based on self-attention models have since been examined (e.g., Zhu and Yang (2020)), joint embedding models are still performant and offer greater interpretability, thus enabling our later error analyses. + +Model details. The similarity between clip $i$ and ASR caption $j$ , $s_{i,j}$ , is estimated by computing the cosine similarity between their corresponding embeddings in the joint space. Joint embedding models are parameterized using gated, multi-layer + +feedforward networks. The visual features we use as input are: frame-wise 2D Inception-v1 pretrained for object detection (Szegedy et al., 2015; Sun et al., 2017) and 3D CNN S3D-G features pretrained for action recognition (Xie et al., 2018; Kay et al., 2017). The language feature inputs are 300 dimensional vectors per word-type; these are fine-tuned during the training process. Max pooling is used for both token embeddings and for per-frame visual features to achieve a single visual and textual embedding for each clip. + +During training, temporally corresponding (clip, ASR caption) pairs are sampled ("Positive" cases). For each positive case, a set of mismatched "Negative" cases is also sampled both from other videos and from the same video in equal proportion. In contrast to Miech et al. (2019), we control for clip length, and sample temporally fixed-length segments. In initial experiments with variable-length segments, we found that our models were capable of "cheating" the grounding task by aligning longer (and shorter, respectively) clips with longer (and shorter) ASR captions, largely ignoring content. Thus, this simplifying choice makes our error analysis significantly more straightforward, and results in minimal performance change. We use 5 second segments, but results are similar with 10 or 30 second windows (see Appendix E). To generate segments, we initially randomly sample 256 per video before discarding ones that have no temporally-accompanying ASR. Segments may overlap, though results are similar without overlaps (see Appendix D). The following hinge loss is minimized for margin $\delta$ : + +$$ +\sum_ {i, j \in \mathcal {P}, \mathcal {N}} \max (0, \delta + s _ {i, j} - s _ {i, i}) + \max (0, \delta + s _ {j, i} - s _ {i, i}) \tag {1} +$$ + +We trained with Adam (Kingma and Ba, 2015), a learning rate of .001, and set $\delta = .1$ , but didn't undertake significant hyperparameter optimization. We terminate training after 300K steps. + +CrossTask replication. To verify that our model simplifications didn't significantly hinder performance, we replicated key experiments from Miech et al. (2019). In particular, we sought to gather the pretraining corpus they used, HowTo100M, which consists of 1.22M videos. Because of, e.g., users deleting videos, we were able to gather features for only $87\%$ of the original set, 1.06M videos. + +![](images/83ab3ecb2d1bab4f6dc45e5ae87edba207c1e1755de6b13a23c3b4ce898f5ba2.jpg) +Figure 1: Intra-video AUC metric: the model scores all possible links between clips and ASR captions within a single video; the model is rewarded for assigning higher similarity to temporally-aligned segments versus mismatched ones. + +We verify the performance of our model using the CrossTask localization task (Zhukov et al., 2019). While we defer details to the original paper, the goal of CrossTask is to temporally localize a set of procedural steps for a task in an unlabeled/unsegmented video depicting that task. An algorithm's performance is evaluated with a recall metric (higher is better). We follow the evaluation procedure given in Miech et al. (2019), except instead of embedding each frame individually, we embed a sliding 5-second window of video clips. + +Our simplified model trained on less data performs comparably to Miech et al. (2019)'s. We achieve 32.6 recall, while they report 33.6 recall; for reference, a supervised upper-bound without pre-training achieves 31.6 recall (full results and more details are in Appendix B). + +Measuring visual-textual alignment. Viewed through the lens of link prediction between truly co-occurring (clip, ASR) pairs, Eq. 1 can be seen as a differentiable approximation of AUC (Rendle et al., 2009). Thus, we propose to operationally measure the groundedness using intra-video AUC: a single score is assigned to each video, rewarding the model if it is able to successfully align temporal pairs within the same video (and penalizing it if not). Fig. 1 presents a visualization of this method. One notable advantage of AUC versus other link prediction metrics is that it is insensitive to the label distribution: shorter videos are not systematically assigned higher scores simply because there are fewer incorrect links. + +# 4 A More Diverse Corpus + +YouTube-600K. YouTube8M (Abu-El-Haija et al., 2016) is a dataset of 6.1M YouTube + +
Category% videos
BBC74.1%
President (USA)71.7%
Hair conditioner71.1%
Madden NFL69.3%
Wig67.9%
Magic (card game)67.9%
Booster pack67.4%
Raw foodism66.5%
NBA 2K1465.2%
Silver65.2%
+ +(a) Most ASR + +
Category% videos
Pachinko0.4%
Jumbotron0.4%
Chipmunk0.3%
Taiko no Tatsujin0.2%
Yo-kai Watch0.1%
Zee Bangla0.1%
Karaoke box0.1%
Wangan Midnight0.1%
Caporales0.0%
Military band0.0%
+ +(b) Least ASR + +Table 1: Categories of YouTube8M with the highest and lowest availability of English ASR (minimum 1K videos); corpus mean = 17%. + +videos, where each video is labeled across 3K categories, ranging from "cooking" to "games" to "nature." It is among the largest and most diverse publicly available dataset of YouTube videos. Due to user deletions and videos without detected spoken words, we are able to collect ASR via the YouTube API for 1.4M (29%) videos; we further filtered to 817K videos tagged with English ASR. There is an extremely wide variance of ASR availability per category, e.g., 74% of "BBC" videos (a category that generally contains news videos by the broadcaster) have ASR, whereas almost no "Military band" videos do (Table 1). While the percentage of ASR-available videos is higher in many instructional video categories, e.g., "cooking" at 31%, "cosmetics" at 44%, etc., many non-instructional categories on YouTube have ASR available (e.g., "silver" at 65%; mostly videos about coins). Maintaining the train / validation split of the original data release yields 639K training videos (henceforth referred to as YouTube-600K) and 167K validation-set videos. + +Human annotation of "Is-it-instructional" While a qualitative examination of YouTube8M reveals clear topical and stylistic diversity compared to domain-restricted corpora, we quantitatively verify that YouTube8M does not consist of mostly instructional videos. + +We sample 6.8K videos with English ASR from the validation set for human labeling. Each video is shown to three paid annotators, who each provide a Yes/No answer to the question: "Does this + +![](images/ac177ed3f07a37f249f5a689d88c6c3df122d6e957d5d95deaeed040362a4c03.jpg) +Figure 2: Distribution of intra-video AUC scores, grouped by meta category, compared to the overall distribution. + +video focus on real-world human actions accompanied by procedural language that explains what is happening on screen in reasonable detail?" Note that our definition of "instructional" intends to include the usual "how-to" videos, but also attempts to capture a more general notion of "instructionalness". For instance, an un-boxing video where parts of a product are taken out and assembled along with corresponding narration should receive "Yes", whereas a video showing only a product from different angles should receive "No", due to a lack of narrated human actions. + +After a pilot study with a few iterations over the guidelines and examples, the annotators reach high agreement: in $96\%$ of cases, all three judges are unanimous. From these annotations, we estimate that around $74\%$ of the videos in the YouTube-600K corpus are not instructional, even for the generalized notion of "instructional-ness." For reference, Miech et al. (2019) conduct an analysis of 100 videos from HowTo100M (constructed with the intention to focus on how-to videos) and estimate that $71\%$ are instructional. + +The annotated i3-video corpus (is-it-instructional-video) is available for download. One potential use-case: consider an automated tool designed exclusively for use on instructional videos. A classifier trained on our labelled corpus could be used to determine if applying the automated tool is appropriate or not for an unlabelled input video. + +Which categories are easiest/hardest? We train our model on YouTube-600K, and compute intravideo AUC for each of the 178K validation videos. First, we average all videos labeled with a particular category to produce a per-category AUC score. The performance in a vast majority of categories + +
DomainExample Categories (AUC)
VehiclesCrossover SUV (70); Sedan (69); Minivan (69); Station wagon (68)
WalkthroughsHotel Suite (71); Apartment (69); Dining room (68); Living room (68)
AdvertisingAdvertising (68); Television advertisement (66); Infomercial (63)
Tech ReviewsCNET (66), Netbook (65), Asus (63)
ToysiPhone 5S (64), MacBook (64)
AppliancesFunko (66); Monster High (64); Figurine (64) Action Figure (64)
PlacesHome appliance (65); Washing machine (64); Kitchen stove (64)
Greenhouse (62) University (61); Amusement park (59)
+ +Table 2: Domains with high operational groundability. + +is above the 50 AUC (random) baseline, and ranges from 51 ("Mixtape") to 76 ("Muffin"). To make sure that the model is not succeeding simply because a category happened to be frequent in the dataset, we note the correlation between category AUC and category frequency is essentially zero $(\rho = .02, p > .58)$ . This suggests that at least some aspect of most categories of videos can be visual-textually grounded. + +We next coarsely aggregate the YouTube8M categories into meta-categories, e.g., "Food and Drink." The AUC distribution of 4 popular meta categories relative to the overall AUC distribution is given in Fig. 2. In general, the grounding succeeds most readily on makeup/hair videos (e.g., "Eye liner" AUC = 74, "Updo" AUC = 68, etc.) and cooking videos (e.g., "Vegetarian cuisine" AUC = 71), domains that have been previously used in video grounding work. Besides these already-studied domains, other high-scoring category types emerge (Table 2). Conversely, some categories are more difficult for the model, e.g., video game categories like "RuneScape" AUC = 54 and "First-person shooter" AUC = 55; speakers in these videos often reference diverse topics unrelated to the game itself. Non-video-game categories can also be difficult, e.g., "Unidentified flying object" AUC = 56, "Dashcam" AUC = 54. + +We next ask: are instructional videos indeed easier to operationally ground? While human judgements of instructional-ness and intra-video AUC are positively correlated $\rho = .20$ ( $p \ll 0$ ), the low magnitude of this correlation provides additional empirical confirmation that other types of videos are also promising. + +Within-category observations. To this point, + +![](images/019a13f5472f38a60203fc584430d2289e92d3a816d0cedb9b040905d0ad89c4.jpg) + +![](images/a0ab1fedf2b017864378610fab247518498356e61ad7cb70066a57187363aad2.jpg) +(a) Action Figure (64 category AUC) +(b) Call of Duty (55 category AUC) +Figure 3: Correlation between per-segment AUC scores and segment timing within video (left column) and the number of tokens in a segment (right column) + +we have identified broad categories of YouTube videos that are more groundable than others. However, it is not yet clear why, e.g., the algorithm gets 64 AUC on "Action Figure," or 55 AUC on "Call of Duty" (a first-person shooter game). We now define a segment-level AUC metric, analogous to the intra-video AUC metric previously defined: it quantifies how readily individual ASR captions are temporally localized by the model within the same video (see Menon and Elkan (2011) for a description of different AUC variants). + +Before examining the relationship between content-based features and segment-level AUC, contextual factors must be considered. Fig. 3 illustrates clear relationships 1) between ASR caption placement within a video and segment AUC (segments at the very beginning and very end of videos tend to be easier); and 2) between the number of tokens in an ASR caption and segment AUC. For "Action Figure", ASR segments with more words are easier (this is the case with most categories), but for "Call of Duty", the opposite is true. + +After controlling for contextual variables, we train OLS regression models to predict segment AUC from lexical unigram features, while controlling for timing/length features. Lexical features add predictive capacity $(p \ll .01$ , F-test). While we find some patterns predictive of segment AUC for both categories, e.g., intro/outro-language (e.g., "hey", "welcome", "peace"), we also observe topical patterns, e.g., several unigrams associated with specific action figure body parts ("knee", "shoulder", "joint", etc.) are positively associated with segment AUC. + +# 5 Implications for Pretraining + +While we've thusfar shown that self-grounding is possible for a diverse set of domains, do we gain anything by training on a more diverse corpus? Or do difficult-to-ground videos introduce noise and degrade representations for downstream tasks? + +We compare two versions of our model: one with parameters learned from training on the diverse YouTube-600K corpus ( $M_{\text{Diverse}}$ ), and one with parameters learned from a domain-specific corpus of 1M instructional videos ( $M_{\text{Instructional}}$ ). + +First, we evaluate each model's capacity to localize instructional steps on the CrossTask (Zhukov et al., 2019) dataset. $M_{\text{Diverse}}$ performs admirably, even with significant domain mismatch and fewer pretraining videos: recall drops by only $15\%$ ( $32.6 \rightarrow 27.4$ ) when swapping from $M_{\text{Instructional}}$ to $M_{\text{Diverse}}$ . + +We next evaluate each model's performance on the same-video clip alignment task over a diverse set of videos: the sample of 6.8K human-annotated videos from the YouTube8M validation set. In terms of intra-video AUC, $M_{\text{Diverse}}$ outperforms $M_{\text{Instructional}}$ on $59\%$ of videos. If we split the data across the "Is-it-instructional" human judgements and compare the two models in each subset, $M_{\text{Instructional}}$ "wins" in $57\%$ of the instructional videos, whereas $M_{\text{Diverse}}$ "wins" in $65\%$ of non-instructional cases. + +In short: both models achieve reasonable performance under instructional vs. non-instructional train/test domain mismatch. Taken together, this is a promising result for future pretraining work with more diverse corpora: at least for these evaluations, good performance on an instructional video grounding task is still possible under domain shift. And while the comparison of intra-video AUC is not necessarily definitive, it suggests that diverse corpora may provide more versatility, and we look forward to exploring this further in future work. + +# 6 Conclusion + +Peeking through the lens of a joint embedding model, we probe into learning visual-textual grounding over a more diverse corpus of YouTube videos vs. prior work. We find that learning visual-textual grounding is possible across many yet-to-be-explored categories of YouTube videos, and that it's possible to learn generalizable representations from a more diverse video set. + +Acknowledgements. In addition to the anonymous reviewers, the authors would like to thank Soravit Changpinyo, Sebastian Goodman, Bryan Seybold, Chen Sun and Ashish Thapliyal for insightful discussions and implementation help. JH completed this work during an internship at Google. + +# References + +Sami Abu-El-Haija, Nisarg Kothari, Joonseok Lee, Paul Natsev, George Toderici, Balakrishnan Varadarajan, and Sudheendra Vijayanarasimhan. 2016. Youtube-8m: A large-scale video classification benchmark. arXiv preprint arXiv:1609.08675. +Jean-Baptiste Alayrac, Piotr Bojanowski, Nishant Agrawal, Josef Sivic, Ivan Laptev, and Simon Lacoste-Julien. 2016. Unsupervised learning from narrated instruction videos. In CVPR. +Jean-Baptiste Alayrac, Ivan Laptev, Josef Sivic, and Simon Lacoste-Julien. 2017. Joint discovery of object states and manipulation actions. In ICCV. +Elad Amrani, Rami Ben-Ari, Daniel Rotman, and Alex Bronstein. 2020. Noise estimation using density estimation for self-supervised multimodal learning. arXiv preprint arXiv:2003.03186. +Tamara L Berg, Alexander C Berg, and Jonathan Shih. 2010. Automatic attribute discovery and characterization from noisy web data. In ECCV. +Christoph Bregler. 1997. Learning and recognizing human dynamics in video sequences. In Computer Society Conference on Computer Vision and Pattern Recognition. +Chien-Yi Chang, De-An Huang, Yanan Sui, Li Fei-Fei, and Juan Carlos Niebles. 2019. D3tw: Discriminative differentiable dynamic time warping for weakly supervised action alignment and segmentation. In CVPR. +David F Fouhey, Wei-cheng Kuo, Alexei A Efros, and Jitendra Malik. 2018. From lifestyle vlogs to everyday interactions. In CVPR. +Chunhui Gu, Chen Sun, David A Ross, Carl Vondrick, Caroline Pantofaru, Yeqing Li, Sudheendra Vijayanarasimhan, George Toderici, Susanna Ricco, Rahul Sukthankar, Cordelia Schmid, and Jitendra Malik. 2018. AVA: A video dataset of spatio-temporally localized atomic visual actions. In CVPR. +Abhinav Gupta, Yajie Miao, Leonardo Neves, and Florian Metze. 2017. Visual features for context-aware speech recognition. In ICASSP. +Jack Hessel, David Mimno, and Lillian Lee. 2018. Quantifying the visual concreteness of words and topics in multimodal datasets. In NAACL. + +Felix Hill and Anna Korhonen. 2014. Learning abstract concept embeddings from multi-modal data: Since you probably cant see what I mean. In EMNLP. +De-An Huang*, Shyamal Buch*, Lucio Dery, Animesh Garg, Li Fei-Fei, and Juan Carlos Niebles. 2018. Finding "it": Weakly-supervised, reference-aware visual grounding in instructional videos. In CVPR. +De-An Huang, Joseph J Lim, Li Fei-Fei, and Juan Carlos Niebles. 2017. Unsupervised visual-linguistic reference resolution in instructional videos. In CVPR. +Oana Ignat, Laura Burdick, Jia Deng, and Rada Mihalcea. 2019. Identifying visible actions in lifestyle vlogs. In ACL. +Will Kay, João Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, Mustafa Suleyman, and Andrew Zisserman. 2017. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950. +Diederik P Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In ICLR. +Hilde Kuehne, Ahsan Iqbal, Alexander Richard, and Juergen Gall. 2019. Mining youtube-a dataset for learning fine-grained action concepts from webly supervised video data. arXiv preprint arXiv:1906.01012. +Yijuan Lu, Lei Zhang, Qi Tian, and Wei-Ying Ma. 2008. What are the high-level concepts with small semantic gaps? In CVPR. +Jonathan Malmaud, Jonathan Huang, Vivek Rathod, Nick Johnston, Andrew Rabinovich, and Kevin Murphy. 2015. What's cookin'? interpreting cooking videos using text, speech and vision. In *NAACL*. +Aditya Krishna Menon and Charles Elkan. 2011. Link prediction via matrix factorization. In ECML-PKDD. +Antoine Miech, Jean-Baptiste Alayrac, Lucas Smaira, Ivan Laptev, Josef Sivic, and Andrew Zisserman. 2020. End-to-end learning of visual representations from uncurated instructional videos. In CVPR. +Antoine Miech, Dimitri Zhukov, Jean-Baptiste Alayrac, Makarand Tapaswi, Ivan Laptev, and Josef Sivic. 2019. HowTo100M: Learning a Text-Video Embedding by Watching Hundred Million Narrated Video Clips. In ICCV. +Yasufumi Moriya, Ramon Sanabria, Florian Metze, and Gareth JF Jones. 2019. Grounding object detections with transcriptions. arXiv preprint arXiv:1906.06147. +Devi Parikh and Kristen Grauman. 2011. Interactively building a discriminative vocabulary of nameable attributes. In CVPR. + +Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. 2009. Bpr: Bayesian personalized ranking from implicit feedback. In UAI. +Adam Roberts, Colin Raffel, and Noam Shazeer. 2020. How much knowledge can you pack into the parameters of a language model? arXiv preprint arXiv:2002.08910. +Ramon Sanabria, Ozan Caglayan, Shruti Palaskar, Desmond Elliott, Loic Barrault, Lucia Specia, and Florian Metze. 2018. How2: a large-scale dataset for multimodal language understanding. In NeurIPS Workshops. +Ozan Sener, Amir R Zamir, Silvio Savarese, and Ashutosh Saxena. 2015. Unsupervised semantic parsing of video collections. In ICCV. +Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. 2019a. Contrastive bidirectional transformer for temporal representation learning. arXiv preprint arXiv:1906.05743. +Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. 2019b. VideoBERT: A joint model for video and language representation learning. In ICCV. +Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. 2017. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV. +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 CVPR. +Yansong Tang, Dajun Ding, Yongming Rao, Yu Zheng, Danyang Zhang, Lili Zhao, Jiwen Lu, and Jie Zhou. 2019. COIN: A large-scale dataset for comprehensive instructional video analysis. In CVPR. +Weiying Wang, Yongcheng Wang, Shizhe Chen, and Qin Jin. 2019. You makeup: A large-scale domain-specific multimodal dataset for fine-grained semantic comprehension. In EMNLP. +Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. 2018. Rethinking spatiotemporal feature learning: Speed-accuracy trade-offs in video classification. In ECCV. +Keiji Yanai and Kobus Barnard. 2005. Image region entropy: a measure of visualness of web images associated with one concept. In ACM MM. +Shoou-I Yu, Lu Jiang, and Alexander Hauptmann. 2014. Instructional videos for unsupervised harvesting and learning of action examples. In ACM MM. +Linchao Zhu and Yi Yang. 2020. Actbert: Learning global-local video-text representations. In CVPR. + +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 ICCV. +Dimitri Zhukov, Jean-Baptiste Alayrac, Ramazan Gokberk Cinbis, David Fouhey, Ivan Laptev, and Josef Sivic. 2019. Cross-task weakly supervised learning from instructional videos. In CVPR. + +# A Additional Model Details + +We adapt Miech et al. (2019)'s joint embedding model that pre-trains by aligning ASR tokens with corresponding video frames. The main difference between our implementation and theirs is how we generated (ASR, caption) pairs. While we considered generating clips according to their methodology, we ran into two problems. First, in early experiments, we found that the interpretability our error analysis was significantly impacted by varying clip length. For example: we were worried that it might not be consistent to compare the model's ability to temporally ground a 1s clip vs. a 15 second clip. There was also high correlation between caption length and temporal clip duration, which further complicated interpretation. Sampling clips of uniform duration solved these problems. + +Second, Miech et al. (2019)'s temporal segmentation was generated by relying on the scrolling timing of the ASR tokens on the YouTube, i.e., the time that YouTube decides to generate a linebreak, removing a line of caption from the screen. Via manual inspection, we found that scrolling time was temporally unreliable, e.g., the time in which ASR captions scroll on YouTube often differs significantly from when particular words were said. Instead, we sample 256 candidate 5 second segments uniformly at random from the video, and then discard segments that have no corresponding ASR. + +Additional visual feature details. For 2D features, we sample frames at 1FPS from all of the videos in our corpus, resize frames to be 256 by 256, and pass them through Inception-v1 (Szegedy et al., 2015) pretrained on JFT (Sun et al., 2017). For 3D convolutional networks, we follow a similar procedure to (Sun et al., 2019), sample frames at 30FPS, aggregate frames into one second non-overlapping clips of 1 second each, and run an S3D-G (Xie et al., 2018) network that is pretrained on the Kinetics action recognition dataset (Kay et al., 2017). Both 2D and 3D features are L2 normalized. The result of this process is a 2524-D feature vector for each second of video in our corpus. + +# B Comparison to HowTo100M + +The full per-task recall comparisons are given in Table 3. Our results, like those of Miech et al. (2019), use Zhukov et al. (2019)'s dynamic programming postprocessing method. We found that + +![](images/f98aa9577c63f6fbd464be737d98a9b5c19bdea831e7b6a0d8c05fcac08c0ae2.jpg) + +![](images/9889c41944e5bab59a3bb9ab3ddd3a1f2472b32e9262daebf0637ae4e949789f.jpg) + +![](images/9ae9a353188b2bd9605e2343602c2fc0743238c5182c3edf2bd60e47795d7ad5.jpg) +(a) Action Figure (64 category AUC) + +![](images/cf1f0d6d16e93e55acfe1fc0a21877d4f4eaded9519b177c98cf6e1018681b41.jpg) +(b) Call of Duty (54 category AUC) +Figure 4: Correlation between per-segment AUC scores and segment timing within video (left column) and the number of tokens in a segment (right column) for the 140K checkpoint (compare to the 300K checkpoint in the main paper). + +it usually resulted in a small performance increase. + +Our simplified model performs only slightly worse (3%) than Miech et al. (2019)'s. While we argue that our model is certainly still representative, there are several reasons why this gap might exist. For example, there may be a regularizing effect when the model is allowed to view clips of varying length. Furthermore, our feature set was different; we used different (but comparable) base neural networks for feature extraction. Also, our model is trained on less data due to authors deleting their videos. Finally — we didn't tune the training hyperparameters for our model/implementation, e.g., hinge size, learning rate, batch size, etc. + +# C Stability of results to checkpoint + +To ensure the results related to intra-video AUC were insensitive to the particular choice of model checkpoint, we re-did the experiments in §4 using a version of our model checkpointed at 140K iterations vs. the 300K presented in the main paper; these experiments were conducted over 21K dev videos instead of the full 167K dev videos presented in the main paper. Figures+tables in that section were consistent with the presented results, and the qualitative observations about the "Action Figure" category held (see Figure 4 for replicated figures). + +# D Stability of results to overlapping windows + +When we generate our windows at training and testing time to compute intra-video AUC, given that + +
Make Kimchi RicePickle CucumberMake Banana Ice CreamGrill SteakJack Up CarMake Jello ShotsChange TireMake LemonadeAdd Oli to CarMake LatteBuild shelvesMake Taco SaladMake French ToastMake Insh CoffeeMake Strawberry CakeMake PancakesMake MeringeMake Fish CurryAverage
Zhukov et al. (2019)15.610.67.514.29.311.817.313.16.412.927.29.215.78.616.313.023.27.413.3
Supervised upper-bound (Zhukov et al., 2019)19.125.338.037.525.728.254.325.818.331.247.712.039.523.430.941.153.417.331.6
HowTo100M (1.2M videos) → Crosstask (Miech et al., 2019)33.527.136.637.924.135.632.735.130.728.543.219.834.733.640.441.641.927.433.6
↓, only 600K instructional videos32.6
↓, only 200K instructional videos31.1
Our HowTo100M (1.06M videos) → Crosstask24.530.039.932.027.037.233.633.524.427.744.719.132.931.735.346.643.422.932.6
Our YouTube-600K (639K videos; 166K instr) → Crosstask21.524.735.226.219.629.525.830.120.922.932.718.426.727.231.043.337.720.527.4
+ +Table 3: Comparison between our simplified model and Miech et al. (2019)'s model on CrossTask, and the effect of pretraining the model on YouTube-600K instead of HowTo100M. Note that HowTo100M $\rightarrow$ Crosstask results are pre-trained on less data when compared to the original works due to video deletion. + +![](images/9858e87dbcaf62c5d306d02d206480511e525d1f4fef63a88420d3c1e3859db8.jpg) +Figure 5: Meta-category AUC with window size of 5, but test-time windows are sampled without overlap. + +we sample 256 candidates per video (and then filter out clips without associated temporal ASR), the windows frequently overlap. We ran additional experiments to ensure that our results held when we sampled non-overlapping clips at testing time. + +We computed an alternate version of the intravideo AUC results using a 140K training iteration checkpoint. Instead of sampling 256 segments at testing time, we only (randomly) sample up to 10 segments, but force them to be non-overlapping. There are some videos that are discarded in this process. For 1/500 videos (or so) we cannot sample non-overlapping segments. However, among the majority of videos for which the sampling is successful, the Spearman correlation with the category-level results allowing for overlap is $\rho = .98$ . Figure 5 reproduces the metacategory plot from the main paper, but with test-time segments sampled without overlap. + +# E Additional Window Sizes + +The results presented in the main paper use a temporal window size of five seconds. We were curious as to the stability of our observations with respect to the choice of this window size. While changing the window size, to an extent, changes + +![](images/9c34858d53d55413441185e4296998fcd8ab817fdf79b1dab08cd5bdf4500776.jpg) +(a) Window size $= 10$ + +![](images/2ac2545270aa3f2e68777c13ba1dbb1c06b29794b13b9d76fb2328cc9c0c50a9.jpg) +(b) Window size $= 30$ +Figure 6: Meta-category AUC using models trained with alternate window sizes of $t = 10, 30$ seconds. The main paper results are with $t = 5$ second windows. + +the nature of the task, we ran with window size 10s and window size 30s to measure the stability of the results. + +Category-level AUC. We computed the intra-video AUC values for the models trained with alternate window sizes. Largely, while the individual AUC values may change by a point or two, the relative pattern stayed the same. The per-category Spearman correlation with the results for the $t = 5$ windows was high: $\rho = .99$ for $t = 10$ and $\rho = .96$ for $t = 30$ (both correlations are true with $p \ll .001$ ). It should be noted that there are marginal differences in the development set videos used for the experiments at $t = 5, 10, 30s$ : because experiments were run at different times, due + +
DomainExample Categories (AUC)
VehiclesCrossover SUV (73); Sedan (72); Minivan (72); Station wagon (71)
WalkthroughsHotel Suite (74); Apartment (72); Dining room (71); Living room (70)
AdvertisingAdvertising (69); Television advertisement (67); Infomercial (64)
Tech ReviewsCNET (67), Netbook (68), Asus (66) iPhone 5S (66), MacBook (66)
ToysFunko (68); Monster High (66); Figurine (66) Action Figure (66)
AppliancesHome appliance (67); Washing machine (66); Kitchen stove (66)
PlacesGreenhouse (63) University (63); Amusement park (60)
+ +to video deletion, $2\%$ fewer videos were available for later experiments. Figure 6 recreates the metacategory plot from the main paper with the different window sizes; Tables 4 and 5 report the same category-level AUC values as the table in the main paper. Overall, the results are very similar. + +Transfer learning. In the main paper, we explored the differences between models trained on YouTube-600K vs. HowTo100M. Here, we conducted the same YouTube8M self-grounding experiments as described in the main paper (varying the training set) with $w = 10$ instead of $w = 5$ . The results are very similar. In terms of intra-video AUC, $M_{\text{Diverse}}$ (trained on YouTube-600K) outperforms $M_{\text{Instructional}}$ (trained on HowTo100M) on $58\%$ of videos (compared to $59\%$ for $w = 5$ in the main paper). If we split the data across the "Is-it-instructional" human judgements and compare the two models in each subset, $M_{\text{Instructional}}$ "wins" in $57\%$ of the instructional videos (compared to $57\%$ for $w = 5$ in the main paper), whereas $M_{\text{Diverse}}$ "wins" in $63\%$ of non-instructional cases (compared to $65\%$ for $w = 5$ in the main paper). + +# F Additional Reproducability Information + +The models were trained and evaluated on a mix of TPU and GPU clusters. Depending on the particular hardware, the training process takes roughly 1 or 2 days to get 300K training iterations. While we make no particular claim about parameter/time efficiency, the number of parameters of our models are similar to HowTo100M's, i.e., roughly 50M. The runtime of our model is relatively fast — on GPUs, batches of hundreds of videos can be processed in seconds. For hyperparameters not + +Table 4: High groundability categories with $t = {10}$ seconds. + +
DomainExample Categories (AUC)
VehiclesCrossover SUV (72); Sedan (72); Minivan (71); Station wagon (71)
WalkthroughsHotel Suite (74); Apartment (71); Dining room (72); Living room (71)
AdvertisingAdvertising (67); Television advertisement (65); Infomercial (61)
Tech ReviewsCNET (65), Netbook (67), Asus (65)
ToysiPhone 5S (64), MacBook (65)
AppliancesFunko (66); Monster High (65); Figurine (65) Action Figure (66)
PlacesHome appliance (65); Washing machine (64); Kitchen stove (64)
Greenhouse (61) University (60); Amusement park (59)
+ +Table 5: High groundability categories with $t = {30}$ seconds. + +specifically described, we mirror the choices made in the HowTo100M public repo. $^{7}$ For evaluating CrossTask, we wrote our own recall computing code that mirrors the setup publicly released by the authors; $^{8}$ this includes several ad-hoc decisions, e.g., computing the floor/ceiling of temporal annotations in CrossTask to form the window, and only counting a "hit" when the predicted time is strictly less than the ceiling (rather than less than or equal). + +# References + +Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, Mustafa Suleyman, and Andrew Zisserman. 2017. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950. +Antoine Miech, Dimitri Zhukov, Jean-Baptiste Alayrac, Makarand Tapaswi, Ivan Laptev, and Josef Sivic. 2019. HowTo100M: Learning a Text-Video Embedding by Watching Hundred Million Narrated Video Clips. In ICCV. +Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. 2019. VideoBERT: A joint model for video and language representation learning. In ICCV. +Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. 2017. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV. +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 CVPR. + +Saining Xie, Chen Sun, Jonathan Huang, Zhuowen Tu, and Kevin Murphy. 2018. Rethinking spatiotemporal feature learning: Speed-accuracy trade-offs in video classification. In ECCV. +Dimitri Zhukov, Jean-Baptiste Alayrac, Ramazan Gokberk Cinbis, David Fouhey, Ivan Laptev, and Josef Sivic. 2019. Cross-task weakly supervised learning from instructional videos. In CVPR. \ No newline at end of file diff --git a/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/images.zip b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..917c47103999bbeac6dbd37ffe502ad0f80c5fe3 --- /dev/null +++ b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6803412f5ef3521ab24fae70237c7f61cff86947094335d16e43a3d461fc78f +size 404377 diff --git a/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/layout.json b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..8333f3e9269693f1d587cdefcdcd8a9408509bf9 --- /dev/null +++ b/beyondinstructionalvideosprobingformorediversevisualtextualgroundingonyoutube/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8ed3951c0114167d27830cbe0068aae2173d066bd2999757c310d79449268f5 +size 342207 diff --git a/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_content_list.json b/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c41440dc058e03c0e3c895d55def1b89ce281400 --- /dev/null +++ b/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d6cba7a31c898962706ccaca1bb439b815071d028e1e9fc59e7ecf8f53bd584 +size 80872 diff --git a/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_model.json b/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_model.json new file mode 100644 index 0000000000000000000000000000000000000000..54e73dff4bdd3e6a937b24eb583da5775114db4f --- /dev/null +++ b/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f7b9c2a3e3d2913d1836e40e8d8721b058a842b5352da6d5e678645dbd438a0 +size 96404 diff --git a/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_origin.pdf b/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4e1f6e300694f4008ece6d62bfa74359978a0f31 --- /dev/null +++ b/biomedicaleventextractionassequencelabeling/7a6dba46-def0-4537-955d-594be6af7154_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a8b69d5b79672736b50b41d851c24fe869440991b4d8e972a67e18b914d40db +size 559672 diff --git a/biomedicaleventextractionassequencelabeling/full.md b/biomedicaleventextractionassequencelabeling/full.md new file mode 100644 index 0000000000000000000000000000000000000000..d0120d5aab7c23b124174669e4765e6ebe59ebb7 --- /dev/null +++ b/biomedicaleventextractionassequencelabeling/full.md @@ -0,0 +1,315 @@ +# Biomedical Event Extraction as Sequence Labeling + +Alan Ramponi\* Rob van der Goot\* Rosario Lombardo\* Barbara Plank\* + +$\diamond$ Department of Information Engineering and Computer Science, University of Trento, Italy + +$\spadesuit$ Department of Computer Science, IT University of Copenhagen, Denmark + +Fondazione the Microsoft Research - University of Trento + +Centre for Computational and Systems Biology (COSBI), Italy + +ramponi@cosbi.eu, robv@itu.dk, lombardo@cosbi.eu, bapl@itu.dk + +# Abstract + +We introduce Biomedical Event Extraction as Sequence Labeling (BEESL), a joint end-to-end neural information extraction model. BEESL recasts the task as sequence labeling, taking advantage of a multi-label aware encoding strategy and jointly modeling the intermediate tasks via multi-task learning. BEESL is fast, accurate, end-to-end, and unlike current methods does not require any external knowledge base or preprocessing tools. BEESL outperforms the current best system (Li et al., 2019) on the Genia 2011 benchmark by $1.57\%$ absolute F1 score reaching $60.22\%$ F1, establishing a new state of the art for the task. Importantly, we also provide first results on biomedical event extraction without gold entity information. Empirical results show that BEESL's speed and accuracy makes it a viable approach for large-scale real-world scenarios. $^{1}$ + +# 1 Introduction + +Biomedical event extraction provides invaluable means for assisting domain experts in the curation of knowledge bases and biomolecular pathways (Ananiadou et al., 2010). While the task has received significant attention in research over the last decade, it remains challenging. Progress has been rather stagnating (see Figure 1). + +Events are typically highly complex and nested structures, which require deep contextual knowledge to resolve. This is particularly the case for biomedical NLP (Kim et al., 2011), where biomolecular events can be nested (Miwa et al., 2014) and long-distance arguments are frequent (Li et al., 2019). Figure 2 shows an example with four events. Each event consists of an event mention (trigger) and one or more arguments. For instance, there is a +REGULATION event triggered by the + +![](images/7ef64c6c6f40ee8b804d03d701254e4315c0409cb4f61e132d8c9c6e30127f02.jpg) +Figure 1: Performance of biomedical event extraction on the BioNLP Genia 2011 test set over time. + +span "induced", with a PROTEIN entity (i.e., "IL-12") as CAUSE and a nested +REGULATION event (i.e., "activation") as Theme. Many state-of-the-art biomedical event extraction systems still work as a pipeline and extract event triggers and their arguments independently (Björne and Salakoski, 2018; Li et al., 2019). They typically employ dependency parsing as features in a CNN model ensemble (Björne and Salakoski, 2018) or in TreeLSTMs with knowledge bases (Li et al., 2019). + +We propose a new approach for biomedical event extraction by casting it as a sequence labeling task (BEESL). Our approach is conceptually simple: we convert the event structures into a representation suitable for sequence labeling, and leverage a multi-label aware decoder with BERT (Devlin et al., 2019) in a multi-task sequence labeling model. This reduces the problem to predicting a structured output for an input sequence to word-level tagging decisions. Compared to previous alternatives (cf. Section 7) which cast event extraction as syntactic or semantic tree- or graph-parsing task, this leads to a faster, joint model which also mitigates error propagation of locally-optimized classifier pipelines (Björne and Salakoski, 2018; + +![](images/52ce311cdce3b1dea7e8961dd6b3255ea87e69265e2ba1eeb813623c37e49d70.jpg) +Figure 2: Top: a text excerpt with four biomedical events. Above the text (italicized), mentions (triggers inside rounded boxes, and entities without rounded boxes) and argument roles are indicated. Bottom: our proposed encoding, where $d$ , $r$ and $h$ represent the label parts for dependents, relations, and heads, respectively. + +Li et al., 2019). Our empirical evaluation shows the effectiveness of BEESL for biomedical event extraction. A quantitative and qualitative analysis shows that BEESL is fast and effective. Despite the model's simplicity, BEESL outperforms the previous best model (Li et al., 2019) on most event categories. + +Contributions To the best of our knowledge, we are the first to cast biomedical event extraction as sequence labeling. We demonstrate that BEESL is an attractive and efficient solution to extract biomedical events. We evaluate it on the BioNLP Genia 2011 benchmark, obtaining a new state of the art (cf. Figure 1), while gaining on efficiency. We additionally provide empirical results of the impact of alternative multi-task encodings, and to the best of our knowledge, the first results of biomedical event extraction without assuming gold entities. + +# 2 Encoding Event Structures + +This section introduces the event structures and how we encode them for sequence labeling. + +# 2.1 Event structures + +Events are structured representations which comprise multiple information units (Figure 2, top). An event is anchored to a trigger, a text span which indicates the presence of an event (Figure 2, rounded boxes). Each event has one or more arguments, namely entities or other events (Figure 2, end of arrows), which are assigned a role in the event (Figure 2, labels on arrows). For example, an EXPRESSION event is indicated in Figure 2 at "production" involving the PROTEIN "IL-10" as its argument. Nested structures are possible and frequent. For instance, the +REGULATION event centered on "activation" is both argument of the "induced"-anchored event as well as the "promote"-anchored event. + +# 2.2 Sequence labeling encoding + +Given $[x_1, \ldots, x_n]$ a sequence of $n$ tokens, we encode event structures as token-level labels $[y_1, \ldots, y_n]$ , to reduce the task to a sequence labeling problem. Adopting dependency parsing terminology, we encode the label $y_i$ for each token $x_i$ as a tuple $\langle d, r, h \rangle$ , where $d$ is the dependent and refers to the token and its mention type (either trigger, entity, or nothing), $r$ is the relation and used to refer to its role, and head $(h)$ denotes the event the token refers to (Figure 2, bottom). In more detail, to discriminate event heads with the same type in text, we encode the heads $h$ as relative head mention position. For instance, $h = +\mathrm{REG}_{+1}$ means the head is the first +REGULATION on the right of $d$ in the relative surface order, whereas $h = +\mathrm{REG}_{-2}$ means it is the second +REGULATION on the left. In Figure 2 the label for "production" is $\langle \text{EXPRESSION}, \text{THEME}, +\mathrm{REG}_{-1} \rangle$ , denoting the token is an EXPRESSION trigger, THEME of the first +REGULATION event on the left. + +As opposed to dependency parsing, tokens may have zero or multiple roots, and thus multiple heads and relations. This poses additional challenges. For instance, the "activation"-anchored event (Figure 2) is both THEME and CAUSE of "induced"-and "promote"-anchored event heads, respectively. As a result, both $r$ and $h$ are multi-label, and the label for "activation" is encoded as $\langle +\text{REGULATION}, [\text{THEME}, \text{CAUSE}], [+ \text{REG}_{-1}, + \text{REG}_{+1}] \rangle$ , where the order of $r$ and $h$ items is preserved. + +# 3 Event Extraction as Sequence Labeling + +Formally, we aim to learn a function $f: X \mapsto Y$ that assigns each token $x_{i}$ a structured label $y_{i}$ , i.e., + +![](images/30aed9b98e1497aaf2eac7717efb8d295f0cb30e4535cc6d72b2b50d3411812b.jpg) +Figure 3: BEESL uses a multi-task multi-label model, using a BERT encoder with layer attention, and dedicated decoders for predicting the labels for each label sub-space, which are trivially merged. + +$\langle d, r, h \rangle$ . A straightforward solution is to predict the label $y_i$ as an atomic entity (i.e., single label) in a single-task model. For BEESL, we instead propose to use multi-task learning (MTL) which allows to learn interdependencies while cutting down the label space, paired with multi-label prediction. + +An overview of BEESL is shown in Figure 3. We use BERT (Devlin et al., 2019) as encoder, pretrained on biomedical texts (Section 4). We mask entity spans for better generalization (Alt et al., 2019). The first WordPiece (Schuster and Nakajima, 2012) of each token $x_{i}$ is used for prediction, where the contextual hidden representation $e_{i}$ of the token $x_{i}$ is encoded with layer-wise attention over the BERT layers, similarly to (Peters et al., 2018; Kondratyuk and Straka, 2019). As decoders, we use standard softmax with a cross entropy loss unless otherwise specified, and introduce a multi-label decoder (Section 3.2) (Figure 3, upper right). + +We empirically evaluate both single-task and multi-task setups, including several MTL encoding alternatives, discussing their limitations and benefits. In the following, we first introduce the multi-task setups, and then multi-label decoding. + +# 3.1 Multi-task strategies + +We denote the label spaces for each component of the labels as $d_{i} \in D, r_{i} \in R,$ and $h_{i} \in H$ . Further, + +we use $\mathcal{L}$ to refer to the maximum label space size. + +Single-task A single-task (ST) setup is used as a baseline. It predicts a single label $y_{i} = \langle d,r,h\rangle$ for each input token $x_{i}$ . The label space is up to $\mathcal{L} = |D|\times |R|\times |H|$ . + +Multi-task The label $y_{i}$ for each token $x_{i}$ is decomposed into parts (hereafter, sub-labels), each treated as a prediction task. The decomposition of the label space allows each sub-label space to be framed as a different task with its own private decoder, mitigating the output space sparsity (Vilares et al., 2019). Depending on the decomposition of the label $y_{i} = \langle d,r,h\rangle$ , we have four multi-task learning options (pairs of tasks, or each subpart as a task, respectively) with the following properties: + +1. $\langle d\rangle ,\langle r,h\rangle$ : up to $\mathcal{L} = |D| + |R|\times |H|$ +2. $\langle d,r\rangle ,\langle h\rangle$ : up to $\mathcal{L} = |D|\times |R| + |H|$ +3. $\langle d,h\rangle ,\langle r\rangle$ : up to $\mathcal{L} = |D|\times |H| + |R|$ +4. $\langle d\rangle ,\langle r\rangle ,\langle h\rangle$ : up to $\mathcal{L} = |D| + |R| + |H|$ + +Option 4 encodes each subpart as its own task. While this leads to the smallest label space, it decouples the problem into 3 separate tasks. Options 1-3 are pair-wise task setups. We hypothesize that BEESL benefits from disentangling mention detection from head labeling (option 1). + +As illustrated in Figure 3, BEESL uses the predicted sub-labels to form the complete label tuple $\hat{y}_i = \langle \hat{d},\hat{r},\hat{h}\rangle$ . In case $r$ and $h$ belong to different sub-label spaces (as is possible in options 2-4), we require that both predictions $\hat{r}$ and $\hat{h}$ are present (non-empty) to ensure well-formedness. This is a downside of these alternative options 2-4, as we will see empirically (Section 5). + +During training, the MTL loss is computed as $L = \sum_{t} \lambda_{t} L_{t}$ , where $L_{t}$ is the loss for each task $t$ , given by the respective decoder (see also Section 3.2), with $\lambda_{t}$ a task-specific weighting parameter. In our experiments we kept $\lambda = 1.0$ for all, since preliminary experiments showed weighting sub-tasks differently was not beneficial. In the single-task setup, the loss reduces to $L = L_{t}$ . + +# 3.2 Multi-label decoder + +The multi-label decoder is designed to handle multiple labels per token, thus being suitable for predicting relations and heads. Given a task with $l_{j} \in L$ labels, it models $P(l_{j}|e_{i})$ for each label $l_{j}$ . Differently from the single-label decoder, each label + +
ItemTrainDevTest
Documents908259347
Sentences8,6642,8883,363
Tokens230,73774,33490,091
Entities11,6254,6905,301
Events10,3103,2504,487
+ +Table 1: Statistics of the Genia 2011 event dataset. + +is predicted with a sigmoid, where all contribute equally to the loss. Given the probabilities $P(l_{j}|e_{i})$ for the $l_{j} \in L$ labels and a threshold $\tau$ , the token $x_{i}$ is assigned all the labels $l_{j}$ with probability $P(l_{j}|e_{i}) \geq \tau$ . If no $P(l_{j}|e_{i}) \geq \tau$ is found, we take the highest scoring label $l_{j}$ (which may also be empty) as a fallback. We employ a binary cross-entropy loss, averaged across all batches. + +# 4 Experimental Setup + +We evaluate BEESL on the Genia 2011 benchmark (Kim et al., 2011), which comprises both abstracts and full-texts. The corpus consists of annotations for PROTEIN entities and 9 fine-grained event types. The Genia event extraction tasks expect both texts and entities as input, and complete events need to be predicted. Statistics on the dataset are shown in Table 1. + +Event types can be categorized into simple, binding and complex events, related to the number and types of arguments. Simple events require a THEMES only, binding events require one or more THEMES arguments, while complex events take both THEMES and CAUSE arguments, where both can in turn be other events, resulting in nested structures. Björne and Salakoski (2011) estimated that $37.2\%$ of the events in the data are nested. We refer the reader to Appendix A.1 for formal event definitions. + +BEESL is based on MaChAmp (van der Goot et al., 2020), a toolkit for multi-task learning and fine-tuning of BERT-like models. We extend MaChAmp to also handle multi-label sequence labeling. We experiment with BEESL in single- and different multi-task setups. + +After sequence labeling, token-level labels are converted into the official BioNLP-ST standoff format for evaluation (Kim et al., 2011). We simply split the event arguments based on their formal definition, producing complete structures (e.g., an + +EXPRESSION event with $k$ Theme arguments is split into $k$ EXPRESSION events, with one Theme each). Similarly to previous work, we focus on sentence-level events. We used BioBERT-Base 1.1 as our BERT model for experiments, since it provides state-of-the-art performance across multiple biomedical information extraction tasks (Lee et al., 2019). For multi-label decoding, we tune the threshold $\tau$ for each setup (yielding $\tau_{MT} = 0.5$ and $\tau_{ST} = 0.7$ ). Other hyper-parameter values and tuning details are provided in Appendix A.2. + +Evaluation In line with previous work, we evaluate BEESL in terms of precision (P), recall (R), and F1 score according to the approximate recursive span matching criterion (Kim et al., 2011) using the official BioNLP online evaluation service. For early stopping during training, we employ the simpler span-based F1 score (as used in named entity recognition) as our proxy metric. We found it highly correlates with the approximate recursive span based F1 official metric. + +No gold entities In biomedical event extraction, entities are typically given in advance. To evaluate BEESL in a setup with predicted entities (Section 6.3), we firstly employ our model as single-task sequence labeler for BIO-tagged entity mentions using default settings and a standard CRF decoder (Gardner et al., 2018). Note that for comparison purposes in all other experiments we assume entity mentions are gold-tagged. Then, we evaluate BEESL with raw texts and predicted entities as input, thus indirectly penalizing events that take over-predicted entities or that miss entities since they are under-predicted. + +# 5 Results + +First, we evaluate the MTL and multi-label decoding strategies on the development set to determine the best setup (Sections 5.1, 5.2). Then, we compare BEESL to the results obtained by the top performing systems on the official test set (Section 5.3). Finally, we gauge its speed (Section 5.4). + +# 5.1 Multi-task settings + +Table 3 (top) summarizes the main results for the MTL experiments. They confirm our hypothesis that $\langle d\rangle ,\langle r,h\rangle$ (option 1) is the most viable representation; it leads to the highest F1 score, largely + +
WorkMethodPRF1
Riedel et al. (2011)FAUST - Model combination (joint+Parsing)64.7549.4156.04
Miwa et al. (2012)EventMine - SVM pipeline (+coref)63.4853.3557.98
Venugopal et al. (2014)BioMLN - SVM pipeline & MLN (joint)63.6153.4258.07
Majumder et al. (2016)Stacked generalization66.4648.9656.38
Björne and Salakoski (2018)TEES - CNN pipeline (single model)64.8650.5356.80
Björne and Salakoski (2018)TEES - CNN pipeline (5x ensemble)68.7649.9757.87
Björne and Salakoski (2018)*TEES - CNN pipeline (mixed 5x ensemble)69.4549.9458.10
Li et al. (2019)BiLSTM pipeline62.1848.4454.46
Li et al. (2019)Tree-LSTM pipeline64.5650.2856.53
Li et al. (2019)KB-driven Tree-LSTM pipeline67.0152.1458.65
BEESLMulti-task neural sequence labeling69.7253.0060.22
+ +Table 2: Performance comparison on the test set of BioNLP Genia 2011. *indicates that the system was trained on training plus part of development data. BEESL uses the official training portion only. Top: traditional ML systems; Middle: state-of-the-art neural systems; Bottom: proposed multi-task sequence labeling system. + +
Multi-taskPRF1
(d), (r, h)71.2855.4462.37
(d, r), (h)72.3551.3160.04
(d, h), (r)73.5149.4959.16
(d), (r), (h)73.0551.3460.30
Multi-labelPRF1
BEESLST73.3052.4261.13
with multi-label71.7456.7163.34
BEESLMT71.2855.4462.37
with multi-label71.8459.4265.04
+ +Table 3: Performance of diverse settings for BEESL (multi-task and multi-label) on the development set. + +outperforming the other MTL options, particularly in recall. These results show that a multi-task setup with separate tasks for mention detection and head labeling, respectively, is the most useful. Option 1, i.e., $\langle d\rangle$ , $\langle r,h\rangle$ defaults to the multi-task option for BEESL (Figure 3) used in the following experiments. + +# 5.2 Adding the multi-label decoder + +We evaluate the multi-label decoder for both single-task $\left(\mathrm{BEESL}_{ST}\right)$ and multi-task $\left(\mathrm{BEESL}_{MT}\right)$ setups (Table 3, bottom). Multi-label decoding is beneficial, as the data contains many multi-headed tokens, and modeling them improves both setups. Single task performance increases substantially, from 61.13 to 63.34 F1 score. Similar signifi + +cant performance gains are observed for multi-task learning, from 62.37 to 65.04 F1 score. Regardless of the multi-label modeling, the multi-task setup provides the highest overall performance. + +# 5.3 Comparison to the state of the art + +We now compare the multi-task multi-label BEESL to the top performing systems (hereafter, simply BEESL). As shown in Table 2, BEESL outperforms the state-of-the-art by a large margin, i.e., an absolute improvement of 1.57 points in F1 score over the KB-Tree LSTM model (Li et al., 2019) (hereafter, KBTL). It improves over both precision and recall, and yields a new state of the art with an F1 score of $60.22\%$ , yet being conceptually simple. + +Table 4 compares F1 scores of BEESL to the previous best model on a per-event level (precision and recall are provided in Appendix A.3). BEESL outperforms the KBTL approach (Li et al., 2019) overall on 7 out of the 9 event types. From a coarse-grained perspective, BEESL outperforms KBTL on simple, binding, and complex event categories. Particularly, improvements over KBTL on simple events are as large as $+13\%$ F1 score. Furthermore, noticeable are also the improvements for binding and nested, complex events, for which our model achieves $50.19\%$ and $48.32\%$ F1 score. From a closer look, the recall of BEESL on simple events is substantially higher than KBTL, which ease a correct identification of complex events. + +Next, we look at performance per text type (i.e., abstract and full-text subsets). BEESL achieves $62.14\%$ F1 score on abstracts-only documents, + +
Event typeBEESLKBTL
Simple events79.3178.73
Gene expression80.9080.28
Transcription69.4675.39
Protein catabolism74.0760.87
Phosphorylation89.5284.36
Localization69.5168.47
Binding50.1944.10
Complex events48.3247.72
Regulation45.9043.52
Positive regulation49.4148.26
Negative regulation47.1749.02
All events60.2258.65
+ +and $55.59\%$ F1 score on full-texts. This confirms that full-texts are harder to process than abstracts, due to the differences in structural and content aspects (Cohen et al., 2010). + +To sum up, BEESL handles events well, and unlike most prior work, does not use knowledge bases or dependency parsers as pre-processing step. BEESL uses multi-task learning with a contextual encoder and multi-label aware decoding, herewith bringing progress to the biomedical event extraction task as illustrated in Figure 1. + +# 5.4 Speed comparison + +We compare BEESL to TEES, the Turku Event Extraction System (Björne and Salakoski, 2018) to compare their speed at inference time on commodity hardware. TEES is the 2nd top-performing system (Figure 1), and its code is freely available. To the best of our knowledge, the source code of (Li et al., 2019) is not yet available. + +Results in Table 5 show that BEESL is $\sim 2\mathrm{x}$ faster and $\sim 5\mathrm{x}$ faster on a consumer grade $\mathrm{CPU}^5$ than TEES single and ensemble system, respectively. In terms of sentences per minute, BEESL processes $\sim 500$ sents/min compared to 255 sents/min and 101 sents/min in TEES single (3.42% lower F1) and ensemble (2.12% lower F1), respectively. + +Table 4: Per-event performance of BEESL and KBTL (KB-driven TreeLSTM) (Li et al., 2019) on the test set. + +
sents/min
TEES (single)255±1
TEES (ensemble)101±1
BEESL499±3
+ +Table 5: Speed comparison to TEES (Björne and Salakoski, 2018) single and ensemble models at inference time. Results are sents/min, averaged over 5 runs. + +
SettingPRF1
BEESL71.8459.4265.04
- multi-task71.6656.9563.47
- multi-label74.2852.3961.44
+ +Table 6: Ablation study on BEESL when removing the multi-task capability (i.e., replacing MTL with independent classifiers) and the multi-label handling. + +# 6 Analysis and Discussion + +To gain insights about BEESL, we shed more light on several aspects. Firstly, we analyze how much BEESL gains from multi-task learning, compared to using a powerful contextualized BERT encoder alone in a single-task learning setup and a formulation with two independent classifiers (Section 6.1). Then, we quantify the stability of the threshold $\tau$ of the multi-label decoder (Section 6.2). We also aim to get deeper insight on model performance without gold entities (Section 6.3), and qualitatively study the sources of prediction errors of BEESL (Section 6.4). + +# 6.1 How important is multi-task learning? + +As opposed to running one single model which models $\langle d\rangle$ and $\langle r,h\rangle$ jointly in a multi-task setup, we also compare to single-task (ST) and an experiment in which we formulate two classifiers which predict the two labels from the best MTL setup separately. This allows us to gauge the effectiveness of the multi-task learning approach compared to local classifiers which use strong BERT-based encoding, and compared to predicting an atomic label in ST. + +Results in Table 6 confirm that leveraging a shared encoder and multi-task learning for both triggers and heads is crucial. Without multi-task learning and multi-label decoding, the F1 score drops to 61.44 (independent classifiers) and 61.13 + +
SettingF1Δ
BEESLST (multi-label)63.34
with best-only prediction62.87-0.47
BEESLMT (multi-label)65.04
with best-only prediction64.54-0.50
+ +![](images/ea06511886ede52c986ac42635bf7f3fff37da4492ce2395e02a5b36bc45b286.jpg) +Figure 4: Stability of the threshold $\tau$ . Values in the range 0.3-0.7 only minimally alter BEESL scores. + +(ST setup, $\mathrm{BEESL}_{ST}$ in Table 3). Adding multi-label decoding helps, as expected. However, the full power of BEESL is only achieved by using both the multi-task and the multi-label approach, which leads to the novel state of the art. + +# 6.2 How brittle is BEESL to the threshold $\tau$ ? + +As shown in Table 3, using a multi-label decoder largely increases the performance of a system with a single-label decoder (from 62.37 to 65.04 F1 score). However, what is left is how much the threshold $\tau$ impacts the performance. To get insights on it, we firstly performed an ablation study setting $\tau = 1.0$ . As introduced in Section 3.2, this reduces to predicting the highest scoring label only - however, in a reduced label space induced by the multi-label aware decoder. We found only part of the improvement is due to the threshold $\tau$ in both multi-task and single-task settings (+0.50% and +0.47%, respectively) (Table 7). + +Moreover, we evaluated BEESL with different $\tau$ values. As shown in Figure 4, a threshold in the range 0.3-0.7 only marginally alters the results, which are still better than predicting the highest scoring label only ( $\tau = 1.0$ ). + +# 6.3 What is the effect of using gold entities? + +The standard in biomedical event extraction is to evaluate the performance of a system on gold en + +Table 7: Ablation study on the threshold $\tau$ of the multi-label decoder ("with best-only prediction": $\tau = {1.0}$ ). + +
PRF1
BEESL71.8459.4265.04
- gold entities66.1554.0959.51
+ +Table 8: Performance of BEESL with no gold entities. + +
Error typeFraction
Trigger
Under-prediction31.43%
Over-prediction28.57%
Wrong type10.00%
Argument
Under-prediction22.86%
Over-prediction7.14%
Wrong type0.00%
+ +Table 9: Error analysis on a random sample of 30 documents from the development set. + +tities. In real-world situations it is unlikely that the data is annotated for entities. We believe it is important to estimate the impact non-gold entities have on system performance (hereafter, silver entities). The performance of the entity prediction on the development set is 87.95 span-based F1 score. + +The results on the event extraction task using silver entities are shown in Table 8. The overall drop in F1 amounts to around $5\%$ , and it is well-balanced across precision and recall. This shows that BEESL's performance is clearly affected, but that the system is relatively robust to noisy, nongold silver entities. We believe that this performance gap can be further minimized by using jackknifing (Agic and Schluter, 2017) to reduce data mismatch, however, this requires to align the predicted entities with the existing events in the training data, which is non-trivial, and we leave this for future work. + +# 6.4 What are the sources of errors? + +We randomly sampled 30 documents (comprising 168 gold events) from the development set for a manual scrutiny for sources of errors. We classified errors into two broad categories, namely trigger and argument errors. Further, we classify them in fine-grained categories based on the type of error, namely under-prediction, over-prediction, and wrong type. Table 9 summarizes the results. + +We notice the largest fraction of errors is due to + +trigger errors. From a closer look, under-predicted triggers account for $31.43\%$ of the total, whereas over-predicted triggers for $28.57\%$ . We investigated the reason for these errors, finding that over-predicted triggers are often due to generic words used very frequently to indicate specific trigger types. For instance, BEESL identifies the +REGULATION event anchored at "activated" in the following sentence: "Tax [...] maximally activated HTLV-I-LTR-CAT and kappa B-fos-CA" albeit the gold standard does not contain the event in this instance. However, from a semantic point of view we believe these errors are acceptable. Other cases include the words such as "detected" and "influences", which are often used as EXPRESSION and REGULATION event triggers, respectively. + +Under-prediction of triggers is instead due to a variety of reasons. Both rare words (e.g., a + REGULATION event centered on "co-transfected") and uncertain events account for a large fraction of this error type. An example of uncertain event is represented by the + REGULATION trigger "importance" in the sentence "[...] importance of NF-kappa B in LT gene expression", that BEESL does not predict. + +Wrongly typed triggers represent only $10\%$ of the errors. An example is represented by ambiguous trigger types. In the sentence "T cells upregulates A3G mRNA levels", BEESL classifies "levels" as an EXPRESSION trigger, while the gold annotation indicates it is a TRANSCRIPTION trigger. By a closer look, we found some triggers in the corpora are annotated as EXPRESSION and TRANSCRIPTION types interchangeably. This is due to the fact a TRANSCRIPTION is a gene EXPRESSION. + +Regarding the identification of arguments, over-predictions are quite uncommon. If erroneous, the main error we found may benefit from syntactic information, which we aim to integrate in a multitask setup in future work. We found no misclassification of arguments in our document samples. Under-prediction of arguments are instead mostly due to under-predicted events. + +# 7 Related Work + +Biomedical event extraction has a long-standing tradition (Riedel et al., 2011; Miwa et al., 2012; Vlachos and Craven, 2012; Venugopal et al., 2014; Majumder et al., 2016). Current work has explored neural methods and uses multiple classification stages. Namely, first identifying trigger mentions, and then evaluating all entity pairs (Li + +et al., 2019; Björne and Salakoski, 2018). They come with the shortcomings of traditional pipeline methods. Many studies use dependency parsers to obtain features or for guidance of Tree-LSTMs (Li et al., 2019; Björne and Salakoski, 2018). + +Recent work in syntactic parsing has shown that reducing parsing to sequence labeling is a viable alternative for both constituent and dependency parsing (Spoustova and Spousta, 2010; Gomez-Rodriguez and Vilares, 2018; Strzyz et al., 2019), which we took as inspiration. Moreover, earlier work framed biomedical event extraction as syntactic and semantic tree- or graph-parsing (McClosky et al., 2011; Rao et al., 2017). In particular, McClosky et al. (2011) do dependency parsing, followed by a second-stage parse reranker model for event extraction, and Rao et al. (2017) cast the problem as subgraph identification problem. + +Joint learning for biomedical event extraction was explored in early work (Riedel and McCallum, 2011; Venugopal et al., 2014; Vlachos and Craven, 2012). Contemporary to our work, a very recent study proposes oneIE, a joint learning model for event extraction (Lin et al., 2020). It proposes a single end-to-end model for event extraction using 4 stages, paired with a beam search, obtaining good results on ACE data. Processing multiple heads has previously been done for relation extraction using multi-head selection (Bekoulis et al., 2018a,b), and sequence labeling has been employed for joint entity and relation classification (Dai et al., 2019) with inter-token attention. We employ it at the token-level for multi-label sequence labeling. + +# 8 Conclusion + +This paper proposes BEESL, a new end-to-end biomedical event extraction system which is both efficient and accurate. BEESL is broadly applicable to event extraction and other tasks that can be recast as sequence labeling. The system's strength comes from the joint multi-task modeling paired with multi-label decoding, which aids interdependencies between the tasks and is superior to alternative decoders based on strong contextualized BERT embeddings. BEESL is fast, and achieves state-of-the-art performance on the Genia 2011 event extraction benchmark without the need of external tools for features and resources such as knowledge bases. Our analysis shows that BEESL works very well across event types. + +We release the code freely, to foster research + +on using BEESL for other NLP tasks as well, e.g., enhanced dependency parsing, fine-grained named entity recognition, and semantic parsing. + +# Acknowledgments + +This research was supported by Fondazione the Microsoft Research - University of Trento Centre for Computational and Systems Biology, Italy, an Amazon Research Award, Independent Research Fund Denmark (Sapere Aude grant 9063-00077B), and NVIDIA corporation for sponsoring Titan GPUs. + +# References + +Zeljko Agić and Natalie Schluter. 2017. How (not) to train a dependency parser: The curious case of jackknifing part-of-speech taggers. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 679-684, Vancouver, Canada. Association for Computational Linguistics. +Christoph Alt, Marc Hübner, and Leonhard Hennig. 2019. Improving relation extraction by pre-trained language representations. In Proceedings of AKBC 2019. +Sophia Ananiadou, Sampo Pyysalo, Jun'ichi Tsujii, and Douglas Kell. 2010. Event extraction for systems biology by text mining the literature. Trends in biotechnology, 28(7):381-390. +Giannis Bekoulis, Johannes Deleu, Thomas Demeester, and Chris Develder. 2018a. Adversarial training for multi-context joint entity and relation extraction. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2830-2836, Brussels, Belgium. Association for Computational Linguistics. +Giannis Bekoulis, Johannes Deleu, Thomas Demeester, and Chris Develder. 2018b. Joint entity recognition and relation extraction as a multi-head selection problem. Expert Systems with Applications, 114:34-45. +Jari Björne and Tapio Salakoski. 2011. Generalizing biomedical event extraction. In Proceedings of BioNLP Shared Task 2011 Workshop, pages 183-191, Portland, Oregon, USA. Association for Computational Linguistics. +Jari Björne and Tapio Salakoski. 2018. Biomedical event extraction using convolutional neural networks and dependency parsing. In Proceedings of the BioNLP 2018 workshop, pages 98-108, Melbourne, Australia. Association for Computational Linguistics. +K Bretonnel Cohen, Helen L Johnson, Karin Verspoor, Christophe Roeder, and Lawrence E Hunter. 2010. + +The structural and content aspects of abstracts versus bodies of full text journal articles are different. BMC bioinformatics, 11(1):492. +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 AAAI Conference on Artificial Intelligence, volume 33, 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, Volume 1 (Long and Short Papers), pages 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. +Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F. Liu, Matthew Peters, Michael Schmitz, and Luke Zettlemoyer. 2018. AllenNLP: A deep semantic natural language processing platform. In Proceedings of Workshop for NLP Open Source Software (NLP-OSS), pages 1-6, Melbourne, Australia. Association for Computational Linguistics. +Carlos Gómez-Rodríguez and David Vilares. 2018. Constituent parsing as sequence labeling. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1314-1324, Brussels, Belgium. Association for Computational Linguistics. +Rob van der Goot, Ahmet Üstün, Alan Ramponi, and Barbara Plank. 2020. Massive choice, ample tasks (MaChAmp): A toolkit for multi-task learning in NLP. arXiv preprint arXiv:2005.14672. +Jin-Dong Kim, Yue Wang, Toshihisa Takagi, and Akinori Yonezawa. 2011. Overview of Genia event task in BioNLP shared task 2011. In Proceedings of BioNLP Shared Task 2011 Workshop, pages 7-15, Portland, Oregon, USA. Association for Computational Linguistics. +Dan Kondratyuk and Milan Straka. 2019. 75 languages, 1 model: Parsing universal dependencies universally. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2779-2795, Hong Kong, China. Association for Computational Linguistics. +Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, and Jaewoo Kang. 2019. BioBERT: A pretrained biomedical language representation model for biomedical text mining. Bioinformatics, 36(4):1234-1240. + +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. +Ying Lin, Heng Ji, Fei Huang, and Lingfei Wu. 2020. A joint neural model for information extraction with global features. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7999-8009, Online. Association for Computational Linguistics. +Amit Majumder, Asif Ekbal, and Sudip Kumar Naskar. 2016. Biomolecular event extraction using a stacked generalization based classifier. In Proceedings of the 13th International Conference on Natural Language Processing, pages 55-64, Varanasi, India. NLP Association of India. +David McClosky, Mihai Surdeanu, and Christopher Manning. 2011. Event extraction as dependency parsing. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 1626-1635, Portland, Oregon, USA. Association for Computational Linguistics. +Makoto Miwa, Paul Thompson, and Sophia Ananiadou. 2012. Boosting automatic event extraction from the literature using domain adaptation and coreference resolution. Bioinformatics, 28(13):1759-1765. +Makoto Miwa, Paul Thompson, Ioannis Korkontzelos, and Sophia Ananiadou. 2014. Comparable study of event extraction in newswire and biomedical domains. In Proceedings of COLING 2014, the 25th International Conference on Computational Linguistics: Technical Papers, pages 2270-2279, Dublin, Ireland. Dublin City University and Association for Computational Linguistics. +Mark Neumann, Daniel King, Iz Beltagy, and Waleed Ammar. 2019. ScispaCy: Fast and robust models for biomedical natural language processing. In Proceedings of the 18th BioNLP Workshop and Shared Task, pages 319-327, Florence, Italy. Association for Computational Linguistics. +Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227-2237, New Orleans, Louisiana. Association for Computational Linguistics. +Sudha Rao, Daniel Marcu, Kevin Knight, and Hal Daume III. 2017. Biomedical event extraction using abstract meaning representation. In BioNLP + +2017, pages 126-135, Vancouver, Canada., Association for Computational Linguistics. +Sebastian Riedel and Andrew McCallum. 2011. Robust biomedical event extraction with dual decomposition and minimal domain adaptation. In Proceedings of BioNLP Shared Task 2011 Workshop, pages 46-50, Portland, Oregon, USA. Association for Computational Linguistics. +Sebastian Riedel, David McClosky, Mihai Surdeanu, Andrew McCallum, and Christopher D. Manning. 2011. Model combination for event extraction in BioNLP 2011. In Proceedings of BioNLP Shared Task 2011 Workshop, pages 51-55, Portland, Oregon, USA. 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. +Drahomíra Spoustová and Miroslav Spousta. 2010. Dependency parsing as a sequence labeling task. The Prague Bulletin of Mathematical Linguistics, 94(1):7-14. +Michalina Strzyz, David Vilaras, and Carlos Gomez-Rodriguez. 2019. Viable dependency parsing as sequence labeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 717-723, Minneapolis, Minnesota. Association for Computational Linguistics. +Deepak Venugopal, Chen Chen, Vibhav Gogate, and Vincent Ng. 2014. Relieving the computational bottleneck: Joint inference for event extraction with high-dimensional features. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 831-843, Doha, Qatar. Association for Computational Linguistics. +David Vilares, Mostafa Abdou, and Anders Søgaard. 2019. Better, faster, stronger sequence tagging constituent parsers. 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 3372-3383, Minneapolis, Minnesota. Association for Computational Linguistics. +Andreas Vlachos and Mark Craven. 2012. Biomedical event extraction from abstracts and full papers using search-based structured prediction. BMC Bioinformatics, 13(11):1759-1765. + +# A Appendix + +# A.1 Data and formal event definitions + +Events on the Genia 2011 benchmark follow the formal specification detailed in Table 10. The full data can be downloaded from the official portal. $^6$ + +
Event typeArguments
Simple events
Gene expressionTheme(P)
TranscriptionTheme(P)
Protein catabolismTheme(P)
PhosphorylationTheme(P)
LocalizationTheme(P)
BindingTheme(P)+
Complex events
RegulationTheme(P/E), Cause(P/E)
Positive regulationTheme(P/E), Cause(P/E)
Negative regulationTheme(P/E), Cause(P/E)
+ +# A.2 Hyper-parameters + +The list of hyper-parameter values and the search space are presented in Table 11, whereas the number of trainable parameters in BEESL is $\approx 110M$ . For tuning, we started from the values reported in previous works on multi-task learning for NLP evaluation benchmarks, e.g., UDify (Kondratyuk and Straka, 2019). We performed 32 search trials via grid search, in which "batch size" and "base learning rate" have been coupled - $(32, 1e^{-3})$ and $(64, 1e^{-2})$ . Additional 9 search trials have been performed for threshold $\tau$ selection for the BEESL multi-task multi-label model. We used the official approximate recursive span matching based F1 score for model selection, whereas the sum of span-based F1 scores of the tasks was employed to determine early stopping of the training process. + +# A.3 Miscellaneous + +Technical details Texts have been tokenized and segmented using scispaCy 0.2.4 (Neumann et al., 2019). In our data it is uncommon that multiple contiguous triggers have the same type, so BIO encoding is not needed. In the rare case of overlapping event triggers of different types, we create a single label $d$ concatenating their types. Similarly + +Table 10: Formal definition of events. P: PROTEIN, E: any event type, +: 1 or more arguments. + +
Hyper-parameterValueSpace
OptimizerAdam
β1, β20.9,0.99
Weight decay0.01
Gradient clipping10
Dropout0.50.1, 0.3, 0.5
BERT dropout0.10.1, 0.2
Mask probability0.10.1, 0.15, 0.2
Layer dropout0.1
Batch size6432, 64
Base learning rate1e-21e-3, 1e-2
BERT learning rate5e-5
Epochs50
Patience5
Multi-label threshold0.50.1, 0.2, ..., 1.0
+ +to previous work, for BINDING events with multiple Theme arguments we employ a simple heuristic to convert them into the BioNLP-ST standoff format (Vlachos and Craven, 2012). For speed experiments with TEES (Björne and Salakoski, 2018), we removed extra modules for a fair comparison. + +Detailed per-event scores We present in Table 12 a complementary view of scores (i.e., with precision and recall) of BEESL and the previous state of the art (Li et al., 2019) on a per-event level. + +Table 11: Hyper-parameter values and search space. + +
Event typeBEESLKBTL
PRF1PRF1
Simple events84.1774.9879.3185.9572.6278.73
Gene expression84.5577.5480.9087.2474.3580.28
Transcription72.5066.6769.4682.3169.5475.39
Protein catabolism83.3366.6774.0787.5046.6760.87
Phosphorylation94.0585.4189.5287.2881.6284.36
Localization83.2159.6969.5180.2859.6968.47
Binding65.3640.7350.1953.1637.6844.10
Complex events58.5441.1448.3255.7341.7347.72
Regulation62.2236.3645.9053.6136.6243.52
Positive regulation60.1441.9349.4157.9041.3748.26
Negative regulation53.1942.3847.1752.3946.0649.02
All events69.7253.0060.2267.0152.1458.65
+ +Table 12: Detailed per-event performance of BEESL and KBTL (KB-driven TreeLSTM) on the test set. + +Upper bound of the encoding We quantified the upper bound of our encoding strategy by directly evaluating the performance of the encoded development set. Results (P: $95.76\%$ , R: $91.30\%$ , F1: $93.48\%$ ) indicate the goodness of our strategy, and that the $\approx 6\%$ missing is due to cross-sentence arguments we disregard, similarly to previous work. \ No newline at end of file diff --git a/biomedicaleventextractionassequencelabeling/images.zip b/biomedicaleventextractionassequencelabeling/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..51f37d30d69e90edd9b9957f5da246c0a2d50eb6 --- /dev/null +++ b/biomedicaleventextractionassequencelabeling/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0b875725362fd1720f8bb6f2aa238d1f0c98e3f7c9ebd81c42304ee2ac6d1cb9 +size 607949 diff --git a/biomedicaleventextractionassequencelabeling/layout.json b/biomedicaleventextractionassequencelabeling/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..d9aa842a53054c872b83df89cf5722e5f0a8a16e --- /dev/null +++ b/biomedicaleventextractionassequencelabeling/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa785aa6527c0f7597fca6bce3be510c03f4198b84c2d3a444892fdabcc2ba9e +size 406134 diff --git a/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_content_list.json b/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..c789bb900f21124875bcd0e082d6ac1e10c8ccc4 --- /dev/null +++ b/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1491d05298646a7c739220e9df365e005c5f3bc590c73b8651d86677746e3ca +size 47426 diff --git a/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_model.json b/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1b4079f6a777eb6d947a3495372d3902667a08d5 --- /dev/null +++ b/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43da8dec2691b2c7bf505c430fcf369ccd885dd45bc0666cbc8714ea76c46f77 +size 56441 diff --git a/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_origin.pdf b/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a9a90447c83a1c0255a19f9cbcaf40cebb415156 --- /dev/null +++ b/biomegatronlargerbiomedicaldomainlanguagemodel/6c17b5c3-5ff1-4b61-a187-c0eb35ba5e36_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a59c5e01c479250bb9fab00bd66006664182a8bc8e180130fe8522c11831f0d1 +size 284277 diff --git a/biomegatronlargerbiomedicaldomainlanguagemodel/full.md b/biomegatronlargerbiomedicaldomainlanguagemodel/full.md new file mode 100644 index 0000000000000000000000000000000000000000..07f9e070bbfa03326f18288289b87174498b2cab --- /dev/null +++ b/biomegatronlargerbiomedicaldomainlanguagemodel/full.md @@ -0,0 +1,191 @@ +# BioMegatron: Larger Biomedical Domain Language Model + +Hoo-Chang Shin, Yang Zhang, Evelina Bakhturina, Raul Puri, Mostofa Patwary, Mohammad Shoeybi, Raghav Mani + +NVIDIA / Santa Clara, California, USA + +hshin@nvidia.com + +# Abstract + +There has been an influx of biomedical domain-specific language models, showing language models pre-trained on biomedical text perform better on biomedical domain benchmarks than those trained on general domain text corpora such as Wikipedia and Books. Yet, most works do not study the factors affecting each domain language application deeply. Additionally, the study of model size on domain-specific models has been mostly missing. We empirically study and evaluate several factors that can affect performance on domain language applications, such as the sub-word vocabulary set, model size, pre-training corpus, and domain transfer. We show consistent improvements on benchmarks with our larger BioMegatron model trained on a larger domain corpus, contributing to our understanding of domain language model applications. We demonstrate noticeable improvements over the previous state-of-the-art (SOTA) on standard biomedical NLP benchmarks of question answering, named entity recognition, and relation extraction. Code and checkpoints to reproduce our experiments are available at github.com/NVIDIA/NeMo. + +# 1 Introduction + +Effectively transferring the success of BERT (Devlin et al., 2018) to the biomedical domain, most notably Lee et al. (2019) (BioBERT) and Beltagy et al. (2019) (SciBERT) inspired a large number of similar works last year. For example, Peng et al. (2019); Alsentzer et al. (2019); Huang et al. (2019) added clinical text to the PubMed biomedical pretraining corpus and tested on standard biomedical and clinical NLP benchmarks. Many other similar works appeared at the ACL BioNLP Workshop (Demner-Fushman et al., 2019). + +More recently, Gu et al. (2020) performed a comprehensive study on the pre-training corpus domain, + +language model masking method, and adversarial training, benchmarking on a number of different datasets for token classification, sequence classification, and sequence regression. + +Compared to the previous works, we perform a more detailed study on (1) subword vocabulary, (2) labeling method, (2) model size, and (3) domain transfer, showing gains in token classification, sequence classification, and question answering. + +# 2 Related Works + +A prime example of Language Models (LMs) in the biomedical domain is BioBERT (Lee et al., 2019). It is a transformer LM pre-trained on the PubMed (www.ncbi.nlm.nih.gov/pubmed) biomedical text corpus comprised of biomedical literature abstracts. Their pre-training started from the checkpoint of Devlin et al. (2018) trained on Wikipedia and Books-Corpus. Independently, Beltagy et al. (2019) (SciBERT) pre-trained BERT from scratch using their vocabulary set on scientific text corpora, including PubMed abstracts and computer science papers. Both demonstrated increased performance over the previous non-BERT SOTA on biomedical benchmarks, including Named Entity Recognition (NER), Relation Extraction (RE), and Question Answering (QA). BioBERT and SciBERT report similar results on NER and RE, while only BioBERT report QA results. + +They inspired other follow-up works (Alsentzer et al., 2019; Huang et al., 2019; Peng et al., 2019), most notably translating their success to the clinical domain, adding the MIMIC-III (Johnson et al., 2016) clinical text corpus. Gu et al. (2020) (PubMedBERT) used the PubMed full-text for pretraining in addition to the abstracts, and use a domain vocabulary set learned from PubMed corpus. + +Meanwhile, they mostly report similar NER and RE tests and results, and only BioBERT reports QA + +results. Additionally, most use a $\mathrm{BERT}_{\mathrm{Base}}$ with 110M parameters. Peng et al. (2019) report slightly improved performance on RE using $\mathrm{BERT}_{\mathrm{Large}}$ while reporting worse results on NER, compared to $\mathrm{BERT}_{\mathrm{Base}}$ . These results on biomedical tasks do not benefit from scaling model size to the same degree as standard NLP benchmarks such as GLUE or SQuAD (Shoeybi et al., 2019; Raffel et al., 2019). + +# 3 Language Model Pre-training + +BERTBase & Large We compare our models to the pre-trained BERTBase & Large models of BioBERT (Lee et al., 2019) and PubMedBERT (Gu et al., 2020) (BERTBase) for fine-tuning and evaluation. For QA we use the BERTLarge variant of BioBERT following the authors' recommendation. + +BioMegatron Megatron-LM (Shoeybi et al., 2019) was introduced for efficient model parallel training of large LMs, with up to 8.3B parameters. Shoeybi et al. (2019) showed that rearranging the order of the layer normalization and the residual connections is critical to enabling the scaling of the BERT-style models beyond 336m parameters, and we use the same architecture. + +Megatron-LM also used a larger pre-training text corpus, comprised of Wikipedia (Devlin et al., 2018), CC-Stories (Trinh and Le, 2018), Real-News (Zellers et al., 2019), and OpenWebtext (Radford et al., 2019). For our LM training, we use the 4.5 billion-word PubMed abstract set and the 1.6 billion-word CC0-licensed Commercial Use Collection of the PMC full-text corpus (www.ncbi.nlm.nih.gov/pmc). + +We train three sizes of BioMegatron: with 345 million, 800 million, and 1.2 billion number of parameters. We compare four pre-training scenarios in the smallest 345m model - using BERT-cased/uncased vocabularies, each pre-trained from scratch and finetuned from general domain LM. We also compare two sets of domain vocabularies learned on PubMed text corpus using SentencePiece (github.com/google/sentencepiece) library, each containing 30k and 50k subword units. + +We train the larger BioMegatron models with less variation: 800m models from scratch on PubMed with BERT -cased/-uncased vocabularies; and 1.2b model starting from general domain LM checkpoint using BERT-uncased vocabulary. + +# 4 Downstream Benchmark Tasks + +We use the most widely used downstream biomedical benchmark datasets for NER, RE, and QA. + +Named Entity Recognition The BC5CDR (Li et al., 2016) NER dataset annotated disease and chemical terms with IOB tagging (Ramshaw and Marcus, 1999). In NCBI-disease (Doogan et al., 2014), only disease entities are IOB-tagged. + +Relation Extraction The ChemProt (Krallinger et al., 2015) dataset contains sentences from PubMed abstracts, where chemical-protein interaction types are annotated as five categories. Relation Extraction is essentially a sequence classification task, classifying a set of sentences into a category. + +Question Answering The BioASQ-7b factoid task (Tsatsaronis et al., 2015) is a biomedical QA dataset whose format is similar to the SQuAD dataset (Rajpurkar et al., 2016). In this task, context-snippet, question and answer triplets, and factoid question/answers are evaluated with strict accuracy (SAcc), lenient accuracy (LAcc), and mean reciprocal rank (MRR). + +# 5 Results and Discussion + +The evaluation results on NER and RE are shown in Table 1, and QA are shown in Table 2. We perform entity-level F1 NER using the official CoNLL evaluation script translated into Python (github.com/spyysalo/conlleval.py). RE uses micro-level F1, and QA uses the BioASQ evaluation script (github.com/BioASQ/Evaluation-Measures). + +# 5.1 Named Entity Recognition + +
Named entity"undifferentiated""Fibrillation"
BERT-cased +tokenizationund ##iff #ere #nti #atedFi ##tri #llla #tion
BBBBBIIIII
BXXXXIXXXX
BioMegatron +bio-vocab-50k +tokenizationundi #fffer #ntia #t#Fibr #llla #tion
BBBBBIIIII
BXXXXIXXXX
PubMedBERT +-vocab (30k) +tokenizationundifferentiatedfibrillation
BI
BI
+ +Figure 1: Examples of tokenization with different subword vocabularies. Under each token, blue and purple text shows the word-level and substring-level labeling, respectively. + +While the NER benchmark datasets appear saturated due to the small sample size, we find that the subword vocabulary is the most critical factor. + +
BenchmarkModel#ParametersVocabularyPrecRecF1
BC5CDR-chemBioBERT110mBERT-cased90.093.491.7
PubMedBERT110mPubMedBERT-vocab (30k)92.193.292.6
BioMegatron345mBio-vocab-30k92.193.692.9
BioMegatron345mBio-vocab-50k92.992.092.5
BioMegatron800mBERT-cased91.392.992.1
BioMegatron1.2bBERT-uncased92.090.591.3
NERBioBERT110mBERT-cased85.089.487.2
PubMedBERT110mPubMedBERT-uncased (30k)86.288.487.3
BioMegatron345mBio-vocab-30k85.288.887.0
BioMegatron345mBio-vocab-50k86.191.088.5
BioMegatron800mBERT-cased85.890.187.9
BioMegatron1.2bBERT-uncased83.889.286.4
NCBI-diseaseBioBERT110mBERT-cased85.090.087.5
PubMedBERT110mPubMedBERT-uncased (30k)85.987.786.8
BioMegatron345mBio-vocab-30k85.688.687.1
BioMegatron345mBio-vocab-50k83.790.487.0
BioMegatron800mBERT-cased87.088.887.8
BioMegatron1.2bBERT-uncased83.590.186.7
RE ChemProtBioBERT110mBERT-cased76.573.374.8
PubMedBERT110mPubMedBERT-uncased (30k)73.677.775.6
BioMegatron345mBio-vocab-30k77.872.575.1
BioMegatron345mBio-vocab-50k74.579.777.0
BioMegatron800mBERT-cased80.468.974.3
BioMegatron1.2bBERT-uncased82.065.672.9
+ +Table 1: Evaluation results on NER and RE after fine-tuning for 30 epochs with hyper-parameter settings of: num- fc-layers: $\{1,2\}$ ; fc-hidden-size: $\{512,1024\}$ ; fc-dropout: 0.5; max-seq-length: 128; learning-rate: 5e-5; cross-entropy loss, with Adam optimizer. BioMegatron models are pre-trained from scratch on PubMed, except 1.2b model which is fine-tuned from a general domain model checkpoint. + +
BenchmarkModel#ParametersVocabularySAccLAccMRR
BioASQ-7b-factoidBioBERT-Base110mBERT-cased30.864.141.1
BioBERT-Large345mBERT-cased42.862.850.1
BioMegatron345mBERT-uncased46.262.652.5
BioMegatron800mBERT-uncased45.258.650.4
BioMegatron1.2bBERT-uncased47.460.952.4
+ +Examples of tokenization with different vocabularies are shown in Figure 1. Representing named entities as single terms is more helpful than breaking them into several subtokens. Table 3 shows the rate named entities break into sub-tokens for each benchmark training set with different subword vocabularies. PubMedBERT vocabulary set is good with a low break-out rate while being smaller in size than our $50\mathrm{k}$ -size vocabulary. A lower break-out rate with smaller vocabulary size probably helps achieve better NER performance despite smaller model size. + +There are two ways to label entities for NER training: (1) labeling the whole entity as a single la + +Table 2: Evaluation results on QA after fine-tuning for 30 epochs on checkpoints fine-tuned on SQuAD dataset with fixed hyper-parameter settings as num-fc-layers: 2; fc-hidden-size: 2048; fc-dropout: 0.1; max-seq-length: 512; learning-rate: 3e-5; cross-entropy loss, using Adam optimizer. BioMegatron models are pre-trained from scratch on PubMed, except 1.2b model which is fine-tuned from a general domain model checkpoint. + +
Sub-word vocabularyBC5-chemBC5-disease
BERT-cased3.0122.42
PubMedBERT-uncased (30k)1.6541.236
BioMegatron-bio-30k-cased1.7531.272
BioMegatron-bio-50k-cased1.4781.116
+ +Table 3: The rate of named entities breaking into subtokens (#tokens/#words) in NER training sets. + +bel, and (2) labeling sub-tokens separately. Figure 1 shows examples of these labeling methods. We find that these different schemes can result in as much as $\sim 2\%$ difference in the F1-score on NER evaluation, possibly indicating that the datasets are too small. We report NER results by labeling sub-tokens sep + +arately, except for the NCBI-disease dataset, where we observe better results with whole-entity labeling across all models. + +# 5.2 Relation Extraction + +Since RE is a classification task, albeit on sequences rather than on tokens, the choice of subword vocabulary has a notable effect. + +We can also observe that larger models result in higher precision for lower recall, both for NER and RE. More hyper-parameter tuning could achieve higher F1-scores, even the generalization ability of such result may be questionable. + +# 5.3 Question Answering + +Table 2 show evaluation results after fine-tuning on SQuAD for 10 epochs and BioASQ for 30 epochs each, following the recipe found to work best by Lee et al. (2019). We found a large batch size to be beneficial, as Q&A pairs repeat up to 88 times. We use a batch size of 64 per GPU with data parallelism on 16 GPUs. Here, using biomedical vocabularies result in much worse results, possibly due to its low relevance in the first SQuAD fine-tuning task. + +Larger models tend to perform better in QA, though it levels off after $345\mathrm{m}$ parameters. The larger model size effect is more evident when finetuning on BioASQ directly, as shown in Table 4. + +
ModelSAccLAccMRR
BioMegatron-345m33.150.439.8
BioMegatron-800m37.756.345.1
BioMegatron-1.2b40.653.745.6
+ +# 5.4 Domain Transfer and Generalization + +We examine how well a general- or domain-specific LM generalizes across domains related to the model size. Gu et al. (2020) studied the effect of "domain-specific" vs. "mixed-domain" pre-training, i.e., pre-training on PubMed from scratch vs. pretraining starting from a general domain LM (finetuning). They found that pre-training on PubMed from scratch is better for biomedical NLP benchmarks, but we analyze its effect with further pretraining (fine-tuning) steps. In other words, if start + +ing from a general domain LM, does sufficient finetuning make it as good as a fully domain-specific model? Can such model have any advantage for cross-domain or cross-discipline generalization? + +Table 4: Results on BioASQ-7b factoid, without finetuning on SQuAD dataset first. The other models, including those using domain vocabularies, could not achieve any comparable results. A consistent pattern of improvement over model size noticeable on par with findings in general domain LM on SQuAD. + +
BenchmarkFine-tuning stepsF1
NERBC5CDR-chem103steps63.2
104steps74.3
105steps89.7
2 · 105steps89.37
3 · 105steps91.8
4 · 105steps92.1
5 · 105steps91.2
BC5CDR-disease103steps39.4
104steps63.6
105steps79.8
2 · 105steps81.2
3 · 105steps79.2
4 · 105steps81.9
5 · 105steps81.8
REChemProt103steps0.00
104steps34.1
105steps63.4
2 · 105steps71.1
3 · 105steps70.4
4 · 105steps69.7
5 · 105steps68.3
+ +Table 5 shows F1-score evaluation on NER and RE benchmarks using a general-domain BioMegatron-1.2b with additional fine tuning. It shows that even for a large LM that was pre-trained on a large text corpus, it needs sufficient further pretraining on domain text (PubMed). After sufficient pre-training on domain text, it can be as good as an LM pre-trained on domain-text only, except that vocabulary has more significant effect on NER. + +Table 5: Comparison of fine-tuning steps for NER and RE benchmark when pre-training general-domain Megatron-1.2b model on PubMed. Cross-domain LMs should be trained sufficiently long on domain text to achieve comparable performance as LM pre-trained on domain text only. + +
ModelSAccLAccMRR
Megatron-345m (general LM)38.552.643.7
Megatron-1.2b (general LM)29.339.732.7
+ +Table 6: Fine-tuning and evaluating on BioASQ-7b using general domain LMs that was not trained on PubMed corpus. Larger model does not perform better. + +Table 6 shows the results of general-domain LMs fine-tuned on BioASQ-7b-factoid. Larger models do not perform better, which may indicate overfitting is occurring on the small training set. + +
ModelSQuAD-v1.1SQuAD-v2.0
BioMegatron-345m90.484.2
BioMegatron-345m-ft86.577.9
BioMegatron-800m91.686.1
BioMegatron-1.2b-ft91.886.4
BERTLARGE90.981.8
RoBERTa94.689.4
Megatron-3.9b95.891.2
+ +Table 7 shows the generalization ability of BioMegatron models on SQuAD datasets. Here, a large biomedical LM pre-trained on large text corpus performs better than smaller general domain LMs such as $\mathrm{BERT}_{\mathrm{LARGE}}$ , even when pre-trained on the biomedical text. + +# 5.5 Other Domain-Specific Factors + +Size and Bias in Biomedical Datasets Annotating biomedical data requires in-depth domain knowledge. Besides, data often have substantial label bias as the occurrences of "abnormal" or "findings" are rare by nature. As a result, biomedical benchmark data tend to be smaller and highly biased than their general domain counterparts. + +Table 7: Fine-tuning on SQuAD -v1.1/-v2.0 using BioMegatron and evaluating on F1-score on dev-set. BioMegatron with '-ft' are pre-trained from general domain checkpoints (fine-tuned). Results of other general domain LMs are compared: RoBERTa (Liu et al., 2019), Megatron-LM (Shoeybi et al., 2019). + +
TaskDataset# SamplesBias %
NERCONLL-2003149870.18
BC5CDR52350.08
CLSMRPC36680.48
ChemProt194610.27
QASQuAD-v1.0875990.4
BioASQ-7b55370.02
+ +Table 8: Label bias in general and biomedical benchmark dataset. CONLL-2003 (Sang and De Meulder, 2003), MRPC (Dolan et al., 2005), and SQuAD (Rajpurkar et al., 2016) are general domain dataset for NER, CLS (RE), and QA, respectively, for comparison against biomedical domain dataset. Label bias is computed as [sum of the #samples of minority labels]/[#samples of majority label], for NER and RE (CLS), and [#minimum repeat of the same answer]/[#maximum repeat of the same answer] for QA. + +Table 8 shows a comparison of benchmark datasets for NER, RE (CLS), and QA in the biomedical domain and their general-domain counterparts. The SQuAD Q&A set is 15 times larger than the BioASQ data, where the same question-answer + +combinations appear up to 88 times in BioASQ. Question-answer pairs are seldom repeated in SQuAD data, at most twice. The BC5CDR NER dataset is 1/3 size of CONLL-2003 and the ratio of I/O to O tags 0.08, compared to 0.18 for CONLL. + +Methods to circumvent data imbalance issues such as oversampling the minority classes (Chawla et al., 2002; Chen et al., 2010) and using weighted cross-entropy gave minor effects on our NER and RE benchmarks. Recently, Li et al. (2019) proposed dice-loss for data-imbalance issues in NLP, with SOTA results on NER and QA, which could be a future avenue to explore for domain LMs. Transfer learning showed effectiveness in the biomedical QA task. However, it is somewhat unclear how to apply it to NER and RE tasks. + +
ModelPubMed Corpus#Words
BioBERTabstracts4.5 billion
PubMedBERTabstracts + full-text16.8 billion
BioMegatronabstracts + full-text-CC6.1 billion
+ +Table 9: Pre-training text corpus of each biomedical LM. We pre-train on PubMed abstracts and full-text commercial-collection (CC) that are free of copyrights. + +Pre-training Corpus and Duration PubMed-BERT is pre-trained on a much larger text corpus, as shown in Table 9. It is a performant domain-LM with a larger pre-training corpus and adequate domain vocabulary compared to its model size. We pre-train our LMs for about one epoch, reaching a masked-LM loss of about 1.2 (Devlin et al., 2018). Further pre-training may be helpful, but it is challenging to have strictly controlled experiments with many different settings. + +# 6 Conclusion + +We review and test several factors that can affect the performance of domain language models. We find that a language model targeted for a domain and application performs best. For example, model size is a secondary factor to vocabulary set for token classification task. Larger model size does not necessarily translate to better performance on a cross-domain benchmark task. + +This probably indicates that there is no master model that can "do it all", at least well enough as a targeted one. The model size is a secondary factor; larger model size can probably further improve the performance of a domain- and application-specific language model. + +# Acknowledgement + +The authors would like to thank Sun Kim at NIH/NCBI (now at Amazon Alexa AI) for helpful discussions and suggestions. + +# References + +Emily Alsentzer, John R Murphy, Willie Boag, WeiHung Weng, Di Jin, Tristan Naumann, and Matthew McDermott. 2019. Publicly available clinical bert embeddings. arXiv preprint arXiv:1904.03323. +Iz Beltagy, Arman Cohan, and Kyle Lo. 2019. Scibert: Pretrained contextualized embeddings for scientific text. arXiv preprint arXiv:1903.10676. +Nitesh V Chawla, Kevin W Bowyer, Lawrence O Hall, and W Philip Kegelmeyer. 2002. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16:321-357. +Sheng Chen, Haibo He, and Edwardo A Garcia. 2010. Ramoboost: ranked minority oversampling in boosting. IEEE Transactions on Neural Networks, 21(10):1624-1642. +Dina Demner-Fushman, K Bretonnel Cohen, Sophia Ananiadou, and Jun'ichi Tsujii. 2019. Proceedings of the 18th bionlp workshop and shared task. In Proceedings of the 18th BioNLP Workshop and Shared Task. +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. +Rezarta Islamaj Dogan, Robert Leaman, and Zhiyong Lu. 2014. Ncbi disease corpus: a resource for disease name recognition and concept normalization. Journal of biomedical informatics, 47:1-10. +Bill Dolan, Chris Brockett, and Chris Quirk. 2005. Microsoft research paraphrase corpus. Retrieved March, 29(2008):63. +Yu Gu, Robert Tinn, Hao Cheng, Michael Lucas, Naoto Usuyama, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. 2020. Domain-specific language model pretraining for biomedical natural language processing. arXiv preprint arXiv:2007.15779. +Kexin Huang, Jaan Altosaar, and Rajesh Ranganath. 2019. Clinicalbert: Modeling clinical notes and predicting hospital readmission. arXiv preprint arXiv:1904.05342. +Alistair EW Johnson, Tom J Pollard, Lu Shen, H Lehman Li-wei, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. 2016. Mimiciii, a freely accessible critical care database. Scientific data, 3:160035. + +Martin Krallinger, Obdulia Rabal, Florian Leitner, Miguel Vazquez, David Salgado, Zhiyong Lu, Robert Leaman, Yanan Lu, Donghong Ji, Daniel M Lowe, et al. 2015. The chemdner corpus of chemicals and drugs and its annotation principles. Journal of cheminformatics, 7(1):1-17. +J Lee, W Yoon, S Kim, D Kim, CH So, and J Kang. 2019. Biobert: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics (Oxford, England). +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 v cdr task corpus: a resource for chemical disease relation extraction. Database, 2016. +Xiaoya Li, Xiaofei Sun, Yuxian Meng, Junjun Liang, Fei Wu, and Jiwei Li. 2019. Dice loss for data-imbalanced nlp tasks. arXiv preprint arXiv:1911.02855. +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. +Yifan Peng, Shankai Yan, and Zhiyong Lu. 2019. Transfer learning in biomedical natural language processing: An evaluation of bert and elmo on ten benchmarking datasets. arXiv preprint arXiv:1906.05474. +Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Better language models and their implications. +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. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: $100,000+$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250. +Lance A Ramshaw and Mitchell P Marcus. 1999. Text chunking using transformation-based learning. In Natural language processing using very large corpora, pages 157-176. Springer. +Erik F Sang and Fien De Meulder. 2003. Introduction to the conll-2003 shared task: Language-independent named entity recognition. Proceedings of CoNLL-2003. +Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. 2019. Megatron-lm: Training multi-billion parameter language models usinggpu model parallelism. arXiv preprint arXiv:1909.08053. + +Trieu H. Trinh and Quoc V. Le. 2018. A simple method for commonsense reasoning. CoRR, abs/1806.02847. +George Tsatsaronis, Georgios Balikas, Prodromos Malakasiotis, Ioannis Partalas, Matthias Zschunke, Michael R Alvers, Dirk Weissenborn, Anastasia Krithara, Sergios Petridis, Dimitris Polychronopoulos, et al. 2015. An overview of the bioasq large-scale biomedical semantic indexing and question answering competition. BMC bioinformatics, 16(1):138. +Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. 2019. Defending against neural fake news. CoRR, abs/1905.12616. \ No newline at end of file diff --git a/biomegatronlargerbiomedicaldomainlanguagemodel/images.zip b/biomegatronlargerbiomedicaldomainlanguagemodel/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7f6070c269d326a3eb7da47db708b1a3ee7848c0 --- /dev/null +++ b/biomegatronlargerbiomedicaldomainlanguagemodel/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b70fa61e26224dfaa235cad67a5297510117df3827afc6103aa262b1f1040f1d +size 367952 diff --git a/biomegatronlargerbiomedicaldomainlanguagemodel/layout.json b/biomegatronlargerbiomedicaldomainlanguagemodel/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..89f5328b25e69ebff1e216e71471f3a4bfe00738 --- /dev/null +++ b/biomegatronlargerbiomedicaldomainlanguagemodel/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08fcde0489bba737ee77216c5a2a8e3ee2e186da1ae036ebfd2cbc8f2a913d28 +size 184934 diff --git a/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_content_list.json b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..0700ebef29942aff34c8edd7e794c20c68d7197d --- /dev/null +++ b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a22719d44a78c1a89c1cf87770122da1aa37e2a1bc4218e375b05d2d5ef3de58 +size 49321 diff --git a/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_model.json b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_model.json new file mode 100644 index 0000000000000000000000000000000000000000..61d01220b90a0ed6abcf8d3507ec2f7cd6d6c14b --- /dev/null +++ b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ca276eea532c50e0e307776633318b9e03bc7eaad0db60872c952b0464429e6 +size 59787 diff --git a/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_origin.pdf b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..b5c91d3c1399caf88849fcb584efa828bd49fb92 --- /dev/null +++ b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/23026b83-6b2d-41a9-9c9f-6335325ef4b2_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0e5321353b85dbb242b6579a1134137b7fbb86f49aa9fa221a9953237993fcb +size 652200 diff --git a/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/full.md b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..439adcfabcfb3ab75b73927c7619b2560bc1486f --- /dev/null +++ b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/full.md @@ -0,0 +1,191 @@ +# Birds have four legs?! + +# NumerSense: Probing Numerical Commonsense Knowledge of Pre-Trained Language Models + +Bill Yuchen Lin + +Seyeon Lee + +Rahul Khanna + +Xiang Ren + +{yuchen.lin,seyeonle,rahulkha,xiangren}@usc.edu + +Department of Computer Science, + +University of Southern California + +# Abstract + +Recent works show that pre-trained language models (PTLMs), such as BERT, possess certain commonsense and factual knowledge. They suggest that it is promising to use PTLMs as "neural knowledge bases" via predicting masked words. Surprisingly, we find that this may not work for numerical commonsense knowledge (e.g., a bird usually has two legs). In this paper, we investigate whether and to what extent we can induce numerical commonsense knowledge from PTLMs as well as the robustness of this process. To study this, we introduce a novel probing task with a diagnostic dataset, NUMERSENSE1, containing 13.6k masked-word-prediction probes (10.5k for fine-tuning and 3.1k for testing). Our analysis reveals that: (1) BERT and its stronger variant RoBERTa perform poorly on the diagnostic dataset prior to any fine-tuning; (2) fine-tuning with distant supervision brings some improvement; (3) the best supervised model still performs poorly as compared to human performance (54.06% vs. 96.3% in accuracy). + +# 1 Introduction + +Pre-trained language models (PTLMs), such as BERT (Devlin et al., 2019), have yielded state-of-the-art performance on many natural language processing tasks. Given PTLMs' cited ability to create general, yet useful text representations, an investigation of their ability to encode commonsense knowledge into representations is warranted—commonsense knowledge is often required to have a full understanding of language. + +Recently there have been a few recent works that do investigate the inquiry of whether PTLMs possess commonsense knowledge (Petroni et al., 2019; Davison et al., 2019; Bouraoui et al., 2020). Overall, these prior studies suggest that PTLMs are + +
Birds can [MASK].BERT-Large +Masked Word Prediction1st:fly (79.5%)
2nd:sing (9.1%)
However, for Numerical Commonsense Knowledge :
A bird usually has [MASK] legs.1st:fou(44.8%)
2nd:two (18.7%)
A car usually has [MASK] wheels.1st:fou(53.7%)
2nd:two (20.5%)
A car usually has [MASK] round wheels.1st:two (37.1%)
2nd:fou(20.2%)
+ +Figure 1: Top: PTLMs often cannot solve masked language modeling tasks needing numerical commonsense knowledge, hence our title. Bottom: Even when PTLMs seemingly succeed, they fail to stay consistent under small perturbations. + +creating text representations that often have commonsense knowledge encoded in them. We, however, find it surprising that when posed with a similar reasoning-based masked-word-prediction task, PTLMs perform poorly in recalling the required numerical commonsense knowledge (see Figure 1). + +Therefore, in this paper, our goal is to study whether PTLMs capture numerical commonsense knowledge, i.e., commonsense knowledge that provides an understanding of the numeric relation between entities. We propose measuring this capability via a masked-word-prediction based probing task, where, the ranking of numeric words by what the model believes most probably fills the mask would expose the capabilities of PTLMs to capture numeric commonsense knowledge. For example, the masked position in the sentence "A bird usually has [MASK] legs." is best filled by the number "two" when considering only numerical words. + +Around this concept, we built a carefully crafted dataset, NUMERSENSE, of 3,145 probes that covers questions from 8 different categories such as everyday objects, biology, geometry, etc. In our initial experiments, we find PTLMs to be brittle against adversarial attacks. As shown in the bottom section of Figure 1, BERT initially correctly predicts the masked word to be "four", but it changes its top result to "two" in the slightly perturbed second + +sentence (a simple insertion of the word 'round'). Thus, we intentionally included adversarial examples in the probes to test the robustness. + +We evaluate PTLMs in two settings (Section 3): (1) a zero-shot setting, meaning no probes from our dataset were used to fine-tune the models before evaluation; (2) a distant supervision setting, where models were fine-tuned on examples from related commonsense reasoning datasets before being evaluated on ours. Our findings reveal that PTLMs are still much worse than humans on the task, although fine-tuning with distant supervision can help. We also provide some cursory analysis on why PTLMs perhaps perform so poorly, pointing to interesting future research. We also hope our work can benefit future works in: 1) improving PTLMs' abilities to faithfully capture (numerical) commonsense, 2) populating numerical facts in current commonsense knowledge bases, and 3) open-domain QA — "Q: How many legs do ants have?" "A: Six!" + +# 2 The NUMERSENSE Probing Task + +We introduce our numerical commonsense reasoning probing task, as well as the creation process of the namesake dataset, NUMERSENSE. Then, we provide a breakdown of what types of knowledge are covered by the probes and finally include additional high-quality distant supervision to test if fine-tuning can improve performance. + +# 2.1 Task Formulation + +We essentially probe PTLMs with the distribution of words a PTLM thinks could fill the masked position, by ranking their softmax scores (greatest to least). If the ranking demonstrates numerical commonsense knowledge—the highest ranked number word (e.g., "one", "two", and so on) is the correct answer—then that probe is successfully completed by the PTLM. The masked position in each probe is chosen such that a number word is an extremely probable way of filling in the blank. + +# 2.2 Probing Data Collection + +To build a suitable dataset for the proposed probing task, we make use of an existing corpus consisting of commonsense assertions, named Open Mind Common Sense (OMCS) (Singh et al., 2002). We first extracted the sentences from OMCS that had at least one of the following 12 number words: + +
CategoryExample
Objects(35.2%)A bicycle has two tires.
Biology(13.5%)Ants have six legs.
Geometry(11.7%)A cube has six faces.
Unit(6.3%)There are seven days in a week.
Math(7.3%)I will be ten next year, as I am nine now.
Physics(5.7%)Water will freeze at zero degrees centigrade.
Geography(2.9%)The world contains seven continents.
Misc.(17.5%)There are no princes in the United States.
+ +Table 1: NUMERSENSE examples of each category. + +{"no"2,"zero", "one", "two", ..., "ten"}. + +However, as to be expected, there were many noisy statements which were either 1) incorrect, 2) containing typos, or 3) having no numerical commonsense logic. We thus manually and pragmatically refined these sentences and did two rounds of vetting by different graduate students, from which we only kept the statements that were accepted by all annotators. After this strict filtration process, we ended up 1,131 cleaned statements for probing. + +We did an initial test and observed that PTLMs can be brittle under a simple perturbation of inserting an adjective near the masked number word. Thus, in order to study the robustness of models in our proposed task, we also added adversarial examples to our dataset by adding adjectives before the noun involved in the numerical reasoning in each probe. The candidate adjectives are generated by querying relevant triples (e.g. for the example in Fig. 1) in the commonsense knowledge graph, ConceptNet (Speer et al., 2017), and further selected or modified by human annotators to assure adversarial examples are still valid and natural. We finally have 3,145 testing probes for NU-MERSENSE as the diagnostic dataset. + +We also manually annotated the category label for each instance so that we can better understand the covered topics and their percentage. We found 8 types of numerical commonsense knowledge ranging from tangible everyday objects (e.g., car, guitar, and table) to geometry (e.g., cube). Table 1 lists some concrete examples of each category. + +# 2.3 Supervision for Fine-Tuning PTLMs + +One may wonder if fine-tuning towards this task could improve the performance. In order to an- + +
ModelsCore Probes+ Adversarial Examples
hit@1hit@2hit@3hit@1hit@2hit@3
GPT-229.8650.8867.4924.7344.2162.30
BERT-Base31.9855.9270.5825.2448.6664.81
RoBERTa-Base36.0460.4272.0828.3951.9167.29
BERT-Large37.6362.0176.7727.1852.8970.22
RoBERTa-Large45.8566.7080.0435.6658.5274.44
Ft. BERT-L.50.0066.3474.9143.5862.2772.92
Ft. RoBERTa-L.54.0669.6179.1547.5266.4376.76
Human Bound89.7(α) / 96.3(β)88.3 (α) / 93.7 (β)
+ +Table 2: Results $(\%)$ of PTLMs on NUMERSENSE. 'Ft.' stands for 'Fine-tuned.' The human performance is shown by closed testing $(\alpha =$ 'no external information') / open testing $(\beta =$ 'Wikipedia is allowed'). + +swer this question, we further collected training sentences from the GenericsKB corpus (Bhakthavatsalam et al., 2020). The sentences in GenericKB are generic commonsense statements that are extracted from Simple Wikipedia, Common Crawl within educational domains, ARC corpus, etc. + +We collected these sentences by first obtaining a list of frequent nouns from various caption corpora such as MSCOCO (Lin et al., 2014) and VATEX (Wang et al., 2019). Then, we selected collected sentences contained at least one number word of interest and finally go through the same human annotator verification process as the test data. We ended up collecting 10,492 sentences for finetuning and believe these sentences, if used properly, can improve PTLMs' ability to recall the numerical commonsense knowledge. + +# 2.4 Statistics of NUMERSENSE + +We show the distribution of the truth number words in the test data in Fig. 2. The average length of the sentence in training data is 11.1 and it is 8.9 in test data. + +![](images/dbb9492922d833d19e7e9d0268ea96d8c6a377688c40401294556e10c89f53b7.jpg) +Figure 2: Truth number distribution of the test set. + +# 3 Empirical Analysis + +We introduce the set-up of the experiments and then present results from different PTLMs in both a zero-shot setting and a distantly supervised finetuned one. We will also provide some analysis on the robustness and biases in the various models, and finally a study of the performance of a state-of-the-art open-domain question-answering model. + +# 3.1 Experiment Set-up + +We run our experiments in two settings, zero-shot inference and additional supervision via finetuning. In the first setting, we probe PTLMs without any modifications, specifically we use BERT and RoBERTa with pre-trained masked-word-prediction heads. + +In our second setting, we use our collected additional supervision dataset (Sec. 2.3) and mask the number words in each sentence. We then proceed to fine tune the models above on these masked sentences, before evaluating them on NUMERSENSE. + +# 3.2 Evaluation Metric and Human Bound + +A masked-word-prediction head (either fine-tuned or not) produces a probability distribution over its whole vocabulary via a softmax layer. As mentioned in Sec. 2.1, NUMERSENSE is the task of using this probability distribution to rank all number words, and evaluating this ranking. To evaluate, we use hit@1/2/3 accuracy, which calculates the percentage of predictions where the correct number word is ranked in the top $k$ number words. + +To estimate human performance on the task, we sampled 300 examples and asked two groups of three people to fill in the masked word, where one group had access to external information (open-book test) from the Web such as Wikipedia and the other did not (closed-book test). We take the majority label as the final human label. + +# 3.3 Experimental results + +We show our experimental results in Table 2. The first four lines are results from PTLMs in the zero-shot inference setting. We see that size matters, as there is a clear performance gain when the model sizes increase. Also, RoBERTa's results are consistently better than BERT's, which is probably because RoBERTa uses a larger training corpora + +![](images/ea63693b34cf61e2e74540acf98e27850f0c6d183b56983fb3a3591ed87cf3d4.jpg) +Figure 3: Performance of RoBERTa-Large V.S. human performance (closed-book tests) on different categories of numerical commonsense knowledge. + +and focuses more on masked language modeling in its pre-training stage. + +We see that our fine-tuning efforts do help improve model performance: “ $37.63 \rightarrow 50.00$ ” for BERT-large and “ $45.85 \rightarrow 54.06$ ” for RoBERTa-large. However, both are still far from the human's closed-book evaluation. Figure 3 shows PTLMs performance is poor across all categories within the core set of NUMERSENSE. + +Comparing the performance of a PTLM on the "Core Probes" set (\#=1,131) versus the "+" Adversarial Examples" set (\#=3,145), we can measure their robustness. We found all models incur a significant performance drop when being evaluated on the adversarial set. This suggests that PTLMs (even when fine-tuned) can be brittle towards adversarial attacks, and future direction in pre-training language models should consider more structured inductive biases such as dependencies and semantic roles when learning contextual representations. + +# 4 Case Studies + +Object bias. Recall the example "a bird usually has [MASK] legs," which BERT-Large predicts to be "four". Does BERT-Large always predict "four" as long as the adjacent word after the [MASK] is 'legs'? To investigate if the bias exists, we show some case studies in Table 3. As 1,000 different randomly generated words fill the '[x]'s we see that both BERT and RoBERTa have a bias towards a certain answer, evidenced by the existence of a dominant answer in the softmax distribution. However, it seems that RoBERTa's (Liu et al., 2019) modified pre-training strategy helps it have less bias. We argue that future studies should further control the bias in masked language modeling. + +Attention distribution. Following the prior probing work (Clark et al., 2019) on the relationship + +between attention weights and syntactic structures, we plot the attention distribution of the sentence "A bird usually has two legs." with respect to the word 'two' in Figure 4. We find that the root word 'has' enjoys the maximum attention at in the first few and middle layers, while the word 'two' gets the maximum attention to itself in the end. The important words for querying the numerical commonsense, namely 'birds' and 'legs', always have low attention weights. This suggests that the BERT (and RoBERTa) may inherently lose the relationship between subject/object and number words. + +# 5 Open-Domain 'How-Many' Questions + +The examples in the NUMERSENSE can be also seen as open-domain questions targeting 'how many' commonsense—"how many legs does a fly usually have?" Answering these open-domain numerical commonsense questions is a practical downstream application of models that are successful in the NUMERSENSE. Thus, as a side note, we also report the performance of the state-of-the-art open-domain QA model (Asai et al., 2020). + +We use the model that is trained on the Natural Question (NQ) dataset (Kwiatkowski et al., 2019), where we replace the '[MASK]'s in our examples with 'how many', so that our probes are in a similar format to NQ examples. For example "a fly usually has [MASK] legs" is converted to "how many legs a fly usually has?" The accuracy of the state-of-the-art model is only $15.4\%$ , which is even lower than using BERT-base without fine-tuning. This indicates that improving performance on NUMERSENSE can help improve the performance on answering open-domain "how-many" questions. + +# 6 Related Work + +Probing Tasks for PTLMs. Prior work in probing language models have primarily focused on analysis of linguistic phenomena. Clark et al. (2019) investigated the relationship between BERT's attention weights and syntactic structures, while such as dependency (e.g. direct objects, noun modifiers), coreference, and sentence segmentation. Tenney et al. (2019) was able to display where certain types of linguistic information is captured within BERT—they in fact find the layers in a PTLM represent the steps of a classical NLP pipeline: POS + +![](images/929e81c3d3336a450d557f819b95179fc4e2415596e496fbe6d4a2f6d7f165c9.jpg) +Figure 4: The attention distribution of the sentence "A bird usually has two legs." on RoBERTa-base. We plot the attention weights $(y)$ between each word and the number word 'two' at different position $(x)$ , e.g., $x = 13$ means (Layer 2, Head 1). + +
Template:a [x] usually has [MASK] legs.
BERT-Lfour: 39.3%, two: 18.3%, three: 10.1%
RoBERTa-Lfour: 20.8%, two: 9.0%, three: 8.1%
Template:most [x] have [MASK] wheels.
BERT-Lfour: 25.3%, two: 14.1%, three: 5.1%
RoBERTa-Lfour: 9.2%, two: 7.8%, three: 4.6%
Template:all [x] have [MASK] sides.
BERT-Ltwo: 28.3%, three: 12.9%, four: 12.9%
RoBERTa-Ltwo: 16.6%, no: 2.9%, three: 2.3%
+ +Table 3: The average Softmax of top 3 predictions in templates where $\left[\mathrm{x}\right]$ is filled with 1k random words. tagging, parsing, NER, semantic roles, and coreference. This line of work has indeed helped us understand the ability of PTLMs to capture linguistic knowledge via self-supervised learning from unlabeled data. We are interested in the numerical commonsense knowledge of PTLMs. + +Probing Commonsense Knowledge. Besides the works that we have discussed in Section 1, Zhou et al. (2020) and Talmor et al. (2019a) also proposed to probe the commonsense knowledge of pretrained language models, following the prior work by Trinh and Le (2018a and 2018b). They both utilized various existing language understanding datasets targeting commonsense knowledge to test if PTLMs can capture certain commonsense knowledge. Lin et al. (2019a) also show that PTLMs can retrieve paths from ConceptNet that aid in interpreting the decision made by the PTLMs on the CommonsenseQA dataset (Talmor et al., 2019b). Lin et al. (2019b) probe the commonsense knowledge in pre-trained language generation models via a constrained text generation task. However, they do not consider numerical commonsense knowledge, which is relatively under-explored area. + +Numerical Commonsense Knowledge. Forbes and Choi (2017) and Goel et al. (2019) studied commonsense comparisons between two physical objects (e.g., a house is usually bigger than + +a person) in pre-trained word embeddings. Elazar et al. (2019) and Yamane et al. (2020) propose to induce the commonsense distribution of quantitative attributes (e.g., mass, length, and currency) of objects. Their goal is to extract or crowd-source such numerical attributes, and then obtain distributions that reflect commonsense knowledge. NUMERSENSE, however, mainly focuses on exact numerical commonsense facts (e.g., a bird has two legs) instead of a range of values (e.g., a tiger weighs around $120kg$ ), and have a larger number of arguments besides physical attributes. + +Encoding Numerics for Computation. Wallace et al. (2019) probe PTLMs in terms of the ability to represent numeracy tokens by a regression task (e.g., “71” → 71.0), and also find that BERT is not good at encoding numerical tokens. Some works focus on incorporate algebra computation ability in PTLMs (Zou and Lu, 2019; Geva et al., 2020), thus making them able to answer math reasoning tasks such as MAWPS (Koncel-Kedziorski et al., 2016) and DROP (Dua et al., 2019). Note that these models and tasks are not targeting numerical commonsense knowledge but mainly the numerical-related computation within text. + +# 7 Conclusion + +We present a probing task, NUMERSENSE, to induce numerical commonsense knowledge from pretrained language models. We collect a new diagnostic dataset carefully verified by human annotators, which covers 8 different topics. Powerful pre-trained models such as BERT and RoBERTa perform surprisingly poorly, even after fine-tuning with high-quality distant supervision. We hope our findings and probing dataset will provide a basis for improving pre-trained masked language models' numerical and other concrete types of commonsense knowledge. + +# Acknowledgements + +This research is based upon work supported in part by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via Contract No. 2019-19051600007, the DARPA MCS program under Contract No. N660011924033 with the United States Office Of Naval Research, the Defense Advanced Research Projects Agency with award W911NF-19-20271, and NSF SMA 18-29268. 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 ODNI, IARPA, or the U.S. Government. We would like to thank all the collaborators in USC INK research lab for their constructive feedback on the work. + +# References + +Akari Asai, Kazuma Hashimoto, Hannaneh Hajishirzi, Richard Socher, and Caiming Xiong. 2020. Learning to retrieve reasoning paths over wikipedia graph for question answering. In International Conference on Learning Representations. +Sumithra Bhakthavatsalam, Chloe Anastasiades, and Peter Clark. 2020. Genericsb: A knowledge base of generic statements. ArXiv, abs/2005.00660. +Zied Bouraoui, Jose Camacho-Collados, and Steven Schockaert. 2020. Inducing relational knowledge from bert. In Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence. +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. +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. +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. + +Dheeru Dua, Yizhong Wang, Pradeep Dasigi, Gabriel Stanovsky, Sameer Singh, and Matt Gardner. 2019. DROP: A reading comprehension benchmark requiring discrete reasoning over paragraphs. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2368-2378, Minneapolis, Minnesota. Association for Computational Linguistics. +Yanai Elazar, Abhijit Mahabal, Deepak Ramachandran, Tania Bedrax-Weiss, and Dan Roth. 2019. How large are lions? inducing distributions over quantitative attributes. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3973-3983, Florence, Italy. Association for Computational Linguistics. +Maxwell Forbes and Yejin Choi. 2017. Verb physics: Relative physical knowledge of actions and objects. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 266-276, Vancouver, Canada. Association for Computational Linguistics. +Mor Geva, Ankit Gupta, and Jonathan Berant. 2020. Injecting numerical reasoning skills into language models. ArXiv, abs/2004.04487. +Pranav Goel, Shi Feng, and Jordan Boyd-Graber. 2019. How pre-trained word representations capture commonsense physical comparisons. In Proceedings of the First Workshop on Commonsense Inference in Natural Language Processing, pages 130-135, Hong Kong, China. Association for Computational Linguistics. +Rik Koncel-Kedziorski, Subhro Roy, Aida Amini, Nate Kushman, and Hannaneh Hajishirzi. 2016. MAwPS: A math word problem repository. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1152-1157, San Diego, California. 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:453-466. +Bill Yuchen Lin, Xinyue Chen, Jamin Chen, and Xi-ang Ren. 2019a. KagNet: Knowledge-aware graph networks for commonsense reasoning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2829-2839, Hong Kong, China. Association for Computational Linguistics. + +Bill Yuchen Lin, Ming Shen, Yu Xing, Pei Zhou, and Xiang Ren. 2019b. CommonGen: A constrained text generation dataset towards generative commonsense reasoning. ArXiv, abs/1911.03705. +Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. 2014. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740-755. Springer. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar S. Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke S. Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A robustly optimized bert pretraining approach. ArXiv, abs/1907.11692. +Fabio Petroni, Tim Rocttäschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language models as knowledge bases? 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 2463-2473, Hong Kong, China. Association for Computational Linguistics. +Push Singh, Thomas Lin, Erik T Mueller, Grace Lim, Travell Perkins, and Wan Li Zhu. 2002. Open mind common sense: Knowledge acquisition from the general public. In OTM Confederated International Conferences "On the Move to Meaningful Internet Systems", pages 1223-1237. Springer. +Robyn Speer, Joshua Chin, and Catherine Havasi. 2017. Conceptnet 5.5: An open multilingual graph of general knowledge. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, AAAI'17, page 4444-4451. AAAI Press. +Alon Talmor, Yanai Elazar, Yoav Goldberg, and Jonathan Berant. 2019a. olmpics - on what language model pre-training captures. ArXiv, abs/1912.13283. +Alon Talmor, Jonathan Herzig, Nicholas Lourie, and Jonathan Berant. 2019b. CommonsenseQA: A question answering challenge targeting commonsense knowledge. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4149-4158, Minneapolis, Minnesota. Association for Computational Linguistics. +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. +Trieu H. Trinh and Quoc V. Le. 2018a. Do language models have common sense. + +Trieu H. Trinh and Quoc V. Le. 2018b. A simple method for commonsense reasoning. ArXiv, abs/1806.02847. +Eric Wallace, Yizhong Wang, Sujian Li, Sameer Singh, and Matt Gardner. 2019. Do NLP models know numbers? probing numeracy in embeddings. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 5307-5315, Hong Kong, China. Association for Computational Linguistics. +Xin Wang, Jiawei Wu, Junkun Chen, Lei Li, Yuan-Fang Wang, and William Yang Wang. 2019. Vatex: A large-scale, high-quality multilingual dataset for video-and-language research. In The IEEE International Conference on Computer Vision (ICCV). +Hiroaki Yamane, Chin-Yew Lin, and Tatsuya Harada. 2020. Measuring numerical common sense: Is a word embedding approach effective? +Xuhui Zhou, Y. Zhang, Leyang Cui, and Dandan Huang. 2020. Evaluating commonsense in pretrained language models. In Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence. +Yanyan Zou and Wei Lu. 2019. Text2Math: End-to-end parsing text into math expressions. 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 5327-5337, Hong Kong, China. Association for Computational Linguistics. \ No newline at end of file diff --git a/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/images.zip b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..eb3f67913bf992d805b151eac04af2eebb2cd1f0 --- /dev/null +++ b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a508fa426f361f38140a122fc457b63b3beb8876e2a926040d0518fe5170b29 +size 228529 diff --git a/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/layout.json b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..6adbe418364eee19bb43c978eba6c8189f5f0fc0 --- /dev/null +++ b/birdshavefourlegsnumersenseprobingnumericalcommonsenseknowledgeofpretrainedlanguagemodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f192d2de3804ad41b4aa6d7f6af93c656da2a59aeb442245c9efba85cddbf93d +size 197241 diff --git a/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_content_list.json b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8a67955bc665ccf562bd4d564b87fa4a80221baa --- /dev/null +++ b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da473916761afb8ea99565ad536a127299aaeefb08a0a0978e35600744a35ee7 +size 110585 diff --git a/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_model.json b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_model.json new file mode 100644 index 0000000000000000000000000000000000000000..2401ef81ac408eab1c1c612f817be2fce7f43cc4 --- /dev/null +++ b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:385c13ab93b6a5f823745ffe8bef89479d0ad23b01e7f950b2c4ed32d38952d6 +size 137191 diff --git a/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_origin.pdf b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ec3dc5e93cb39acc9d2094115a405756935a4a83 --- /dev/null +++ b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/30c6b796-78d7-41ec-bd59-c2edac1dce84_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce2434c8429cfdab0894073a1f5a975602278a9580cb345773bc2ec0acc4ef06 +size 1060308 diff --git a/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/full.md b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/full.md new file mode 100644 index 0000000000000000000000000000000000000000..a74a577996c973a6e20bcd85a0009de60693a19f --- /dev/null +++ b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/full.md @@ -0,0 +1,470 @@ +# BiST: Bi-directional Spatio-Temporal Reasoning for Video-Grounded Dialogues + +Hung Le†§*, Doyen Sahoo†, Nancy F. Chen§, Steven C.H. Hoit‡ + +† Singapore Management University + +hungle.2018@smu.edu.sg + +Salesforce Research Asia + +{dsahoo, shoi}@salesforce.com + +$^{\S}$ Institute for Infocomm Research, A*STAR + +nfychen@i2r.a-star.edu.sg + +# Abstract + +Video-grounded dialogues are very challenging due to (i) the complexity of videos which contain both spatial and temporal variations, and (ii) the complexity of user utterances which query different segments and/or different objects in videos over multiple dialogue turns. However, existing approaches to video-grounded dialogues often focus on superficial temporal-level visual cues, but neglect more fine-grained spatial signals from videos. To address this drawback, we propose Bi-directional Spatio-Temporal Learning (BiST), a vision-language neural framework for high-resolution queries in videos based on textual cues. Specifically, our approach not only exploits both spatial and temporal-level information, but also learns dynamic information diffusion between the two feature spaces through spatial-to-temporal and temporal-to-spatial reasoning. The bidirectional strategy aims to tackle the evolving semantics of user queries in the dialogue setting. The retrieved visual cues are used as contextual information to construct relevant responses to the users. Our empirical results and comprehensive qualitative analysis show that BiST achieves competitive performance and generates reasonable responses on a large-scale AVSD benchmark. We also adapt our BiST models to the Video QA setting, and substantially outperform prior approaches on the TGIF-QA benchmark. + +# 1 Introduction + +A video-grounded dialogue agent aims to converse with humans not only based on signals from natural language but also from other modalities such as sound and vision of the input video. Recent efforts (Alamri et al., 2018; Sanabria et al., 2019; Alamri et al., 2019) consider video-grounded dialogues as an extension of video Question-Answering (QA) + +![](images/ead02977654f5cb43afceef97cf400e39638dff938c96fca1d01e8ff8650f5c2.jpg) + +H: How many people are in the video? +H: What room is he in? +H: Does he enter the kitchen? +H: What does he do before he sits down? +e in the video? + +chen? +Here he sits down? + +H: Is he happy or sad? + +![](images/d6d6d2d294758342db5bb082a08f3651c19c5d0dd8a2770eb5119295bfe776d9.jpg) + +![](images/ebdb90ce846c95dbf2173c44a88adde73f33a22b7c2d9a205dfd4546cf39e4c4.jpg) + +A: There is just one person +A: The man is in the kitchen +A: No he is already in the kitchen +A: He closes the cabinet and then walks to the +table and pulls the chair out to sit down +A: He appears to be neutral in expression + +![](images/da5676158a60466262b1640de6261fcf9e51bef2177bdd8980358c922ae9fa05.jpg) +Figure 1: Examples of video-grounded dialogues from the benchmark datasets of Audio-Visual Scene Aware Dialogues (AVSD) challenge (Alamri et al., 2018, 2019). H: human, A: the dialogue agent. + +H: hello, what is the first thing he does? +H: where does he put it? +H: what does he do after that? +"thing he does?" +? +that? + +![](images/b2ef2454ea59424c9e5fcfc90b11b9b445eb7d00c94d1efe015812037eed1feb.jpg) + +![](images/3a9d38cc3332c3bfd4a66f049ee9677641d196005a05a74c306728d7688fe08c.jpg) + +A: he takes off his long sleeve shirt +A: he sets it on the table in front of him +A: he opens the door and sits down on the ground + +(Tapaswi et al., 2016; Jang et al., 2017; Lei et al., 2018) whereby the agent answers questions from humans over multiple turns rather than a single turn (See Figure 1). This is a very complex task as the dialogue agent needs to possess not only strong language understanding to generate natural responses but also sophisticated reasoning over video information, including the related objects, their positions and motions, etc. Compared to image-based NLP tasks such as image QA and captioning (Antol et al., 2015; Xu et al., 2015; Goyal et al., 2017), video-grounded dialogues are more challenging as the feature representation of a video involves both spatial and temporal dimensions. Ideally, a dialogue agent has to process information of both dimensions to address the two major questions: "where to look" (spatial reasoning) and "when to look" (temporal reasoning) in the video. + +However, current approaches in video-grounded dialogues (Hori et al., 2019; Le et al., 2019b; Sanabria et al., 2019) often overlook spatial features and assume each spatial region is equally important to the current task (each spatial region is + +assigned with a uniform weight). Such approach is appropriate for cases where the video involves just few objects and spatial positions can be treated similarly. However, in many scenarios (e.g. examples in Figure 1), each video frame often contains multiple distinct objects and not all of them are relevant to the given question. + +Related tasks to video-grounded dialogues are video QA and video captioning. Previous efforts in these research areas such as (Jang et al., 2017; Aafaq et al., 2019) explicitly consider both spatial and temporal features of input video. These models learn to summarize spatial features based on their importance to question rather than considering each region equally. We are motivated by these approaches and propose to extend spatiotemporal reasoning to dialogues. However, rather than fixing on processing spatial inputs then learning temporal inputs, we note that in some cases, e.g. extended videos over a long period, it is more practical to first identify the relevant video segments before pinpointing the specific subjects of interest. Considering questions in a dialogue setting, it is appropriate to assume the questions are relevant to varying temporal locations of the video rather than just a small fixed segment. We, thus, propose to explore a bidirectional vision-language reasoning approach to fully exploit both spatial and temporal-level features through two reasoning directions. + +Our approach includes two parallel networks to learn relevant visual signals from the input video based on the language signals from user utterances. Each network projects the language-based features to a three-dimensional tensor which is then used to independently learn video signals following a reasoning direction either as spatial $\rightarrow$ temporal or temporal $\rightarrow$ spatial. The output from each network is dynamically combined by importance scores computed based on language and visual features. The weighted output is recurrently used as input to the reasoning modules to allow the models to progressively derive relevant video signals over multiple steps. Intuitively, spatial $\rightarrow$ temporal reasoning is more appropriate for human queries related to specific entities or for input video involving many objects. temporal $\rightarrow$ spatial reasoning is more suitable for human queries about a particular video segment or for videos of extensive lengths. + +We name our proposed approach Bidirectional Spatio-Temporal Learning (BiST), with the following contributions: (1) Rather than exploit + +ing temporal-level information only, our approach equally emphasizes both spatial and temporal features of videos for higher-resolution queries of visual cues. (2) To tackle the diverse queried information from conversational queries, we propose a bidirectional strategy, denoted spatial $\leftrightarrow$ temporal, to enable comprehensive information diffusion between the two visual feature spaces. (3) Our models achieve competitive performance on the "AVSD" (Audio-Visual Scene Aware Dialogues) benchmark from the $7^{th}$ Dialogue System Technology Challenge (DSTC7) (Alamri et al., 2018, 2019). We adapt our models to a video QA task "TGIF-QA" (Jang et al., 2017) and achieve significant performance gains. (4) We conduct a comprehensive ablation and qualitative analysis and demonstrate the efficacy of our bidirectional reasoning approach. + +# 2 Related Work + +Our work is related to two research topics: video-grounded dialogues and spatio-temporal learning. Video-grounded Dialogues. Following recent efforts that combine NLP and Computer Vision research (Antol et al., 2015; Xu et al., 2015; Goyal et al., 2017), video-grounded dialogues are extended from the two major research fields: video action recognition and detection (Simonyan and Zisserman, 2014; Yang et al., 2016; Carreira and Zisserman, 2017) and dialogues/QA (Rajpurkar et al., 2016; Budzianowski et al., 2018; Gao et al., 2019a). Approaches to video-grounded dialogues (Sanabria et al., 2019; Hori et al., 2019; Le et al., 2019b) typically use pretrained video models, such as 2D CNN models on video frames (Donahue et al., 2015; Feichtenhofer et al., 2016), and 3D CNN models on video clips (Tran et al., 2015; Carreira and Zisserman, 2017), to extract visual features. However, these approaches mostly exploit the superficial information from the temporal dimension and neglect spatial-level signals. These approaches integrate spatial-level features simply through sum pooling with equal weights to obtain a global representation at the temporal level. They are, thus, not ideal for complex questions that investigate entity-level or spatial-level information (Jang et al., 2017; Alamri et al., 2019). The dialogue setting exacerbates this limitation as it allows users to explore various aspects of the video contents, including both low-level (spatial) and high-level (temporal) information, over multiple dialogue turns. Our approach aims to address this + +challenge in video-grounded dialogues by retrieving fine-grained information from video through a bidirectional reasoning framework. + +Spatio-temporal Learning. Most efforts in spatiotemporal learning focus on action recognition or detection tasks. (Yang et al., 2019) proposes to progressively refine coarse-scale information through temporal extension and spatial displacement for action detection. (Li et al., 2019a) uses a shared network of 2D CNNs over three orthogonal views of video to obtain spatial and temporal signals for action recognition. (Qiu et al., 2019) adopts a two-path network architecture that integrates global and local information of both temporal and spatial dimensions for video classification. Other research areas that investigate spatio-temporal learning include video captioning (Aafaq et al., 2019), video super-resolution (Li et al., 2019b), and video object segmentation (Xu et al., 2019). In general, spatio-temporal learning approaches aim to process higher-resolution information from complex videos that involve multiple objects in each video frame or motions over video segments (Yang et al., 2019). We are motivated by a similar reason observed in video-grounded dialogues and explore a vision-language bidirectional reasoning approach to obtain more fine-grained visual features. + +# 3 BiST Model + +The input includes a video $V$ , dialogue history of $(t - 1)$ turns (where $t$ is the current turn), each including a pair of (human utterance $H$ , dialogue agent response $A$ ) $(H_{1}, A_{1}, \dots, H_{t - 1}, A_{t - 1})$ , and current human utterance $H_{t}$ . The output is a system response $A_{t}$ that can address current human utterance. The input video can contain features in different modalities, including vision, audio, and text (such as video caption or subtitle). Without loss of generalization, we can denote each text input as a sequence of tokens, each represented by a unique token index from a vocabulary set $V$ : dialogue history $X_{\mathrm{his}}$ , user utterance $X_{\mathrm{que}}$ , text input of video $X_{\mathrm{cap}}$ , and output response $Y$ . We also denote $L_{\mathrm{S}}$ as the length of a sequence $S$ . For instance, $L_{\mathrm{que}}$ is the length of $X_{\mathrm{que}}$ . + +Our model is composed of four parts: (1) The encoders encode text sequences and video inputs, including visual, audio, and text features, into continuous representations. For non-text features such as vision and sound, we follow previous work (Lei et al., 2018; Hori et al., 2019) and assume access + +to pre-trained models. (2) Several neural reasoning components learn dependencies between user utterances/query and video features of multiple modalities. For video visual features, we propose to learn dependencies at both spatial and temporal levels in two directions (see Figure 2). Specifically, we allow interaction between each token in user query and each spatial position or temporal step of the video. The outputs from spatial-based or temporal-based reasoning are sequentially incorporated in two directions, temporal→spatial and spatial→temporal. The bidirectional strategy enables information being fused dynamically and captures complex dependencies between textual signals from dialogues and visual signals from videos. (3) The decoder passes encoded system responses over multiple attention steps, each of which integrates information from textual or video representations. The decoder output is passed to a generator to generate tokens by an auto-regressive way. (4) The generator computes three distributions over the vocabulary set, one distribution as output from a linear transformation and the others based on pointer attention scores over positions of input sequences. + +# 3.1 Encoders + +Text Encoder. We use an encoder to embed text-based input $X$ into continuous representations $Z \in \mathbb{R}^{L_X \times d}$ . $L_{X}$ is the length of sequence $X$ and $d$ is the embedding dimension. A text encoder includes a token-level embedding layer and a layer normalization (Ba et al., 2016). The embedding layer includes a trainable matrix $E \in \mathbb{R}^{|V| \times d}$ , with each row representing a token in the vocabulary set $V$ as a vector of dimension $d$ . We denote $E(X)$ as the embedding function that looks up the vector of each token in input sequence $X$ : $Z_{\mathrm{emb}} = E(X) \in \mathbb{R}^{L_X \times d}$ . To incorporate the positional encoding layer, we adopt the approach from (Vaswani et al., 2017) with each token position represented as a sine or cosine function. The output from positional encoding and token-level embedding is combined through element-wise summation and layer normalization. The encoder outputs include representations for dialogue history $Z_{\mathrm{his}}$ , user query $Z_{\mathrm{que}}$ , video caption $Z_{\mathrm{cap}}$ , and target response $Z_{\mathrm{res}}$ . For target response, during training, the sequence is shifted left by one position to allow prediction in the decoding step $i$ is auto-regressive on the previous positions $1, \ldots, (i - 1)$ . We share the embedding matrix $E$ to encode all text sequences. + +![](images/8364ff13c739507cab9cf57dc561eac19cf479f6c47c1117dcd241b9a0cf6e16.jpg) +Figure 2: Our bidirectional approach models the dependencies between text and vision in two reasoning directions: spatial $\rightarrow$ temporal and temporal $\rightarrow$ spatial. $\otimes$ and $\oplus$ denote dot-product operation and element-wise summation. + +Video Encoder. We make use of a 3D-CNN video model to extract spatio-temporal visual features. The dimensions of the resulting output depend on the configuration of sampling stride and clip length. We denote the output from a pretrained visual model as $Z_{\mathrm{vis}}^{\mathrm{pre}} \in \mathbb{R}^{F \times P \times d_{\mathrm{vis}}^{\mathrm{pre}}}$ where $F$ is the number of sampled video clips, $P$ is the spatial dimension from a 3D CNN layer, and $d_{\mathrm{vis}}^{\mathrm{pre}}$ is the feature dimension. We apply a linear layer with ReLU and layer normalization to reduce feature dimension to $d \ll d_{\mathrm{vis}}^{\mathrm{pre}}$ . For audio features, we follow similar procedures to obtain audio representation $Z_{\mathrm{aud}} \in \mathbb{R}^{F \times d}$ . We keep the pretrained visual and audio models fixed and directly use extracted features to our dialogue models. + +# 3.2 Bi-directional Reasoning + +We propose a bidirectional architecture whereby the text features are used to select relevant information in both spatial and temporal dimensions in two reasoning directions (See Figure 2). + +Temporal $\rightarrow$ spatial. In one direction, the user query is used to select relevant information along temporal steps of each spatial region independently. We first stack the encoded query features to $P$ spatial positions and denote the stacked features as $Z_{\mathrm{que}}^{\mathrm{stack}} \in \mathbb{R}^{P \times L_{\mathrm{que}} \times d}$ . For each spatial position, the model learns the dependencies between question and each of $F$ temporal steps through an attention mechanism as follows: + +$$ +Z _ {t 2 s} ^ {(1)} = Z _ {\text {v i s}} ^ {\mathsf {T}} W _ {t 2 s} ^ {(1)} \in \mathbb {R} ^ {P \times F \times d _ {\text {a t t}}} \tag {1} +$$ + +$$ +Z _ {t 2 s} ^ {(2)} = Z _ {\mathrm {q u e}} ^ {\mathrm {s t a c k}} W _ {t 2 s} ^ {(2)} \in \mathbb {R} ^ {P \times L _ {\mathrm {q u e}} \times d _ {\mathrm {a t t}}} \tag {2} +$$ + +$$ +S _ {t 2 s} ^ {(1)} = \operatorname {S o f t m a x} \left(Z _ {t 2 s} ^ {(2)} Z _ {t 2 s} ^ {(1)} ^ {\top}\right) \in \mathbb {R} ^ {P \times L _ {\text {q u e}} \times F} \tag {3} +$$ + +where $d_{\mathrm{att}}$ is the dimension of the attention hidden layer, $W_{t2s}^{(1)} \in \mathbb{R}^{d \times d_{\mathrm{att}}}$ and $W_{t2s}^{(2)} \in \mathbb{R}^{d \times d_{\mathrm{att}}}$ . The attention scores $S_{t2s}^{(1)}$ are used to obtain weighted sum along the temporal dimension of each spatial position of $Z_{\mathrm{vis}}$ . The resulting tensor is passed through a linear transformation and ReLU layer. The output contains temporally attended visual features and are combined with language features through skip connection. We denote the output by vector $Z_{t2s}^t$ . + +From the temporally attended features, user query is used again to obtain dependencies along the spatial dimension. We use a similar attention network to model the interaction between each token in query and each temporally attended spatial region. + +$$ +Z _ {t 2 s} ^ {(3)} = Z _ {t 2 s} ^ {t} W _ {t 2 s} ^ {(3)} \in \mathbb {R} ^ {L _ {\text {q u e}} \times P \times d _ {\text {a t t}}} \tag {4} +$$ + +$$ +Z _ {t 2 s} ^ {(4)} = Z _ {\text {q u e}} W _ {t 2 s} ^ {(4)} \in \mathbb {R} ^ {L _ {\text {q u e}} \times d _ {\text {a t t}}} \tag {5} +$$ + +$$ +S _ {t 2 s} ^ {(2)} = \operatorname {S o f t m a x} \left(Z _ {t 2 s} ^ {(3)} Z _ {t 2 s} ^ {(4) ^ {\mathsf {T}}}\right) \in \mathbb {R} ^ {L _ {\text {q u e}} \times P} \tag {6} +$$ + +where $W_{t2s}^{(3)} \in \mathbb{R}^{d \times d_{\mathrm{att}}}$ and $W_{t2s}^{(4)} \in \mathbb{R}^{d \times d_{\mathrm{att}}}$ . The attention scores $S_{t2s}^{(2)}$ is used to obtain the weighted sum of all spatial positions from $Z_{t2s}^t$ . The output is temporal-to-spatially attended visual features and is incorporated into language features through skip connection. We denote the resulting output as $Z_{t2s}$ . + +Spatial $\rightarrow$ temporal. In this reasoning direction, similar neural operations are used to compute spatially attended features followed by temporally attended features. The main difference from the other + +reasoning direction is that we stacked the query features to $F$ temporal steps to obtain $Z_{\mathrm{que}}^{\mathrm{stack}} \in \mathbb{R}^{F \times L_{\mathrm{que}} \times d}$ . Other network components, including two attention layers, are as described in Equation 1 to 6. The final output is denoted as $Z_{s2t}$ . + +Previous approaches in video-based NLP tasks (Yu et al., 2016; Jang et al., 2017; Hori et al., 2019) focus on the interaction between global representations of questions and temporal-level representations of videos. This strategy potentially loses critical information on spatial variations in video frames. Our approach does not only emphasize both spatial and temporal feature spaces but also allows neural models to diffuse information from these feature spaces in two different ways. As we can consider spatial information as local signals and temporal information as global signals, our approach enables global-to-local and local-to-global diffusion of visual cues in video. This approach is similar to (Qiu et al., 2019) in which local and global visual signals are learned and diffused iteratively. However, different from this approach, our approach focuses on language-vision reasoning for more accurate visual information queries. + +Multimodal Reasoning. In addition to language- vision reasoning, our models also consider learning of other information dependencies between queries and audio inputs or textual video inputs. + +- Language $\rightarrow$ Audio Reasoning. We adopt similar neural operations from language-vision reasoning. The difference is that we directly use the query features without stacking the features into Equation 1 to 3. The resulting output of text-audio reasoning is denoted as $Z_{\mathrm{q2a}}$ which contains query-guided temporally attended features of $Z_{\mathrm{aud}}$ . +- Language $\rightarrow$ Language Reasoning. This reasoning module focuses on the unimodal dependencies between user query and video caption (if the caption is available). As the caption can contain useful information about the video content, we apply the dot-product attention mechanism similarly as with audio features to obtain $Z_{\mathrm{q2c}}$ . + +Multimodal Fusioning. Given the attended features, we combine them to obtained query-guided video representation, incorporating information from all modalities. We denote the concatenated representation in the following: + +$$ +Z _ {\mathrm {q 2 v i d}} = [ Z _ {\mathrm {q u e}}; Z _ {t 2 s}; Z _ {s 2 t}, Z _ {\mathrm {q 2 a}}, Z _ {\mathrm {q 2 c}} ] \in \mathbb {R} ^ {L _ {\mathrm {q u e}} \times 5 d} +$$ + +where ; is the concatenation operation. The features are combined through an importance score matrix: + +$$ +S _ {\mathrm {v i d}} = \operatorname {S o f t m a x} \left(Z _ {\mathrm {q 2 v i d}} W _ {\mathrm {q 2 v i d}}\right) \in \mathbb {R} ^ {L _ {\mathrm {q u e}} \times 4} +$$ + +where $W_{\mathrm{q2vid}} \in \mathbb{R}^{5d \times 4}$ . The scores from $S_{\mathrm{vid}}$ are used to obtain the weighted sum of component video modalities, resulting in a fusion vector from multiple modalities. We denote the resulting output $Z_{\mathrm{vid}}$ . Compared to previous work such as (Hori et al., 2019; Le et al., 2019b) which generally treat all modalities equally, our multimodal features are fused in a question-dependent manner. Potentially, our approach can avoid noisy or unnecessary signals, e.g. audio features not needed for questions only concerning visual contents. + +# 3.3 Response Decoder + +The decoder aims to decode system responses in an auto-regressive manner. During inference, a special token $\langle \mathrm{sos} \rangle$ is fed to the decoder. The output token is then concatenated to this special token as input to the decoder again to decode the second token. This repeats until reaching a limit of decoding rounds or when the special token $\langle \mathrm{eos} \rangle$ is predicted. We apply a similar decoding architecture as (Le et al., 2019b). The decoder includes three attention layers to incorporate contextual cues from textual components to the output token representations. The first layer is a self-attention to learn dependencies among the current tokens. Intuitively, this helps to shape a more semantically structured sequence. The second and third attention steps are used to capture contextual information from dialogue history and current user query to make the responses coherently connected to the whole dialogue context. To incorporate contextual cues from video components, our decoder is slightly different from (Le et al., 2019b). Instead of sequentially going through multiple attention layers, we only need one layer on the fused features $Z_{\mathrm{vid}}$ . This is more memory efficient since it only requires a single attention operation. It also does not depend on the design decision of the ordering of attention layers. At decoding step $j$ , we denote the decoder output as $Z_{\mathrm{dec}} \in \mathbb{R}^{j \times d}$ . + +# 3.4 Pointer Generator + +Given the output from the decoder, the generator network is used to materialize responses in natural language. A linear transformation is used to obtain distribution over the vocabulary set $V$ . + +$$ +P _ {\mathrm {v o c a b}} = \operatorname {S o f t m a x} (Z _ {\mathrm {d e c}} W _ {\mathrm {v o c a b}}) \in \mathbb {R} ^ {j \times | V |} +$$ + +where $W_{\mathrm{vocab}} \in \mathbb{R}^{d \times |V|}$ . We share the weights between $W_{\mathrm{vocab}}$ and $E$ as the semantics between source sequences and target responses are similar. To strengthen the model generation capability, we adopt pointer networks (Vinyals et al., 2015) to emphasize tokens from source sequences, i.e. user queries and video captions. We denote $\mathrm{Ptr}(Z_1, Z_2)$ as the pointer network operation i.e. each token in $Z_2$ is "pointed" to all tokens in $Z_1$ through a learnable probability distribution. The resulting probability distribution is aggregated by all tokens in $Z_1$ to obtain $\mathrm{Ptr}(Z_1, Z_2) \in L_{Z_2} \times |V|$ . The final output distribution, denoted $P_{\mathrm{out}} \in \mathbb{R}^{j \times |V|}$ , is the weighted sum of three distributions: $P_{\mathrm{vocab}}$ , $\mathrm{Ptr}(Z_{\mathrm{que}}, Z_{\mathrm{dec}})$ , and $\mathrm{Ptr}(Z_{\mathrm{cap}}, Z_{\mathrm{dec}})$ . The weights for this fusion are learned via a linear transformation with softmax: $\alpha = \text{Softmax}(Z_{\mathrm{gen}}W_{\mathrm{gen}}) \in \mathbb{R}^{L_{\mathrm{res}} \times 3}$ where $Z_{\mathrm{gen}} = [Z_{\mathrm{res}}; Z_{\mathrm{dec}}; Z_{\mathrm{que}}^{\mathrm{exp}}; Z_{\mathrm{cap}}^{\mathrm{exp}}] \in \mathbb{R}^{j \times 4d}$ , $W_{\mathrm{gen}} \in \mathbb{R}^{4d \times 3}$ , and $Z_{\mathrm{que}}^{\mathrm{exp}}$ and $Z_{\mathrm{cap}}^{\mathrm{exp}}$ are the stacked tensors of caption and user queries to $j$ dimensions. + +Optimization. During training, we learn all model parameters by minimizing the generation loss: + +$$ +\mathcal {L} = \sum_ {j = 0} ^ {L _ {Y}} - \log (P _ {\mathrm {o u t}} (y _ {j})). +$$ + +# 4 Experiments + +# 4.1 Experimental Setups + +Datasets. We use the AVSD benchmark from DSTC7 (Alamri et al., 2018, 2019) which contains dialogues grounded on the Charades videos (Sigurdsson et al., 2016). In addition, we adapt our models to the video QA benchmark TGIF-QA (Jang et al., 2017). (See Table 1 for a summary of the two datasets). To extract visual and audio features, we used 3D-CNN ResNext-101 (Xie et al., 2017) pretrained on Kinetics (Hara et al., 2018) to obtain spatio-temporal visual features and VG-Gish pretrained on YouTube videos (Hershey et al., 2017) to extract (temporal) audio features. We sample video clips to extract visual features with a window size of 16 frames, and stride of 16 and 4 in AVSD and TGIF-QA respectively. In TGIF-QA experiments, we also extract visual features from pretrained ResNet-152 (He et al., 2016) for a fair comparison with existing work. In AVSD experiments, we make use of the video summary as the video-dependent text input $X_{\mathrm{cap}}$ . + +Training Procedure. We adopt the Adam optimizer (Kingma and Ba, 2015) and the learning rate + +
Benchmark#TrainVal.Test
AVSDDialogs7,6591,7871,710
Turns153,18035,74013,490
Words1,450,754339,006110,252
TGIF-QACount QA24,1592,6843,554
Action QA18,4282,0472,274
Trans. QA47,4345,2706,232
Frame QA35,4533,93913,691
+ +Table 1: Summary of DSTC7 AVSD and TGIF-QA benchmark. The TGIF-QA contains 4 different tasks: (1) Count: open-ended QA which counts the number of repetitions of an action. (2) Action: multi-choice (MC) QA about a certain action occurring a fixed number of times. (3) Transition: MC QA about the temporal variation of video. (4) Frame: open-ended QA which can be answered from one video frame. + +strategy from (Vaswani et al., 2017). We set the learning rate warm-up steps equivalent to 5 epochs and train models up to 50 epochs. We select the best models based on the average loss per epoch in the validation set. We initialize all model parameters with uniform distribution (Glorot and Bengio, 2010). During training, we adopt the auxiliary auto-encoder loss function from (Le et al., 2019b). We adopt Transformer attention (Vaswani et al., 2017) in our models and select the following hyperparameters: $d = d_{\mathrm{att}} = 128$ , $N_{\mathrm{att}} = N_{\mathrm{dec}} = 3$ , and $h_{\mathrm{att}} = 8$ where $N_{\mathrm{att}}$ and $N_{\mathrm{dec}}$ are the number of Transformer blocks in multimodal reasoning and decoder networks and $h_{\mathrm{att}}$ is the number of attention heads. We tuned other hyper-parameters following grid-search over the validation set. In AVSD experiments, we train our models by applying label smoothing (Szegedy et al., 2016) on the target system responses $Y$ . We adopt a beam search technique with a beam size 5. + +# 4.2 Modifications for Video QA + +In many Video QA benchmarks such as TGIF-QA (Jang et al., 2017), the tasks are retrieval-based (e.g. output a single score for each output candidate) rather than generation-based as in many dialogue tasks. Following (Fan et al., 2019), we first concatenate the question with each candidate answer individually and treat this as $Z_{\mathrm{que}}$ to our models. As there is no target response to be decoded, we adapt our models to this setting by using a trainable vector $z_{j} \in \mathbb{R}^{d}$ to represent a candidate response $R_{j}$ , replacing $Z_{\mathrm{res}} \in \mathbb{R}^{j \times d}$ in a dialogue, as input to the decoder. The output, denoted $Z_{j,\mathrm{dec}} \in \mathbb{R}^{d}$ , is passed to a linear transformation layer to obtain a score $s_{j,\mathrm{out}} = Z_{j,\mathrm{dec}} W_{\mathrm{out}} \in \mathbb{R}$ + +
Model\(Z_{\text{vis}}\)\(Z_{\text{aud}}\)\(Z_{\text{cap}}\)BLEU1BLEU2BLEU3BLEU4METEORROUGE-LCIDEr
Baseline (Hori et al., 2019)I3D--0.6210.4800.3790.3050.2170.4810.733
MTN (Le et al., 2019b)I3D--0.6540.5210.4200.3430.2470.5200.936
MTN (Le et al., 2019b)ResNext--0.6880.5500.4440.3630.2600.5410.985
BiSTResNext--0.7110.5780.4750.3940.2610.5501.050
Video Sum. (Sanabria et al., 2019)ResNext-0.7180.5840.4780.3940.2670.5631.094
Video Sum.+How2 (Sanabria et al., 2019)ResNext-0.7230.5860.4760.3870.2660.5641.087
MTN (Le et al., 2019b)I3D-0.7150.5810.4760.3920.2690.5591.066
MTN (Le et al., 2019b)ResNext-0.7310.5970.4900.4060.2710.5641.127
BiSTResNext-0.7540.6220.5150.4300.2840.5841.190
Baseline (Hori et al., 2019)I3DVGGish-0.6260.4850.3830.3090.2150.4870.746
Baseline+GRU+HierAttn. (Le et al., 2019a)I3DVGGish-0.6310.4910.3900.3150.2390.5090.848
FA+HRED (Nguyen et al., 2018)I3DVGGish-0.6480.5050.3990.3230.2310.5100.843
Student-Teacher (Hori et al., 2019)I3DVGGish-0.6750.5430.4460.3710.2480.5270.966
MTN (Le et al., 2019b)I3DVGGish-0.6920.5560.4500.3680.2590.5370.964
MTN (Le et al., 2019b)ResNextVGGish-0.6880.5540.4520.3720.2510.5310.950
BiSTResNextVGGish-0.7150.5600.4770.3900.2590.5521.030
Baseline+GRU+HierAttn. (Le et al., 2019a)I3DVGGish0.6330.4900.3860.3100.2420.5150.856
FA+HRED (Nguyen et al., 2018)I3DVGGish0.6950.5530.4440.3600.2490.5440.997
Student-Teacher (Hori et al., 2019)I3DVGGish0.7270.5930.4880.4050.2730.5661.118
MTN (Le et al., 2019b)I3DVGGish0.7310.5970.4940.4100.2740.5691.129
MTN (Le et al., 2019b)ResNextVGGish0.7350.6000.4980.4130.2750.5711.137
BiSTResNextVGGish0.7550.6190.5100.4290.2840.5811.192
+ +Table 2: Evaluation results on the test split of the AVSD benchmark. The results are presented in 4 settings by video feature components: (1) visual-only, (2) visual and text, (3) visual and audio, and (4) visual, audio, and text. + +where $W_{\mathrm{out}} \in \mathbb{R}^{d \times 1}$ . In this setting, we remove the language → language and language → audio reasoning modules. The loss function is the summed pairwise hinge loss (Jang et al., 2017) between scores of positive answer $s_{\mathrm{out}}^p$ and each negative answer $s_{j,\mathrm{out}}^n$ . $\mathcal{L} = \sum_{j=1}^{K} \max(0, m - (s_{\mathrm{out}}^p - s_{j,\mathrm{out}}^n))$ where $K$ is the total number of candidate answers and $m$ is a hyper-parameter used as a margin between positive and negative answers. + +Training. Multiple-choice tasks, including Action and Transition, are trained following the pairwise loss with $K = 5$ and $m = 1$ . Count task is trained with similar approach but as a regression problem with a single output score $s_{\mathrm{out}}$ . The loss function is measured as mean square error between output $s_{\mathrm{out}}$ and label $y$ . The open-ended Frame task is trained as a generation task, similarly to the dialogue response generation task, with a single-token output. We use the vector $z \in \mathbb{R}^d$ as input to the decoder. The generator includes a single linear layer with $W_{\mathrm{out}} \in \mathbb{R}^{d \times |v|}$ . We do not apply pointer network in this case as the output is only a single-token response. + +# 4.3 Results + +AVSD Results. We report the objective scores, including BLEU (Papineni et al., 2002), METEOR (Banerjee and Lavie, 2005), ROUGE-L (Lin, 2004), and CIDEr (Vedantam et al., 2015). These metrics, which formulate lexical overlaps between generated and ground-truth dialogue responses, are borrowed from language generation tasks such + +as machine translation and captioning. We compare our generated responses with 6 reference responses. Major baseline models are: (1) Baseline (Alamri et al., 2018; Hori et al., 2019) consists of LSTM-based encoder-encoder with attention layers between user queries and temporal-level visual and audio features. (2) Baseline + GRU + HierAttn. (Le et al., 2019a) extends (1) through GRU and question-guided self-attention and caption attention. (3) $FA + HRED$ (Nguyen et al., 2018) adopts FiLM neural blocks for language-vision dependency learning. (4) Video Summarization (Sanabria et al., 2019) reformulates the task as a video summarization task and enhances the models with transfer learning from a large-scale summarization benchmark. (5) Student-Teacher (Hori et al., 2019) adopts dual network architecture in which a student network is trained to mimic a teacher network trained with additional video-dependent text input. (6) MTN (Le et al., 2019b) fuses temporal features of different modalities sequentially through a Transformer decoder architecture. (7) FGA (Schwartz et al., 2019) consists of attention networks between all pairs of modalities and the models aggregate attention scores along edges of an attention graph. + +In Table 2, we present the scores by different combinations of features, including vision $Z_{\mathrm{vis}}$ , audio $Z_{\mathrm{aud}}$ , and text $Z_{\mathrm{cap}}$ . In all settings, our models outperform the existing approaches. The performance of our models in the visual-only setting shows the performance gain coming from our bidirectional language-vision reasoning approach. We + +
ModelZvisCount (Loss)Action (Acc)Trans. (Acc)Frame (Acc)
VIS (aggr) (Ren et al., 2015)R5.090.4680.5690.346
VIS (avg) (Ren et al., 2015)R4.800.4880.3480.350
MCB (aggr) (Fukui et al., 2016)R5.170.5890.2430.257
MCB (avg) (Fukui et al., 2016)R5.540.2910.3300.155
Yu et al. (Yu et al., 2017)R5.130.5610.6400.396
ST-VQA (s) (Jang et al., 2017)R+C4.280.5730.6370.455
ST-VQA (t) (Jang et al., 2017)R+C4.400.6080.6710.493
ST-VQA (st) (Jang et al., 2017)R+C4.560.5700.5960.478
Co-Mem (Gao et al., 2018)R+F4.100.6820.7430.515
PSAC (Li et al., 2019c)R4.270.7040.7690.515
HME (Fan et al., 2019)R+C4.020.7390.7780.538
STA (Gao et al., 2019b)R4.250.7230.7900.566
CRN+MAC (Le et al., 2019c)R4.230.7130.7870.592
MQL (Lei et al., 2020)V---0.598
QueST (Jiang et al., 2020)R4.190.7590.8100.597
HGA (Jiang and Han, 2020)R+C4.090.7540.8100.551
GCN (Huang et al., 2020)R+C3.950.7430.8110.563
HCRN (Le et al., 2020)R+RX3.820.7500.8140.559
BiSTR2.400.8390.8170.630
BiSTRX2.190.8470.8190.648
+ +Table 3: Evaluation results on the test split of the TGIF-QA benchmark. Visual features are: R(ResNet), C(C3D), F(FlowCNN), RX(ResNext). + +also observe a performance boost whenever the text feature from video is considered. When we add the audio features, however, the performance gain is not significant. This reveals a potential future extension in our work to better combine visual and audio feature representations. FGA (Schwartz et al., 2019) reports the CIDEr score of 0.806 in the visual-only setting. Compared to FGA, our performance gain indicates the efficacy of learning fine-grained dependencies between query and visual features at both spatial and temporal levels to select relevant information from video. + +TGIF-QA Results. We give the L2 loss for Count task and accuracy for the other three QA tasks (See Appendix A for description of baseline models). From Table 3, our model outperforms existing approaches across all QA tasks, using either frame-level (appearance) feature, ResNet, or sequence-level feature, ResNext. Our models perform better with ResNext as we expect sequence-level feature is more consistent than frame-level feature. Experiments on this benchmark show clearer performance gain of our bidirectional language-vision reasoning approach as the performance is not affected by errors of generation components as in the AVSD experiments. By focusing on learning high-resolution dependencies from spatio-temporal features, our models can fully exploit contextual cues and select better answers for video QA tasks. + +Impacts of Spatio-temporal Learning. We con + +sider model variants based on the spatio-temporal dynamics and report the results in Table 4. We noted that when using a single reasoning direction, the model with temporal $\rightarrow$ spatial performs better than one with the reverse reasoning direction. This observation is different from prior approaches of spatio-temporal learning such as (Jang et al., 2017) which are limited to the reasoning order spatial $\rightarrow$ temporal. This can be explained as the videos in the AVSD benchmark are typically longer than other QA benchmarks. It is practical to focus on temporal locations in frame sequences first before selecting spatial regions in individual frames. In addition, dialogue queries are positioned in a multi-turn setting whereby each turn is relevant to different video segments as the dialogue evolves. Potentially, this observation indicates an important difference of video-grounded dialogues compared to video QA. Secondly, we also observe that our model performance improves when we use both reasoning directions rather than only one of them. Our motivation for this approach is similar to (Schuster and Paliwal, 1997) who proposes a bidirectional strategy to process sequences in both forward and backward directions. Similarly, our approach exploits visual information through a bidirectional information diffusion strategy that can interpret information from both spatial or temporal aspects based on language input. Finally, we observe that using spatio-temporal features is better + +![](images/d2abbdd267092eca4f4aeb57e3ea61485f9d2dfec8064f45685a11b13476b039.jpg) +Figure 3: Comparison of dialogue response outputs of BiST against the baseline models. Parts of the outputs that match and do not match the ground truth are highlighted in green and red respectively. + +than only using one of them, demonstrating the importance of information in both dimensions. To obtain $Z_{\mathrm{vis}}$ for spatial-only or temporal-only features, the spatio-temporal features are passed through an average pooling operation along the temporal or spatial dimensions respectively. + +
t2ss2tBLEU4METEORROUGE-LCIDEr
0.4300.2840.5841.190
0.4220.2810.5811.183
0.4200.2820.5791.177
t only0.4190.2780.5731.156
s only0.4180.2760.5701.150
+ +Ablation Analysis. We conduct experiments with model variants of different hyper-parameter settings. Specifically, we vary the number of attention rounds $N_{\mathrm{att}}$ and attention heads $h_{\mathrm{att}}$ . From Table 5, we noted the contribution of the multi-round architecture to language-vision reasoning as the performance improves with larger reasoning steps, i.e. up to three attention rounds. However, we observe that as we increase to more than 3 reasoning steps, the model performance only improves slightly. We also note that using a multi-head attention mechanism is suitable for tasks dealing with information-intensive media such as video and dialogues. The multi-head structure enables feature projection to multiple subspaces and capture complex language-vision dependencies. + +Qualitative Analysis. In Figure 3, we present some example outputs. We note that the predicted dialogue responses of BiST models are closer to the ground-truth responses. Particularly for complex questions that query specific segments (example B, C, D), and/or specific spatial locations (Example D), our approach can generally produce better + +Table 4: Ablation analysis on the AVSD benchmark with variants of BiST by spatio-temporal dynamics. + +
NhattBLEU4METEORROUGE-LCIDEr
3-380.4300.2840.5841.190
1-180.4180.2800.5741.171
2-280.4220.2780.5761.171
3-310.4140.2780.5801.173
3-320.4180.2800.5791.174
3-340.4280.2800.5841.195
+ +Table 5: Performance of model variants by $N = N_{\mathrm{att}} = N_{\mathrm{dec}}$ and $h_{\mathrm{att}}$ on the AVSD benchmark + +responses. Another observation is that for ambiguous examples such as Example C (where the visual appearance is not clear to differentiate "apartment" and "business office"), our model can return the correct answer. Potentially this can be explained by the extracted signals from spatial-level feature representations. Finally, we note that there are still some errors that make the output sentences partially wrong, such as mismatching subjects (example A), wrong entities (Example B), or wrong actions (Example C). For detailed qualitative analysis, please refer to Appendix B. + +# 5 Conclusion + +We proposed BiST, a novel deep neural network approach for video-grounded dialogues and video QA, which exploits the complex visual nuances of videos through a bidirectional reasoning framework in both spatial and temporal dimensions. Our experimental results show that BiST can extract relevant, high-resolution visual cues from videos and generate quality dialogue responses/answers. + +# References + +Nayyer Aafaq, Naveed Akhtar, Wei Liu, Syed Zulqarnain Gilani, and Ajmal Mian. 2019. Spatio-temporal dynamics and semantic attribute enriched visual encoding for video captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 12487-12496. +Huda Alamri, Vincent Cartillier, Abhishek Das, Jue Wang, Stefan Lee, Peter Anderson, Irfan Essa, Devi Parikh, Dhruv Batra, Anoop Cherian, Tim K. Marks, and Chiori Hori. 2019. Audio-visual scene-aware dialog. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. +Huda Alamri, Chiori Hori, Tim K Marks, Dhruv Batra, and Devi Parikh. 2018. Audio visual scene-aware dialog (avsd) track for natural language generation in dstdc7. In DSTC7 at AAAI2019 Workshop, volume 2. +Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. 2015. Vqa: Visual question answering. In Proceedings of the IEEE international conference on computer vision, pages 2425-2433. +Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. 2016. Layer normalization. arXiv preprint arXiv:1607.06450. +Satanjeev Banerjee and Alon Lavie. 2005. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pages 65-72. +Pawel Budzianowski, Tsung-Hsien Wen, Bo-Hsiang Tseng, Inigo Casanueva, Stefan Ultes, Osman Ramadan, and Milica Gašić. 2018. MultiWOZ - a large-scale multi-domain wizard-of-Oz dataset for task-oriented dialogue modelling. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 5016-5026, Brussels, Belgium. Association for Computational Linguistics. +Joao Carreira and Andrew Zisserman. 2017. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6299-6308. +Jeffrey Donahue, Lisa Anne Hendricks, Sergio Guadarrama, Marcus Rohrbach, Subhashini Venugopalan, Kate Saenko, and Trevor Darrell. 2015. Long-term recurrent convolutional networks for visual recognition and description. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2625-2634. +Chenyou Fan, Xiaofan Zhang, Shu Zhang, Wensheng Wang, Chi Zhang, and Heng Huang. 2019. Heterogeneous memory enhanced multimodal attention model for video question answering. In Proceedings + +of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1999-2007. +Christoph Feichtenhofer, Axel Pinz, and Andrew Zisserman. 2016. Convolutional two-stream network fusion for video action recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1933-1941. +Akira Fukui, Dong Huk Park, Daylen Yang, Anna Rohrbach, Trevor Darrell, and Marcus Rohrbach. 2016. Multimodal compact bilinear pooling for visual question answering and visual grounding. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 457-468, Austin, Texas. Association for Computational Linguistics. +Jianfeng Gao, Michel Galley, Lihong Li, et al. 2019a. Neural approaches to conversational ai. Foundations and Trends in Information Retrieval, 13(2-3):127-298. +Jiyang Gao, Runzhou Ge, Kan Chen, and Ram Nevata. 2018. Motion-appearance co-memory networks for video question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6576-6585. +Lianli Gao, Pengpeng Zeng, Jingkuan Song, Yuan-Fang Li, Wu Liu, Tao Mei, and Heng Tao Shen. 2019b. Structured two-stream attention network for video question answering. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6391-6398. +Xavier Glorot and Yoshua Bengio. 2010. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 249-256. +Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. 2017. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In CVPR, volume 1, page 3. +Kensho Hara, Hirokatsu Kataoka, and Yutaka Satoh. 2018. Can spatiotemporal 3d cnns retrace the history of 2d cnns and imagenet? In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 6546-6555. +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. +Shawn Hershey, Sourish Chaudhuri, Daniel PW Ellis, Jort F Gemmeke, Aren Jansen, R Channing Moore, Manoj Plakal, Devin Platt, Rif A Saurous, Bryan Seybold, et al. 2017. CNN architectures for largescale audio classification. In Acoustics, Speech and Signal Processing (ICASSP), 2017 IEEE International Conference on, pages 131-135. IEEE. + +C. Hori, H. Alamri, J. Wang, G. Wichern, T. Hori, A. Cherian, T. K. Marks, V. Cartillier, R. G. Lopes, A. Das, I. Essa, D. Batra, and D. Parikh. 2019. End-to-end audio visual scene-aware dialog using multimodal attention-based video features. In ICASSP 2019 - 2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 2352-2356. +Chiori Hori, Anoop Cherian, Tim K Marks, and Takaaki Hori. 2019. Joint student-teacher learning for audio-visual scene-aware dialog. Proc. Interspeech 2019, pages 1886-1890. +Deng Huang, Peihao Chen, Runhao Zeng, Qing Du, Mingkui Tan, and Chuang Gan. 2020. Location-aware graph convolutional networks for video question answering. In The AAAI Conference on Artificial Intelligence (AAAI), volume 1. +Yunseok Jang, Yale Song, Youngjae Yu, Youngjin Kim, and Gunhee Kim. 2017. Tgif-qa: Toward spatiotemporal reasoning in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2758-2766. +Jianwen Jiang, Ziqiang Chen, Haojie Lin, Xibin Zhao, and Yue Gao. 2020. Divide and conquer: Question-guided spatio-temporal contextual attention for video question answering. In The AAAI Conference on Artificial Intelligence (AAAI). +Pin Jiang and Yahong Han. 2020. Reasoning with heterogeneous graph alignment for video question answering. In The AAAI Conference on Artificial Intelligence (AAAI). +Diederick P Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR). +Hung Le, S Hoi, Doyen Sahoo, and N Chen. 2019a. End-to-end multimodal dialog systems with hierarchical multimodal attention on video features. In DSTC7 at AAAI2019 workshop. +Hung Le, Doyen Sahoo, Nancy Chen, and Steven Hoi. 2019b. Multimodal transformer networks for end-to-end video-grounded dialogue systems. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5612-5623, Florence, Italy. Association for Computational Linguistics. +Thao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. 2019c. Learning to reason with relational video representation for question answering. arXiv preprint arXiv:1907.04553. +Thao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. 2020. Hierarchical conditional relation networks for video question answering. arXiv preprint arXiv:2002.10698. + +Chenyi Lei, Lei Wu, Dong Liu, Zhao Li, Guoxin Wang, Haihong Tang, and Houqiang Li. 2020. Multiquestion learning for visual question answering. In The AAAI Conference on Artificial Intelligence (AAAI). +Jie Lei, Licheng Yu, Mohit Bansal, and Tamara Berg. 2018. TVQA: Localized, compositional video question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1369-1379, Brussels, Belgium. Association for Computational Linguistics. +Chao Li, Qiaoyong Zhong, Di Xie, and Shiliang Pu. 2019a. Collaborative spatiotemporal feature learning for video action recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR). +Sheng Li, Fengxiang He, Bo Du, Lefei Zhang, Yonghao Xu, and Dacheng Tao. 2019b. Fast spatio-temporal residual network for video superresolution. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. +Xiangpeng Li, Jingkuan Song, Lianli Gao, Xianglong Liu, Wenbing Huang, Xiangnan He, and Chuang Gan. 2019c. Beyond rnns: Positional self-attention with co-attention for video question answering. In The 33rd AAAI Conference on Artificial Intelligence, volume 8. +Chin-Yew Lin. 2004. Rouge: A package for automatic evaluation of summaries. Text Summarization Branches Out. +Dat Tien Nguyen, Shikhar Sharma, Hannes Schulz, and Layla El Asri. 2018. From film to video: Multi-turn question answering with multi-modal context. In AAAI 2019 Dialog System Technology Challenge (DSTC7) Workshop. +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311-318. Association for Computational Linguistics. +Zhaofan Qiu, Ting Yao, Chong-Wah Ngo, Xinmei Tian, and Tao Mei. 2019. Learning spatio-temporal representation with local and global diffusion. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 12056-12065. +Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. Squad: $100,000+$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250. +Mengye Ren, Ryan Kiros, and Richard Zemel. 2015. Exploring models and data for image question answering. In Advances in neural information processing systems, pages 2953-2961. + +Ramon Sanabria, Shruti Palaskar, and Florian Metze. 2019. Cmu sinbad's submission for the dstd7 avsd challenge. In DSTC7 at AAAI2019 workshop, volume 6. +Mike Schuster and Kuldip K Paliwal. 1997. Bidirectional recurrent neural networks. IEEE transactions on Signal Processing, 45(11):2673-2681. +Idan Schwartz, Seunghak Yu, Tamir Hazan, and Alexander G Schwing. 2019. Factor graph attention. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2039-2048. +Gunnar A Sigurdsson, Gül Varol, Xiaolong Wang, Ali Farhadi, Ivan Laptev, and Abhinav Gupta. 2016. Hollywood in homes: Crowdsourcing data collection for activity understanding. In European Conference on Computer Vision, pages 510-526. Springer. +Karen Simonyan and Andrew Zisserman. 2014. Two-stream convolutional networks for action recognition in videos. In Advances in neural information processing systems, pages 568-576. +Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. 2016. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2818-2826. +Makarand Tapaswi, Yukun Zhu, Rainer Stiefelhagen, Antonio Torralba, Raquel Urtasun, and Sanja Fidler. 2016. MovieQA: Understanding Stories in Movies through Question-Answering. In *IEEE Conference on Computer Vision and Pattern Recognition* (CVPR). +Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. 2015. Learning spatiotemporal features with 3d convolutional networks. In Proceedings of the IEEE international conference on computer vision, pages 4489-4497. +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. +Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. 2015. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4566-4575. +Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. 2015. Pointer networks. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett, editors, Advances in Neural Information Processing Systems 28, pages 2692-2700. Curran Associates, Inc. + +Saining Xie, Ross Girshick, Piotr Dólar, Zhuowen Tu, and Kaiming He. 2017. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1492-1500. +Kai Xu, Longyin Wen, Guorong Li, Liefeng Bo, and Qingming Huang. 2019. Spatiotemporal cnn for video object segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1379-1388. +Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. 2015. Show, attend and tell: Neural image caption generation with visual attention. In International conference on machine learning, pages 2048-2057. +Xiaodong Yang, Pavlo Molchanov, and Jan Kautz. 2016. Multilayer and multimodal fusion of deep neural networks for video classification. In Proceedings of the 24th ACM international conference on multimedia, pages 978-987. ACM. +Xitong Yang, Xiaodong Yang, Ming-Yu Liu, Fanyi Xiao, Larry S Davis, and Jan Kautz. 2019. Step: Spatio-temporal progressive learning for video action detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 264-272. +Haonan Yu, Jiang Wang, Zhiheng Huang, Yi Yang, and Wei Xu. 2016. Video paragraph captioning using hierarchical recurrent neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4584-4593. +Youngjae Yu, Hyungjin Ko, Jongwook Choi, and Gun-hee Kim. 2017. End-to-end concept word detection for video captioning, retrieval, and question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3165-3173. + +# A TGIF-QA Baselines + +In TGIF-QA experiments, we compare our models with the following baselines: (1) VIS (Ren et al., 2015) and (2) MCB (Fukui et al., 2016) are two image-based VQA baselines which were adapted to TGIF-QA by (Jang et al., 2017). (3) Yu et al. (Yu et al., 2017) uses a high-level concept word detector and the detected words are used for semantic reasoning. (4) ST-VQA (Jang et al., 2017) integrates temporal and spatial features by first pretraining temporal part and then finetuning the spatial part. (5) Co-Mem (Gao et al., 2018) includes a co-memory mechanism on two video streams based on motion and appearance features. (6) PSAC (Li et al., 2019c) uses multi-head attention layers to exploit the dependencies between text and temporal variation of video. (7) HME (Fan et al., 2019) is a memory network with read and write operations to update global context representations. (8) STA (Gao et al., 2019b) divides video into $N$ segments and uses temporal attention modules on each segment independently. (9) CRN+MAC (Le et al., 2019c) is a clip-based reasoning framework by aggregating frame-level features into clips through temporal attention. (10) MQL (Lei et al., 2020) exploits the semantic relations among questions and proposes a multi-label prediction task. (11) QueST (Jiang et al., 2020) has two types of question embeddings: spatial and temporal embeddings based on attention guided by video features. (12) HGA (Jiang and Han, 2020) is a graph alignment network consisting of inter- and intra-modality edges to model the interaction between video and question. (13) GCN (Huang et al., 2020) is a similar approach with graph network but utilizes the video object-level features as node representations. (14) HCRN (Le et al., 2020) extends (Le et al., 2019c) with a hierarchical relation network over temporal-level video features. + +# B Qualitative Analysis + +We present additional example outputs in Figure 4. For each examples, we include the last dialogue turn from the dialogue history. In general, BiST can generate responses that better match the ground truth than the Baseline (Hori et al., 2019) and MTN (Le et al., 2019b) (example A, B). Furthermore, we analyze both negative and positive outputs and have the following observations: + +- In cases where the videos contain more than + +one actions, our models can predict responses that describe multiple actions in their correct orders of appearance. For instance, in example D, even though our model response does not completely match the ground truth, it is still correctly explaining the sequence of actions, including first "walking into the room" and "sits down on a chair", matching the visual input from video. MTN response in the same example can express multiple actions but fail to detect the second action before "takes his shirt off". A similar observation can be found in the example F. + +- In cases where the entities are hard to detect due to weak visual distinction, BiST can materialize the correct entity in its responses, e.g. in example C, "a towel" was seen in the last sampled video frame. Another example is example H where BiST detects both "shirt" and "pants" entities (even though their color attributes are not totally correct). However, in example E, all models fail to identify the entity "a cushion", possibly because of the ambiguous and subdue visual features of this object in the video. This displays an important challenge for more fine-grained information extraction in video-grounded dialogues. + +- We noted our model fails in the following complex cases. First, for case with ambiguous questions such as example C, BiST emphasizes an action in the later part of the video ( $3^{rd}$ sampled frame) rather than the early part of the video ( $1^{st}$ and $2^{nd}$ sampled frame). This error might be due to the implied temporal specification in the question. Similarly, in example G, the ambiguous question results in generated responses of different action-level granularity from all models and some responses are partially correct. Secondly, in cases where the ground-truth answer involves unseen entity (example F with the entity "a man" without any visual appearance but possibly detected by his voice in the audio input), our model fails to include this entity in the response. A possible explanation for this example is that our model is not able to detect the entity based on audio input, i.e. "a man talking". This presents the retaining challenge to fully combine multiple modalities into natural language responses in dialogues. + +![](images/ed3b42af041bbcc37b67c11ecbde8f478ac03f84066af645d6d84907becafaa2.jpg) +A + +...does the person speak during the video? no he is quiet through the video... + +Question: does the man ever show any sort of emotion during the video, smile or frown or anything? + +Response (Baseline): no he does not show any emotion. + +Response (MTN): no he does not smile at all. Response (BiST): no he does not show any emotion. + +Response (ground-truth): no he is neutral through out + +![](images/fd97ea99e4b9f17f24b3cb80784d66fee3b0860b7c722496b50ec4a4539e71bf.jpg) + +![](images/c597dc6616cf919936b432ad5459f903359f47545494ef929695cd158ca785a5.jpg) + +...is she placing something on top of the dresser ?no . i think she grabs something off the dresser . + +Question: does she get anything out of her closet? + +Response (Baseline): no , she does not take anything out of the refrigerator . + +Response (MTN): no, she doesn't get anything out of the closet. + +Response (BiST): no, she does not get anything out of closet + +Response (ground-truth): no, she doesn't go into the closet at all. + +![](images/6008f010fcab7585730da142dd38dc0134aaf336828ee08a164e8426936e56d3.jpg) +c + +...how many people are there? there is just one person... + +Question: what do they do? + +Response (Baseline): the man walks into the room + +Response (MTN): he gets up and goes to a window. + +Response (BiST): he puts a towel on the floor Response (ground-truth): he stands up from a bench and closes the window + +![](images/9c816d769d280a3e5bca22a7a7daf34e61a19b01663d6c7bf6405b5b33fcbd46.jpg) + +![](images/e4f1cf860346c91790491e30b7ba3cb6994fa7559edb356edd08e8de24ffae59.jpg) + +...is it a man? + +yes, it is a man in the video. + +Question: what does he do first? + +Response (Baseline): he walks into the room + +Response (MTN): he walks into the room and takes his shirt off his shirt + +Response (BiST): he walks into the room and sits down on a chair + +Response (ground-truth): he comes into the room + +![](images/fc6f081ce4802c10b4032793c76027e688621db2919f0155b12ea3bba16c3399.jpg) +E + +...what does he do next? + +he puts the sandwich down.. + +Question: what is the white thing that he is sitting on? + +Response (Baseline): it appears to be a bed + +Response (MTN): it looks like a sandwich + +Response (BiST): he is sitting on the white chair Response (ground-truth): it is a cushion on the table + +![](images/5d17be41566c9257c85d66610342689500054268e858c714bdf1b1c2ac103b1e.jpg) + +![](images/f229a00d329a1589600367044bdc5b7646dc82aeb90c068e430aa2b55e511045.jpg) + +...what is the first thing that occurs? + +a woman is standing outside holding a book... + +Question: what happens after that? + +Response (Baseline): she picks up her phone and walks out of the room + +Response (MTN): she walks over to the door and picks up a book. + +Response (BiST): she is holding a book and looking at it. + +Response (ground-truth): a man starts talking to her and she goes up a step. + +![](images/b4e6f70d0fe5b2e1b0d043870e0d501497d18d020abb97035738e04517d36b03.jpg) +G +Figure 4: Comparison of dialogue response outputs of BiST against the baseline models: Baseline (Hori et al., 2019) and MTN (Le et al., 2019b). Parts of the outputs that match and do not match the ground truth are highlighted in green and red respectively. + +![](images/eb0109088c4e46cbb8474c22755ac1b33d4be5227084c53152dd1ac870aba44e.jpg) + +![](images/3e156a753e6000d2e71ebe25c2e025368b71e9e493b78937e4d89722ba375961.jpg) + +Question: what is happening in the video? + +Response (Baseline): a man walks into the room + +Response (MTN): a man walks into the kitchen and sits in a chair + +Response (BiST): a man is standing in front of a pantry + +Response (ground-truth): a guy goes to wash dishes + +![](images/eddab00814727cfa36afbe964767c441843da1d946474dc59f5592a2e081904e.jpg) + +![](images/7ee682a5c1b62d15b4adaea90e259b50006ed4708da35bb2ce284720619f08c4.jpg) + +...is there anything else in the video? + +no, all you can see is the woman and the window .... + +Question: what is she wearing? + +Response (Baseline): she is wearing a blue shirt and a shirt + +Response (MTN): she is wearing a black t-shirt and white shirt + +Response (BiST): she is wearing a black shirt and black pants + +Response (ground-truth): she 's wearing a blue shirt , black pants , and a red + +headscarf \ No newline at end of file diff --git a/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/images.zip b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0e22c2925728e3c11c5a667d54a25b4395cb76de --- /dev/null +++ b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e1b1f31d291a6e1ca886145510335c12567c0a17d8c92f30289394052efe35c +size 666455 diff --git a/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/layout.json b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1eea0dfae55cb34f9bf423251428064f06866b69 --- /dev/null +++ b/bistbidirectionalspatiotemporalreasoningforvideogroundeddialogues/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:524fb4f3291a24958f9e0207e65a795e549196a77c3e5c1895721df1258f776d +size 569525 diff --git a/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_content_list.json b/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..8d8b3b5ae567c82bff930f188e0406c2d4c26237 --- /dev/null +++ b/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef9922a6eb1ce1c18f152a453a36aa85c83b3ac4f1f24bf730dc7be905840862 +size 86297 diff --git a/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_model.json b/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_model.json new file mode 100644 index 0000000000000000000000000000000000000000..8fad887facd0a7b6b6f122419eb03b43704254be --- /dev/null +++ b/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b7942371f179242756f0d03ddb63d0c23523e49bd9a882e6d3b8d62587cdbee +size 105503 diff --git a/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_origin.pdf b/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4ba6890587a7e2bab6101d8ddb2fb72ef646d476 --- /dev/null +++ b/blanklanguagemodels/c53f67e2-0185-4de2-9a4a-5d1dc6dafffd_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f2f0b8543ce295a2bba587b50c9ecd4705cd0a07a56d8e758dc8ec68ecfc8ed +size 418612 diff --git a/blanklanguagemodels/full.md b/blanklanguagemodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..df1fa5113ea7b596461bafbe45e8b3a4976ced20 --- /dev/null +++ b/blanklanguagemodels/full.md @@ -0,0 +1,415 @@ +# Blank Language Models + +# Tianxiao Shen* Victor Quach* Regina Barzilay Tommi Jaakkola MIT CSAIL + +{tianxiao, quach, regina, tommi}@csail.mit.edu + +# Abstract + +We propose Blank Language Model (BLM), a model that generates sequences by dynamically creating and filling in blanks. The blanks control which part of the sequence to expand, making BLM ideal for a variety of text editing and rewriting tasks. The model can start from a single blank or partially completed text with blanks at specified locations. It iteratively determines which word to place in a blank and whether to insert new blanks, and stops generating when no blanks are left to fill. BLM can be efficiently trained using a lower bound of the marginal data likelihood. On the task of filling missing text snippets, BLM significantly outperforms all other baselines in terms of both accuracy and fluency. Experiments on style transfer and damaged ancient text restoration demonstrate the potential of this framework for a wide range of applications. + +# 1 Introduction + +Neural language models have shown impressive performance across many applications such as machine translation and summarization where the text is generated from scratch (Bahdanau et al., 2014; Rush et al., 2015). However, a broader set of text generation tasks — including text editing, information fusion, and ancient text restoration — requires the model to start with partially specified text and generate the missing fragments. In the general setup, the input document may have any number of missing spans, and each span may have an unknown number of missing tokens. To perform this text infilling task (Zhu et al., 2019), a model should: (1) provide fine-grained control over the generation location, (2) accommodate a variable number of missing tokens, and (3) respect both the preceding and following context. + +They also have which + +They also have ice cream which is really good. + +Figure 1: BLM fills in blanks of arbitrary length. + +Existing approaches focus on adapting left-to-right language models for text infilling. Intricate inference algorithms leveraging dynamic programming or gradient search are proposed to find the filling content that has a high likelihood within the surrounding context (Sun et al., 2017; Liu et al., 2019a; Zaidi et al., 2020). These methods make simplified Markov assumptions, require high decoding time complexity, and cannot adapt to variable infilling length. Alternatively, Donahue et al. (2020) predict the concatenation of the infilling content, but do not guarantee that the output will match the number of missing spans in the input. + +In this work, we introduce the Blank Language Model (BLM), which uses a special “_” symbol to control where tokens can be placed. The generation of BLM follows the grammar of replacing a blank with a word and possibly adjoining blanks. By jointly modeling context and missing content, BLM supports the control of generation location and produces consistent infilling of variable length. + +Our model can start from a single blank or partial text with blanks in specified locations. It maps the entire input into a sequence of vector representations, and further processes the representations in blank positions to determine the generation action. Generation actions are performed iteratively until there are no blanks. Since multiple trajectories of BLM actions can produce the same final text, we train the model by maximizing a lower bound of the log-likelihood marginalized over trajectories. At test time, we can use simple greedy decoding or beam search to fill in the blanks in the input text. + +BLM shows superior performance in text infilling (Zhu et al., 2019), ancient text restoration (As + +
Step tCanvas cAction a
Location bWord w(Left l, Right r)
0.#1#1isY
1.#1 is #2#1customerN
2.customer #1 is #2#2awesomeN
3.customer #1 is awesome#1serviceN
4.customer service is awesome-End-
+ +Figure 2: An example trajectory that generates the sentence "customer service is awesome". Each action is a tuple $(b, w, l, r)$ , indicating the blank location $b$ selected for expansion, the word $w$ to fill in, whether to create a left blank $l$ , and whether to create a right blank $r$ . + +sael et al., 2019) and style transfer (Shen et al., 2017), demonstrating its flexibility to generate text in diverse conditions. Our model achieves $92.5\%$ accuracy and BLEU score of 23.1 on the Amazon dataset for sentiment transfer. On the task of restoring ancient text that lost half of the characters, we reduce the error rate by 3.3 points compared to previous methods. + +# 2 Related Work + +Recent work has explored various sequence models for non-autoregressive machine translation (Gu et al., 2017). The Insertion Transformer supports dynamic canvas with word insertion (Stern et al., 2019), but does not allow users to specify where to insert. The model is unaware of which parts of the canvas are contiguous text spans that should remain intact, and which (potentially scattered) parts need to be filled in. Directly forcing the Insertion Transformer to perform text infilling can therefore lead to suboptimal solutions. The Levenshtein Transformer combines insertion and deletion through complex policy learning (Gu et al., 2019b). Its insertion mechanism is a two-stage process in which placeholders are first predicted and then filled-in in a masked language model (MLM) manner. In text infilling where the blanks/placeholders are given, it reduces to an MLM. + +MLMs are commonly used in representation learning (Devlin et al., 2018; Joshi et al., 2020). To use them in rewriting tasks, one needs to specify the insertion length in advance and heuristically determine the generation order among the masks (Fedus et al., 2018; Wang and Cho, 2019; Ghazvininejad et al., 2019). Similarly, XL-Net requires absolute positional embedding and thus does not support unknown-length text infilling (Yang et al., 2019; Shih et al., 2019). BLM provides a natural formulation for generative modeling that can dynamically + +accommodate insertions of various length. + +Another line of work focuses on finding an optimal language generation order, such as syntax-based generation (Dyer et al., 2016) and learning adaptive generation order (Gu et al., 2019a). These approaches are tailored to generation from scratch in a specific order. Our model instead is attuned for text rewriting, where the missing parts can be located anywhere in the input text, and the algorithm must flexibly complete them. + +# 3 Blank Language Models + +A blank language model (BLM) generates sequences by creating and filling in blanks. Generation starts with a single blank and ends when there is no blank. In each step, the model selects a blank “_”, predicts a word $w$ , and fills the blank with “ $w$ ”, “_” $w$ ”, “ $w$ ” or “_” $w$ ” This way, a blank can be expanded to any number of words. + +We define a canvas as a sequence of words interspersed with special “_” tokens. The subsequent action is conditioned on this intermediate stage of generation. Suppose the current canvas is $c = (c_{1}, \dots, c_{n})$ with blanks located at indices $b_{1}, \dots, b_{k}$ (i.e. $c_{b_{i}} =$ “_”, for $i = 1, \dots, k$ ). BLM maps this canvas to a distribution over actions specifying how the canvas is to be revised: + +$$ +p (b, w, l, r \mid c; \theta) = \operatorname {B L M} (c) \tag {1} +$$ + +where $b \in \{b_1, \dots, b_k\}$ is a blank location; $w$ is a word in the vocabulary $V$ ; $l, r \in \{0, 1\}$ denote whether or not to create a blank to the left and right of $w$ ; and $\theta$ are the model parameters. The action, defined as the tuple $(b, w, l, r)$ uniquely specifies the next state of canvas (see Fig. 2 for illustration). + +Alternatively, we can view the actions in BLM as production rules in a grammar. Each blank represents a nonterminal symbol or the start symbol, + +![](images/e6788f57a0e2f6140374f685b1fd9efed88861d6814c989502c5350685ab8b01.jpg) +Figure 3: Architecture of the BLM. In the first stage, an index is chosen among all current blank positions. For that location, a word is selected in the second stage. In the final stage, the blank representation is concatenated with the chosen word's embedding and fed into an MLP to determine the creation of the following blanks. + +and the terminal symbols come from the vocabulary $V$ . The production rules are restricted to be of the form “_” $\rightarrow$ “_?w_?” for $w \in V$ , where “?” indicates that the preceding symbol is optional. In contrast to context-free grammars, the probability distribution over production rules in BLM is conditioned on the entire canvas generated so far. + +Model Architecture We encode the canvas $c$ into a sequence of representations $(z_{1},\dots ,z_{n})$ and take representations $Z = (z_{b_1},\dots ,z_{b_k})$ where the blanks are located. Let $d$ denote the dimension of $z$ 's. We factorize the joint distribution $p(b,w,l,r|c;\theta)$ into three parts (shown in Fig. 3): + +1. Choose a blank: + +$$ +p \left(b _ {i} \mid c; \theta\right) = \operatorname {S o f t m a x} \left(u ^ {T} Z\right) \tag {2} +$$ + +where $u\in \mathbb{R}^d$ is a parameter vector to project $z$ 's into one-dimensional logits. + +2. Predict a word for the selected blank: + +$$ +p (w \mid c, b _ {i}; \theta) = \operatorname {S o f t m a x} \left(W z _ {b _ {i}}\right) \tag {3} +$$ + +where $W\in \mathbb{R}^{|V|\times d}$ is a parameter matrix to project $z_{b_i}$ into the vocabulary. + +3. Decide whether or not to create blanks to the left and right of the predicted word: + +$$ +p (l, r \mid c, b _ {i}, w; \theta) = \operatorname {M L P} \left(z _ {b _ {i}}, v _ {w}\right) \tag {4} +$$ + +where $v_{w}$ is the word vector of $w$ , and MLP is a multilayer perceptron with 4 output classes: Left.Yes/No × Right.Yes/No. + +Likelihood Now let us consider the probability $p(x; \theta)$ of generating a sentence/paragraph $x = (x_{1}, \dots, x_{n})$ under the BLM. We call the generating process from an initial blank to complete text a trajectory. The same final text $x$ can be realized by multiple trajectories. However, if we specify the order in which the words in $x$ are generated, the trajectory will be uniquely determined. Consider the example trajectory of a 4-word sentence in Fig. 2. Given the order $(3, 1, 4, 2)$ , at step 0 when we generate $x_{3}$ , both left and right blanks are created for future generations of $x_{1}$ and $x_{2}, x_{4}$ . In step 1 of generating $x_{1}$ , only a right blank is created for the future $x_{2}$ . Subsequent steps can be deduced by analogy. The correspondence between trajectories and generation orders allows us to write the marginal likelihood as: + +$$ +\begin{array}{l} p (x; \theta) = \sum_ {\sigma \in S _ {n}} p (x, \sigma ; \theta) \\ = \sum_ {\sigma \in S _ {n}} \prod_ {t = 0} ^ {n - 1} p \left(a _ {t} ^ {x, \sigma} \mid c _ {t} ^ {x, \sigma}; \theta\right) \tag {5} \\ \end{array} +$$ + +where $S_{n}$ is the set of all $n$ -permutations; $a_{t}^{x,\sigma}, c_{t}^{x,\sigma}$ denote the action and canvas at step $t$ under sentence $x$ and order $\sigma$ , respectively (cf. Fig. 2). + +Training Different losses have been proposed to train generalized sequence models. For instance, BERT and XL-Net mask and predict $15\%$ of tokens conditioned on the rest. This strategy is more suitable for representation learning rather than generation. Insertion Transformer masks different numbers of tokens and weights them with uniform loss or binary tree loss (Stern et al., 2019; Chan et al., + +# Algorithm 1 BLM training + +1: Initialize model parameters $\theta$ +2: repeat +3: Sample a training example $x = (x_{1},\dots ,x_{n})$ +4: Sample $t$ from 0 to $n - 1$ +5: Sample an $n$ -permutation $\sigma$ +6: Construct canvas $c$ that keeps tokens $x_{\sigma_j}(j = 1,\dots ,t)$ and collapses remaining tokens as blanks +7: Get $n - t$ target actions $a_{j - t}$ for filling $x_{\sigma_j}$ ( $j = t + 1, \dots, n$ ) into canvas $c$ +8: Compute loss $\{a_1,\dots ,a_{n - t}\}$ , model.Forward(c)) from Eq. (8) +9: Update $\theta$ by gradient descent +0: until Convergence + +2019). It aims to perform fast inference through parallel decoding. Here, we present a training objective from the language modeling perspective by estimating the log likelihood of generating $x$ . + +Directly computing the marginal likelihood over $n!$ orders is intractable. We apply Jensen's inequality to lower bound the log likelihood: + +$$ +\begin{array}{l} \log p (x; \theta) = \log \sum_ {\sigma \in S _ {n}} \prod_ {t = 0} ^ {n - 1} p (a _ {t} ^ {x, \sigma} | c _ {t} ^ {x, \sigma}; \theta) \\ \geq \log (n!) + \frac {1}{n !} \sum_ {\sigma \in S _ {n}} \sum_ {t = 0} ^ {n - 1} \log p \left(a _ {t} ^ {x, \sigma} \mid c _ {t} ^ {x, \sigma}; \theta\right) \tag {6} \\ \end{array} +$$ + +where equality holds when the posterior $p(\sigma |x;\theta)$ is uniform. By maximizing this lower bound, we do not favor any particular order, but encourage the model to realize $x$ equally well in all orders. It can help the model to complete any partial input text regardless of the position of blanks. + +A naive training algorithm is to directly estimate the lower bound in Eq. (6): first uniformly sample a permutation $\sigma$ from $S_{n}$ and a step $t$ from 0 to $n - 1$ , then construct the canvas $c_{t}^{x,\sigma}$ , and compute the estimated loss $[- \log (n!) - n \cdot \log p(a_{t}^{x,\sigma}|c_{t}^{x,\sigma};\theta)]$ . However, this procedure has a large variance and can only compute the loss of a single action in one pass (in contrast to left-to-right language models that compute $n$ word losses per pass). + +To train the model more efficiently, we note that the canvas $c_{t}^{x,\sigma}$ depends only on the first $t$ elements of $\sigma$ . Hence we can combine into one pass the loss calculations of trajectories that are the same in the first $t$ steps but different at the $t + 1$ step. Switching + +
They also have _ which _. They also have ice cream which is really good .
τε εγγονον εισαι???????σοφιαι τε εγγονον εισαιου του σοφιαι
The employees were super nice and efficient ! The employees were rude and unprofessional !
+ +Figure 4: Examples of input and output for text infilling, ancient text restoration, and style transfer tasks. + +the summation order of $\sigma$ and $t$ , we have: + +$$ +\begin{array}{l} \sum_ {t = 0} ^ {n - 1} \frac {1}{n !} \sum_ {\sigma \in S _ {n}} \log p \left(a _ {t} ^ {x, \sigma} \mid c _ {t} ^ {x, \sigma}; \theta\right) \\ = n \cdot \mathbb {E} _ {t} \mathbb {E} _ {\sigma_ {1: t}} \mathbb {E} _ {\sigma_ {t + 1}} \mathbb {E} _ {\sigma_ {t + 2: n}} [ \log p (a _ {t} ^ {x, \sigma} | c _ {t} ^ {x, \sigma}; \theta) ] \\ = n \cdot \mathbb {E} _ {t} \mathbb {E} _ {\sigma_ {1: t}} \mathbb {E} _ {\sigma_ {t + 1}} \left[ \log p \left(a _ {t} ^ {x, \sigma} \mid c _ {t} ^ {x, \sigma}; \theta\right) \right] \\ = \mathbb {E} _ {t} \mathbb {E} _ {\sigma_ {1: t}} \left[ \frac {n}{n - t} \sum_ {\sigma_ {t + 1}} \log p \left(a _ {t} ^ {x, \sigma} \mid c _ {t} ^ {x, \sigma}; \theta\right) \right] \tag {7} \\ \end{array} +$$ + +which leads to our efficient training algorithm: sample $t$ from 0 to $n - 1$ and partial permutation $\sigma_{1:t}$ , construct the canvas $c_t^{x,\sigma}$ , and compute loss: + +$$ +- \log (n!) - \frac {n}{n - t} \sum_ {\sigma_ {t + 1}} \log p \left(a _ {t} ^ {x, \sigma} \mid c _ {t} ^ {x, \sigma}; \theta\right) \tag {8} +$$ + +The whole process is illustrated in Algorithm 1. In this way, we can compute in expectation $n / 2$ action losses per pass. + +# 4 Experiments + +We test BLM's capacity to rewrite specified portions of text on three tasks: text infilling (Zhu et al., 2019), ancient text restoration (Assael et al., 2019) and style transfer (Shen et al., 2017). Fig. 4 displays example inputs and outputs for these tasks. We also measure the perplexity of BLM on language modeling benchmarks and compare with traditional left-to-right language models. + +Experimental Details In all experiments, the sequence representations in BLM are obtained using the encoder module of transformer_base (Vaswani et al., 2017) (6 layers, 8 heads, $d_{model} = 512$ , $d_{ff} = 2048$ , $d_k = d_v = 64$ ). The MLP used for blank prediction has one hidden layer of size 1024. Weight decay, learning rate, and dropout are tuned based on the loss on the validation set for each dataset respectively. When decoding, we use beam size in $\{1, 5, 10\}$ and choose the best value as + +
Mask ratioBLEUPPL
10%20%30%40%50%10%20%30%40%50%
No infill75.255.037.423.613.098.4163.0266.3421.0647.9
InsT84.872.358.946.033.848.344.241.839.737.7
MLM (oracle length)83.769.355.543.232.258.459.859.859.056.8
BERT+LM82.866.350.337.426.255.155.254.956.553.6
Seq2seq-full86.372.959.446.334.051.346.941.031.920.6
Seq2seq-fill82.867.552.939.928.664.671.073.465.648.7
BLM86.573.259.646.834.850.244.939.935.032.7
+ +Table 1: BLEU scores and perplexity of generated documents by different models for text infilling. The perplexity is measured by a pre-trained left-to-right language model, and the original documents have perplexity 55.8. + +
Mask ratio10%20%30%40%50%
Seq2seq-full15.022.428.733.340.6
Seq2seq-fill31.028.434.542.547.2
+ +Table 2: Infilling failure rate $(\%)$ of seq2seq models. Other methods always produce valid outputs. + +observed on the validation set. We note that beam search in BLM does not search for the sentence with the maximum marginal likelihood $p(x; \theta)$ , but instead for a sentence and a trajectory that have the maximum joint likelihood $p(x, \sigma; \theta)$ . + +# 4.1 Text Infilling + +Dataset We experiment on the Yahoo Answers dataset, which has 100K/10K/10K documents for train-valid/test respectively (Yang et al., 2017). A document has a maximum length of 200 words, with an average of 78 words. Following Zhu et al. (2019), we automatically compile test data by deleting portions of documents. For each document $x$ we randomly mask a given ratio $r$ of its tokens. Contiguous masked tokens are collapsed into a single “_”, resulting in a canvas $c$ to be completed. + +Metrics We measure generation's accuracy by computing its BLEU score against the original document $x$ , and fluency as its perplexity evaluated by a pre-trained (left-to-right) language model. We also report the failure rate, which is the percentage of invalid generations, such as missing existing words or not filling in all the blanks. + +Baselines We compare BLM with five baselines: + +- Insertion Transformer (InstT): By default, InstT does not support controlling the insertion position. We force it to produce valid generations by normalizing the predictions over valid locations, disabling the ⟨eos⟩ prediction unless all + +blanks have been filled, and prioritizing slots that have not been filled yet. Without these steps, InsT would have a failure rate $\geq 88\%$ . + +- MLM (oracle length): MLM for text infilling requires predicting the length of each blank. Here we replace blanks with the target number of $\langle \mathrm{mask} \rangle$ tokens, and fill them autoregressively by the most-confident-first heuristic. +- $BERT + LM$ : We use BERT's representation of each blank as seed for a left-to-right language model that learns to generate the tokens in the corresponding blank. At inference time, the multiple blanks are filled in one after another, conditioned on previous generations. +- Seq2seq-full (Donahue et al., 2020): We train a seq2seq model to output the full document $x$ from input $c$ . Note that it may have invalid outputs that do not match the input format, such as missing existing tokens in $c$ or generating tokens in incorrect locations. +- Seq2seq-fill (Donahue et al., 2020): We train a seq2seq model to output only tokens to be placed in the blanks, with a special ‘|’ token to indicate separation. For the example in Fig. 4, its target output will be “ice cream |is really good”. Unlike seq2seq-full, seq2seq-fill does not have the problem of losing existing tokens in $c$ . However, it may still fail to generate the correct number of ‘|’ that matches the input. + +Results As shown in Table 1, BLM achieves the highest BLEU score at all mask ratios: 0.7 to 1.7 higher than InsT, 2.6 to 4.1 higher than MLM with oracle length, and 3.7 to 9.4 higher than BERT+LM. InsT is not trained with insertion position control. Restricting it to generate at the specified positions thus bias the model towards making suboptimal + +
Mask-ratio 10%Mask-ratio 50%
Blankedwhen time flies, _ does it go? _ the center of the _ to be recycled _ made into new time.when time _, where _? _ the _ of _ universe to _ recycled _ made into _.
BLMwhen time flies, _ where does it go? for the center of the _ earth to be recycled and made into new time.when time was created , where did it come from ? it was the first part of the universe to be recycled and made into space .
InsTwhen time flies, _ where does it go? for the center of the _ earth has to be recycled and made into new time.when time was created , where was it ? what was the name of the universe to be recycled and made into space .
MLM (oracle len)when time flies, _ where does it go? from the center of the _ earth to be recycled _made into new time.when time is , where is the universe ? from the creation of the universe to be recycled and made into the universe .
BERT+LMwhen time flies, _ where does it go? to the center of the _ earth to be recycled _made into new time.when time is , where to ? i need to find the way of the universe to be recycled and made into a lot .
Seq2seq-fullwhen time flies, _ where does it go? at the center of the _ earth to be recycled and made into new time.when time heals , where does it go? it's the end of the universe to be recycled and made into space .
Seq2seq-fillwhen time flies, _ how does it go? at the center of the _ earth to be recycled and made into new time . how |at |earth |andwhen time is time , where is time ? time is the time of time universe to the recycled be made into and . the universe is time |is time |time is |time |time |the |be |and |the universe
Originalwhen time flies , where does it go? to the center of the _ universe to be recycled and made into new time .when time flies , where does it go? to the center of the _ universe to be recycled and made into new time .
+ +Figure 5: Example generations of different models for text infilling on Yahoo Answers. Completions are in italic. Invalid completions are in red. For Seq2seq-fill, we present model outputs along with the merged document. + +completions. MLM is trained to independently predict masked tokens instead of jointly modeling them. Even with the target number of $\langle \mathrm{mask}\rangle$ tokens given, its performance is still inferior to BLM. BERT+LM lags behind other models. In BERT training, one mask corresponds to one token, whereas a blank here can cover multiple tokens, and the distance between words is not fixed. Hence, it is difficult for the LM to complete the sentence from BERT representations. + +Seq2seq-full has BLEU scores closest to BLM. However, its failure rate ranges from $15\%$ to $40.6\%$ as the mask ratio increases. Seq2seq-fill performs worse than Seq2seq-full, possibly because the decoder has to model segmented text while counting the number of blanks. + +In terms of fluency, outputs of BLM, InsT and Seq2seq-full all have perplexity lower than original data perplexity. This is because with beam search, models tend to generate the most typical output with the highest likelihood (Holtzman et al., 2019). + +Examination of model generations confirms the superiority of BLM. In Fig. 5, we showcase example outputs by each model at different mask ratios. In low mask ratio settings, models only need to fill in the blanks with a single word to produce grammatical completions. Most models succeed in this task. With a higher mask ratio of $50\%$ , the main ideas of the document are concealed, and the infilling task is much more challenging. Models + +need to creatively generate sentences that fit the imposed canvas. Although the original meaning of the sentence is not recovered, BLM is the only model able to produce a coherent document with consistency between the question and the answer. + +Overall, BLM displays the best performance both quantitatively and qualitatively. Its inherent text infilling ability frees it from length, order, or termination heuristics used by other methods. + +# 4.2 Ancient Text Restoration + +Ancient text restoration is a form of text infilling where there are fragments in ancient documents that are illegible due to time-related damages and need to be recovered. Assael et al. (2019) introduces the PHI-ML dataset made of fragments of ancient Greek inscriptions. Restoration is performed at the character-level. The number of characters to recover is assumed to be known and indicated by a corresponding number of ‘?’ symbols, as shown in the second row of Fig. 4. In reality, when epigraphists restore a deteriorated document, the length of the lost fragment is unknown and needs to be guessed as a first step. While models proposed by Assael et al. (2019) relies on expert conjectures, we note that BLM can bypass this limitation and flexibly generate completions without this additional knowledge. However, in order to compute the character error rate (CER) for each ‘?’ and have a fair comparison with previous work, we evaluate our model in the length-aware setting. + +
Mask ratioSingle-Multi-slot
1%25%40%50%
Human57.3%---
Pythia32.5%---
Pythia-Word29.1%36.9%42.3%44.9%
L-BLM33.7%37.1%37.9%41.6%
+ +Table 3: CER for ancient text restoration. + +Length-aware BLM (L-BLM) We present a variant of BLM adapted to the specific features of this task. The vocabulary $V$ is an alphabet of characters from the ancient Greek language. We extend $V$ with special “ $[t]$ ” tokens that denote the length of the fragment to recover. Specifically, as a preprocessing step, consecutive ‘?’ characters are collapsed into a single “ $[t]$ ” token, where $t$ is the number of ‘?’ symbols. For each such blank token, L-BLM is trained to predict a character to fill in and the length $l \in \{0, \dots, t-1\}$ of the new blank to its left. The length of the new blank on the right is accordingly $t-1-l$ . + +Dataset The PHI-ML dataset contains about 3 million words / 18 million characters. We evaluate models in two settings: single-slot and multi-slot. For the single-slot setting, we use the testing script of Assael et al. (2019) which samples a context of length $L = 1000$ from an inscription, then samples a slot of length $C \in [1, 10]$ from that context. The characters from the slot are replaced with ‘?’ and constitute the target. For the multi-slot setting, we progressively increase the number of slots, yielding mask ratios of $25\%$ , $40\%$ and $50\%$ respectively. + +Baselines Assael et al. (2019) proposed two models: Pythia, a character-level seq2seq-based approach; and Pythia-Word, a variant of Pythia that uses both character and word representations as input. During training, the model learns to recover the missing characters of examples where a random slot has been masked. When testing on the multi-slot setting, Pythia(-Word) is applied iteratively with beam size 20 for each slot. + +Results Table 3 summarizes the CER of all models in both settings. L-BLM achieves similar CER as Pythia in the single-slot setting, significantly outperforming human experts. Augmented with word representations, Pythia-Word further decreases the error rate compared to character-only methods. + +In reality, restoring damaged inscriptions re + +quires reconstructing multiple lost fragments. As a larger proportion of text is missing, Pythia-Word's performance is degraded. L-BLM is robust to the setting change and outperforms Pythia-Word at the mask ratio of $40\%$ and $50\%$ by 4.4 and 3.3 points, respectively. We posit that L-BLM's advantage lies in its ability to maximize the joint likelihood of the completions over all slots. In contrast, Pythia-Word's is only aware of one slot at a time, and beam search is performed locally within each slot. + +# 4.3 Sentiment Transfer + +The goal of sentiment transfer is to modify the sentiment of a sentence while maintaining its topic (Shen et al., 2017). An example is described on the third row of Fig. 4. Inspired by the way humans perform rewriting, we follow a recent line of work in style transfer that adopts a two-step approach (Li et al., 2018; Xu et al., 2018; Wu et al., 2019b): + +1. Remove words and expressions of high polarity from the source sentence; +2. Complete the partial sentence with words and expressions of the target sentiment. + +Specifically, we adapt the Mask-And-Infill (M&I) framework of Wu et al. (2019b). We perform Step 1 by training a Bi-LSTM sentiment classifier and masking words whose attention weight is above average. We evaluate the contribution of our model as an infilling module in Step 2 in place of their fine-tuned BERT model. To this end, we train two instances of BLM on the dataset, one for each sentiment. At test time, the corresponding BLM is used to produce completions of the target sentiment. + +Wu et al. (2019b) further train the infilling model with the classifier to improve transfer accuracy. They use soft words relaxation to backprop gradients from the classifier to the generator. For BLM, however, we cannot pick locations or insert blanks as "soft" choices, making it challenging to employ a classifier at training time. Nevertheless, we can easily apply the classifier to guide inference. We sample 10 outputs and keep the one with the highest classifier ranking. It is not slower than beam search with size 10 and can be fully parallelized. + +Datasets We test on the Yelp and Amazon review datasets (Shen et al., 2017; Li et al., 2018). The Yelp dataset has $450\mathrm{K} / 4\mathrm{K} / 1\mathrm{K}$ non-parallel sentences for train-valid/test respectively, and the Amazon dataset has $555\mathrm{K} / 2\mathrm{K} / 1\mathrm{K}$ sentences. Each sentence is labeled as either positive or negative. + +
YelpAmazon
ACCBLEUACCBLEU
Li et al. (2018)88.78.448.022.8
Zhang et al. (2018)96.622.884.133.9
Wu et al. (2019a)91.529.940.241.9
M&I with MLM + classifier41.515.931.232.1
97.314.175.928.5
M&I with BLM + classifier79.621.952.024.7
96.521.592.523.1
+ +Table 4: Accuracy and BLEU scores for style transfer. + +
everyone that i spoke with was very helpful and kind . everyone that i spoke with was rude and unprofessional . everyone that i spoke with wasn't helpful or kind.
the beans were in the burro in the rice was nowhere to be found . the beans were in the burro in the rice was the best i found . the beans were in the burro and the rice was plentiful
there is definitely not enough room in that part of the venue . there is always enough parking in that part of the venue . there is so much room in that part of the venue
it is n't terrible , but it is n't very good either . it is n't fancy , but it is still very good either . it is n't perfect , but it is very good .
+ +Figure 6: Example generations by BLM for sentiment transfer on Yelp. The first line is the source sentence with masked words in bold. The second line is BLM's completion. The third line is a human reference. + +Metrics We use evaluation methods introduced by prior work (Shen et al., 2017; Li et al., 2018). To assess the accuracy of generated sentences with respect to the target sentiment, we use a pretrained CNN classifier that achieves $97.7\%$ accuracy on the Yelp dataset and $82.2\%$ accuracy on the Amazon dataset. We also measure the BLEU score between transferred sentences and human references. + +Results In Table 4, we can see that directly applying BLM as the infilling module is significantly better than MLM. The accuracy on Yelp and Amazon datasets is increased by $38.1\%$ and $20.8\%$ , respectively. In addition to the aforementioned problem of MLM being trained to predict masked tokens independently, it must generate the same number of tokens as in the source sentence, whereas our BLM formulation is not subject to this constraint. Our simple use of a classifier at inference time further improves accuracy. It achieves the highest accuracy of $92.5\%$ on Amazon with a small decrease in BLEU, indicating that BLM can easily find high-quality outputs. + +In Fig. 6, we show examples generated by BLM on Yelp. It can dynamically adapt to the imposed + +
m1101001000
Estimated PPL46.344.443.342.5
+ +Table 5: The estimated perplexity of BLM with the number of MC samples $m$ on WikiText-103. + +
PTBWT2WT103
LSTM (Grave et al., 2016)82.399.348.7
AWD-LSTM (Merit et al., 2017)57.365.8-
TCN (Bai et al., 2018)88.7-45.2
Transformer (Dai et al., 2019)--30.1
Adaptive (Baevski and Auli, 2018)--18.7
Transformer-XL (Dai et al., 2019)54.5-18.3
InsT (our implementation)77.391.439.4
BLM69.281.242.5
+ +Table 6: Perplexity on the PTB and WikiText datasets. + +canvas and fill in blanks with expressions of varied lengths, e.g., “nowhere to be found” → “the best i found” and “definitely not” → “always”. We note that failure cases arise when negative words like “either” are left unmasked; BLM is then unable to produce satisfactory outputs from the canvas. + +# 4.4 Language Modeling + +Language modeling is a special case of text infilling where sequences are generated from scratch. Traditional left-to-right models dominate this task, but are not suitable for text infilling. Conversely, unconventional sequence models are rarely evaluated on language modeling. Here, we study the perplexity of BLM and Insertion Transformer, and compare them with left-to-right language models to provide additional insights. + +We use the Monte-Carlo method to estimate the likelihood in Eq. (5) with $m$ samples. While the estimate is unbiased, given that per-word perplexity is a convex function of per-sentence likelihood, sampling estimates like ours are likely yielding a value higher than the actual perplexity (see Appendix B for a proof). As $m$ increases, it converges to the actual perplexity. + +Datasets We test on three benchmark datasets: Penn Treebank (PTB) which has about 1M tokens (Mikolov et al., 2010), WikiText-2 (WT2) which has 2M tokens, and WikiText-103 (WT103) which has 103M tokens (Merit et al., 2016). + +Results Table 5 shows the trend of estimated PPL with the number of samples $m$ . We choose $m = 1000$ in our evaluation, which is close to convergence. Table 6 summarizes the perplexity of our + +model in comparison with previous work. The top results are achieved by the Transformer-XL (Dai et al., 2019) and the adaptive embedding method (Baevski and Auli, 2018). They use larger model sizes and supplementary techniques that can also be combined with our model. BLM rivals the Insertion Transformer and outperforms left-to-right language models with LSTM and Temporal Convolutional Network (TCN) architecture. Language modeling seems to still be challenging for free-order models. By reporting the perplexity of unconventional models like BLM, we hope to stimulate future work in this area to close the performance gap with traditional left-to-right models. + +# 5 Conclusion + +In this paper, we proposed the Blank Language Model for flexible text generation. Given partially specified text with one or more blanks, BLM will fill in the blanks with a variable number of tokens consistent with the context. We demonstrate the effectiveness of our model on various text rewriting tasks, including text infilling, ancient text restoration and style transfer. + +The action of BLM consists of selecting a blank and replacing it with a word and possibly adjoining blanks. We train BLM by optimizing a lower bound on the marginal data likelihood that sums over all possible generation trajectories. In this way, we encourage the model to realize a sentence equally well in all orders, which is suitable for filling arbitrary blanks. Appendix C shows examples generated by BLM along with their trajectories. Depending on the application, we could also train the model to generate in specific orders by placing higher weights on the corresponding trajectories. + +BLM has plenty of future applications, including template filling, information fusion, assisting human writing, etc. Moreover, we can extend our formulation to a conditional generative model. Such models can be used in machine translation to support editing and refining translation, as well as in dialogue systems to compose a complete sentence with given elements. While we proposed BLM for language generation, it would also be interesting to compare the representations learned by BLM with those produced by other pre-training methods. + +# Acknowledgments + +We thank all reviewers and the MIT NLP group for their thoughtful feedback. + +# References + +Yannis Assael, Thea Sommerscheid, and Jonathan Prag. 2019. Restoring ancient text using deep learning: a case study on Greek epigraphy. 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 6368-6375. +Alexei Baevski and Michael Auli. 2018. Adaptive input representations for neural language modeling. arXiv preprint arXiv:1809.10853. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +Shaojie Bai, J Zico Kolter, and Vladlen Koltun. 2018. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271. +William Chan, Nikita Kitaev, Kelvin Guu, Mitchell Stern, and Jakob Uszkoreit. 2019. Kermit: Generative insertion-based modeling for sequences. arXiv preprint arXiv:1906.01604. +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. +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. +Chris Donahue, Mina Lee, and Percy Liang. 2020. Enabling language models to fill in the blanks. arXiv preprint arXiv:2005.05339. +Chris Dyer, Adhiguna Kuncoro, Miguel Ballesteros, and Noah A Smith. 2016. Recurrent neural network grammars. arXiv preprint arXiv:1602.07776. +William Fedus, Ian Goodfellow, and Andrew M Dai. 2018. Maskgan: better text generation via filling in the .. arXiv preprint arXiv:1801.07736. +Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. 2019. Constant-time machine translation with conditional masked language models. arXiv preprint arXiv:1904.09324. +Edouard Grave, Armand Joulin, and Nicolas Usunier. 2016. Improving neural language models with a continuous cache. arXiv preprint arXiv:1612.04426. +Jiatao Gu, James Bradbury, Caiming Xiong, Victor OK Li, and Richard Socher. 2017. Non-autoregressive neural machine translation. arXiv preprint arXiv:1711.02281. + +Jiatao Gu, Qi Liu, and Kyunghyun Cho. 2019a. Insertion-based decoding with automatically inferred generation order. Transactions of the Association for Computational Linguistics, 7:661-676. +Jiatao Gu, Changhan Wang, and Junbo Zhao. 2019b. Levenshtein transformer. In Advances in Neural Information Processing Systems, pages 11179-11189. +Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2019. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751. +Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S Weld, Luke Zettlemoyer, and Omer Levy. 2020. Spanbert: Improving pre-training by representing and predicting spans. Transactions of the Association for Computational Linguistics, 8:64-77. +Juncen Li, Robin Jia, He He, and Percy Liang. 2018. Delete, retrieve, generate: a simple approach to sentiment and style transfer. In *NAACL*. +Dayiheng Liu, Jie Fu, Pengfei Liu, and Jiancheng Lv. 2019a. TIGS: An inference algorithm for text infilling with gradient search. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4146-4156. +Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019b. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692. +Stephen Merity, Nitish Shirish Keskar, and Richard Socher. 2017. Regularizing and optimizing LSTM language models. arXiv preprint arXiv:1708.02182. +Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2016. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843. +Tomáš Mikolov, Martin Karafiát, Lukáš Burget, Jan Černocký, and Sanjeev Khudanpur. 2010. Recurrent neural network based language model. In Eleventh annual conference of the international speech communication association. +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 NAACL-HLT 2019: Demonstrations. +Alexander M Rush, Sumit Chopra, and Jason Weston. 2015. A neural attention model for abstractive sentence summarization. arXiv preprint arXiv:1509.00685. +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, pages 6830-6841. + +Yong-Siang Shih, Wei-Cheng Chang, and Yiming Yang. 2019. Xl-editor: Post-editing sentences with xlnet. arXiv preprint arXiv:1910.10479. +Mitchell Stern, William Chan, Jamie Kiros, and Jakob Uszkoreit. 2019. Insertion transformer: Flexible sequence generation via insertion operations. arXiv preprint arXiv:1902.03249. +Qing Sun, Stefan Lee, and Dhruv Batra. 2017. Bidirectional beam search: Forward-backward inference in neural sequence models for fill-in-the-blank image captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6961-6969. +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. +Alex Wang and Kyunghyun Cho. 2019. Bert has a mouth, and it must speak: Bert as a markov random field language model. arXiv preprint arXiv:1902.04094. +Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, R'emi Louf, Morgan Funtowicz, and Jamie Brew. 2019. Huggingface's transformers: State-of-the-art natural language processing. ArXiv, abs/1910.03771. +Chen Wu, Xuancheng Ren, Fuli Luo, and Xu Sun. 2019a. A hierarchical reinforced sequence operation method for unsupervised text style transfer. arXiv preprint arXiv:1906.01833. +Xing Wu, Tao Zhang, Liangjun Zang, Jizhong Han, and Songlin Hu. 2019b. Mask and infill: Applying masked language model for sentiment transfer. In IJCAI. +Jingjing Xu, Xu Sun, Qi Zeng, Xiaodong Zhang, Xu-ancheng Ren, Houfeng Wang, and Wenjie Li. 2018. Unpaired sentiment-to-sentiment translation: A cycled reinforcement learning approach. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 979-988. +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 5754-5764. +Zichao Yang, Zhiting Hu, Ruslan Salakhutdinov, and Taylor Berg-Kirkpatrick. 2017. Improved variational autoencoders for text modeling using dilated convolutions. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 3881-3890. JMLR.org. + +Najam Zaidi, Trevor Cohn, and Gholamreza Haffari. 2020. Decoding as dynamic programming for recurrent autoregressive models. In International Conference on Learning Representations. +Zhirui Zhang, Shuo Ren, Shujie Liu, Jianyong Wang, Peng Chen, Mu Li, Ming Zhou, and Enhong Chen. 2018. Style transfer as unsupervised machine translation. arXiv preprint arXiv:1808.07894. +Wanrong Zhu, Zhiting Hu, and Eric Xing. 2019. Text infilling. arXiv preprint arXiv:1901.00158. + +# Appendix + +# A Implementation Details for Text Infilling Baselines + +# A.1 Insertion Transformer + +We implement the Insertion Transformer in our own framework, using the same Transformer encoder module as for BLM and replacing the prediction layers by Insertion Transformer's mechanism. The canvas is also generated according to the training procedure of Insertion Transformer. + +# A.2 Masked Language Model + +We use the RobertaForMaskedLM architecture in the Transformers library for MLM (Wolf et al., 2019; Liu et al., 2019b). + +At test time, the model is given an easier version of the text infilling task where blanks are expanded into sequences of $\langle \mathrm{mask}\rangle$ tokens of the target length (or equivalently, the model uses an oracle to predict the length of the infilling). + +We experiment with three decoding strategies: (1) one-shot: the model predicts all masks simultaneously (2) left-to-right: the model fills in the masks from left to right (3) confident-first: the model fills one mask at a time that has the highest score. We report results for the confident-first strategy which has the best performance. + +# A.3 BERT+LM + +We use the bert-base-uncased model as served by the Transformers library (Wolf et al., 2019; Devlin et al., 2018). The left-to-right language model is a Transformer decoder to predict tokens in a blank. Its input word embedding is concatenated with BERT's output in the blank position at each time step. + +# A.4 Seq2seq-full and Seq2seq-fill + +For both seq2seq baselines, we use Fairseq's transformer-iwslt-de_en architecture (Ott et al., 2019). To generate training data, we apply the blanking procedure to the input dataset and generate $k$ copies of each sentence with different masks. We experiment with $k \in \{1, 10, 100\}$ and report the best performance, obtained by $k = 10$ . + +# B Monte-Carlo Estimate of Perplexity + +For a sentence $x$ of length $n$ , we estimate $p(x; \theta)$ in Eq. (5) with $m$ samples: + +$$ +X _ {m} = \frac {n !}{m} \sum_ {i = 1} ^ {m} p (x, \sigma_ {i}; \theta) +$$ + +where $\sigma_{i}$ 's are randomly sampled orders. + +Note that $X_{m}$ is an unbiased estimate of $p(x;\theta)$ : + +$$ +\mathbb {E} [ X _ {m} ] = p (x; \theta) +$$ + +The estimated PPL is accordingly: + +$$ +Y _ {m} = X _ {m} ^ {- 1 / n} +$$ + +Since $z^{-1 / n}$ is a convex function of $z$ + +$$ +\mathbb {E} [ Y _ {m} ] = \mathbb {E} [ X _ {m} ^ {- 1 / n} ] \geq \mathbb {E} [ X _ {m} ] ^ {- 1 / n} = p (x; \theta) ^ {- 1 / n} +$$ + +i.e., the expectation of the estimated PPL $\geq$ the actual PPL. As $m$ increases, the variance of $X_{m}$ decreases, and the inequality becomes tighter. + +Hence, we will observe that as $m$ increases, the estimated PPL becomes smaller and converges to the real PPL. + +# C Generation Trajectory + +
_ +__ also _ +the _ also _ +the _ also _ choice _ +the salsa _ also _ choice _ +the salsa was also _ choice _ +the salsa was also _ only choice _ +the salsa was also _ only choice . +the salsa was also my only choice .
_ , _ +_, _ terrible _ +poor , _ terrible _ +poor , _ terrible , _ +poor , _ terrible , very _ +poor selection , _ terrible , very _ +very poor selection , _ terrible , very _ +very poor selection , service terrible , very _ +very poor selection , service terrible , very _ ! +very poor selection , service terrible , very slow !
_ favorite _ +my favorite _ +my favorite _ pittsburgh _ +my favorite _ pittsburgh . +my favorite restaurant _ pittsburgh . +my favorite restaurant in pittsburgh .
_ the _ +_ is _ the _ +_ is _ the _ . +_ is _ the _ are _ . +_ food is _ the _ are _ . +_ food is _ the _ are _ friendly . +_ food is _ and the _ are _ friendly . +_ food is delicious and the _ are _ friendly . +_ food is delicious and the _ are very friendly . +_ food is delicious and the owners are very friendly . +_ the food is delicious and the owners are very friendly .
+ +Figure 7: Examples of BLM generation trajectory on the Yelp review dataset. \ No newline at end of file diff --git a/blanklanguagemodels/images.zip b/blanklanguagemodels/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..484ce920da7c2a4cd714451a1d244efeb023f68e --- /dev/null +++ b/blanklanguagemodels/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1a36fd093330cbf88ed0d3a680cc308fa58fda49f9dd0df1e6432ef5ed482a9 +size 641941 diff --git a/blanklanguagemodels/layout.json b/blanklanguagemodels/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..55271760cd8aa6132f47f91d5f5ab2469fb41242 --- /dev/null +++ b/blanklanguagemodels/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67c6f3b7690c10981d79d61a06ef958f7484077dbbf6639fdae7a6e9f019f369 +size 472926 diff --git a/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_content_list.json b/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..d797409a4b19fe8cbe0e22985bcd077f337218d2 --- /dev/null +++ b/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e98d8e83adee753ab694927c5725084f0c3f79b8b767b63d56fe652ce0818e1 +size 75683 diff --git a/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_model.json b/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_model.json new file mode 100644 index 0000000000000000000000000000000000000000..0dd2b67a7756dcd9c6e4475d0f351b171e443388 --- /dev/null +++ b/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:979778fc43b92f3003b24fff827323b541649be28af17dbbe30ab199dd10fb5a +size 95875 diff --git a/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_origin.pdf b/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..57dcc00f42687449445585f7a3790f819e1505ae --- /dev/null +++ b/bleumightbeguiltybutreferencesarenotinnocent/acb6853c-3467-4774-bd13-95e3265a2e4b_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3457f2fef45ec3bdc01093bf1dc3e50cc5696387279ba23f4ef25fd17f587344 +size 276532 diff --git a/bleumightbeguiltybutreferencesarenotinnocent/full.md b/bleumightbeguiltybutreferencesarenotinnocent/full.md new file mode 100644 index 0000000000000000000000000000000000000000..795b0fe78e2be13c848be5fa9c97d3916dcb4e90 --- /dev/null +++ b/bleumightbeguiltybutreferencesarenotinnocent/full.md @@ -0,0 +1,274 @@ +# BLEU might be Guilty but References are not Innocent + +Markus Freitag, David Grangier, Isaac Caswell + +Google Research + +{freitag,grangier,icaswell}@google.com + +# Abstract + +The quality of automatic metrics for machine translation has been increasingly called into question, especially for high-quality systems. This paper demonstrates that, while choice of metric is important, the nature of the references is also critical. We study different methods to collect references and compare their value in automated evaluation by reporting correlation with human evaluation for a variety of systems and metrics. Motivated by the finding that typical references exhibit poor diversity, concentrating around translationese language, we develop a paraphrasing task for linguists to perform on existing reference translations, which counteracts this bias. Our method yields higher correlation with human judgment not only for the submissions of WMT 2019 English $\rightarrow$ German, but also for Back-translation and APE augmented MT output, which have been shown to have low correlation with automatic metrics using standard references. We demonstrate that our methodology improves correlation with all modern evaluation metrics we look at, including embedding-based methods. To complete this picture, we reveal that multi-reference BLEU does not improve the correlation for high quality output, and present an alternative multi-reference formulation that is more effective. + +# 1 Introduction + +Machine Translation (MT) quality has greatly improved in recent years (Bahdanau et al., 2015; Gehring et al., 2017; Vaswani et al., 2017). This progress has cast doubt on the reliability of automated metrics, especially in the high accuracy regime. For instance, the WMT English $\rightarrow$ German evaluation in the last two years had a different top system when looking at automated or human evaluation (Bojar et al., 2018; Barrault et al., 2019). Such discrepancies have also been observed in the + +past, especially when comparing rule-based and statistical systems (Bojar et al., 2016b; Koehn and Monz, 2006; Callison-Burch et al., 2006). + +Automated evaluations are however of crucial importance, especially for system development. Most decisions for architecture selection, hyperparameter search and data filtering rely on automated evaluation at a pace and scale that would not be sustainable with human evaluations. Automated evaluation (Koehn, 2010; Papineni et al., 2002) typically relies on two crucial ingredients: a metric and a reference translation. Metrics generally measure the quality of a translation by assessing the overlap between the system output and the reference translation. Different overlap metrics have been proposed, aiming to improve correlation between human and automated evaluations. Such metrics range from n-gram matching, e.g. BLEU (Papineni et al., 2002), to accounting for synonyms, e.g. METEOR (Banerjee and Lavie, 2005), to considering distributed word representation, e.g. BERTScore (Zhang et al., 2019). Orthogonal to metric quality (Ma et al., 2019), reference quality is also essential in improving correlation between human and automated evaluation. + +This work studies how different reference collection methods impact the reliability of automatic evaluation. It also highlights that the reference sentences typically collected with current (human) translation methodology are biased to assign higher automatic scores to MT output that share a similar style as the reference. Human translators tend to generate translation which exhibit translationese language, i.e. sentences with source artifacts (Koppel and Ordan, 2011). This is problematic because collecting only a single style of references fails to reward systems that might produce alternative but equally accurate translations (Popovic, 2019). Because of this lack of diversity, multi-reference evaluations like multi-reference BLEU are also bi + +ased to prefer that specific style of translation. + +As a better solution, we show that paraphrasing translations, when done carefully, can improve the quality of automated evaluations more broadly. Paraphrased translations increase diversity and steer evaluation away from rewarding translation artifacts. Experiments with the official submissions of WMT 2019 English $\rightarrow$ German for a variety of different metrics demonstrate the increased correlation with human judgement. Further, we run additional experiments for MT systems that are known to have low correlation with automatic metrics calculated with standard references. In particular, we investigated MT systems augmented with either back-translation or automatic post-editing (APE). We show that paraphrased references overcome the problems of automatic metrics and generate the same order as human ratings. + +Our contributions are four-fold: (i) We collect different types of references on the same test set and show that it is possible to report strong correlation between automated evaluation with human metrics, even for high accuracy systems. (ii) We gather more natural and diverse valid translations by collecting human paraphrases of reference translations. We show that (human) paraphrases correlate well with human judgments when used as reference in automatic evaluations. (iii) We present an alternative multi-reference formulation that is more effective than multi reference BLEU for high quality output. (iv) We release a rich set of diverse references to encourage research in systems producing other types of translations, and reward a wider range of generated language. + +# 2 Related Work + +Evaluation of machine translation is of crucial importance for system development and deployment decisions (Moorkens et al., 2018). Human evaluation typically reports adequacy of translations, often complemented with fluency scores (White, 1994; Graham et al., 2013). Evaluation by human raters can be conducted through system comparisons, rankings (Bojar et al., 2016a), or absolute judgments, direct assessments (Graham et al., 2013). Absolute judgments allow one to efficiently compare a large number of systems. The evaluation of translations as isolated sentences, full paragraphs or documents is also an important factor + +in the cost/quality trade-offs (Carpuat and Simard, 2012). Isolated sentence evaluation is generally more efficient but fails to penalize contextual mistakes (Tu et al., 2018; Hardmeier et al., 2015). + +Automatic evaluation typically collects human reference translations and relies on an automatic metric to compare human references to system outputs. Automatic metrics typically measure the overlap between references and system outputs. A wide variety of metrics has been proposed, and automated metrics is still an active area of research. BLEU (Papineni et al., 2002) is the most common metric. It measures the geometric average of the precision over hypothesis n-grams with an additional penalty to discourage short translations. NIST (Doddington, 2002) is similar but considers up-weighting rare, informative n-grams. TER (Snover et al., 2006) measures an edit distance, as a way to estimate the amount of work to post-edit the hypothesis into the reference. ME-TEOR (Banerjee and Lavie, 2005) suggested rewarding n-gram beyond exact matches, considering synonyms. Others are proposing to use contextualized word embeddings, like BERTscore (Zhang et al., 2019). Rewarding multiple alternative formulations is also the primary motivation behind multiple-reference based evaluation (Nießen et al., 2000). Dreyer and Marcu (2012) introduced an annotation tool and process that can be used to create meaning-equivalent networks that encode an exponential number of translations for a given sentence. Orthogonal to the number of references, the quality of the reference translations is also essential to the reliability of automated evaluation (Zbib et al., 2013). This topic itself raises the question of human translation assessment, which is beyond the scope of this paper (Moorkens et al., 2018). + +Meta-evaluation studies the correlation between human assessments and automatic evaluations (Callison-Burch et al., 2006, 2008; Callison-Burch, 2009). Indeed, automatic evaluation is useful only if it rewards hypotheses perceived as fluent and adequate by a human. Interestingly, previous work (Bojar et al., 2016a) has shown that a higher correlation can be achieved when comparing similar systems than when comparing different types of systems, e.g. phrase-based vs neural vs rule-based. In particular, rule-based systems can be penalized as they produce less common translations, even when such translations are fluent and adequate. Similarly, recent benchmark results comparing neu + +ral systems on high resource languages (Bojar et al., 2018; Barrault et al., 2019) have shown mismatches between the systems with highest BLEU score and the systems faring the best in human evaluations. Freitag et al. (2019); Edunov et al. (2019) study this mismatch in the context of systems trained with back-translation (Sennrich et al., 2016) and noisy back-translation (Edunov et al., 2018). They observe that systems training with or without back-translation (BT) can reach a similar level of overlap (BLEU) with the reference, but hypotheses from BT systems are more fluent, both measured by humans and by a language model (LM). They suggest considering LM scores in addition to BLEU. + +Freitag et al. (2019); Edunov et al. (2019) point at translationese as a major source of mismatch between BLEU and human evaluation. Translationese refers to artifacts from the source language present in the translations, i.e. human translations are often less fluent than natural target sentences due to word order and lexical choices influenced by the source language (Koppel and Ordan, 2011). The impact of translationese on evaluation has recently received attention (Toral et al., 2018; Zhang and Toral, 2019; Graham et al., 2019). In the present work, we are specifically concerned that the presence of translationese in the references might cause overlap-based metrics to reward hypotheses with translationese language more than hypotheses using more natural language. The question of bias to a specific reference has also been raised in the case of monolingual human evaluation (Fomicheva and Specia, 2016; Ma et al., 2017). The impact of translationese in test sets is related to but different from the impact of translationese in the training data (Kurokawa et al., 2009; Lembersky et al., 2012; Bogoychev and Sennrich, 2019; Riley et al., 2019). + +In this work, we explore collecting a single reference translation, using human paraphrases to steer away as much as possible from biases in the reference translation that affect the automatic metrics to prefer MT output with the same style (e.g. translationese). Automatic methods to extract paraphrase n-grams (Zhou et al., 2006) or full sentence paraphrases (Kauchak and Barzilay, 2006; Bawden et al., 2020; Thompson and Post, 2020) have been used to consider multiple references. In contrast, we generate a single unbiased reference translation generated by humans instead of trying to cover a wider space of possible translations. In contrast to human paraphrasing (our instructions asked for + +most diverse paraphrases), automatic paraphrasing are still far from perfect (Roy and Grangier, 2019) and mostly generate local changes that do not steer away from biases as e.g. introducing different sentence structures. + +# 3 Collecting High Quality and Diverse References + +We acquired two types of new reference translations: first, we asked a professional translation service to provide an additional reference translation. Second, we used the same service to paraphrase existing references, asking a different set of linguists. + +# 3.1 Additional Standard References + +We asked a professional translation service to create additional high quality references to measure the effect of different reference translations. The work was equally shared by 10 professional linguists. The use of CAT tools (dictionaries, translation memory, MT) was specifically disallowed, and the translation service employed a tool to disable copying from the source field and pasting anything into the target field. The translations were produced by experienced linguists who are native speakers in the target language. The original WMT English $\rightarrow$ German newstest2019 reference translations have been generated in sequence while keeping an 1-1 alignment between sentences. This should help the linguists to use some kind of document context. We instead shuffled the sentences to also get translations from different linguists within a document and avoid systematic biases within a document. The collection of additional references not only may yield better references, but also allows us to conduct various types of multi-reference evaluation. In addition of applying multi-reference BLEU, it also allows us to select the most adequate option among the alternative references for each sentence, composing a higher quality set. + +# 3.2 Diversified Paraphrased References + +The product of human translation is assumed to be ontologically different from natural texts (Koppel and Ordan, 2011) and is therefore often called translationese (Gellerstam, 1986). Translationese includes the effects of interference, the process by which the source language leaves distinct marks in the translation, e.g. word order, sentence structure (monotonic translation) or lexical choices. It also often brings simplification (Laviosa, 1997), as + +# Task: Paraphrase the sentence as much as possible: + +To paraphrase a source, you have to rewrite a sentence without changing the meaning of the original sentence. + +1. Read the sentence several times to fully understand the meaning +2. Note down key concepts +3. Write your version of the text without looking at the original +4. Compare your paraphrased text with the original and make minor adjustments to phrases that remain too similar + +Please try to change as much as you can without changing the meaning of the original sentence. Some suggestions: + +1. Start your first sentence at a different point from that of the original source (if possible) +2. Use as many synonyms as possible +3. Change the sentence structure (if possible) + +Figure 1: Instructions used to paraphrase an existing translation as much as possible. + +
SourceThe Bells of St. Martin'sFall SilentasChurches in HarlemStruggle .
TranslationDie Glocken von St. MartinverstammendaKirchen in HarlemProbleme haben .
ParaphraseDie Probleme in Harlems Kirchenlassendie Glocken von St. Martinverstammen .
ParaphraseDie Kirchen in Harlemkämpfen mit Problemen, und so lautendie Glocken von St. Martin nicht mehr .
+ +Table 1: Reference examples of a typical translation and two different paraphrases of this translation. The paraphrases are not only very different from the source sentence (e.g. sentence structure), but also differ a lot when compared to each other. + +the translator might impoverish the message, the language, or both. The troubling implication is that a reference set of translationese sentences is biased to assign higher word overlap scores to MT outputs that produces a similar translationese style, and penalizes MT output with more natural targets (Freitag et al., 2019). Collecting a different type of reference could uncover alternative high quality systems producing different styles of outputs. + +We explore collecting diverse references using paraphrasing to steer away from translationese, with the ultimate goal of generating a natural-to-natural test set, where neither the source sentences nor the reference sentences contain translationese artifacts. In an initial experiment on a sample of 100 sentences, we asked linguists to paraphrase (translated) sentences. The paraphrased references had only minor changes and consequently only minor impact on the automatic metrics. Therefore, we changed the instructions and asked linguists to paraphrase the sentence as much as possible while also suggesting using synonyms and different sentence structures. The paraphrase instructions are shown in Figure 1. These instructions satisfy not only our goal to generate an unbiased sentence, but also have the side effect that two paraphrases + +of the same sentence are quite different. All our paraphrase experiments in this paper are done with these instructions. One might be concerned that paraphrasing "as much as possible" might yield excessive reformulation at the expense of adequacy in some cases. To compensate for this in the present paper, we collect adequacy ratings for all produced paraphrases. These ratings allow us to select the most adequate paraphrase from among available alternatives for the same sentence, which results in a composite high paraphrase set with strong adequacy ratings (see Table 2). A paraphrase example is given in Table 1. Even without speaking any German, one can easily see that the paraphrases have a different sentence structure than the source sentence, and both paraphrases are quite different. + +# 4 Experimental Set-up + +# 4.1 Data and Models + +We use the official submissions of the WMT 2019 English $\rightarrow$ German news translation task (Barrault et al., 2019) to measure automatic scores for different kinds of references. We then report correlations with the WMT human ratings from the same evaluation campaign. We chose English $\rightarrow$ German as this track had the most submissions and the outputs + +with the highest adequacy ratings. + +# 4.2 Human Evaluation + +We use the same direct assessment template as was used in the WMT 2019 evaluation campaign. Human raters are asked to assess a given translation by how adequately it expresses the meaning of the corresponding source sentence on an absolute 0-100 rating scale. We acquire 3 ratings per sentence and take the average as the final sentence score. In contrast to WMT, we do not normalize the scores, and report the average absolute ratings. + +# 5 Experiments + +We generate three additional references for the WMT 2019 English $\rightarrow$ German news translation task. In addition to acquiring an additional reference (AR), we also asked linguists to paraphrase the existing WMT reference and the AR reference (see Section 3 for details). We refer to these paraphrases as WMT.p and AR.p. + +# 5.1 Human Evaluation of References + +It is often believed that the most accurate translations should also yield the highest correlation with humans ratings when used as reference for an automatic metric. For that reason, we run a human evaluation (Section 4.2) for all reference translations to test this hypothesis (Table 2). While all reference translations yield high scores, the paraphrased references are rated as slightly less accurate. We suspect that this may at least in part be an artifact of the rating methodology. Specifically, translations whose word order matches that of the source (i.e. translationese) are easier to rate than translations that use very different sentence structures and phrasing than the source sentence. We generated our paraphrased reference translation with the instructions to modify the translations as much as possible. Therefore, the non-translationese, perhaps more natural, nature of the paraphrased translations make it more demanding to assign an accurate rating. + +As a by-product of these ratings, we consider selecting the best rated references among alternatives for each sentence. Representing this method of combining reference sets with the HQ() function, we generate 3 new reference sets. These are (a) HQ(WMT, AR), abbreviated as HQ(R); (b) HQ(WMT.p, AR.p), abbreviated as HQ(P); and (c) HQ(WMT, AR, AR.p, WMT.p), abbreviated as HQ(all 4). Interestingly, the combined paraphrased + +reference $HQ(P)$ has a higher human rating than WMT or AR alone. + +
adequacy rating
WMT85.3
WMT.p81.8
AR86.7
AR.p80.8
HQ(R) [WMT+AR]92.8
HQ(P) [WMT,p+AR.p]89.1
HQ(all 4) [all 4]95.3
+ +# 5.2 Correlation with Human Judgement + +Table 3 provides the system-level rank-correlations (Spearman's $\rho$ and Kendall's $\tau$ )² of BLEU (calculated with sacreBLEU (Post, 2018)³) evaluating translations of newstest2019 for different references. On the full set of 22 submissions, all 3 new references (AR, WMT.p, AR.p) show higher correlation with human judgment than the original WMT reference, with the paraphrased references WMT.p coming out on top. Furthermore, each paraphrased reference set shows higher correlation when compared to the reference set that it was paraphrased from. + +Table 2: Human adequacy assessments for different kinds of references, over the full set of 1997 sentences. + +
Full Set (22)Referenceρτ
single refWMT0.880.72
AR0.890.76
WMT.p0.910.79
AR.p0.890.77
single refHQ(R)0.910.78
HQ(P)0.910.78
HQ(all 4)0.910.79
multi refAR+WMT0.900.75
AR.p+WMT.p0.900.79
all 40.900.75
+ +Table 3: Spearman's $\rho$ and Kendall's $\tau$ for the WMT2019 English→German official submissions with human ratings conducted by the WMT organizers. + +Although, the combined reference HQ(R) (Section 5.1) improves correlation when compared to the non-paraphrased reference sets (WMT and AR), not one of the three combined references HQ(R), + +HQ(P), HQ(all 4) shows higher correlation than the paraphrased reference set WMT.p. This result casts doubt on the belief that if references are rated as more adequate, it necessarily implies that such references will yield more reliable automated scores. + +We further find that multi-reference BLEU (calculated with sacreBLEU) does not exhibit better correlation with human judgments either than single-reference BLEU or than the composed reference sets HQ(x). It is generally assumed that multi-reference BLEU yields higher correlation with human judgements due to the increased diversity in the reference translations. However, combining two translated reference sets that likely share the same systematic translationese biases does still prefers translationese translations. Interestingly, multi-reference BLEU with multiple paraphrases also does not show higher correlation than single-reference BLEU. Combining all 4 references with multi reference BLEU shows the same correlation numbers as the combination of $AR + WMT$ . As we will see later, the BLEU scores calculated with paraphrased references are much lower than those calculated with standard references. They have fewer n-gram matches, which are mostly only a subset of the n-gram matches of the standard references. Adding paraphrased references to a mix of standard references therefore has a small effect on the total number of n-gram matches, and as a consequence the scores are not much affected. + +Note that the correlation numbers already appear relatively high for the full set of systems. This is because both Kendall's $\tau$ and Spearman's $\rho$ rank correlation operate over all possible pairs of systems. Since the submissions to WMT2019 covered a wide range of translation qualities, any metric able to distinguish the highest-scoring and lowest-scoring systems will already have a high correlation. Therefore, small numeric increases as demonstrated in Table 3 can correspond to much larger improvements in the local ranking of systems. + +As a consequence, we looked deeper into the correlation between a subset of the systems that performed best in human evaluation, where correlation for metrics calculated on the standard reference is known to break down. Kendall's $\tau$ rank correlation as a function of the top k systems can be seen in Figure 2. During the WMT 2019 Metric task (Ma et al., 2019), all official submissions (using the original WMT reference) had low correlation scores with human ratings. The paraphrased references + +improve especially on high quality system output, and every paraphrased reference set (dotted line) outperforms its corresponding unparaphrased set (same-color solid line). + +![](images/4eb3b8cf8ce6ffedeb0fdac347442dea512d7fe1891e499d5c3636a393b3b5c8.jpg) +Figure 2: Kendall's $\tau$ correlation of BLEU for the best k systems (based on human ratings). + +These improvements in ranking can be seen in Table 4, which reports the actual BLEU scores of the top seven submissions with four different references. Since we asked humans to paraphrase the WMT reference as much as possible (Section 3) to get very different sentences, the paraphrased BLEU scores are much lower than what one expects for a high-quality system. Nevertheless, the system outputs are better ranked and show the highest correlation of any references explored in this paper. + +
WMTHQ(R)WMT.pHQ(P)human
FB43.642.315.115.00.347
Micr.sd44.842.114.914.90.311
Micr.dl44.842.214.914.90.296
MSRA46.042.114.214.10.214
UCAM44.140.414.214.20.213
NEU44.640.814.014.10.208
MLLP42.438.313.313.40.189
+ +Table 4: BLEU scores of the best submissions of WMT2019 English $\rightarrow$ German. + +# 5.3 Alternative Metrics + +Any reference-based metric can be used with our new reference translations. In addition to BLEU, we consider TER (Snover et al., 2006), METEOR (Banerjee and Lavie, 2005),chrF (Popovic, 2015), the f-score variant of BERTScore (Zhang et al., 2019) and Yisi-1 (Lo, 2019) (winning system of WMT 2019 English $\rightarrow$ German metric task). Table 5 compares these metrics. As we saw in Figure 2, the paraphrased version of each reference set yields higher correlation with human evaluation + +across all evaluated metrics than the corresponding original references, with the only exception of TER for HQ(P). Comparing the two paraphrased references, we see that HQ(P) shows higher correlation for chrF and Yisi when compared to WMT.p. In particular Yisi (which is based on word embeddings) seems to benefit from the higher accuracy of the reference translation. + +
metricWMTHQ(R)WMT.pHQ(P)HQ(all)
BLEU0.720.780.790.790.79
1-TER0.710.740.710.670.74
chrF0.740.810.780.820.78
MET0.740.810.810.810.80
BERTS0.780.820.820.820.81
Yisi-10.780.840.840.860.84
+ +# 5.4 WMT18 + +We acquired a paraphrased as-much-as-possible reference (WMT.p) for newstest2018 English $\rightarrow$ German with the same instruction as used before (Figure 1). The test set newstest2018 is a joint test set which means that half of the sentences have been originally written in English and translated into German, and vice versa. We paraphrased the reference sentences for the forward translated half only as we want to have a natural English source sentence. Correlation with human rankings of the WMT18 evaluation campaign are summarized in Table 6. The paraphrased reference WMT.p show higher correlations with human judgement for all metrics. + +Table 5: WMT 2019 English $\rightarrow$ German: Correlations (Kendall's $\tau$ ) of alternative metrics: BLEU, 1.0 - TER, chrF, METEOR, BERTScore, and Yisi-1. + +
refBLEUchrfMETEORBERTSYisi-1
WMT0.750.760.750.800.82
WMT.p0.910.820.840.900.91
+ +# 6 Why Paraphrases? + +While the top WMT submissions use very similar approaches, there are some techniques in MT that are known to produce more natural (less translationese) output than others. We run experiments with a variety of models that have been shown that their actual quality scores have low correlation with + +automatic metrics. In particular, we focus on backtranslation (Sennrich et al., 2016) and Automatic Post Editing (APE, Freitag et al. (2019)) augmented systems trained on WMT 2014 English $\rightarrow$ German. All these systems have in common that they generate less translationese output, and thus BLEU with translationese references under-estimate their quality. The experiment in this section follows the setup described in Freitag et al. (2019). + +We run adequacy evaluation on WMT newstest 2019 for the 3 systems, as described in Section 4.2. Both the APE and the BT models, which use additional target-side monolingual data, are rated higher by humans than the system relying only on bitext. Table 7 summarizes the BLEU scores for our different reference translations. All references generated with human translations (WMT, HQ(R) and HQ(all 4)) show negative correlation with human ratings for these extreme cases and produce the wrong order. On the other hand, all references that rely purely on paraphrased references do produce the correct ranking of these three systems. This further suggests that reference translations based on human translations bias the metrics to generate higher scores for translationese outputs. By paraphrasing the reference translations, we undo this bias, and the metric can measure the true quality of the underlying systems with greater accuracy. + +Table 6: WMT 2018 English→German: Kendall's $\tau$ . + +
ReferencebitextAPEBTcorrect?
human84.586.187.8
WMT39.434.637.9
WMT.p12.512.712.9
HQ(R)35.032.134.9
HQ(p)12.412.813.0
HQ(all 4)27.225.827.5
+ +Table 7: BLEU scores for WMT newstest 2019 English $\rightarrow$ German for MT systems trained on bitext, augmented with BT or using APE as text naturalizer. The correct column indicates if the model ranking agrees with human judgments. + +This finding, that existing reference translation methodology may systematically bias against modelling techniques known to improve human-judged quality, raises the question of whether previous research has incorrectly discarded approaches that actually improved the quality of MT. Releasing all reference translations gives the community a chance to revisit some of their decisions and measure quality differences for high quality systems. + +# 7 Characterizing Paraphrases + +# 7.1 Alignment + +One typical characteristic of translationese is that humans prefer to translate a sentence phrase-by-phrase instead of coming up with a different sentence structure, resulting in 'monotonic' translations. To measure the monotonicity of the different reference translations, we compute an alignment with fast-align (Dyer et al., 2013) on the WMT 2014 English-German parallel data and compare the alignments of all four references. Table 8 summarizes the average absolute distance of two alignment points for each reference. The paraphrased translations are less monotonic and use a different sentence structure than a pure human translation. + +
WMTARWMT.pAR.p
5.175.276.436.88
+ +Table 8: Average absolute distance per alignment point, as a proxy for word-by-word ('monotonic') translation. Lower scores indicate more monotonic translation. + +# 7.2 Matched n-grams + +The actual BLEU scores calculated with the paraphrased references are much lower compared to BLEU scores calculated with standard references (Table 4). Nevertheless, the paraphrased references show higher correlation with human judgment, which motivates us to investigate which n-grams of the MT output are actually matching the paraphrased references during BLEU calculation. The n-grams responsible for the most overlap with standard references are generic, common n-grams. In the winning submission of the WMT 2019 English $\rightarrow$ German evaluation campaign from Facebook, the 4grams with the highest number of matches are: + +$\bullet$ , sagte er. $\rightarrow 28$ times (, he said.) +- " , sagte er $\rightarrow {14}$ times ( " , he said) +- fügte hinzu, dass $\rightarrow 8$ times (added that) + +These matches are crucial to reach high $>40$ BLEU scores, and appear in translation when using the same sentence structure as the source sentence. On the other hand, the n-grams overlapping with the paraphrased references show a different picture. They usually reward n-grams that express the semantic meaning of the sentence. The 4-grams with the highest number of matches with the paraphrased references for the same system are: + +- Wheeling, West Virginia $\rightarrow$ 3 times (Wheeling, West Virginia) +- von Christine Blasey Ford $\rightarrow$ 3 times (from Christine Blasey Ford) +- Erdbeben der Stärke $7,5 \rightarrow 3$ times (7.5 magnitude earthquake) + +# 8 Conclusions + +This work presents a study on the impact of reference quality on the reliability of automated evaluation of machine translation. We consider collecting additional human translations as well as generating more diverse and natural references through paraphrasing. We observe that the paraphrased references result in more reliable automated evaluations, i.e. stronger correlation with human evaluation for the submissions of the WMT 2019 English $\rightarrow$ German evaluation campaign. These findings are confirmed across a wide range of automated metrics, including BLEU,chrF, METEOR, BERTScore and Yisi. We further demonstrate that the paraphrased references correlate especially well for the top submissions of WMT, and additionally are able to correctly distinguish baselines from systems known to produce more natural output (those augmented with either BT or APE), whose quality tends to be underestimated by references with translationese artifacts. + +We explore two different approaches to multi-reference evaluation: (a) standard multi-reference BLEU, and (b) selecting the best-rated references for each sentence. Contrary to conventional wisdom, we find that multi-reference BLEU does not exhibit better correlation with human judgments than single-reference BLEU. Combining two standard reference translations by selecting the best rated reference, on the other hand, did increase correlation for the standard reference translations. Nevertheless, the combined paraphrasing references are of higher quality for all techniques when compared to the standard reference counter part. + +We suggest using a single paraphrased reference for more reliable automatic evaluation going forward. Although a combined paraphrased reference shows slightly higher correlation for embedding based metrics, it is over twice as expensive to construct such a reference set. To drive this point home, our experiments suggest that standard reference translations may systematically bias against modelling techniques known to improve human-judged quality, raising the question of whether previous + +research has incorrectly discarded approaches that actually improved the quality of MT. Releasing all reference translations gives the community a chance to revisit some of their decisions and measure quality differences for high quality systems and modelling techniques that produce more natural or fluent output. + +As a closing note, we would like to emphasize that it is more difficult for a human rater to rate a paraphrased translation than a translationese sentence, because the latter may share a similar structure and lexical choice to the source. We suspect that human evaluation is also less reliable for complex translations. Future work, can investigate whether finer ratings could correct the bias in favor of lower effort ratings, and how this may interact with document-level evaluation. + +# 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. +Satanjeev Banerjee and Alon Lavie. 2005. METEOR: An Automatic Metric for MT Evaluation with Improved Correlation with Human Judgments. In Proceedings of the ACL workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pages 65-72. +Loic Barrault, Ondrej Bojar, Marta R. Costa-jussa, Christian Federmann, Mark Fishel, Yvette Graham, Barry Haddow, Matthias Huck, Philipp Koehn, Shervin Malmasi, Christof Monz, Mathias Muller, Santanu Pal, Matt Post, and Marcos Zampieri. 2019. Findings of the 2019 Conference on Machine Translation (WMT19). In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 1-61, Florence, Italy. Association for Computational Linguistics. +Rachel Bawden, Biao Zhang, Lisa Yankovskaya, Andre Tattar, and Matt Post. 2020. Explicit representation of the translation space: Automatic paraphrasing for machine translation evaluation. +Nikolay Bogoychev and Rico Sennrich. 2019. Domain, Translationese and Noise in Synthetic Data for Neural Machine Translation. arXiv preprint arXiv:1911.03362. +Ondrej Bojar, Rajen Chatterjee, Christian Federmann, Yvette Graham, Barry Haddow, Matthias Huck, Antonio Jimeno Yepes, Philipp Koehn, Varvara Logacheva, Christof Monz, Matteo Negri, Aurélie Néveol, Mariana Neves, Martin Popel, Matt Post, + +Raphael Rubino, Carolina Scarton, Lucia Specia, Marco Turchi, Karin Verspoor, and Marcos Zampieri. 2016a. Findings of the 2016 Conference on Machine Translation. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pages 131-198, Berlin, Germany. Association for Computational Linguistics. +Ondrej Bojar, Christian Federmann, Mark Fishel, Yvette Graham, Barry Haddow, Philipp Koehn, and Christof Monz. 2018. Findings of the 2018 Conference on Machine Translation (WMT18). In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pages 272-303, Belgium, Brussels. Association for Computational Linguistics. +Ondrej Bojar, Christian Federmann, Barry Haddow, Philipp Koehn, Matt Post, and Lucia Specia. 2016b. Ten Years of WMT Evaluation Campaigns: Lessons Learned. Translation Evaluation: From Fragmented Tools and Data Sets to an Integrated Ecosystem, page 27. +Chris Callison-Burch. 2009. Fast, Cheap, and Creative: Evaluating Translation Quality Using Amazon's Mechanical Turk. In Proceedings of the 2009 Conference on Empirical Methods in Natural Language Processing, pages 286-295, Singapore. Association for Computational Linguistics. +Chris Callison-Burch, Cameron Fordyce, Philipp Koehn, Christof Monz, and Josh Schroeder. 2008. Further Meta-evaluation of Machine Translation. In Proceedings of the Third Workshop on Statistical Machine Translation, StatMT '08, pages 70-106, Stroudsburg, PA, USA. Association for Computational Linguistics. +Chris Callison-Burch, Miles Osborne, and Philipp Koehn. 2006. Re-evaluating the Role of Bleu in Machine Translation Research. In 11th Conference of the European Chapter of the Association for Computational Linguistics, Trento, Italy. Association for Computational Linguistics. +Marine Carpuat and Michel Simard. 2012. The Trouble with SMT Consistency. In Proceedings of the Seventh Workshop on Statistical Machine Translation, pages 442-449. Association for Computational Linguistics. +George Doddington. 2002. Automatic evaluation of machine translation quality using n-gram cooccurrence statistics. In Proceedings of the Second International Conference on Human Language Technology Research, HLT '02, pages 138-145, San Francisco, CA, USA. Morgan Kaufmann Publishers Inc. +Markus Dreyer and Daniel Marcu. 2012. Hyter: Meaning-equivalent semantics for translation evaluation. In Proceedings of the 2012 Conference of the + +North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 162-171. Association for Computational Linguistics. +Chris Dyer, Victor Chahuneau, and Noah A Smith. 2013. A Simple, Fast, and Effective Reparameterization of IBM Model 2. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 644-648. +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, pages 489-500, Brussels, Belgium. Association for Computational Linguistics. +Sergey Edunov, Myle Ott, Marc'Aurelio Ranzato, and Michael Auli. 2019. On The Evaluation of Machine Translation Systems Trained With Back-Translation. arXiv preprint arXiv:1908.05204. +Marina Fomicheva and Lucia Specia. 2016. Reference Bias in Monolingual Machine Translation Evaluation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pages 77-82, Berlin, Germany. Association for Computational Linguistics. +Markus Freitag, Isaac Caswell, and Scott Roy. 2019. APE at Scale and Its Implications on MT Evaluation Biases. In Proceedings of the Fourth Conference on Machine Translation, pages 34-44, Florence, Italy. Association for Computational Linguistics. +Jonas Gehring, Michael Auli, David Grangier, and Yann N. Dauphin. 2017. A Convolutional Encoder Model for Neural Machine Translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pages 123-135. +Martin Gellerstam. 1986. Translationese in swedish novels translated from english. In Lars Wollin and Hans Lindquist, editors, Translation Studies in Scandinavia, page 88-95. CWK Gleerup. +Yvette Graham, Timothy Baldwin, Alistair Moffat, and Justin Zobel. 2013. Continuous Measurement Scales in Human Evaluation of Machine Translation. In Proceedings of the 7th Linguistic Annotation Workshop and Interoperability with Discourse, pages 33-41, Sofia, Bulgaria. Association for Computational Linguistics. +Yvette Graham, Barry Haddow, and Philipp Koehn. 2019. Translationese in Machine Translation Evaluation. CoRR, abs/1906.09833. +Christian Hardmeier, Preslav Nakov, Sara Stymne, Jörg Tiedemann, Yannick Versley, and Mauro Cettolo. 2015. Pronoun-focused MT and cross-lingual pronoun prediction: Findings of the 2015 DiscoMT + +shared task on pronoun translation. In Proceedings of the Second Workshop on Discourse in Machine Translation, pages 1-16, Lisbon, Portugal. Association for Computational Linguistics. +David Kauchak and Regina Barzilay. 2006. Paraphrasing for automatic evaluation. In Proceedings of the Human Language Technology Conference of the NAACL, Main Conference, pages 455-462, New York City, USA. Association for Computational Linguistics. +Philipp Koehn. 2010. Statistical Machine Translation. Cambridge University Press. +Philipp Koehn and Christof Monz. 2006. Manual and automatic evaluation of machine translation between European languages. In Proceedings on the Workshop on Statistical Machine Translation, pages 102-121, New York City. Association for Computational Linguistics. +Moshe Koppel and Noam Ordan. 2011. Translationese and its dialects. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies - Volume 1, HLT '11, pages 1318-1326, Stroudsburg, PA, USA. Association for Computational Linguistics. +David Kurokawa, Cyril Goutte, and Pierre Isabelle. 2009. Automatic detection of translated text and its impact on machine translation. In Proceedings of MT-Summit XII, pages 81-88. +Sara Laviosa. 1997. How comparable can'comparable corpora'be? Target. International Journal of Translation Studies, 9(2):289-319. +Gennadi Lembersky, Noam Ordan, and Shuly Wintner. 2012. Adapting translation models to translationese improves SMT. In Proceedings of the 13th Conference of the European Chapter of the Association for Computational Linguistics, EACL '12, pages 255-265, Stroudsburg, PA, USA. Association for Computational Linguistics. +Chi-kiu Lo. 2019. Yisi-a unified semantic mt quality evaluation and estimation metric for languages with different levels of available resources. In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pages 507-513. +Qingsong Ma, Yvette Graham, Timothy Baldwin, and Qun Liu. 2017. Further investigation into reference bias in monolingual evaluation of machine translation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2476-2485, Copenhagen, Denmark. Association for Computational Linguistics. +Qingsong Ma, Johnny Wei, Ondrej Bojar, and Yvette Graham. 2019. Results of the WMT19 metrics shared task: Segment-level and strong MT systems pose big challenges. In Proceedings of the Fourth Conference on Machine Translation (Volume + +2: Shared Task Papers, Day 1), pages 62-90, Florence, Italy. Association for Computational Linguistics. +Joss Moorkens, Sheila Castilho, Federico Gaspari, and Stephen Doherty. 2018. *Translation Quality Assessment: From Principles to Practice*. Springer. +Sonja Nießen, Franz Josef Och, Gregor Leusch, and Hermann Ney. 2000. An evaluation tool for machine translation: Fast evaluation for MT research. In Proceedings of the Second International Conference on Language Resources and Evaluation (LREC'00), Athens, Greece. European Language Resources Association (ELRA). +Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a Method for Automatic Evaluation of Machine Translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pages 311-318. Association for Computational Linguistics. +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. +Maja Popović. 2019. On reducing translation shifts in translations intended for MT evaluation. In Proceedings of Machine Translation Summit XVII Volume 2: Translator, Project and User Tracks, pages 80-87. +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. +Parker Riley, Isaac Caswell, Markus Freitag, and David Grangier. 2019. *Translationese as a language in "multilingual" nmt*. +Aurko Roy and David Grangier. 2019. Unsupervised paraphrasing without translation. In ACL (I), pages 6033-6039. Association for Computational Linguistics. +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 (Volume 1: Long Papers), pages 86-96, Berlin, Germany. Association for Computational Linguistics. +Matthew Snover, Bonnie Dorr, Richard Schwartz, Linnea Micciulla, and John Makhoul. 2006. A study of translation edit rate with targeted human annotation. In *In Proceedings of Association for Machine Translation in the Americas*, pages 223-231. +Brian Thompson and Matt Post. 2020. Automatic machine translation evaluation in many languages via zero-shot paraphrasing. arXiv preprint arXiv:2004.14564. + +Antonio Toral, Sheila Castilho, Ke Hu, and Andy Way. 2018. Attaining the unattainable? Reassessing claims of human parity in neural machine translation. In Proceedings of the Third Conference on Machine Translation: Research Papers, pages 113-123, Belgium, Brussels. Association for Computational Linguistics. +Zhaopeng Tu, Yang Liu, Shuming Shi, and Tong Zhang. 2018. Learning to remember translation history with a continuous cache. Transactions of the Association for Computational Linguistics, 6:407-420. +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. +John S. White. 1994. The ARPA MT Evaluation Methodologies: Evolution, Lessons, and Further Approaches. In Proceedings of the 1994 Conference of the Association for Machine Translation in the Americas, pages 193-205. +Rabih Zbib, Gretchen Markiewicz, Spyros Matsoukas, Richard Schwartz, and John Makhoul. 2013. Systematic comparison of professional and crowdsourced reference translations for machine translation. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 612-616, Atlanta, Georgia. Association for Computational Linguistics. +Mike Zhang and Antonio Toral. 2019. The effect of translationese in machine translation test sets. CoRR, abs/1906.08069. +Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2019. Bertscore: Evaluating text generation with BERT. Arxiv, 1904.09675. +Liang Zhou, Chin-Yew Lin, and Eduard Hovy. 2006. Re-evaluating Machine Translation Results with Paraphrase Support. In Proceedings of the 2006 Conference on Empirical Methods in Natural Language Processing, pages 77-84, Sydney, Australia. Association for Computational Linguistics. \ No newline at end of file diff --git a/bleumightbeguiltybutreferencesarenotinnocent/images.zip b/bleumightbeguiltybutreferencesarenotinnocent/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..f0fa9a38e6844d907e868f28b12186aa12afa089 --- /dev/null +++ b/bleumightbeguiltybutreferencesarenotinnocent/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a3f26ff25e3f33893b3ff78e43737b1d40a548d0429625f1ce04952d236fb3bf +size 283988 diff --git a/bleumightbeguiltybutreferencesarenotinnocent/layout.json b/bleumightbeguiltybutreferencesarenotinnocent/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..bf1be613a62648326f6b3494438b765196d8d1ed --- /dev/null +++ b/bleumightbeguiltybutreferencesarenotinnocent/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0c32ea7c086b631bfe42f09233fb9ee06f0c7e9b461ad47321bb409d2ef9672 +size 323082 diff --git a/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_content_list.json b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..200260a2c494d31c6cf252854ac816110637fc05 --- /dev/null +++ b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a18d273b7da3abcc39ca10f0699c13ba495a70ef8d960c35324565a85d482ab +size 42495 diff --git a/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_model.json b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_model.json new file mode 100644 index 0000000000000000000000000000000000000000..e25ede5eeff6823190707958247730cb4b97e60a --- /dev/null +++ b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:161a5a06c991030493cd7686f469add30756f8893107808e23e543897b766267 +size 51751 diff --git a/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_origin.pdf b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..405a140ea862ab7763fd1aa69e71be92349d0867 --- /dev/null +++ b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/e3e4cc46-ce89-489d-8c28-28011828701a_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbcef5deabc6e3e6d5b1d1c528161f8af4ab8673ddacbb5f8156d776f506ed00 +size 750185 diff --git a/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/full.md b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/full.md new file mode 100644 index 0000000000000000000000000000000000000000..4098a2a7973c7b62de5edcfddc8093c4285f0e2b --- /dev/null +++ b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/full.md @@ -0,0 +1,186 @@ +# Bootstrapped Q-learning with Context Relevant Observation Pruning to Generalize in Text-based Games + +Subhajit Chaudhury IBM Research + +subhajit@jp.ibm.com + +Daiki Kimura IBM Research + +daiki@jp.ibm.com + +Kartik Talamadupula IBM Research + +krtalamad@us.ibm.com + +Michiaki Tatsubori IBM Research + +mich@jp.ibm.com + +Asim Munawar IBM Research + +asim@jp.ibm.com + +Ryuki Tachibana IBM Research + +ryuki@jp.ibm.com + +# Abstract + +We show that Reinforcement Learning (RL) methods for solving Text-Based Games (TBGs) often fail to generalize on unseen games, especially in small data regimes. To address this issue, we propose Context Relevant Episodic State Truncation (CREST) for irrelevant token removal in observation text for improved generalization. Our method first trains a base model using Q-learning, which typically overfits the training games. The base model's action token distribution is used to perform observation pruning that removes irrelevant tokens. A second bootstrapped model is then retrained on the pruned observation text. Our bootstrapped agent shows improved generalization in solving unseen TextWorld games, using $10\mathrm{x} - 20\mathrm{x}$ fewer training games compared to previous state-of-the-art (SOTA) methods despite requiring fewer number of training episodes. + +# 1 Introduction + +Reinforcement Learning (RL) methods are increasingly being used for solving sequential decision-making problems from natural language inputs, like text-based games (Narasimhan et al., 2015; He et al., 2016; Yuan et al., 2018; Zahavy et al., 2018) chat-bots (Serban et al., 2017) and personal conversation assistants (Dhingra et al., 2017; Li et al., 2017; Wu et al., 2016). In this work, we focus on Text-Based Games (TBGs), which require solving goals like "Obtain coin from the kitchen", based on a natural language description of the agent's observation of the environment. To interact with the environment, the agent issues text-based action commands ("go west") upon which it receives a reward signal used for training the RL agent. TBGs serve as testbeds for interactive real-world tasks + +Goal: Who's got a virtual machine and is about to play through an fast paced round of textworld? You do! Retrieve the coin in the balmy kitchen. + +Observation: You've entered a studio. You try to gain information on your surroundings by using a technique you call "looking." You need an unguarded exit? you should try going east. You need an unguarded exit? You should try going south. You don't like doors? Why not try going west, that entranceway is unblocked. Bootstrapped Policy Action: go south + +Figure 1: Our method retains context-relevant tokens from the observation text (shown in green) while pruning irrelevant tokens (shown in red). A second policy network re-trained on the pruned observations generalizes better by avoiding overfitting to unwanted tokens. + +like virtual-navigation agents on cellular phones at a shopping mall with user rating as the reward. + +Traditional text-based RL methods focus on the problems of partial observability and large action spaces. However, the topic of generalization to unseen TBGs is less explored in the literature. We show that previous RL methods for TBGs often show poor generalization to unseen test games. We hypothesize that such overfitting is caused due to the presence of irrelevant tokens in the observation text, which might lead to action memorization. To alleviate this problem, we propose CREST, which first trains an overfitted base model on the original observation text in training games using Q-learning. Subsequently, we apply observation pruning for each training game, such that observation tokens that are not semantically related to the base policy's action tokens are pruned. Finally, we re-train a bootstrapped policy on the pruned observation text using Q-learning that improves generalization by removing irrelevant tokens. Figure 1 shows an + +![](images/9fa3d24fa6c5c2657c16f524e937f61ce18a956ffabccce02c468b5a8b2c30f5.jpg) +(a) Overview of our CREST observation pruning system + +![](images/cc935ae2779a2f287f5056bc13482e8e25b71e7b191dc4d35c08ef55fbce22b6.jpg) +(c) Medium validation games +Figure 2: (a) Overview of Context Relevant Episodic State Truncation (CREST) module using Token Relevance Distribution for observation pruning. Our method shows better generalization from $10\mathrm{x}-20\mathrm{x}$ less number of training games and faster learning with fewer episodes on (b) "easy" and (c) "medium" validation games. + +illustrative example of our method. Experimental results on TextWorld games (Côté et al., 2018) show that our proposed method generalizes to unseen games using almost $10\mathrm{x}-20\mathrm{x}$ fewer training games compared to SOTA methods; and features significantly faster learning. + +# 2 Related Work + +LSTM-DQN (Narasimhan et al., 2015) is the first work on text-based RL combining natural language representation learning and deep Q-learning. LSTM-DRQN (Yuan et al., 2018) is the state-of-the-art on TextWorld CoinCollector games, and addresses the issue of partial observability by using memory units in the action scorer. Fulda et al. (2017) proposed a method for affordance extraction via word embeddings trained on a Wikipedia corpus. AE-DQN (Action-Elimination DQN) – a combination of a Deep RL algorithm with an action eliminating network for sub-optimal actions – was proposed by Zahavy et al. (Zahavy et al., 2018). Recent methods (Adolphs and Hofmann, 2019; Ammanabrolu and Riedl, 2018; Ammanabrolu and Hausknecht, 2020; Yin and May, 2019; Adhikari et al., 2020) use various heuristics to learn better state representations for efficiently solving complex TBGs. + +# 3 Our Method + +# 3.1 Base model + +We consider the standard sequential decision-making setting: a finite horizon Partially Observ- + +able Markov Decision Process (POMDP), represented as $(s,a,r,s')$ , where $s$ is the current state, $s'$ the next state, $a$ the current action, and $r(s,a)$ is the reward function. The agent receives state description $s_t$ that is a combination of text describing the agent's observation and the goal statement. The action consists of a combination of verb and object output, such as "go north", "take coin", etc. The overall model has two modules: a representation generator, and an action scorer as shown in Figure 2. The observation tokens are fed to the embedding layer, which produces a sequence of vectors $\boldsymbol{x}^t = \{x_1^t,x_2^t,\dots,x_{N_t}^t\}$ , where $N_{t}$ is the number of tokens in the observation text for timestep $t$ . We obtain hidden representations of the input embedding vectors using an LSTM model as $h_i^t = f(x_i^t,h_{i - 1}^t)$ . We compute a context vector (Bahdanau et al., 2014) using attention on the $j^{th}$ input token as, + +$$ +e _ {j} ^ {t} = v ^ {T} \tanh \left(W _ {h} h _ {j} ^ {t} + b _ {a t t n}\right) \tag {1} +$$ + +$$ +\alpha_ {j} ^ {t} = \operatorname {s o f t m a x} \left(e _ {j} ^ {t}\right) \tag {2} +$$ + +where $W_{h}$ , $v$ and $b_{attn}$ are learnable parameters. The context vector at time-step $t$ is computed as the weighted sum of embedding vectors as $c^{t} = \sum_{j=1}^{N_{t}} \alpha_{j}^{t} h_{j}^{t}$ . The context vector is fed into the action scorer, where two multi-layer perceptrons (MLPs), $Q(s, v)$ and $Q(s, o)$ produce the Q-values over available verbs and objects from a shared MLP's output. The original works of Narasimhan et al. (2015); Yuan et al. (2018) do + +Table 1: Average success rate of various methods on 20 unseen test games. Experiments were repeated on three random seeds. Our method trained on almost ${20} \times$ fewer data has a similar success rate to state-of-the-art methods. + +
MethodsEasyMediumHard
N25N50N500N50N100N500N50N100
LSTM-DQN (no att)0.00.030.330.00.00.00.00.0
LSTM-DRQN (no att)0.170.530.870.020.00.250.00.0
LSTM-DQN (+attn)0.00.030.580.00.00.00.00.0
LSTM-DRQN (+attn)0.320.470.870.020.060.820.020.08
LSTM-DRQN (+attn+dropout)0.580.801.00.020.370.850.00.33
Ours (ConceptNet+no att)0.470.50.980.750.670.970.620.92
Ours (Word2vec+att)0.670.821.00.570.920.950.770.92
Ours (Glove+att)0.700.971.00.670.720.900.10.63
Ours (ConceptNet+att)0.820.931.00.670.950.970.930.88
+ +not use the attention layer. LSTM-DRQN replaces the shared MLP with an LSTM layer so that the model remembers previous states, thus addressing the partial observability in these environments. + +Q-learning (Watkins and Dayan, 1992; Mnih et al., 2015) is used to train the agent. The parameters of the model are updated by optimizing the following loss function obtained from the Bellman equation (Sutton et al., 1998), + +$$ +\mathcal {L} = \left\| Q (s, a) - \mathbb {E} _ {s, a} \left[ r + \gamma \max _ {a ^ {\prime}} Q \left(s ^ {\prime}, a ^ {\prime}\right) \right] \right\| _ {2} \tag {3} +$$ + +where $Q(s, a)$ is obtained as the average of verb and object Q-values, $\gamma \in (0, 1)$ is the discount factor. The agent is given a reward of 1 from the environment on completing the objective. We also use episodic discovery bonus (Yuan et al., 2018) as a reward during training that introduces curiosity (Pathak et al., 2017) encouraging the agent to uncover unseen states for accelerated convergence. + +# 3.2 Context Relevant Episodic State Truncation (CREST) + +Traditional LSTM-DQN and LSTM-DRQN methods are trained on observation text containing irrelevant textual artifacts (like "You don't like doors?" in Figure 1), that leads to overfitting in small data regimes. Our CREST module removes unwanted tokens in the observation that do not contribute to decision making. Since the base policy overfits on the training games, the action commands issued by it can successfully solve the training games, thus yielding correct (observation text, action command) pairs for each step in the training games. Therefore, by only retaining tokens in the observation text that are contextually similar to the base model's + +![](images/68bb578fbb42580ddb6daf110c5c361fb2f7ed33854b4811dcc433e0ffca6fb9.jpg) + +![](images/e338338ff57900a2d5cc0288a97ff5f47f8d60ccde8e96eadd2e3ff5c6bcd012.jpg) +Figure 3: Ranking of context-relevant tokens from observation text by our token relevance distribution. + +![](images/b4df31c4526e2d3b974e7ead556b79ad773b0019ab93f8c4e0be572f0c998854.jpg) +Observation: You've entered a cookhouse. You begin to take stock of what's in the room. You need an unguarded exit? You should try going north. There is an exit to the south. Don't worry, it is unguarded. There is a coin on the floor. + +action command, we can remove unwanted tokens in the observation, which might otherwise cause overfitting. Figure 2(a) shows an overview of our method. + +We use three embeddings to obtain token relevance: (1) Word2Vec (Mikolov et al., 2013); (2) Glove (Pennington et al., 2014); and (3) Concept-net (Liu and Singh, 2004). + +The distance between tokens is computed using cosine similarity, $D(\mathbf{a}, \mathbf{b})$ . + +Token Relevance Distribution (TRD): We run inference on the overfitted base model for each training game (indexed by $k$ ) and aggregate all the action tokens issued for that particular game as the Episodic Action Token Aggregation (EATA), $\mathcal{A}^k$ . For each token $w_i$ in a given observation text $o_t^k$ at step $t$ for the $k^{th}$ game, we compute the Token Relevance Distribution (TRD), $\mathcal{C}$ as: + +$$ +\mathcal {C} \left(w _ {i}, \mathcal {A} ^ {k}\right) = \max _ {a _ {j} \in \mathcal {A} ^ {k}} D \left(w _ {i}, a _ {j}\right) \forall w _ {i} \in \boldsymbol {o} _ {t} ^ {k}, \tag {4} +$$ + +where the $i^{th}$ token $w_{i}$ 's score is computed as the maximum similarity to all tokens in $\mathcal{A}^k$ . This relevance score is used to prune irrelevant tokens in the + +![](images/3c859a7d054698dfac214cd7bcd12f79db6aec772d657f4857e607a7a11b8560.jpg) +Figure 4: Comparison of validation performance for various thresholds on (a) easy and (b) medium games, (c) Our method trained on L15 games and tested on L20 and L25 games significantly outperforms the previous methods. + +![](images/ab32b8094bfdbb29e9c4c8a22620ba2dab240954e96b0118f2ea4dc5770bb6ee.jpg) + +observation text by creating a hard attention mask using a threshold value. Figure 3 presents examples of TRD's from observations highlighting which tokens are relevant for the next action. Examples of token relevance are shown in the appendix. + +Bootstrapped model: The bootstrapped model is trained on the pruned observation text by removing irrelevant tokens using TRDs. The same model architecture and training methods as the base model are used. During testing, TRDs on unseen games are computed as $\mathcal{C}(w_i,\mathcal{G})$ , by global aggregation of action tokens, $\mathcal{G} = \bigcup_{k}\mathcal{A}^{k}$ , that combines the EATA for all training games. This approach retains all relevant action tokens to obtain the training domain information during inference, assuming similar domain distribution between training and test games. + +# 4 Experimental Results + +Setup: We used easy, medium, and hard modes of the Coin-collector Textworld (Côté et al., 2018; Yuan et al., 2018) framework for evaluating our model's generalization ability. The agent has to collect a coin that is located in a particular room. We trained each method on various numbers of training games (denoted by N#) to evaluate generalization ability from a few numbers of games. + +Quantitative comparison: We compare the performance of our proposed model with LSTM-DQN (Narasimhan et al., 2015) and LSTM-DRQN (Yuan et al., 2018). + +Figure 2(b) and 2(c) show the reward of various trained models, with increasing training episodes on easy and medium games. Our method shows improved out-of-sample generalization on validation games with about $10\mathrm{x} - 20\mathrm{x}$ fewer training games + +(500 vs. 25, 50) with accelerated training using drastically fewer training episodes compared to previous methods. + +We report performance on unseen test games in Table 1. Parameters corresponding to the best validation score are used. Our method trained with $N25$ and $N50$ games for easy and medium levels respectively achieves performance similar to 500 games for SOTA methods. We perform an ablation study with and without attention in the policy network and show that the attention mechanism alone does not substantially improve generalization. We also compare the performance of various word embeddings for TRD computation and find that ConceptNet gives the best generalization performance. + +Dropout: In Table 1, we also compare the performance of dropout (with probability 0.5) that randomly masks activations from the encoded state representation. We find that dropout improves performance compared to vanilla LSTM-DRQN. However, our method outperforms the model with dropout because dropout randomly drops tokens in an uninformed fashion. Our method uses a prior action token distribution from overfitted games to effectively remove irrelevant tokens. + +Pruning threshold: In this experiment, we test our method's response to changing threshold values for observation pruning. Figure 4(a) and Figure 4(b) reveals that thresholds of 0.5 for easy games and 0.7 for medium games give the best validation performance. A very high threshold might remove relevant tokens, leading to failure in training, whereas a low threshold value would retain the most irrelevant tokens, leading to over-fitting. + +Zero-shot transfer: In this experiment, agents + +![](images/eebd4f4ae3ce21e84a12c3be4e7a5267620009e397d3c8e2eef0b205cad57d37.jpg) +Figure 5: Token relevance scores for nouns in the test set for cooking games. The tokens having a score close to 1.0 correspond to overlaps between the train and test games. The other tokens were unseen during training. Our method can retain most tokens related to cooking using a threshold of 0.4, based on the training action token distribution obtained from an oracle. + +trained on games with quest lengths of 15 rooms were tested on unseen game configurations with quest lengths of 20 and 25 rooms, respectively, without retraining, to study the zero-shot transferability of our learned agents to unseen configurations. The results in the bar charts of Figure 4(c) for $N50$ easy games show that our proposed method can generalize to unseen game configurations significantly better than previous state-of-the-art methods on the coin-collector game. + +Generalizability to other games: In the above experimental section, we reported results on the coin-collector environment, where the nouns and verbs used in the train and test games have substantial overlap. We now present a discussion on our method's generalizability to other games, where the context-relevant tokens for a given game may never have occurred in any training game. + +To test our method's generalizability, we performed experiments on the cooking games considered in Adolphs and Hofmann (2019). A sample observation from these games looks like this: "You see a fridge. The fridge contains some water, a diced cilantro and a diced parsley. You wonder idly who left that here. Were you looking for an oven? Because look over there, it's an oven. Were you looking for a table? Because look over there, it's a table. The table is massive. On the table you make out a cookbook and a knife. You see a counter. However, the counter, like an empty counter, has nothing on it." The objective of this game is to prepare a meal by following the recipe found in the kitchen, and then eat it. + +We took 20 train and 20 test games from the cooking domain, all featuring unseen items in the test observations. Training action commands were obtained from the oracle walkthrough games provided as part of the cooking world games, and not from the overfitted train games (since in this experiment we were evaluating the generalizability of the method across unseen tokens). From the training games, we obtain noun action tokens: {"onion", "potato", "parsley", "apple", "counter", "pepper", "meal", "water", "fridge", "carrot)}. Using our token relevance (TRD) method (using ConceptNet embeddings) described in Section 3.2, we obtain scores for unseen cooking related nouns during test as: {"banana": 0.45, "cheese": 0.48, "chop": 0.39, "cilantro": 0.71, "cookbook": 0.30, "knife": 0.13, "oven": 0.52, "stove": 0.48, "table": 0.43}. + +Although these nouns were absent in the training action distribution, our proposed method can assign a high score to all these words (except "knife"), since they are similar in concept to the training actions. An appropriate threshold (for eg. $\text{th} = 0.4$ ) can retain most tokens, as shown in Figure 5. The threshold value can be automatically tuned using validation games, as discussed in Section 4. Additionally, we believe that sampling action tokens from overfitted training games (our proposed method) instead of from an oracle (used for this result) would improve action token diversity and successfully retain more context-relevant words. Thus, assuming some overlap between training and testing knowledge domains, our method is generalizable and can reduce overfitting for RL in NLP tasks. + +# 5 Conclusion + +We present a method for improving generalization in TBGs by removing irrelevant tokens from observation texts. Our bootstrapped model – trained on the salient observation tokens – obtains generalization performance similar to SOTA methods – with 10x-20x fewer training games – due to better generalization; and shows accelerated convergence. In this paper, we have restricted our analysis to TBGs that feature similar domain distributions in train and test games. In the future, we will focus our attention on the topic of generalization in the presence of domain differences such as novel objects; and given goal statements in test games that were not seen by the agent during training. + +# References + +Ashutosh Adhikari, Xingdi Yuan, Marc-Alexandre Côté, Mikuláš Zelinka, Marc-Antoine Rondeau, Romain Laroche, Pascal Poupart, Jian Tang, Adam Trischler, and William L Hamilton. 2020. Learning dynamic knowledge graphs to generalize on text-based games. arXiv preprint arXiv:2002.09127. +Leonard Adolphs and Thomas Hofmann. 2019. Ledeepchef: Deep reinforcement learning agent for families of text-based games. arXiv preprint arXiv:1909.01646. +Prithviraj Ammanabrolu and Matthew Hausknecht. 2020. Graph constrained reinforcement learning for natural language action spaces. arXiv preprint arXiv:2001.08837. +Prithviraj Ammanabrolu and Mark O Riedl. 2018. Playing text-adventure games with graph-based deep reinforcement learning. arXiv preprint arXiv:1812.01628. +Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. +Marc-Alexandre Côté, Ákos Kádár, Xingdi Yuan, Ben Kybartas, Tavian Barnes, Emery Fine, James Moore, Matthew Hausknecht, Layla El Asri, Mahmoud Adada, et al. 2018. Textworld: A learning environment for text-based games. arXiv preprint arXiv:1806.11532. +Bhuwan Dhingra, Lihong Li, Xiujun Li, Jianfeng Gao, Yun-Nung Chen, Faisal Ahmed, and Li Deng. 2017. Towards end-to-end reinforcement learning of dialogue agents for information access. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 484-495. +Nancy Fulda, Daniel Ricks, Ben Murdoch, and David Wingate. 2017. What can you do with a rock? affordance extraction via word embeddings. arXiv preprint arXiv:1703.03429. +Ji He, Jianshu Chen, Xiaodong He, Jianfeng Gao, Li-hong Li, Li Deng, and Mari Ostendorf. 2016. Deep reinforcement learning with a natural language action space. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1621-1630. +Xiujun Li, Yun-Nung Chen, Lihong Li, Jianfeng Gao, and Asli Celikyilmaz. 2017. End-to-end task-completion neural dialogue systems. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 733-743. +Hugo Liu and Push Singh. 2004. Conceptnet—a practical commonsense reasoning tool-kit. BT technology journal, 22(4):211-226. + +Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pages 3111-3119. +Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. 2015. Human-level control through deep reinforcement learning. Nature, 518(7540):529. +Karthik Narasimhan, Tejas Kulkarni, and Regina Barzilay. 2015. Language understanding for text-based games using deep reinforcement learning. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1-11. +Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. 2017. Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 16-17. +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 (EMNLP), pages 1532-1543. +Iulian V Serban, Chinnadhurai Sankar, Mathieu Germain, Saizheng Zhang, Zhouhan Lin, Sandeep Subramanian, Taesup Kim, Michael Pieper, Sarath Chandar, Nan Rosemary Ke, et al. 2017. A deep reinforcement learning chatbot. arXiv preprint arXiv:1709.02349. +Richard S Sutton, Andrew G Barto, et al. 1998. Introduction to reinforcement learning, volume 2. MIT press Cambridge. +Christopher JCH Watkins and Peter Dayan. 1992. Q-learning. Machine learning, 8(3-4):279-292. +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. +Xusen Yin and Jonathan May. 2019. Learn how to cook a new recipe in a new house: Using map familiarization, curriculum learning, and bandit feedback to learn families of text-based adventure games. arXiv preprint arXiv:1908.04777. +Xingdi Yuan, Marc-Alexandre Côté, Alessandro Sordoni, Romain Laroche, Remi Tachet des Combes, Matthew Hausknecht, and Adam Trischler. 2018. Counting to explore and generalize in text-based games. arXiv preprint arXiv:1806.11525. + +Tom Zahavy, Matan Haroush, Nadav Merlis, Daniel J Mankowitz, and Shie Mannor. 2018. Learn what not to learn: Action elimination with deep reinforcement learning. In Advances in Neural Information Processing Systems, pages 3562-3573. \ No newline at end of file diff --git a/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/images.zip b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..0a07fea6d120768ebb4ccc6820a4f9b427d6380a --- /dev/null +++ b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ad70f5301e5b9c7ebaba17dccada0e32630c1fce8069a81fc8993619c3cdb2f +size 343923 diff --git a/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/layout.json b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..48968235a9e74058ea738e56c26137e83e7e633d --- /dev/null +++ b/bootstrappedqlearningwithcontextrelevantobservationpruningtogeneralizeintextbasedgames/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17bfb504d380aa933e78c9ce63cc4abe944cf4d2b5a322a46774a13fa32b1b6f +size 206520 diff --git a/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_content_list.json b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3eb556edb63c50e478fd009e269dc37311425b76 --- /dev/null +++ b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fd331ca363e8ce52d04894594d29fc03bb09fca9d4a6e36088043a0b375c5b5 +size 116209 diff --git a/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_model.json b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_model.json new file mode 100644 index 0000000000000000000000000000000000000000..487f3674f4ebf90b3ab1efd37e547df724b22e84 --- /dev/null +++ b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d6d5ea5437d3e4680fcb713d6a284a00728d339745f58d56049bfcb1c401c93 +size 141039 diff --git a/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_origin.pdf b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5971832703f46493e3a842ebaad59c46745eb495 --- /dev/null +++ b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/177d6324-6c8a-4ea0-9126-f887d62cd5dd_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f13ede2f8e82b4195e526f4e74ceaed382ec751e180defdda9a2a951b167222b +size 732580 diff --git a/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/full.md b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f97d0b5c47c885f932ca48a9c8d31427fc19e311 --- /dev/null +++ b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/full.md @@ -0,0 +1,414 @@ +# Bridging Linguistic Typology and Multilingual Machine Translation with Multi-View Language Representations + +Arturo Oncevay Barry Haddow Alexandra Birch + +School of Informatics, University of Edinburgh, Scotland + +{a.oncevay,a.birch}@ed.ac.uk,bhaddow@inf.ed.ac.uk + +# Abstract + +Sparse language vectors from linguistic typology databases and learned embeddings from tasks like multilingual machine translation have been investigated in isolation, without analysing how they could benefit from each other's language characterisation. We propose to fuse both views using singular vector canonical correlation analysis and study what kind of information is induced from each source. By inferring typological features and language phylogenies, we observe that our representations embed typology and strengthen correlations with language relationships. We then take advantage of our multi-view language vector space for multilingual machine translation, where we achieve competitive overall translation accuracy in tasks that require information about language similarities, such as language clustering and ranking candidates for multilingual transfer. With our method, which is also released as a tool, we can easily project and assess new languages without expensive retraining of massive multilingual or ranking models, which are major disadvantages of related approaches. + +# 1 Introduction + +Recent surveys consider linguistic typology as a potential source of knowledge to support multilingual natural language processing (NLP) tasks (O'Horan et al., 2016; Ponti et al., 2019). Linguistic typology studies language variation in terms of their functional processes (Comrie, 1989). Several typological knowledge bases (KB) have been crafted, from where we can extract categorical language features (Littell et al., 2017). Nevertheless, their sparsity and reduced coverage present a challenge for an end-to-end integration into NLP algorithms. For example, the World Atlas of Language Structure (WALS; Dryer and Haspelmath, 2013) encodes 143 features for 2,679 languages, but their mean + +coverage per language is barely around $14\%$ . + +Dense and data-driven language representations have emerged in response. They are computed from multilingual settings of language modelling (Östling and Tiedemann, 2017) and neural machine translation (NMT) (Malaviya et al., 2017). However, the language diversity in the corpus-based representations is limited. The language coverage could be broadened with other knowledge, such as that encoded in WALS, to distinguish even more language properties. Therefore, to obtain the best of both views (KB and task-learned) with minimal information loss, we project a shared space of discrete and continuous features using a variant of canonical correlation analysis (Raghu et al., 2017). + +For our study, we fuse language-level embeddings from multilingual machine translation with syntactic features of WALS. We inspect how much typological knowledge is present by predicting features for new languages. Then, we infer language phylogenies and inspect whether specific relationships are induced from the task-learned vectors. + +Furthermore, to demonstrate that our approach has practical benefits in NLP, we apply our language vectors in multilingual NMT with language clustering (Tan et al., 2019) and adapt the ranking of related languages for multilingual transfer (Lin et al., 2019). As a side outcome, we identify that there is an ideal setting to encode language relationships in language embeddings from NMT. Finally, we are releasing a simple tool to allow everyone to fuse their own representations for clustering, ranking and more. + +# 2 Multi-view language representations + +Our primary goal is to fuse parallel representations of the same language in one shared space, and canonical correlation analysis (CCA) allows us to find a projection of two views for a given set of + +data. With CCA, we look for linear combinations that maximise the correlation of the two sources in each coordinate iteratively (Hardoon et al., 2004). After training, we can apply the transformation learned on a new sample from any view to obtain a CCA-based language representation. $^{1}$ + +CCA considers all dimensions of the two views as equally important. However, our sources are potentially redundant: KB features are mostly one-hot-encoded, whereas task-learned ones inherit the high dimensionality of the embedding layer. Moreover, few samples and sparsity could make the convergence harder. For the redundancy issue, singular value decomposition (SVD) is an appealing alternative. With SVD, we factorise the source data matrix to compute the principal components and singular values. Furthermore, to deal with sparsity, we adopt a truncated SVD approximation, which is also known as latent semantic analysis in the context of linear dimensionality reduction for term-count matrices (Dumais, 2004). + +The two-step transformation of SVD followed by CCA is called singular vector canonical correlation analysis (SVCCA; Raghu et al., 2017) in the context of understanding the representation learning throughout neural network layers. That being said, we use SVCCA to get language representations and not to inspect a neural architecture. + +# 3 Methodology and research questions + +To embed linguistic typology knowledge in dense representations for a broad set of languages, we employ SVCCA (§2) with the following sources: + +KB view. We employ the language vectors from the URIEL and lang2vec database (Littell et al., 2017). Precisely, we work with the $k$ -NN vectors of the Syntax feature class ( $U_S$ ; 103 feats.), that are composed of binary features encoded from WALS (Dryer and Haspelmath, 2013). + +(NMT) Learned view. Firstly, we exploit the NMT-learned embeddings from the Bible $(L_{B};512$ + +dim.) (Malaviya et al., 2017). Up to 731 entries are available in lang2vec that intersects with $U_{S}$ . They were trained in a many-to-English NMT model with a pseudo-token identifying the source language at the beginning of every input sentence. + +Secondly, we take the many-to-English language embeddings learned for the language clustering task on multilingual NMT ( $L_{W}$ ; 256 dim.) (Tan et al., 2019), where they use 23 languages of the $\mathrm{WIT}^3$ corpus (Cettolo et al., 2012). + +One main difference for the latter is the use of factors in the architecture, meaning that the embedding of every input token was concatenated with the embedded pseudo-token that identifies the source language. The second difference is the neural architecture used to extract the embeddings: the former use a recurrent neural network, whereas the latter a small transformer model (Vaswani et al., 2017). + +Finally, we train a new set of embeddings $(L_{T})$ that we extracted from the 53 languages of the TED corpus (many-to-English) processed by Qi et al. (2018), using the approach of Tan et al. (2019).3 + +What knowledge do we represent? Each source embeds specialised knowledge to assess language relatedness. The KB vectors can measure typological similarity, whereas task-learned embeddings correlates with other kinds of language relationships (e.g. genetic) (Bjerva et al., 2019b). To analyse whether each kind of knowledge is induced with SVCCA, we assess the tasks of typological feature prediction (§4) and reconstruction of a language phylogeny (§5). + +What is the benefit for multilingual NMT (and NLP)? Language-level representations can evaluate the distance between languages in a vector space. We then can assess their applicability on multilingual NMT tasks that require guidance from language relationships. Therefore, language clustering and ranking related partner languages for (multilingual) transfer are our study cases $(\S 6)$ . + +# 4 Prediction of typological features + +An example of a typological feature is a word order specification, like whether the adjective is predominately placed before or after the noun (features #24 and #25 of $U_{S}$ ). Our task consists in predicting syntactic features ( $U_{S}$ ) leaving one-language and + +
one-language-outone-family-out
SingleSVCCA#F.SingleSVCCA
LB(Bible)72.7771.6813472.1570.62
LW(WIT-23)81.2784.831279.4979.68
LT(TED-53)77.9685.371876.3681.06
+ +Table 1: Avg. accuracy $(\uparrow)$ of typological feature prediction per NMT-learned and SVCCA $(U_{S},L_{*})$ setting. + +one-language-family out to control phylogenetic relationships (Bjerva et al., 2019a). Previous work has shown that task-learned embeddings are potential candidates to predict features of a linguistic typology KB (Malaviya et al., 2017), and our goal is to evaluate whether SVCCA can enhance the NMT-learned language embeddings with typological knowledge from their KB parallel view. + +Experimental setup. We use a Logistic Regression classifier per $U_{S}$ feature, which is trained with the NMT-learned or SVCCA representations in both one-language-out and one-language-family-out settings. For prediction, we use the original embedding or its SVCCA projection as inputs. + +Results. In Table 1, we observe that SVCCA outperformed their NMT-learned counterparts for $L_{W}$ and $L_{T}$ , where the performance is significantly better for the one-language-out setting. In the case of $L_{B}$ (with 731 entries), we notice that the overall performance drops, and the SVCCA transformation cannot improve it. We argue that a potential reason for the accuracy dropping is the method used to extract the NMT-learned embeddings (initial pseudo-token instead of factors: §7), which could diminishes the information embedded about each language, and consequently, impacts the SVCCA projection. In conclusion, we notice that specific typological knowledge is usually hard to learn in an unsupervised way, and fusing them with KB vectors using SVCCA is feasible for inducing information of linguistics typology in some scenarios. + +# 5 Language phylogeny analysis + +According to Bjerva et al. (2019b), there is a positive correlation between the language distances in a phylogenetic tree and a pairwise distance-matrix of task-learned representations. Our goal therefore + +is to investigate whether fusing linguistic typology with SVCCA can preserve or enhance the embedded relationship information. For that reason, we examine how well a language phylogeny can be reconstructed from language representations (§5.1), and also study the correlation (Appendix B). + +# 5.1 Inference of a phylogenetic tree + +Experimental design. Based on previous work (Rabinovich et al., 2017), we take a tree of 17 Indo-European languages (Serva and Petroni, 2008) as a Gold Standard (GS), which is shown in Figure 1a. We also use agglomerative clustering with variance minimisation (Ward Jr, 1963) as linkage, but we employ cosine similarity as Bjerva et al. (2019b). + +We also consider a concatenation $(\oplus)$ of the KB and NMT-learned views as a baseline. + +It is essential to highlight that none of the NMT-learned and $\oplus$ vectors have all the 17 language entries of the GS. Therefore, we can already see one of the significant advantages of the SVCCA vectors, as we are able to represent "unknown" languages using one of the views. The NMT-learned views lack English, since they were extracted from the source side of a many-to-English system, but we were able to project the KB English vectors into the shared space. In addition, we project other four languages (Swedish, Danish, Latvian, Lithuanian) to complete the $L_{W}$ embeddings of Tan et al. (2019) and Latvian to complete our own $L_{T}$ set. + +Evaluation metric. We differ from previous studies and use a tree edit distance metric, which is defined as the minimum cost of transforming one tree into another by inserting, deleting or modifying (the label of) a node. Specifically, we used the All Path Tree Edit Distance algorithm (APTED; Pawlik and Augsten, 2015, 2016), a novel one for the task. We chose an edit-distance method as it is more transparent for assessing what is the degree of impact for a single change of linkage in the GS. + +As we need to compare inferred pruned trees with different number of nodes, we propose a normalised version given by: nAPTED = APTED /(|GS| + |τ|), where τ is the inferred + +
KB-view
US(Syntax)30-0.45
NMT-learnedUS ⊕ L*SVCCA(US,L*)
LB(Bible)35-0.5427-0.4223-0.34
LW(WIT-23)35-0.6223-0.4127-0.48
LT(TED-53)15-0.2618-0.2910-0.15
+ +Table 2: APTED and nAPTED scores $(\downarrow)$ between the GS and inferred trees from all scenarios. APTED ranges from 0 (no difference) and the size of the tree at most. NMT-learned and concatenation $(\oplus)$ can only reconstruct pruned trees of $16(L_{B})$ $12(L_{W})$ and 15 $(L_{T})$ languages. + +tree, and $|\cdot|$ indicates the number of nodes. The denominator then is the maximum cost possible of deleting all nodes of $\tau$ and inserting each GS node. + +Results. Table 2 shows the results for all settings, where the single-view scores are meagre in most of the cases. For instance, the $U_{S}$ inferred tree (Fig.1c) requires 30 edits to match the GS. The exception is $L_{T}$ (Fig.1d), which requires half the edits, although it is incomplete. + +We observe that the best absolute and normalised scores are obtained by fusing $U_{S}$ and $L_{T}$ with SVCCA (Fig.1b). English is projected in the Germanic branch, although Latvian is separated from the Balto-Slavic group. The latter case is similar for Bulgarian, which is misplaced in the original $L_{T}$ tree as well. Nevertheless, we only require ten editions to equate the GS (where 66 is the maximum cost possible), confirming that our approach is a robust alternative for completing language entries and inferring a language phylogeny. $^{7}$ + +In conclusion, we observe that using typological knowledge with SVCCA enhances the language relationship encoded in the NMT-learned embeddings. In Appendix B, we further discuss what kind of relationship we are representing in the NMT-learned embeddings and SVCCA, and study their correlation. + +# 6 Application in multilingual NMT + +With multilingual NMT, we can translate several language-pairs using a single model. Low-resource languages usually benefit through multilingual transfer, which resembles a simultaneous training of the parent(s) and child models. Therefore, we want to take advantage of a language-level vector + +![](images/b98a7477d54eee7e187642fd731bb23c90470a1dfe52b6cd084dff6cba95a4c8.jpg) +(a) Gold Standard + +![](images/c27975e1285186eaaaa74ad90c4e8612cc067750b3905c147d12ca2cce4151f2.jpg) +(b) SVCCA $(U_S, L_T)$ + +![](images/0b88fb277918fd5c5f27f33d8486bec8c2ba2d372c6fe5e1d29ee31df64b00f9.jpg) +(c) $U_{S}$ : Syntax +Figure 1: Gold Standard phylogeny (a) and reconstructed trees (b-d). $L_{T}$ is smaller. + +![](images/783fb28dde1940477f7d9d2f90f3fbf6a10bca49712139fde80b5eca2ea86afa.jpg) +(d) $L_{T}$ :TED-53 + +space for relating similar languages and enhancing multilingual transfer within multilingual NMT. For that reason, we first address the language clustering task proposed by Tan et al. (2019), and afterwards, the language ranking model of Lin et al. (2019). + +Language clustering. The main idea is to obtain smaller multilingual NMT models as an intermediate point between maintaining many pairwise systems and a single massive multilingual model. With limited resources, it is challenging to support the first scenario, whereas the advantages for the massive setting are also very appealing (e.g. simplified training process, translation improvement for low-resource languages or zero-shot translation (Johnson et al., 2017)). Therefore, to address the task, Tan et al. (2019) trained a factored multilingual NMT model of 23 languages from Cettolo et al. (2012), where the language embedding is concatenated in every input token. Then, they performed hierarchical clustering with the representations, and selected a number of clusters guided by the Elbow method. Finally, they compared the systems against individual, massive and language family-based cluster models. + +In a practical multilingual NMT system, it is not only necessary to choose the right clustering, the + +ability to easily add new languages is also important. With this in mind, we apply our multi-view representations to compute a set of clusters, and we also address the question: do we need to train the massive model again if we want to add one or more new languages to our setting? + +Language ranking. The original goal of LANGRANK is to choose a parent language to perform transfer learning in different tasks, NMT included. To achieve this, Lin et al. (2019) trained a model based on the performance of several hundred pairwise MT systems using the dataset of Qi et al. (2018). For the input features, they considered linguistically-informed vectors from lang2vec (Littell et al., 2017) and corpus-based statistics, such as word/sub-word overlapping and the ratio of the token-types or the data size between the target child and potential candidates, where the latter features were some of the most relevant. + +Considering the transfer capabilities within multilingual NMT and the possibility to obtain a ranked list of candidates from LANGRANK, we propose an adapted task of choosing $k$ -related languages for multilingual transfer. We then use our multi-view representations to rank related languages from the vector space, as they embed information about typological and lexical relationships. This is similar to the features that Lin et al. (2019) consider, but without training a ranking model fed with scores from pairwise MT systems. + +# 6.1 Experimental setup + +We focus on the many-to-one (English) multilingual NMT setting to simplify the evaluation in both tasks. However, similar experiments could be performed in a one-to-many direction. + +Dataset. We use the dataset processed and tokenised by Qi et al. (2018) of 53 languages (TED-53), from where we learned our $L_{T}$ embeddings. We opted for TED-53 to better evaluate the extensibility of clusters and because it is also used to train the LANGRANK model. The list of languages, set sizes and other details are included in Appendix A. Before preprocessing the text, we drop any sentences from the training sets which overlap with any of the test sets. Since we are building many-to-English multilingual systems, this is important, as any such overlap will bias the results. + +Model and training. Similar to Tan et al. (2019), we train small transformer models (Vaswani et al., + +2017). We jointly learn 90k shared sub-words with the byte pair encoding (Sennrich et al., 2016) algorithm built in SentencePiece (Kudo and Richardson, 2018). We also oversample all the training data of the less-resourced languages in each cluster, and shuffle them proportionally in all batches. + +We use Nematus (Sennrich et al., 2017) only to extract the factored language embeddings from the TED-53 corpus $(L_{T})$ . Besides, given the large number of experiments, we also choose the efficient Marian NMT (Junczys-Dowmunt et al., 2018) toolkit for training the rest of systems. With Marian NMT, we only use the basic pseudo-token setting for identifying the source language, as we did not need to retrieve new language embeddings after training. Besides, we allow the Marian NMT framework to automatically determine the minibatch size given the sentence-length and available memory (mini-batch-fit parameter). + +We train our models with up to four NVIDIA P100 GPUs using Adam optimiser (Kingma and Ba, 2014) with default parameters $(\beta_{1} = 0.9, \beta_{2} = 0.98, \varepsilon = 10^{-9})$ and early stopping at 5 validation steps for the cross-entropy metric. Finally, the sacreBLEU version string (Post, 2018) is as follows: BLEU+case.mixed+numrefs.1+smooth.exp +tok.13a+version.1.3.7. + +Clustering settings. We first list the baselines and our approaches, with the number of clusters/models between brackets: + +1. Individual [53]: Pairwise model per language. +2. Massive [1]: A single model for all languages. +3. Language families [20]: Based on historical linguistics. We divide the 33 Indo-European languages into 7 branches. Moreover, 11 groups only have one language. +4. KB [3]: $U_{S}$ (Syntax) tends to agglomerate large clusters (with 4-13-33 languages), behaving similar to a massive model (Fig. 2c). +5. Learned [11]: We train a set of 53 factored embeddings $(L_{T})$ similar to Tan et al. (2019) (Fig. 2d). +6. Concatenation [18]: $U_S \oplus L_T$ . +7. SVCCA-53 [10]: Multi-view representation with SVCCA composing both $U_{S}$ and $L_{T}$ vectors (Fig. 2a). +8. SVCCA-23 [10]: Similar to the previous setting, but we use the set of 23 language embeddings $L_{W}$ instead (Tan et al., 2019), and project the 30 complementary languages with SVCCA $(U_{S},L_{W})$ (Fig. 2b). + +![](images/4d9e30ca04829f80ac0be97ec79a27312940a9b8489dd76167ba19ba24e6b20f.jpg) +(a) SVCCA-53 $(U_S, L_T)$ : SVCCA representations of Syntax and TED-53 + +![](images/45f74f19dc3c193cb7f7e53b9b83c360cddfe635048c1132ad0e98a8d0039100.jpg) +(b) SVCCA-23( $U_S$ , $L_W$ ): SVCCA representations of Syntax and WIT-23 + +![](images/02046b98468cceb7517bb589390a752f02e7fb0bf89b08e384d0e044ec411d94.jpg) + +![](images/9575c3e0245ad949541429942899fa995347678eba252bd0da20ce14d12d5b81.jpg) +(c) $U_{S}$ : Syntax + +![](images/6a0135963cfe8b560c7b40a5d252d36e43000d3d8668157e4fe26930cf4c6674.jpg) + +![](images/6047ea8aee923ae9c187806376eeba1cdcbc67ef19f21805fe9dc1057f315936.jpg) +(d) $L_{T}$ : NMT-learned from TED-53 (using factors) + +![](images/bb6ab4fe21a51717b56708b32a29ab19feb2bbe01a53820fc07d6ce5983dd87a.jpg) + +![](images/bb6a4746cab20570bbc91d2e5e8c96c6232fa4d904fac0356d15eb6939ef0a78.jpg) +Figure 2: (a) Clustering of TED-53 using the SVCCA-53 representations. At the left, we include the Elbow and Silhouette criteria to define the number of clusters. For the former, it is not clear what is the value to choose, whereas for the later we automatically select the highest peak at ten clusters. (b-d) Elbow method, silhouette analysis and dendrograms for SVCCA-23( $U_S$ , $L_W$ ) with 30 additionally projected languages, $U_S$ and $L_T$ . + +With the last setting, we are interrogating whether SVCCA is a useful method for rapidly increasing the number of languages without retraining massive models given new entries that require their NMT-learned embeddings for clustering. + +Similar to Tan et al. (2019), we use hierarchical agglomeration with average linkage and cosine similarity. However, we choose a different criterion for choosing the optimal number of clusters. + +Selection of number of clusters. The Elbow criterion has been suggested for this purpose (Tan et al., 2019); however, as we can see in Figure 2, it might be ambiguous. Thus, we propose using a heuristic called Silhouette (Rousseeuw, 1987), + +which returns a score in the [-1,1] range. A sample cluster with a silhouette close to 1 indicates that it is cohesive and well-separated. With the average silhouette of all samples, we vary the number of clusters, and look for the peak value above two. + +Ranking settings. We focus on five low-resource languages from TED-53: Bosnian (bos, Indo-European/Balto-Slavic), Galician (glg, Indo-European/Italic), Malay (zlm, Austronesian), Estonian (est, Uralic) and Georgian (kat, Kartvelian). They have between 5k and 13k translated sentences with English, and we chose them as they achieved the most significant improvement from the individual to the massive setting. We then identified the + +top-3 related languages using LANGRANK, which give us a multilingual training set of around 500 thousand sentences for each case. Given that LANGRANK usually prefers to choose candidates with larger data size (Lin et al., 2019), for a fair comparison, we use SVCCA and cosine similarity to choose the $k$ closest languages that can agglomerate a similar amount of parallel sentences. + +# 6.2 Language clustering results + +We first briefly discuss the composition of clusters obtained by SVCCA. Then, we analyse the results grouped by training size bins. We complement the analysis by family groups in Appendix D. + +Cluster composition: In Figure 2, we observe that SVCCA-53 (Fig. 2a) has adopted ten clusters with a proportionally distributed number of languages (the smallest one is Greek-Arabic-Hebrew, and the largest one has seven entries). Moreover, the languages are usually grouped by phylogenetic or geographical criteria. These agglomeration trends are adopted from both the KB (Fig. 2c) and NMT-learned (Fig. 2d) sources. + +From a more detailed inspection, there are entries that do not correspond to their respective family branches, although the single-view sources might induce the bias. For instance, the $L_{T}$ phylogenetic tree (Fig. 1d) "misplaced" Bulgarian within Italic languages. Nevertheless, the unexpected agglomerations rely on the features encoded in the KB or the NMT learning process, and we expect they can uncover surprising clusters to avoid isolating languages without close relatives (e.g. Basque, or even Japanese as the only Japonic member in the set). Another benefit is noticeable in the SVCCA-23 clusters (Fig. 2b), which have resemblances with the SVCCA-53 agglomeration despite using only 23 languages to compute the shared space. + +Training size bins: We manually define the upper bounds of the bins as [10,75,175,215] thousands of training sentences, which results in groups composed by [14,14,13,12] languages. Figure 3 shows the box plots of BLEU from where we can analyse each distribution (mean, variance). + +Throughout all the bins, we observe that both SVCCA-53 and SVCCA-23 accomplish a comparable accuracy with the best setting in each group. In other words, their clusters provide stable performance for both low or high-resource languages. + +In the first bin of the smallest corpora, the Massive baseline and the large clusters of $U_{S}$ barely sur + +![](images/cdf90681f0c7ab24363113ba8785465679cc1e367aafa64f9fffb1b9d45387b1.jpg) +Figure 3: Box plots of BLEU scores per training-size bins. Each bin is represented by the range of minimum and maximum training size. Outliers are shown as diamonds. + +pass the SVCCA schemes. Nevertheless, SVCCA contributes a notable advantage if we want to train a multilingual NMT model for a specific low-resource language, and we do not have the resources for training a massive system. We further analyse this scenario in §6.3. + +In the rightmost bin, for the highest resource languages, the Massive and $U_{S}$ performed worse than SVCCA. Furthermore, we show a competitive accuracy for the Individual and Family approaches. The former's clusters have steady performance across most of the bins as well. Nevertheless, they double the number of clusters that we have in both SVCCA settings, and with more than half of the "clusters" having only one language. + +Other approaches, like using the NMT-learned embeddings $(L_{T})$ as Tan et al. (2019) or the concatenation baseline, obtain similar translation results in the last three bins. However, we need to obtain the NMT-learned embeddings first in order to fulfil those methods (from a 53-languages massive model). Using SVCCA and a pre-trained smaller set of language embeddings is enough for projecting new representations, as we present with our SVCCA-23 approach. + +# 6.3 Language ranking results + +After discussing overall translation accuracy for all the languages, we now focus on five specific low-resource cases and how multilingual transfer enhance their performance. Table 3 shows the BLEU scores of the translation into English for the smaller multilingual models that group each child language with their candidates ranked by LANGRANK and our SVCCA-53 representations. + +We also include the results of the individual and massive MT systems. Even when the latter baseline provides a significant improvement over the former, we observe that many of the smaller multilingual models outperform the translation accuracy of the massive system. The result suggests that the amount of data is not the most important confound for supporting multilingual transfer in a low-resource language, which is aligned with the literature (Wang and Neubig, 2019). + +Comparing the two ranking approaches, we observe that SVCCA approximates the performance of LANGRANK in most of the cases. We note that LANGRANK prefers related languages with large datasets, as it only requires three candidates to group around half a million training samples, whereas SVCCA suggests to include from three to ten languages to reach a similar amount of parallel sentences. However, increasing the number of languages could impact the multilingual transfer negatively (see the case of Georgian or kat), as it is analogous to adding different "out-of-domain" samples. To alleviate this, we could bypass candidate languages that do not possess a specific amount of training samples. + +We argue that our representations still provides a robust alternative to determine which languages are suitable for multilingual transfer learning. The notable advantage is that we do not need to pretrain MT systems from a specific dataset, and we can easily extend the coverage of languages without re-training the ranking model to consider new language entries8. + +
LInd.Mas.LANGRANKSVCCA-53
bos4.226.628.8 (434)28.2 [5]
glg8.424.927.7 (443)28.4 [3]
zlm4.120.121.2 (463)21.0 [4]
est5.813.513.5 (533)12.1 [6]
kat5.814.313.3 (499)10.5 [10]
+ +Table 3: BLEU scores $(\mathrm{L}\rightarrow \mathrm{English})$ for Individual, Massive and ranking approaches. LANGRANK shows the accumulated training size (in thousands) for the top-3 candidates, whereas with SVCCA we approximate the amount of data and include the number of languages between brackets. + +![](images/99c8879491b0aea1e6c8ac226cefd2d4fe219fe5d3edb46b0c404daafd9d298b.jpg) +(a) $L_{T}*$ + +![](images/07ffc1839e19cab25b0f16dea85e90b8e482c02c93c6c1732fd05f7a3067d60f.jpg) +(b) $L_{B}$ +Figure 4: Silhouette analysis for the $L_{T}$ * embeddings trained using an initial pseudo-token (left) and the $L_{B}$ Bible vectors (right). Both cases present a downtrend curve with scores below 0.2. The hierarchies of $L_{T}$ and $L_{B}$ are shown in Figures 6b and 6a (in the Appendix), respectively. + +# 7 Factors over initial pseudo-tokens + +We additionally argue that the configuration used to compute the language embeddings impacts what relationship they can learn. For the analysis, we extract an alternative set of 53 language embeddings $(L_{T}*)$ but using the initial pseudo-token setting instead of factors. Then, we perform a silhouette analysis to identify whether we can build cohesive and well-separated clusters of languages. + +Figure 4 shows the silhouette analysis for the aforementioned embeddings $(L_{T^{*}})$ together with the Bible embeddings $(L_{B})$ that were trained with the same configuration. We observe that the silhouette score never exceeds 0.2, and the curve keeps degrading when we examine a higher number of clusters, which contrast the trend shown in Figure 2. The pattern proves that the vectors are not suitable for clustering (the hierarchies are shown in Figure 6 in the Appendix), and they might only encode enough information to perform a classification task in the multilingual NMT training and inference. For that reason, we consider it essential to use language embeddings from factors for extracting language relationships. + +# 8 Related work + +For language-level representations, URIEL and lang2vec (Littell et al., 2017) allow a straightforward extraction of typological binary features from different KBs. Murawaki (2015, 2017, 2018) exploits them to build latent language representations with independent binary variables. Language features are encoded from data-driven tasks as well, such as NMT (Malaviya et al., 2017) or language modelling (Tsvetkov et al., 2016; Ostling and Tiedemann, 2017; Bjerva and Augenstein, 2018b) + +with complementary linguistic-related target tasks (Bjerva and Augenstein, 2018a). + +Our approach is most similar to Bjerva et al. (2019a), as they build a generative model from typological features and use language embeddings, extracted from factored language modelling at character-level, as a prior of the model to extend the language coverage. However, our method primarily differs as it is mainly based in linear algebra, encodes information from both sources since the beginning, and can deal with a small number of shared entries (e.g. 23 from $L_{W}$ ) to compute robust representations. + +There has been very little work on adopting typology knowledge for NMT. There is not a deep integration of the topics (Ponti et al., 2019), but one shallow and prominent case is the ranking method (Lin et al., 2019) that we analysed in §6. + +Finally, CCA and its variants have been previously used to derive embeddings at word-level (Faruqui and Dyer, 2014; Dhillon et al., 2015; Osborne et al., 2016). Kudugunta et al. (2019) also used SVCCA but to inspect sentence-level representations, where they uncover relevant insights about language similarity that are aligned with our results in §5. However, as far as we know, this is the first time a CCA-based method has been used to compute language-level representations. + +# 9 Takeaways and practical tool + +We summarise our key findings as follows: + +- SVCCA can fuse linguistic typology KB entries with NMT-learned embeddings without diminishing the originally encoded typological and genetic similarity of languages. +- Our method is a robust alternative for identifying clusters and choosing related languages for multilingual transfer in NMT. The advantage is notable when it is not feasible to pretrain a ranking model or learn embeddings from a massive multilingual system. Assessing new languages is an important ability, given that most of them do not have even enough monolingual corpora to learn embeddings from multilingual language modelling (Joshi et al., 2020). +- Factored language embeddings encode more information to agglomerate related languages than the initial pseudo-token setting. + +Furthermore, we make our code available as an + +open-source tool $^9$ , together with our $L_{T}$ factored-embeddings, to compute multi-view language representations using SVCCA. We enable the option to use other language vectors from lang2vec (Phonology or Phonetic Inventory) as the KB-source, and to upload new task-learned embeddings from different settings, such as one-to-many or many-to-many NMT, and also multilingual language modelling. Besides, given a list of languages to assess, our method will project new language representations when they are only available in the KB-view. Finally, we include the tasks of language clustering and ranking candidates, which could benefit multilingual NLP studies that involve massive datasets of hundreds of languages. + +# 10 Conclusion + +We compute multi-view language representations with SVCCA using two sources: KB and NMT-learned vectors. With a typological feature prediction task and the inference of phylogenetic trees, we showed that the knowledge and language relationship encoded in both sources is preserved in the combined representation. Moreover, our approach offers important advantages because we can evaluate projected languages with entries in only one of the views and can easily extend the language coverage. The benefits are noticeable in multilingual NMT tasks, like language clustering and ranking related languages for multilingual transfer. We plan to study how to deeply incorporate our typologically-enriched embeddings in multilingual NMT, where there are promising avenues in parameter selection (Sachan and Neubig, 2018) and generation (Platanios et al., 2018). + +# Acknowledgments + +This work was supported by funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No 825299 (GoURMET) and the EP-SRC fellowship grant EP/S001271/1 (MTStretch). Also, it was performed using resources provided by the Cambridge Service for Data Driven Discovery (CSD3) operated by the University of Cambridge Research Computing Service (http://www.csd3.cam.ac.uk/), provided by Dell EMC and Intel using Tier-2 funding from the Engineering and Physical Sciences Research Council (capital + +grant EP/P020259/1), and DiRAC funding from the Science and Technology Facilities Council (www.dirac.ac.uk). We express our thanks to Kenneth Heafield and Rico Sennrich, who provided us with access to the computing resources. + +Last but not least, we thank the organisers and participants of the First Workshop of Typology for Polyglot NLP, and the members of the Statistical Machine Translation group at the University of Edinburgh, whose provided relevant feedback in an early stage of the study. + +# References + +Antonios Anastasopoulos. 2019. A note on evaluating multilingual benchmarks. +Johannes Bjerva and Isabelle Augenstein. 2018a. From phonology to syntax: Unsupervised linguistic typology at different levels with language embeddings. 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 907-916, New Orleans, Louisiana. Association for Computational Linguistics. +Johannes Bjerva and Isabelle Augenstein. 2018b. Tracking typological traits of uralic languages in distributed language representations. In Proceedings of the Fourth International Workshop on Computational Linguistics of Uralic Languages, pages 76-86, Helsinki, Finland. Association for Computational Linguistics. +Johannes Bjerva, Yova Kementchedjhieva, Ryan Cotterell, and Isabelle Augenstein. 2019a. A probabilistic generative model of linguistic typology. 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 1529-1540, Minneapolis, Minnesota. Association for Computational Linguistics. +Johannes Bjerva, Robert Östling, Maria Han Veiga, Jörg Tiedemann, and Isabelle Augenstein. 2019b. What do language representations really represent? Computational Linguistics, 45(2):381-389. +Mauro Cettolo, Christian Girardi, and Marcello Federico. 2012. WIT3: Web inventory of transcribed and translated talks. In Proceedings of the $16^{\text{th}}$ Conference of the European Association for Machine Translation (EAMT), pages 261-268, Trento, Italy. +Bernard Comrie. 1989. Language universals and linguistic typology: Syntax and morphology. University of Chicago press. +Paramveer S Dhillon, Dean P Foster, and Lyle H Ungar. 2015. Eigenwords: Spectral word embeddings. The + +Journal of Machine Learning Research, 16(1):3035-3078. +Matthew S. Dryer and Martin Haspelmath, editors. 2013. WALS Online. Max Planck Institute for Evolutionary Anthropology, Leipzig. +Susan T Dumais. 2004. Latent semantic analysis. Annual review of information science and technology, 38(1):188-230. +Isidore Dyen, Joseph B Kruskal, and Paul Black. 1992. An indoeuropean classification: A lexicostatistical experiment. Transactions of the American Philosophical society, 82(5):iii-132. +Manaal Faruqui and Chris Dyer. 2014. Improving vector space word representations using multilingual correlation. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 462-471, Gothenburg, Sweden. Association for Computational Linguistics. +David R Hardoon, Sandor Szedmak, and John Shawe-Taylor. 2004. Canonical correlation analysis: An overview with application to learning methods. Neural computation, 16(12):2639-2664. +Melvin Johnson, Mike Schuster, Quoc V. Le, Maxim Krikun, Yonghui Wu, Zhifeng Chen, Nikhil Thorat, Fernanda Viégas, Martin Wattenberg, Greg Corrado, Macduff Hughes, and Jeffrey Dean. 2017. Google's multilingual neural machine translation system: Enabling zero-shot translation. Transactions of the Association for Computational Linguistics, 5:339-351. +Pratik Joshi, Sebastin Santy, Amar Budhiraja, Kalika Bali, and Monojit Choudhury. 2020. The state and fate of linguistic diversity and inclusion in the NLP world. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6282-6293, Online. Association for Computational Linguistics. +Marcin Junczys-Dowmunt, Kenneth Heafield, Hieu Hoang, Roman Grundkiewicz, and Anthony Aue. 2018. Marian: Cost-effective high-quality neural machine translation in C++. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, pages 129-135, Melbourne, Australia. Association for Computational Linguistics. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +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. + +Sneha Kudugunta, Ankur Bapna, Isaac Caswell, and Orhan Firat. 2019. Investigating multilingual NMT representations at scale. 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 1565-1575, Hong Kong, China. Association for Computational Linguistics. +Yu-Hsiang Lin, Chian-Yu Chen, Jean Lee, Zirui Li, Yuyan Zhang, Mengzhou Xia, Shruti Rijhwani, Junxian He, Zhisong Zhang, Xuezhe Ma, Antonios Anastasopoulos, Patrick Littell, and Graham Neubig. 2019. Choosing transfer languages for cross-lingual learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3125-3135, Florence, Italy. Association for Computational Linguistics. +Patrick Littell, David R. Mortensen, Ke Lin, Katherine Kairis, Carlisle Turner, and Lori Levin. 2017. URIEL and lang2vec: Representing languages as typological, geographical, and phylogenetic vectors. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 8-14, Valencia, Spain. Association for Computational Linguistics. +Chaitanya Malaviya, Graham Neubig, and Patrick Littell. 2017. Learning language representations for typology prediction. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2529-2535, Copenhagen, Denmark. Association for Computational Linguistics. +Yugo Murawaki. 2015. Continuous space representations of linguistic typology and their application to phylogenetic inference. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 324-334, Denver, Colorado. Association for Computational Linguistics. +Yugo Murawaki. 2017. Diachrony-aware induction of binary latent representations from typological features. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 451-461, Taipei, Taiwan. Asian Federation of Natural Language Processing. +Yugo Murawaki. 2018. Analyzing correlated evolution of multiple features using latent representations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 4371-4382, Brussels, Belgium. Association for Computational Linguistics. +John Nerbonne, Peter Kleiweg, Wilbert Heeringa, and Franz Manni. 2008. Projecting dialect distances to geography: Bootstrap clustering vs. noisy clustering. + +In Data Analysis, Machine Learning and Applications, pages 647-654, Berlin, Heidelberg. Springer Berlin Heidelberg. +Helen O'Horan, Yevgeni Berzak, Ivan Vulic, Roi Reichart, and Anna Korhonen. 2016. Survey on the use of typological information in natural language processing. In Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, pages 1297-1308, Osaka, Japan. The COLING 2016 Organizing Committee. +Dominique Osborne, Shashi Narayan, and Shay B. Cohen. 2016. Encoding prior knowledge with eigenword embeddings. Transactions of the Association for Computational Linguistics, 4:417-430. +Robert Östling and Jörg Tiedemann. 2017. Continuous multilinguality with language vectors. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 644-649, Valencia, Spain. Association for Computational Linguistics. +Mateusz Pawlik and Nikolaus Augsten. 2015. Efficient computation of the tree edit distance. ACM Transactions on Database Systems (TODS), pages 3:1-3:40. +Mateusz Pawlik and Nikolaus Augsten. 2016. Tree edit distance: Robust and memory-efficient. Information Systems, 56:157-173. +Emmanouil Antonios Platanios, Mrinmaya Sachan, Graham Neubig, and Tom Mitchell. 2018. Contextual parameter generation for universal neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 425-435, Brussels, Belgium. Association for Computational Linguistics. +Edoardo Maria Ponti, Helen O'Horan, Yevgeni Berzak, Ivan Vulic, Roi Reichart, Thierry Poibeau, Ekaterina Shutova, and Anna Korhonen. 2019. Modeling language variation and universals: A survey on typological linguistics for natural language processing. Computational Linguistics, 45(3):559-601. +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. +Ye Qi, Devendra Sachan, Matthieu Felix, Sarguna Padmanabhan, and Graham Neubig. 2018. When and why are pre-trained word embeddings useful for neural machine translation? 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 529-535, New Orleans, Louisiana. Association for Computational Linguistics. +Ella Rabinovich, Noam Ordan, and Shuly Wintner. 2017. Found in translation: Reconstructing phylogenetic language trees from translations. In Proceedings of the 55th Annual Meeting of the Association + +for Computational Linguistics (Volume 1: Long Papers), pages 530-540, Vancouver, Canada. Association for Computational Linguistics. +Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. 2017. SVCCA: Singular vector canonical correlation analysis for deep learning dynamics and interpretability. In Advances in Neural Information Processing Systems 30, pages 6076-6085. Curran Associates, Inc. +Peter J Rousseeuw. 1987. Silhouettes: a graphical aid to the interpretation and validation of cluster analysis. Journal of computational and applied mathematics, 20:53-65. +Devendra Sachan and Graham Neubig. 2018. Parameter sharing methods for multilingual self-attentional translation models. In Proceedings of the Third Conference on Machine Translation: Research Papers, pages 261–271, Belgium, Brussels. Association for Computational Linguistics. +Rico Sennrich, Orhan First, Kyunghyun Cho, Alexandra Birch, Barry Haddow, Julian Hitschler, Marcin Junczys-Dowmunt, Samuel Läubli, Antonio Valerio Miceli Barone, Jozef Mokry, and Maria Nadejde. 2017. Nematus: a toolkit for neural machine translation. In Proceedings of the Software Demonstrations of the 15th Conference of the European Chapter of the Association for Computational Linguistics, pages 65-68, Valencia, Spain. Association for Computational Linguistics. +Rico Sennrich, Barry Haddow, and Alexandra Birch. 2016. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715-1725, Berlin, Germany. Association for Computational Linguistics. +M. Serva and F. Petroni. 2008. Indo-European languages tree by Levenshtein distance. EPL (Europhysics Letters), 81(6):68005. +Xu Tan, Jiale Chen, Di He, Yingce Xia, Tao QIN, and Tie-Yan Liu. 2019. Multilingual neural machine translation with language clustering. 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 963-973, Hong Kong, China. Association for Computational Linguistics. +Yulia Tsvetkov, Sunayana Sitaram, Manaal Faruqui, Guillaume Lample, Patrick Littell, David Mortensen, Alan W Black, Lori Levin, and Chris Dyer. 2016. Polyglot neural language models: A case study in cross-lingual phonetic representation learning. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1357-1366, San + +Diego, California. 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. +Xinyi Wang and Graham Neubig. 2019. Target conditioned sampling: Optimizing data selection for multilingual neural machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5823-5828, Florence, Italy. Association for Computational Linguistics. +Joe H Ward Jr. 1963. Hierarchical grouping to optimize an objective function. Journal of the American Statistical Association, 58(301):236-244. + +# A Languages and individual BLEU scores + +We work with 53 languages pre-processed by (Qi et al., 2018), from where we mapped the ISO 639-1 codes to the ISO 693-2 standard. However, we need to manually correct the mapping of some codes to identify the correct language vector in the URIEL (Littell et al., 2017) library: + +- zh (zho, Chinese macro-language) mapped to cmn (Mandarin Chinese). +- $fa$ (fas, Persian inclusive code for 11 dialects) mapped to pes (Western/Iranian Persian). +- ar (ara, Arabic) mapped to arb (Standard Arabic). + +We disregard working with artificial languages like Esperanto (eo) or variants like Brazilian Portuguese (pt-br) and Canadian French (fr-ca). + +Table 4 presents the list of all the languages with the following details: ISO 693-2 code, language family, size of the training set in thousands of sentences (with their respective training size bin) and the individual BLEU score obtained per clustering approach and other baselines. + +# B Correlation of SVCCA with genetic similarity + +Bjerva et al. (2019b) argued that raw language embeddings from language modelling correlates with genetic and structural similarity10. For the former, + +BLEU score per approach + +
ISOLanguageLang. familySize (k)BinIndividualMassiveFamily\( U_S \)\( L_T \)SVCCA-53SVCCA-23
kazKazakhTurkic312.55.34.04.33.32.73.33.0
belBelarusianIE/Balto-Slavic413.113.014.313.74.32.812.410.1
benBengaliIE/Indo-Iranian413.110.55.96.24.34.64.45.7
eusBasqueIsolate512.211.12.210.95.63.96.410.1
zlmMalayAustronesian514.120.115.619.76.54.119.619.6
bosBosnianIE/Balto-Slavic514.226.628.028.36.54.126.123.6
urdUrduIE/Indo-Iranian513.911.87.58.05.55.67.16.8
azeAzerbaijaniTurkic512.88.16.46.74.23.27.37.4
tamTamilDravidian611.45.11.44.02.82.62.72.3
monMongolianMongolic712.76.92.75.73.93.55.26.1
marMarathiIE/Indo-Iranian913.27.05.15.24.14.03.34.7
glgGalicianIE/Italic918.424.929.126.129.028.728.928.2
kurKurdishIE/Indo-Iranian1014.010.16.810.84.93.66.38.1
estEstonianUralic1015.813.510.514.18.18.111.711.9
katGeorgianKartvelian1325.814.35.814.58.84.65.65.5
nobNor. BokmalIE/Germanic15219.035.238.836.435.035.039.139.1
hinHindiIE/Indo-Iranian1828.116.08.810.59.56.28.38.6
slvSlovenianIE/Balto-Slavic1928.719.519.820.221.819.318.119.7
myaBurmeseSino-Tibetan2024.910.37.67.36.04.17.73.4
hyeArmenianIE/Armenian2129.016.39.016.99.813.213.312.2
finFinnishUralic2328.514.411.514.98.38.312.115.0
mkdMacedonianIE/Balto-Slavic24215.726.827.327.427.228.025.122.6
litLithuanianIE/Balto-Slavic41212.217.919.418.420.019.017.918.6
sqiAlbanianIE/Albanian43220.827.820.829.128.631.626.325.8
danDanishIE/Germanic44230.735.638.436.734.434.438.939.0
porPortugueseIE/Italic50227.232.836.933.736.636.036.736.5
sweSwedishIE/Germanic55227.030.833.631.829.729.734.334.6
slkSlovakIE/Balto-Slavic60218.124.126.024.726.825.523.722.2
indIndonesianAustronesian85323.824.321.426.028.027.026.526.5
thaThaiKra-Dai96315.416.815.416.919.017.617.717.7
cesCzechIE/Balto-Slavic101320.722.123.922.824.223.321.222.1
ukrUkrainianIE/Balto-Slavic106319.820.922.622.023.522.521.221.7
hrvCroatianIE/Balto-Slavic120328.527.530.428.930.831.528.326.7
ellGreekIE/Hellenic132331.929.931.930.932.233.434.232.7
srpSerbianIE/Balto-Slavic134326.425.628.327.128.829.426.325.4
hunHungarianUralic145319.117.217.017.921.317.718.018.7
fasPersianIE/Indo-Iranian148320.918.59.019.722.422.28.417.9
deuGermanIE/Germanic165330.125.529.526.931.431.729.929.6
vieVietnameseAustroasiatic169322.720.322.721.623.622.222.322.3
bulBulgarianIE/Balto-Slavic172333.929.931.931.433.333.134.233.8
polPolishIE/Balto-Slavic173318.917.419.118.219.318.918.316.9
ronRomanianIE/Italic178430.025.830.727.028.130.830.829.6
turTurkishTurkic179419.514.616.215.620.720.317.117.9
nldDutchIE/Germanic181431.726.630.627.732.533.031.230.5
fraFrenchIE/Italic189435.630.635.932.035.936.134.334.5
spaSpanishIE/Italic193437.232.237.433.537.537.037.536.2
cmnChineseSino-Tibetan197414.913.513.912.615.815.814.714.7
jpnJapaneseJaponic20149.88.59.88.610.810.89.89.7
itaItalianIE/Italic201433.628.634.129.633.933.333.732.4
korKoreanKoreanic202414.412.214.411.915.115.013.35.8
rusRussianIE/Balto-Slavic205420.418.119.419.020.119.518.318.8
hebHebrewAfroasiatic208432.424.432.925.829.930.331.931.6
arbArabicAfroasiatic211426.520.527.521.625.426.527.526.6
+ +Table 4: List of languages with their BLEU scores per clustering approach (IE=Indo-European). + +they correlated a distance matrix with pairwise-leafdistances of the GS. However, Serva and Petroni (2008) originally inferred the phylogeny by comparing the translated Swadesh list of 200-words (Dyen et al., 1992) with Levenshtein (edit) distance. + +The list is a crafted set of concepts for comparative linguistics (e.g. I, eye, sleep), and it is usually processed by lexicostatistics methods to study language relationship through time. Therefore, we prefer to argue that corpus-based embeddings could partially encode lexical similarity of languages. + +We perform a Spearman correlation between + +the cophenetic matrix11 of the GS and the pairwise cosine-distance matrices of $U_{S}$ , $L_{T}$ and SVCCA $(U_{S},L_{T})$ , where we obtain correlation coefficients of 0.48, 0.68 and 0.80, respectively (p-values $< 0.001$ ). Our conclusion is that typological knowledge strengthen the representation of lexical similarity within NMT-learned embeddings. + +# C SVD explained variance selection + +To compute SVCCA, we transform each source space using SVD, where we can choose to preserve a number of dimensions that represents an accumulated explained variance of the original dataset. For that reason, we perform a parameter sweep between 0.5 and 1.0 using 0.05 incremental steps. For a fair comparison, we also transform the single spaces (KB or Learned) with SVD and look for the optimal threshold. + +Prediction of typological features. We selected a 0.5 threshold for the NMT-learned vectors of $L_{B}$ and $L_{W}$ , and 0.7 for $L_{T}$ . In case of the SVCCA representation, $L_{T}$ uses [0.75,0.70], whereas $L_{B}$ and $L_{W}$ employ [0.95,0.50] values. The parameter values are for both one-language-out and one-family-out settings. We can argue that there is redundancy in the NMT-learned embeddings, as the prediction of typological features with Logistic Regression always prefers a dimensionality-reduced version instead of the original data (threshold at 1.0). + +Language phylogeny inference. In Table 5, we report the optimal value for the SVD explained variance ratio in each single and multi-view (concatenation and SVCCA) setting. + +Language clustering (and ranking). We cannot perform an exhaustive analysis for the threshold of the explained variance ratio per view. As our main goal is to increase the coverage of languages steadily, we must determine what configuration allows a stable growth of the hierarchy. + +We thereupon take inspiration from bootstrap clustering (Nerbonne et al., 2008), and increase the number of language entries from few entries (e.g. 10) to 53 by resample bootstrapping using each of the source vectors: $U_{S}$ , $L_{T}$ and $L_{W}$ . Afterwards, we search for the threshold value that preserves a stable number of clusters given the peak silhouette value. Our heuristic looks for the least variability throughout the incremental bootstrapping (Fig. 5). + +
SingleUS ⊕ L*SVCCA(US,L*)
US (Syntax)30 / 0.45 (0.5)
LB (Bible)35 / 0.54 (0.9)27 / 0.42 (0.70,0.55)23 / 0.34 (0.70,0.75)
LW (WIT-23)35 / 0.62 (0.8)23 / 0.41 (0.75,0.95)27 / 0.48 (0.50,0.95)
LT (TED-53)15 / 0.26 (0.6)18 / 0.29 (0.70,0.55)10 / 0.15 (1.00,0.55)
+ +Table 5: Similar to Table 2, but including the optimal values for the SVD explained variance in each setting. + +![](images/e118bf3637e86bc9f77fd0dec560324c078299bd200ac2b00679116096192830.jpg) +(a) Syntax: $U_{S}$ (0.65) +Figure 5: Analysis of the number of clusters (blue) and the ratio of number of clusters per total languages (red) given the chosen thresholds of explained variance ratio. We show the confidence interval computed from the bootstrapping, and we observe that the number of clusters is stable since 42 and 38 languages for $U_{S}$ and $L_{T}$ vectors, respectively. + +![](images/1a06048f93efe96aae3919ffe3edcb550706a6a1dd576433e4b6c1923a525676.jpg) +(b) TED-53: $L_{T}$ (0.6) + +We found that 0.65 is the most stable value for $U_{S}$ , whereas 0.60 is the best one for both $L_{T}$ and $L_{W}$ , so we thereupon fix SVCCA-53 and SVCCA-23 to [0.65,0.6]. We also apply the chosen thresholds on the concatenation baseline for a fair comparison. In the single-view cases, the transformations with the tuned variance ratio do not overcome any non-optimised counterparts. + +# D Language clustering results by language families + +Following a guide for evaluating multilingual benchmarks (Anastasopoulos, 2019), we also group the scores by language families. Table 6 includes the overall weighted average per number of languages in each family branch. We observe that most of the approaches have obtained clusters with similar overall translation accuracy. The individual models are the only ones that significantly underperform. The poor performance is transferred to the Family baseline, as most of the groups contains only one language given the low language diversity of the dataset. + +The $U_{S}$ vectors obtain the highest overall accuracy, mostly from their few large clusters (see Fig. 2c). Meanwhile, SVCCA-53 achieves the second-best overall result, by a minimal margin, and with 3 to 7 languages per cluster, which are usually faster + +
Lang. families# L Size (k)IndividualMassiveFamily\( U_S \)\( L_T \)SVCCA-53SVCCA-23
Isolate (Basque)1 52.2011.102.2010.905.603.906.40 △-4.710.10 △-1.0
Dravidian1 61.405.101.404.002.802.602.70 △-2.42.30 △-2.8
Mongolic1 72.706.902.705.703.903.505.20 △-1.76.10 △-0.8
Kartvelian1 135.8014.305.8014.508.804.605.60 △-8.95.50 △-9.0
IE/Armenian1 219.0016.309.0016.909.8013.2013.30 △-3.612.20 △-4.7
IE/Albanian1 4420.8027.8020.8029.1028.6031.6026.30 △-5.325.80 △-5.8
Kra-Dai1 9715.4016.8015.4016.9019.0017.6017.70 △-1.317.70 △-1.3
IE/Hellenic1 13231.9029.9031.9030.9032.2033.4034.2032.70 △-1.5
Austroasiatic1 17022.7020.3022.7021.6023.6022.2022.30 △-1.322.30 △-1.3
Japonic1 2019.808.509.808.6010.8010.809.80 △-1.09.70 △-1.1
Koreanic1 20314.4012.2014.4011.9015.1015.0013.30 △-1.85.80 △-9.3
Austronesian2 9113.9522.2018.5022.8517.2515.5523.0523.05
Sino-Tibetan2 2189.9011.9010.759.9510.909.9511.20 △-0.79.05 △-2.8
Afroasiatic2 42029.4522.4530.2023.7027.6528.4029.70 △-0.529.10 △-1.1
Uralic3 18011.1315.0313.0015.6312.5711.3713.93 △-1.715.20 △-0.4
Turkic3 1898.279.338.878.879.408.739.23 △-0.29.43
IE/Germanic5 46227.7030.7434.1831.9032.6032.7634.6834.56 △-0.1
IE/Indo-Iranian6 1987.2012.327.1810.078.457.706.30 △-6.08.63 △-3.7
IE/Italic6 82328.6729.1534.0230.3233.5033.6533.65 △-0.432.90 △-1.1
IE/Balto-Slavic13 1,17117.7422.2623.8823.2422.0521.3022.39 △-1.521.71 △-2.2
Weighted average →Number of clusters/models →16.7019.7619.7920.0319.6019.1619.97 △-0.119.82 △-0.1
53120311181010
+ +Table 6: BLEU score average per language family (IE=Indo-European). Every method includes the weighted BLEU average per number of languages (#L) and the number of clusters/models. Bold and italic represent first and second best results per family. $\Delta$ for SVCCA indicates the difference with respect to the highest score. + +to converge. Besides, the massive model, the $L_{T}$ embeddings and the concatenation baseline present a competitive achievement as well. However, the first requires more resources to train until convergence, whereas the last two need the 53 pre-trained embeddings from a previous massive system. + +In contrast, SVCCA-23 is a faster alternative if we want to target specific new languages (see Fig. 2b). We only require a small group of language embeddings (e.g. $L_{W}$ of 23 entries) and project the rest with SVCCA and a set KB-vectors as a side view. For instance, if we need to deploy a translation model for Basque or Thai, we could reach a comparable or better accuracy to a massive model with the SVCCA-23 chosen clusters of only 3 (Arabic, Hebrew) or 5 (Chinese, Indonesian, Vietnamese, Malay) languages, respectively. + +![](images/bbe72f9b0580a686b5dd64ba099a3e3d16b440219b3f006e59b85ab3e6e6805f.jpg) + +![](images/903ef9fdcdbb822becbd0720a81344b5caec63b885be83b4a73c3bb00414f701.jpg) +(a) $L_{B}$ : NMT-learned from Bible +(b) $L_{T}*$ : NMT-learned from TED-53 but with initial pseudo-tokens + +![](images/40c4820c4e62a45d3bae4a677dd2e2d3a298a34f4ce6ecf7997ac6a9305aeca3.jpg) + +![](images/5ad9faa220431ffccc0da8c78fa3a62d52c9e104a0578be5c6900c66bb25df14.jpg) +(c) SVCCA-53\*( $U_S, L_T$ ): SVCCA representations of Syntax and TED-53 but with initial pseudo-tokens + +![](images/664b80251707266188dd7b236925d12c623e34751190737b74dd8b0b931179ae.jpg) + +![](images/d660ef43e8e37a22bae589e4c974ccc3ed045ceceb82d08cac5e188a87f5d19f.jpg) +Figure 6: Silhouette analysis and dendrograms for clustering the 53 languages of TED-53 using different language representations. In (a) and (b), we note that the silhouette score is below 0.2 (1 is best), and the hierarchies do not define natural groups for the languages, as they are usually very separated from each other. In (c), we note that SVCCA is affected by the noisy agglomeration of the original NMT-learned embeddings with initial pseudotokens. \ No newline at end of file diff --git a/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/images.zip b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ea791e71de6e0dfe8596165fd3b8e55fa00d8711 --- /dev/null +++ b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa3a8842296cffb885982f2043a117abd8131734f13c727f3bd0d759f869ebb1 +size 1129737 diff --git a/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/layout.json b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4ae0e1a07e29c61a2d574cc876afccbb6c97b639 --- /dev/null +++ b/bridginglinguistictypologyandmultilingualmachinetranslationwithmultiviewlanguagerepresentations/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83fcdd9b94e1c394c3ea99fecb70c847293a4c205462037a36beebb50ae52306 +size 532254 diff --git a/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_content_list.json b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..2d1696a9a8a068a0f077fd76765994ba7955d199 --- /dev/null +++ b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f2edff6efb2788b52f2ebf35cc79617dafd168080113f54641f181cb5e41dd2 +size 89135 diff --git a/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_model.json b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_model.json new file mode 100644 index 0000000000000000000000000000000000000000..9aba8315aaf62cf99480c9698c089c59553f49f7 --- /dev/null +++ b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3250fc9edbd05ccf330c8cf0634b837e18fd7933f4f969e0e6b763b9b4df548c +size 105828 diff --git a/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_origin.pdf b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..634cb94873800cc70e0da5cb232deb50eb13fef2 --- /dev/null +++ b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/1919e3c0-565b-463a-a3f2-0bed1be00ae0_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba9910edcdb323ebf58d4f9a643343919f9587a635a9ed3df83e0b8845fc9aaa +size 470963 diff --git a/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/full.md b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f8fca36ac59c3a6f2cc7052f0efa59aed56d9341 --- /dev/null +++ b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/full.md @@ -0,0 +1,378 @@ +# Bridging the Gap between Prior and Posterior Knowledge Selection for Knowledge-Grounded Dialogue Generation + +Xiuyi Chen $^{1,2,3}$ , Fandong Meng $^{4}$ , Peng Li $^{4}$ , Feilong Chen $^{1,2,3}$ , Shuang Xu $^{1}$ , Bo Xu $^{1,2,3}$ , Jie Zhou $^{4}$ + +$^{1}$ Institute of Automation, Chinese Academy of Sciences (CASIA). Beijing, China + +$^{2}$ Research Center for Brain-inspired Intelligence, CASIA + +3University of Chinese Academy of Sciences, Beijing, China + +{chenxiuyi2017, chenfeilong2018, shuang.xu, xubo}@ia.ac.cn + +$^{4}$ Pattern Recognition Center, WeChat AI, Tencent Inc, Beijing, China + +{fandongmeng,patrickpli,withtomzhou}@tencent.com + +# Abstract + +Knowledge selection plays an important role in knowledge-grounded dialogue, which is a challenging task to generate more informative responses by leveraging external knowledge. Recently, latent variable models have been proposed to deal with the diversity of knowledge selection by using both prior and posterior distributions over knowledge and achieve promising performance. However, these models suffer from a huge gap between prior and posterior knowledge selection. Firstly, the prior selection module may not learn to select knowledge properly because of lacking the necessary posterior information. Secondly, latent variable models suffer from the exposure bias that dialogue generation is based on the knowledge selected from the posterior distribution at training but from the prior distribution at inference. Here, we deal with these issues on two aspects: (1) We enhance the prior selection module with the necessary posterior information obtained from the specially designed Posterior Information Prediction Module (PIPM); (2) We propose a Knowledge Distillation Based Training Strategy (KDBTS) to train the decoder with the knowledge selected from the prior distribution, removing the exposure bias of knowledge selection. Experimental results on two knowledge-grounded dialogue datasets show that both PIPM and KDBTS achieve performance improvement over the state-of-the-art latent variable model and their combination shows further improvement. + +# 1 Introduction + +Knowledge-grounded dialogue (Ghazvininejad et al., 2018) which leverages external knowledge to generate more informative responses, has become a popular research topic in recent years. Many researchers have studied how to effectively leverage the given knowledge to enhance dialogue understanding and/or improve dialogue generation + +
ContextI just got a husky puppy.
Knowledge Pool#Knowledge Sentence
0Husky is a general name for a sled type of dog used in northern regions, differentiated from other sled-dog types by their fast pulling style.
1Huskies are also today kept as pets, and groups work to find new pet homes for retired racing and adventure trekking dogs.
2Huskies are used in sled dog racing.
3The use of "husk" is recorded from 1852 for dogs kept by Inuit people
......
LChild of the Wolves is a children's novel, published in 1996, about a Siberian husky puppy that joins a wolf pack.
Response aIt sounds cute! Huskies are known amongst sled-dogs for their fast pulling style.
Response bIt sounds cute! I have read a novel about a husky puppy joining a wolf pack. Is your husky puppy wolf-like in appearance?
+ +Table 1: An example shows the diversity of knowledge selection in knowledge-grounded dialogue. Here, we show two different responses with two possible selection decisions. For the same context, there may be diverse knowledge sentences to generate different responses which help their selection decisions in turn. The prior knowledge selection only depends on context while the posterior knowledge selection means selection with context and response (Lian et al., 2019). + +(Zhao et al., 2019b; Sun et al., 2020; Madotto et al., 2018; Chen et al., 2019; Yavuz et al., 2019; Tang and Hu, 2019; Li et al., 2019; Zheng and Zhou, 2019; Niu et al., 2019; Meng et al., 2019; Ren et al., 2019; Ye et al., 2020). However, they usually use the pre-identified knowledge (Zhang et al., 2018; Moghe et al., 2018; Qin et al., 2019) which is not available in some real-world scenarios. And others leverage the retrieval system to get the knowledge which may contain noisy and irrelevant data (Chaudhuri et al., 2018; Parthasarathi and Pineau, 2018; Zhou et al., 2018; Gopalakrishnan et al., 2019). Recently, Dinan et al. (2019) propose to decompose this task into two subproblems: knowledge selection and response generation. This pipeline framework has been widely used for the open domain setting (Chen et al., 2017; Min et al., 2018; Nie et al., 2019) and shows promising performance with explicit use of knowledge in knowledge-grounded dialogue (Dinan et al., 2019). + +Knowledge selection plays an important role in open-domain knowledge-grounded dialogue (Di + +nan et al., 2019) since the inappropriate knowledge selection may prevent the model from leveraging the knowledge accurately (Lian et al., 2019), or even lead to an inappropriate response. The example in Table 1 shows two phenomena: (1) There may exist one-to-many relations between the dialogue context and the knowledge, resulting in the diversity of knowledge selection (Kim et al., 2020); (2) The posterior knowledge selection with context and response is much easier than the prior knowledge selection only depending on context. It is rather intuitive that we can dramatically reduce the scope of knowledge selection when we know the knowledge contained in the response, while such posterior information is not available at inference. Recently, latent variable models (Lian et al., 2019; Kim et al., 2020), using the posterior distribution to guide the prior distribution, have been proposed to deal with the diversity of knowledge selection. They can jointly model knowledge selection with response generation and achieve promising performance. Despite their success, latent variable models suffer from a huge gap between prior and posterior knowledge selection as discussed below. + +We analyze the gap in latent variable models on two aspects: (1) Compared with the posterior selection module, the prior selection module has no access to the necessary posterior information. As a result, it is hard for the prior distribution to approximate the posterior distribution correctly at training, so that the prior selection module may not select knowledge properly at inference. (2) Response generation of latent variable models is based on the knowledge selected from the posterior distribution at training but from the prior distribution at inference. This discrepancy, also named exposure bias, leads to a gap between training and inference (Ranzato et al., 2015; Zhang et al., 2019; Zhao et al., 2019a), and therefore the decoder may have to generate a response with inappropriate knowledge selected from an unfamiliar prior distribution. + +In this paper, we propose to bridge the gap between prior and posterior knowledge selection for knowledge-grounded dialogue generation. Firstly, we enhance the prior selection module with the necessary posterior information which is obtained by the specially designed Posterior Information Prediction Module (PIPM). Secondly, inspired by knowledge distillation (Hinton et al., 2015), we design a Knowledge Distillation Based Training Strategy (KDBTS) to train the decoder with + +the knowledge selected by the prior module, removing the exposure bias of knowledge selection. Experimental results show that both PIPM and KDBTS bring performance improvement on two knowledge-grounded dialogue datasets, i.e., Wizard of Wikipedia (Dinan et al., 2019) and HollE (Moghe et al., 2018). And the combination of PIPM and KDBTS obtains the new state-of-the-art performance with further improvement. + +Our contributions are summarized as follows: + +- We clearly point out the gap between prior and posterior knowledge selection of latent variable models and propose to enhance the prior selection module with the necessary posterior information. Moreover, we explore several variants of posterior information. +- We focus on the exposure bias of knowledge selection for knowledge-grounded dialogue, and design a knowledge distillation based training strategy to deal with it. +- Experimental results show that both PIPM and KDBTS bring performance improvement, and their combination achieves the state-of-the-art performance with further improvement. + +# 2 Background + +# 2.1 Task Formulation + +For a dialogue with $T$ turns, each turn is a pair of message $x_{t}$ and response $y_{t}$ . Besides, each turn is associated with a knowledge pool $\mathcal{K}_t = \{k_t^l\} = \{k_t^1,\dots ,k_t^L\}$ consisting of $L$ sentences. The context $ctx_{t}$ consists of the dialogue history $hist_{t} = [x_{1},y_{1},\dots ,x_{t - 1},y_{t - 1}]$ and the message $x_{t}$ . + +Given the context $ctx_{t}$ , we firstly select a knowledge sentence $k_{t}^{\mathrm{sel}} \in \mathcal{K}_{t}$ from the knowledge pool, then leverage the selected knowledge to generate an informative response $y_{t}$ . The selection history at the $t$ -th turn is $kh_{t} = [k_{1}^{\mathrm{sel}}, \dots, k_{t-1}^{\mathrm{sel}}]$ . + +# 2.2 Latent Knowledge Selection For Response Generation + +To obtain the likelihood of response $y_{t}$ , latent variable models treat knowledge $k$ as the latent variable and marginalize over all possible knowledges $\mathcal{K}_t$ : + +$$ +p \left(y _ {t} \mid c t x _ {t}\right) = \mathbb {E} _ {k \sim \pi_ {\theta} \left(\mathcal {K} _ {t}\right)} p _ {\theta} \left(y _ {t} \mid c t x _ {t}, k\right), \tag {1} +$$ + +![](images/b18c6ce7b765d5ab6fd947fadd52e8d99610e720b391b40d94b1873da4868cf4.jpg) +Figure 1: Latent knowledge selection for response generation. We train the decoder with the selected knowledge from posterior distribution with the red line, while we have to infer with the knowledge selected by the prior selection module without access to the response. + +where $p_{\theta}\left(y_t|ctx_t,k\right)$ is the decoder network, and $\pi_{\theta}\left(\mathcal{K}_t\right)$ , short for $\pi_{\theta}\left(\mathcal{K}_t|ctx_t,kh_t\right)$ , is the prior distribution over the knowledge pool $\mathcal{K}_t$ based on the context $ctx_t$ and selection history $kh_t$ . The evidence lower bound (ELBO) is written as: + +$$ +\mathcal {L} _ {\mathrm {E L B O}} = - \mathcal {L} _ {\mathrm {N L L}} ^ {\mathrm {p o s t}} - \mathcal {L} _ {\mathrm {K L}} \leq \log p (y _ {t} | c t x _ {t}) +$$ + +$$ +\mathcal {L} _ {\mathrm {N L L}} ^ {\text {p o s t}} = - \mathbb {E} _ {k \sim q _ {\phi} (\mathcal {K} _ {t})} \left[ \log p _ {\theta} \left(y _ {t} | c t x _ {t}, k\right) \right], \tag {2} +$$ + +$$ +\mathcal {L} _ {\mathrm {K L}} = D _ {\mathrm {K L}} \left(q _ {\phi} \left(\mathcal {K} _ {t}\right) \| \pi_ {\theta} \left(\mathcal {K} _ {t}\right)\right) +$$ + +where $q_{\phi}(\mathcal{K}_t)$ , short for $q_{\phi}(\mathcal{K}_t|ctx_t,y_t,kh_t)$ , is an inference network to approximate the true posterior distribution $p(\mathcal{K}_t|ctx_t,y_t,kh_t)$ . + +The Gap between Prior and Posterior Knowledge Selection. Firstly, compared with the posterior selection module, the prior selection module has no access to the posterior information as shown in Figure 1. As a result, it is hard for the prior distribution to approximate the posterior distribution correctly by minimizing the KL divergence in Equation 2 at training. Hence, the prior selection module may not select knowledge properly at inference. Secondly, comparing the two expectation terms in Equation 1 and 2, we see that the selected knowledge for response generation at training and inference is drawn from different distributions, i.e., the posterior distribution $k \sim q_{\phi}(\mathcal{K}_t)$ at training and the prior distribution $k \sim \pi_{\theta}(\mathcal{K}_t)$ at inference. Figure 1 clearly shows this discrepancy which will cause the decoder to have to generate with knowledge selected from the unfamiliar prior distribution. These issues lead to the gap between prior and posterior knowledge selection, which we try to deal with in this paper. + +# 2.3 Sequential Knowledge Transformer + +Recently, Kim et al. (2020) propose Sequential Knowledge Transformer (SKT), the state-of-the-art latent variable model for knowledge selection. Here, we briefly describe SKT, based on which we validate the effectiveness of our approach. + +Sentence Encoding. For any sentence $sent_{t}$ with $N_{w}$ words at $t$ -th turn, SKT uses a shared BERT (Devlin et al., 2019) to obtain the context aware word representations $\mathbf{H}_{t}^{sent}$ with $d$ dims and then converts them into the sentence representation $\mathbf{h}_{t}^{sent}$ by mean pooling (Cer et al., 2018): + +$$ +\mathbf {H} _ {t} ^ {s e n t} = \operatorname {B E R T} (s e n t _ {t}) \in \mathbb {R} ^ {N _ {w} \times d} +$$ + +$$ +\mathbf {h} _ {t} ^ {s e n t} = \mathrm {M e a n} \left(\mathbf {H} _ {t} ^ {s e n t}\right) \in \mathbb {R} ^ {d} +$$ + +As a result, we obtain $\mathbf{H}_t^x$ and $\mathbf{h}_t^x$ for the message $x_{t}$ $\mathbf{H}_t^y$ and $\mathbf{h}_t^y$ for the response $y_{t}$ ,and $\mathbf{H}_t^{k_t}$ and $\mathbf{h}_t^{k_t}$ for any knowledge sentence $k_{t}^{l}\in \mathcal{K}_{t}$ + +Knowledge Selection. To utilize the dialogue history and selection history, two GRUs (Cho et al., 2014) are used to summarize them as corresponding states $\mathbf{s}_t^{hist}$ and $\mathbf{s}_t^{kh}$ with zero initialization: + +$$ +\mathbf {s} _ {t} ^ {\text {h i s t}} = \operatorname {G R U} _ {\text {d i a l}} \left(\left[ \mathbf {h} _ {t} ^ {x}; \mathbf {h} _ {t} ^ {y} \right], \mathbf {s} _ {t - 1} ^ {\text {h i s t}}\right) \in \mathbb {R} ^ {d}, \tag {4} +$$ + +$$ +\mathbf {s} _ {t} ^ {k h} = \mathrm {G R U} _ {\mathrm {s e l}} \left(\mathbf {h} _ {t} ^ {k _ {t} ^ {\mathrm {s e l}}}, \mathbf {s} _ {t - 1} ^ {k h}\right) \in \mathbb {R} ^ {d} +$$ + +where $\mathbf{h}_t^x$ , $\mathbf{h}_t^y$ and $\mathbf{h}_t^{k_t^{\mathrm{sel}}}$ are sentence vectors of message $x_{t}$ , response $y_{t}$ and the selected knowledge $k_{t}^{\mathrm{sel}}$ and $[\cdot ;\cdot ]$ denotes concatenation. Then, the prior query $\mathbf{q}_t^{\mathrm{prior}}$ and posterior query $\mathbf{q}_t^{\mathrm{post}}$ are obtained: + +$$ +\mathbf {q} _ {t} ^ {\text {p r i o r}} = \left[ \mathbf {s} _ {t - 1} ^ {k h}; \mathbf {s} _ {t - 1} ^ {h i s t}; \mathbf {h} _ {t} ^ {x} \right] \tag {5} +$$ + +$$ +\mathbf {q} _ {t} ^ {\mathrm {p o s t}} = \left[ \mathbf {s} _ {t - 1} ^ {k h}; \mathbf {s} _ {t} ^ {h i s t} \right] +$$ + +Note that $\mathbf{s}_{t - 1}^{kh}$ summarizes the selection history $kh_{t} = [k_{1}^{\mathrm{sel}},\dots ,k_{t - 1}^{\mathrm{sel}}]$ , and $\mathbf{s}_t^{hist}$ contains current response information, i.e., $\mathbf{h}_t^y$ , not available at inference. The distribution $\mathbf{a}_t^{\mathrm{P}}(\mathcal{K}_t)$ over knowledge pool $\mathcal{K}_t$ is obtained by the dot-product attention: + +$$ +\mathbf {a} _ {t} ^ {\mathrm {P}} \left(\mathcal {K} _ {t}\right) = \operatorname {s o f t m a x} \left(\mathbf {v} _ {t} ^ {\mathrm {P}} \left[ \mathbf {h} _ {t} ^ {k _ {t} ^ {1}}, \dots , \mathbf {h} _ {t} ^ {k _ {t} ^ {L}} \right]\right), \tag {6} +$$ + +$$ +\mathbf {v} _ {t} ^ {\mathrm {P}} = \mathbf {W} ^ {\mathrm {P}} \mathbf {q} _ {t} ^ {\mathrm {P}} \in \mathbb {R} ^ {d} +$$ + +where "P" denotes either prior or posterior, $\mathbf{W}_{\mathrm{P}}$ is the projection matrix and $\mathbf{a}_t^{\mathrm{P}}(\mathcal{K}_t)\in \mathbb{R}^L$ + +![](images/19167640c76126a5d5d4282ebb41606e1ff1ffe0bf3aa5551a865dfa3d744ec9.jpg) +Figure 2: Our Framework. Firstly, we enhance the prior selection module with the necessary posterior information $\hat{I}$ obtained from the Posterior Information Prediction Module (PIPM). Secondly, we design a two-stage Knowledge Distillation Based Training Strategy (KDBTS). At the first stage, KDBTS trains the posterior selection module (the teacher) with the red line. At the second stage, response generation is based on the knowledge selected by the prior module, which is guided by the well-trained teacher, and we only update the green blocks at this stage. + +Finally, the knowledge $k_{t}^{\mathrm{sel}}$ is selected by sampling from the posterior distribution $q_{\phi}(\mathcal{K}_t) = \mathbf{a}_t^{\mathrm{post}}(\mathcal{K}_t)$ at training while selected with the highest probability over the prior distribution $\pi_{\theta}(\mathcal{K}_t) = \mathbf{a}_t^{\mathrm{prior}}(\mathcal{K}_t)$ at inference. + +Generation with Knowledge. SKT takes the concatenation of message $x_{t}$ and selected knowledge sentence $k_{t}^{\mathrm{sel}}$ as input and generates responses by the Transformer decoder (Vaswani et al., 2017) with copy mechanism (Gu et al., 2016). Though there are various models studying how to improve the generation quality based on the given knowledge, here, we simply follow the decoder of SKT and mainly focus on the knowledge selection issue. + +# 3 Approach + +In this section, we show how to bridge the gap between prior and posterior knowledge selection in knowledge-grounded dialogue. Firstly, we design the Posterior Information Prediction Module (PIPM) to enhance the prior selection module with the necessary posterior information. Secondly, we design a Knowledge Distillation Based Training Strategy (KDBTS) to train the decoder with the knowledge selected from the prior distribution, removing the exposure bias of knowledge selection. + +# 3.1 Posterior Information Prediction Module + +As shown in Figure 2, we design a Posterior Information Prediction Module (PIPM) to predict the necessary posterior information. The main motivation is that we want to enhance the prior selection module with the necessary posterior information, so that it could approximate the posterior distribution better at training and leverage the posterior + +information for knowledge selection at inference. Following the typical setting in latent variable models (Lian et al., 2019; Kim et al., 2020), we use the response in bag-of-words (BOW) format (Zhao et al., 2017) as the posterior information. Here we take the dialogue context and the knowledge pool as input to generate the posterior information. + +We firstly summarize the context as the query of this module $\mathbf{q}_t^{\mathrm{PI}} = [\mathbf{s}_{t - 1}^{hist};\mathbf{h}_t^x ]$ and use it to get the attention distribution $\mathbf{a}_t^{\mathrm{PI}}(\mathcal{K}_t)$ over the knowledge pool $\kappa_{t}$ by Equation 6. Then, we summarize the knowledge representation in the knowledge pool with the weights in $\mathbf{a}_t^{\mathrm{PI}}(\mathcal{K}_t)$ considered: + +$$ +\mathbf {h} _ {t} ^ {\mathrm {P I}} = \left[ \mathbf {h} _ {t} ^ {k _ {t} ^ {1}}, \dots , \mathbf {h} _ {t} ^ {k _ {t} ^ {L}} \right] \cdot \mathbf {a} _ {t} ^ {\mathrm {P I}} \left(\mathcal {K} _ {t}\right) \in \mathbb {R} ^ {d}. \tag {7} +$$ + +Secondly, we take the summarization of the dialogue context and the knowledge pool as input and use a position wise feed-forward network (FFN) (Vaswani et al., 2017) to generate the posterior information $\hat{I}_t$ in BOW format as: + +$$ +\hat {I} _ {t} = \operatorname {s o f t m a x} \left(\operatorname {F F N} \left(\left[ \mathbf {q} _ {t} ^ {\mathrm {P I}}; \mathbf {h} _ {t} ^ {\mathrm {P I}} \right]\right)\right) \in \mathbb {R} ^ {| V |}. \tag {8} +$$ + +Finally, we use the generated posterior information $\hat{I}_t$ to obtain the updated prior query $\hat{\mathbf{q}}_t^{\mathrm{post}}$ as: + +$$ +\hat {\mathbf {q}} _ {t} ^ {\text {p o s t}} = \left[ \mathbf {q} _ {t} ^ {\text {p r i o r}}; \hat {I} _ {t} \cdot \mathbf {E} \right], \tag {9} +$$ + +where $\mathbf{E} \in \mathbb{R}^{|V| \times d}$ is the embedding matrix and $|V|$ is the vocabulary size. Compared with $\mathbf{q}_t^{prior}$ in Equation 5, $\hat{\mathbf{q}}_t^{post}$ additionally contains the predicted posterior information, and we replace $\mathbf{q}_t^{prior}$ with $\hat{\mathbf{q}}_t^{post}$ for knowledge selection in Equation 6. We supervise this module by an addition loss $\mathcal{L}_{\mathrm{PIPM}}$ with the grounded posterior information $I$ , i.e., the + +bag of tokens in the golden response: + +$$ +\mathcal {L} _ {\mathrm {P I P M}} = - 1 / | I | \sum_ {w \in I} \log \left(\hat {I} _ {t} ^ {w}\right). \tag {10} +$$ + +Note that we remove the context information from $I$ because this information is already contained in the prior query $\mathbf{q}_t^{\mathrm{prior}}$ . + +# 3.2 Knowledge Distillation Based Training Strategy + +Current latent variable models (Lian et al., 2019; Kim et al., 2020) suffer from the exposure bias of knowledge selection as shown in Figure 1. Therefore, the decoder may have to generate a response with inappropriate knowledge selected from an unfamiliar prior distribution. Inspired by knowledge distillation (Hinton et al., 2015), we design the Knowledge Distillation Based Training Strategy (KDBTS) to deal with this exposure bias. KDBTS is a two-stage training strategy that we firstly train the posterior selection module as the teacher and then leverage the well-trained posterior module to train the prior selection module as the student. + +First Training Stage. We train a teacher at this stage, which is used to guide the student at the next stage. We can obtain a teacher as the by-product, i.e., the posterior selection module, from the training process of latent variable models in Figure 1. However, we find the posterior selection module is affected by the prior distribution when minimizing the KL term in Equation 2, and experiments in Section 5.2 show that it is usually not good enough. As a result, we introduce a "fix" operation to make sure that the posterior selection module can not be affected by the prior distribution, and replace the KL term $\mathcal{L}_{\mathrm{KL}}$ with the fixed KL term $\mathcal{L}_{\mathrm{KL}}^{\mathrm{fix}}$ : + +$$ +\mathcal {L} _ {\mathrm {K L}} ^ {\text {f i x}} = D _ {\mathrm {K L}} \left(\operatorname {f i x} \left(q _ {\phi} \left(\mathcal {K} _ {t}\right)\right) \| \pi_ {\theta} \left(\mathcal {K} _ {t}\right)\right). \tag {11} +$$ + +The total loss for training the teacher is as follows: + +$$ +\mathcal {L} _ {1} = \mathcal {L} _ {\mathrm {N L L}} ^ {\text {p o s t}} + \mathcal {L} _ {\mathrm {K L}} ^ {\text {f i x}} - \log q _ {\phi} \left(k _ {t} ^ {a}\right) + \lambda \mathcal {L} _ {\mathrm {P I P M}}, \tag {12} +$$ + +where $\mathcal{L}_{\mathrm{NLL}}^{\mathrm{post}}$ is defined in Equation 2, $k_{t}^{a}\in \mathcal{K}_{t}$ is the golden selected knowledge for knowledge loss - $\log q_{\phi}(k_{t}^{a})$ which is proposed by (Kim et al., 2020) and $\lambda$ is a hyperparameter. + +Second Training Stage. Once we obtain the teacher, we could leverage the posterior distribution from the well-trained teacher to deal with the diversity of knowledge selection. At this training stage, + +we feed the knowledge selected by the prior module into the decoder as shown in Figure 2, which is the same as the inference process. In this way, KDBTS removes the exposure bias of knowledge selection. Here, we only update the prior selection module and the decoder (the green blocks in Figure 2) because the encoder is shared by the student and the teacher. The total loss for training the student at this stage is: + +$$ +\mathcal {L} _ {2} = \mathcal {L} _ {\mathrm {N L L}} ^ {\text {p r i o r}} + \mathcal {L} _ {\mathrm {K L}} ^ {\text {f i x}} - \log \pi_ {\theta} \left(k _ {t} ^ {a}\right), \tag {13} +$$ + +where $\mathcal{L}_{\mathrm{NLL}}^{\mathrm{prior}} = -\mathbb{E}_{k\sim \pi_{\theta}(\mathcal{K}_t)}[\log p_\theta (y_t|ctx_t,k)]$ and $-\log \pi_{\theta}(k_t^a)$ is the knowledge loss. + +Compared with $\mathcal{L}_{\mathrm{NLL}}^{\mathrm{post}}$ defined in Equation 2, $\mathcal{L}_{\mathrm{NLL}}^{\mathrm{prior}}$ optimizes the decoder with knowledge selected from the prior distribution. Figure 2 clearly shows that KDBTS removes the exposure bias of knowledge selection by feeding the knowledge selected from prior distribution into the decoder. + +# 4 Experiments + +# 4.1 Dataset + +We adopt two multi-turn knowledge-grounded dialogue datasets for experiments. + +Wizard of Wikipedia (Dinan et al., 2019) contains 18,430 training dialogues, 1,948 validation dialogues and 1,933 test dialogues on 1365 topics. And test set is split into two subsets according to topics, which are Test Seen with 965 dialogues and Test Unseen with 968 dialogues whose topics are never seen in training and validation set. There are about 61 sentences on average in the knowledge pool per turn, which are retrieved from Wikipedia based on the context. + +Holl-E (Moghe et al., 2018) contains 7,228 training dialogues, 930 validation dialogues and 913 test dialogues. There are two versions of the test set: one with a single golden reference, the other with multiple golden references. Each dialogue is assigned with a document of about 60 sentences on average as the knowledge pool. Here, we use the modified version (Kim et al., 2020) which fits for knowledge selection. + +# 4.2 Baseline Models + +We compare our approach with a set of competitive baselines: + +TMN is short for E2E Transformer MemNet (Dinan et al., 2019). TMN uses a Transformer memory network for knowledge selection and a Transformer + +decoder with copy mechanism for utterance prediction. Knowledge selection is trained based on the knowledge label without posterior distribution. + +$\mathbf{TMN}_{\mathbf{BERT}}$ is short for TMN+BERT, implemented by (Kim et al., 2020). $\mathbf{TMN}_{\mathbf{BERT}}$ replaces the Transformer memory network with a pre-trained BERT. + +PostKS (Lian et al., 2019) only uses the posterior knowledge distribution as a pseudo-label for knowledge selection. PostKS uses GRU-based encoder and decoder without copy mechanism and does not use the knowledge label at the training stage. + +$\mathrm{TMN}_{\mathrm{BERT} + \mathrm{PostKS} + \mathrm{CP}}$ is short for TMN+BERT+ PostKS+Copy, implemented by (Kim et al., 2020). Compared with $\mathrm{TMN}_{\mathrm{BERT}}$ , it additionally uses the the posterior distribution in PostKS. + +SKT (Kim et al., 2020) is the current state-of-the-art latent variable model. Compared with $\mathrm{TMN_{BERT}} + \mathrm{PostKS_{cp}}$ , SKT leverages the posterior distribution by sequential latent modeling. + +# 4.3 Implementation Details + +We validate the effectiveness of our approach based on current state-of-the-art model SKT (Kim et al., 2020), using the same datasets and data-processing codes3. A shared encoder initialized with $\mathrm{BERT}_{\mathrm{BASE}}$ (Devlin et al., 2019) is used to encode dialogue and knowledge sentences. Then, a 5-layer Transformer decoder with copy mechanism is used to generate the response. We use a FFN with 512 hidden dims to generate the posterior information in BOW formats. The hidden size $d$ is 768 and the vocabulary size $|V|$ is 30, 522. Each batch consists of dialogues rather than individual turns, and the batch size is 1. The hyperparameter $\lambda$ in Equation 13 is set to 0.5 for all experiments without searching. The "fix" operation in Equation 11 is implemented by gradient stoping. + +Models are trained end-to-end using the Adam optimizer (Kingma and Ba, 2014) with gradient clipping at 0.4 and the learning rate is 0.00002. And we apply label smoothing (Pereyra et al., 2017) and set 0.1 for knowledge selection and 0.05 for response generation. We approximate the expectation in Equation 1 and 2 by drawing one sample with Gumbel-Softmax function (Jang et al., 2016) with temperature $\tau = 0.1$ . We train our teacher with 5 epochs, then select the teacher to teach the student according to the prior knowledge selection accuracy rather than posterior selection accuracy, + +because the shared encoder and decoder may be optimized overly for the posterior selection module, which is not a good initialization for the student. We train other models 20 epochs and select them according to the R-1 score as the final goal is to generate high-quality responses. + +# 4.4 Evaluation + +Automatic Evaluation. Following (Dinan et al., 2019; Kim et al., 2020), we use accuracy (Acc) to evaluate the knowledge selection and use perplexity (PPL), unigram F1 (R-1) and bigram F1 (R-2) to evaluate the quality of response generation automatically. Following (Kim et al., 2020), we remove all the punctuation and (a, an, the) before computing the R-1 and R-2 scores. Note that lower perplexity and higher R-1 and R-2 indicate better generation quality. + +Human Evaluation. We firstly select 100 samples from each test set on the Wizard of Wikipedia dataset for human evaluation. Then, we ask three annotators to judge whether the response makes sense (Sensibleness) or is specific (Specificity) with the dialogue context. Finally, we obtain Sensibility and Specificity Average (SSA) scores, which could penalize boring and vague responses and is suitable for the goal of knowledge-grounded dialogue (Adiwardana et al., 2020). Moreover, compared with Engagingness and Knowledgeability used in (Dinan et al., 2019; Kim et al., 2020), SSA, evaluated in 0/1 format, is more objective and easier to conduct (Adiwardana et al., 2020). + +# 5 Results and Analysis + +# 5.1 Main Results + +Quantitative Results. We report automatic results on the Wizard of Wikipedia dataset in Table 2 and we have the following observations: (1) From row 4 and 5 we can see that the PIPM indeed provides some necessary posterior information which is helpful for knowledge selection. (2) Comparing row 4 and 6, we see that the KDBTS brings about significant improvement on generation quality by removing the exposure bias of knowledge selection. (3) The combination of PIPM and KDBTS achieves further improvement on most metrics, except the knowledge selection accuracy. We think the reason is that there may exist several similar knowledge sentences leading to the same response. As a result, SKT+PIPM+KDBTS may select a reasonable + +
#MethodTest SeenTest Unseen
Acc ↑PPL ↓R-1 ↑R-2 ↑Acc ↑PPL ↓R-1 ↑R-2 ↑
0TMN22.563.516.9NA12.297.314.4NA
1PostKS4.879.113.01.04.2193.813.11.0
2\( TMNBERT \)23.753.516.84.513.6105.713.52.2
3\( TMNBERT+PostKS+CP \)25.552.219.06.514.483.415.63.9
4SKT26.852.019.36.818.381.416.14.2
5SKT+PIPM (Ours)27.953.119.67.019.678.517.04.9
6SKT+KDBTS (Ours)27.346.019.97.320.668.817.25.1
7SKT+PIPM+KDBTS (Ours)27.742.719.97.319.465.717.65.4
+ +Table 2: Quantitative results on the Wizard of Wikipedia dataset. Both PIPM and KDBTS bring about improvement over the state-of-the-art model (SKT) and their combination obtains further improvement on most metrics. + +
#MethodSingle ReferenceMulti Reference
Acc ↑PPL ↓R-1 ↑R-2 ↑Acc ↑PPL ↓R-1 ↑R-2 ↑
0TMN22.7140.620.110.332.383.624.312.8
1PostKS1.5196.615.26.03.2114.119.27.9
2\( TMNBERT \)28.2112.625.918.337.566.931.122.7
3\( TMNBERT+PostKS+CP \)27.847.429.222.337.827.935.929.0
4SKT29.248.929.823.139.228.536.529.7
5SKT+PIPM (Ours)31.047.530.223.841.127.037.431.0
6SKT+KDBTS (Ours)30.339.730.823.840.123.237.430.5
7SKT+PIPM+KDBTS (Ours)30.639.230.823.940.623.137.730.7
+ +Table 3: Quantitative results on the Holl-E dataset. + +
MethodTest SeenTest Unseen
SKT48.2 (52.7&43.7)45.5 (50.7&40.3)
Ours60.8 (65.0&56.7)55.2 (61.3&50.0)
Human81.3 (81.7&81.0)80.7 (81.0&80.3)
+ +Table 4: Qualitative results on Wizard of Wikipedia. Ours denotes SKT+PIPM+KDBTS. The scores in each cell are "SSA (Sensibleness&Specificity)". + +
NameDetails
I=yBOWbag-of-word information in the response, i.e., the words.
I=yxBOWyBOW -xBOW
I=yykxBOWyBOW +kaBOW -xBOW
I=ySeqthe response
+ +Table 5: Several variants of posterior information. + +knowledge but not the golden one to generate informative and fluent responses, because models are selected according to the generation quality rather than the selection accuracy (Kim et al., 2020). + +Results in Table 3 lead to consistent observations on the Holl-E dataset that both PIPM and KDBTS bring performance improvement over the state-of-the-art latent variable model SKT, and their combination achieves further improvement, resulting in the new state-of-the-art performance. + +Qualitative Results. We report human evaluation results of the generated responses in Table 4. We see that our approach brings about consistent improvement over the state-of-the-art model SKT. Our approach can leverage the selected knowledge appropriately to generate more sensible and spe + +cific responses, which are fluent and informative. + +# 5.2 Analysis + +PIPM. We explore several variants of posterior information in Tabel 5 to better study this module. Besides the default $y_{\mathrm{BOW}}^x$ , we also explore two variants in BOW format: (1) $y_{\mathrm{BOW}}$ does not remove the context information; (2) $yk_{\mathrm{BOW}}^x$ additionally considers another source of posterior information, i.e., the golden selected knowledge $k_t^a$ . And we consider the sequence information in $y_{\mathrm{Seq}}$ , as the BOW format discards the word order. Note that we use the FFN in Equation 8 to obtain the posterior information in BOW formats, and we take $\mathbf{H}_t^x + \mathbf{h}_t^{\mathrm{PI}}$ as input and use a 3-layer Transformer decoder to generate $y_{\mathrm{Seq}}$ . Moreover, we also perform an ablation study to investigate the effectiveness + +
#MethodTest SeenTest Unseen# Parameters
Acc ↑PPL ↓R-1 ↑R-2 ↑Acc ↑PPL ↓R-1 ↑R-2 ↑
0SKT26.852.019.36.818.381.416.14.2174056704
1SKT+PIPM (ySeq)27.951.919.16.718.877.516.04.0192361216
2SKT+PIPM (yBOW)27.351.519.37.018.478.016.14.3192664890
3SKT+PIPM (ykBOW)27.652.219.06.819.878.116.34.6192664890
4SKT+PIPM (yxBOW)27.953.119.67.019.678.517.04.9192664890
5SKT+PIPM (w/o update)26.951.819.37.219.077.016.64.7192075066
6SKT†—teacher32.847.420.47.520.275.017.04.8174056704
7SKT (KLfix)†—teacher52.043.124.110.438.361.620.37.1174056704
8SKT (KLfix)28.073.318.56.520.699.315.84.4174056704
9SKT+KDBTS27.445.920.07.320.568.617.25.1174056704
+ +Table 6: Quantitative results for model analysis on the Wizard of Wikipedia dataset. The default setting of PIPM is $y_{\mathrm{BOW}}^x$ . Models with $\dagger$ are teachers which are not comparable as they use the posterior knowledge selection at inference, and their results can be regarded as the upper bound. KLfix means that we replace $\mathcal{L}_{\mathrm{KL}}$ with $\mathcal{L}_{\mathrm{KL}}^{\mathrm{fix}}$ . + +of generated posterior information for prior knowledge selection. We remove the predicted posterior information $\hat{I}$ in Equation 9, but still use $\mathcal{L}_{\mathrm{PIPM}}$ in Equation 10 for comparison. + +These results are reported in the upper part (row $1 \sim 5$ ) of Table 6 and the observations are stated as follows: (1) Compared with SKT in row 0, the variants of posterior information in row $1 \sim 4$ bring improvement on selection accuracy, though some generation metrics are slightly lower because of the exposure bias of knowledge selection. (2) From row 1 and 2, we see that the sequence information in $y_{\mathrm{Seq}}$ contributes to the knowledge selection. However, it is inefficient to generate $y_{\mathrm{Seq}}$ word by word, and $y_{\mathrm{Seq}}$ is not better than $y_{BOW}^x$ in row 4. And there is no significant difference between $y_{\mathrm{BOW}}^x$ and $y_{\mathrm{BOW}}^x$ which combines another source of posterior information. (3) We report the ablation result in row 5 to investigate the effectiveness of generated posterior information for knowledge selection. We see that this information improves the selection accuracy (compared with row 4). + +KDBTS. We investigate the training strategy in the lower part (row $6\sim 9$ ) of Table 6 and the observations are stated as follows: (1) Comparing row 6 and 7, we see that SKT $(\mathrm{KLfix})^{\dagger}$ is a good teacher with a much higher selection accuracy because $\mathcal{L}_{\mathrm{KL}}^{\mathrm{fix}}$ in Equation 11 guarantees the posterior selection module not affected by the prior distribution. When using $\mathcal{L}_{\mathrm{KL}}$ in Equation 2, $\mathrm{SKT}^{\dagger}$ achieves the lower accuracy (32.8 vs 52.0) and the lower KL divergence (0.31 vs 1.41), which indicates that the posterior module is affected by the prior distribution. (2) Despite doing well in knowledge selection, + +SKT (KLfix) in row 8 performs worse in generation than SKT. Because SKT (KLfix) has a larger KL divergence (1.41 vs 0.31) than $\mathrm{SKT}^4$ , it has to generate the response with the knowledge selected from a much more unfamiliar prior distribution. (3) As our KDBTS in row 9 does not suffer from the exposure bias of knowledge selection, the generation quality is improved significantly. We are amazed at finding that the selection accuracy is also improved and we argue that the KDBTS drives the prior distribution to approximate the posterior distribution at most by minimizing the KL term with the posterior distribution fixed. + +# 5.3 Case Study + +Table 7 shows two example response on the Wizard of Wikipedia dataset. We see that the posterior information $\hat{I}$ , e.g., "rock band" and "formed", provided by the PIPM, is helpful for knowledge selection, although there is some noise information, e.g., "american". And quantitative results in Section 5.1 show that this module is effective although not perfect. We see that the responses generated by SKT have repeated words in case 1 and do not reply directly in case 2. Our method can leverage the selected knowledge sufficiently to generate a fluent and informative response because our KDBTS removes the exposure bias of knowledge selection by training the decoder with knowledge selected in the same way as the inference process. + +
Case 1ContextI used to listen to the rolling stones a lot when i was a child.
Golden KnowledgeThe rolling stones are an English rock band +formed in London, england in 1962.
HumanMe too. I can’t believe they formed in London as far back as 1962! +what’s your favorite song?
SKTThe rolling stones are an English rock band formed in London in London.
OursPosterior Information +in BOW format (Top 20)[PAD] in the rock band , they formed is are ? +of a you i ’! from and american
ResponseI love the rolling stones! +They are an English rock band formed in 1962.
Case 2ContextHow do teams score points?
Golden KnowledgePoints are primarily scored by advancing the ball into the opposing team’s +end zone for a touchdown or kicking the ball through the opponent.
HumanPoints are scored by advancing the ball into the opposing teams end zone +for a touchdown or kicking it through the opponents goalposts for a field goal. +good question!
SKTThe object is to score by getting the ball into the opposing goal.
OursPosterior Information +in BOW format (Top 20)the players [PAD] of , is goal a ball and +to team on it each in score points most field
ResponsePoints are scored by advancing the ball +into the opposing team’s end zone.
+ +Table 7: Examples of generated responses on the Wizard of Wikipedia dataset. + +# 6 Related Work + +We mainly focus on knowledge selection in open domain knowledge-grounded dialogue, and there are several work studying this issue (Dinan et al., 2019; Lian et al., 2019; Kim et al., 2020). Here, we point out the gap between prior and posterior knowledge selection and try to deal with this gap. + +The PIPM has some relations with several work. Deliberation Decoder (Xia et al., 2017; Wang et al., 2019; Li et al., 2019) leverages two decoders for two-pass generation. We also use two decoders in PIPM ( $y_{\mathrm{Seq}}$ ), but the first decoder is used to generate posterior information for the knowledge selection rather than the second-pass generation. BOW loss, proposed by (Zhao et al., 2017), is adopted to supervise the posterior module (Lian et al., 2019). Here, we have three different aspects: (1) We use the BOW loss for the prior module rather than the posterior module; (2) We use posterior information in BOW format to enhance the prior selection module; (3) We explore several BOW variants. + +Our KDBTS is inspired by knowledge distillation (Hinton et al., 2015). Instead of using more complex structure as the teacher for model compression, we treat the posterior selection module with additional input information (e.g., the response) as the teacher, and deal with the exposure bias of knowledge selection. Lite ELBO (Zhao et al., 2019a) is proposed to remove the exposure bias at latent space for a different task. However, Lite ELBO naturally does not leverage the posterior distribution as it sets the posterior module the same as the prior module. Our KDBTS is a two-stage + +training strategy that uses the posterior distribution as the teacher to guide the prior selection module and uses the knowledge selected from the prior distribution to train the decoder. + +# 7 Conclusion + +In this paper, we firstly analyze the gap between prior and posterior knowledge selection for open-domain knowledge-grounded dialogue. Then, we deal with it on two aspects: (1) We enhance the prior selection module with the posterior information obtained by the PIPM and we explore several variants of posterior information. (2) We design the KDBTS to train the decoder with knowledge selected from the prior distribution, removing the exposure bias of knowledge selection. Experiments show that both PIPM and KDBTS improve the state-of-the-art latent variable model and their combination achieves further improvement. In the future, we would explore three aspects: (1) more efficient posterior information representation and corresponding prediction module, (2) the interpretability of knowledge selection and (3) knowledge selection without knowledge label. + +# Acknowledgments + +We would like to thank the anonymous reviewers for their insightful comments. This work was supported by the Key Programs of the Chinese Academy of Sciences (ZDBS-SSW-JSC006) and the Strategic Priority Research Program of the Chinese Academy of Sciences (Grant No. XDB32070000). + +# References + +Daniel Adiwardana, Minh-Thang Luong, David R So, Jamie Hall, Noah Fiedel, Romal Thoppilan, Zi Yang, Apoorv Kulshreshtha, Gaurav Nemade, Yifeng Lu, et al. 2020. Towards a human-like open-domain chatbot. arXiv preprint arXiv:2001.09977. +Daniel Cer, Yinfei Yang, Sheng-yi Kong, Nan Hua, Nicole Limtiaco, Rhomni St John, Noah Constant, Mario Guajardo-Cespedes, Steve Yuan, Chris Tar, et al. 2018. Universal sentence encoder. arXiv preprint arXiv:1803.11175. +Debanjan Chaudhuri, Agustinus Kristiadi, Jens Lehmann, and Asja Fischer. 2018. Improving Response Selection in Multi-Turn Dialogue Systems by Incorporating Domain Knowledge. In Proceedings of the 22nd Conference on Computational Natural Language Learning, pages 497-507. +Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. 2017. Reading Wikipedia to Answer Open-Domain Questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1870-1879. +Xiuyi Chen, Jiaming Xu, and Bo Xu. 2019. A working memory model for task-oriented dialog response generation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2687-2693, Florence, Italy. Association for Computational Linguistics. +Kyunghyun Cho, Bart van Merrienboer, Caglar Gul- cehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ger 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. +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. +Emily Dinan, Stephen Roller, Kurt Shuster, Angela Fan, Michael Auli, and Jason Weston. 2019. Wizard of Wikipedia: Knowledge-Powered Conversational Agents. In International Conference on Learning Representations. +Marjan Ghazvininejad, Chris Brockett, Ming-Wei Chang, Bill Dolan, Jianfeng Gao, Wen-tau Yih, and Michel Galley. 2018. A knowledge-grounded neural conversation model. In Thirty-Second AAAI Conference on Artificial Intelligence. + +Karthik Gopalakrishnan, Behnam Hedayatnia, Qinlang Chen, Anna Gottardi, Sanjeev Kwatra, Anu Venkatesh, Raefer Gabriel, and Dilek Hakkani-Tür. 2019. Topical-Chat: Towards Knowledge-Grounded Open-Domain Conversations. Proc. Interspeech 2019, pages 1891-1895. +Jiatao Gu, Zhengdong Lu, Hang Li, and Victor O.K. Li. 2016. Incorporating copying mechanism in sequence-to-sequence learning. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1631-1640, Berlin, Germany. Association for Computational Linguistics. +Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. 2015. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531. +Eric Jang, Shixiang Gu, and Ben Poole. 2016. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144. +Byeongchang Kim, Jaewoo Ahn, and Gunhee Kim. 2020. Sequential Latent Knowledge Selection for Knowledge-Grounded Dialogue. arXiv: Computation and Language. +Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. +Zekang Li, Cheng Niu, Fandong Meng, Yang Feng, Qian Li, and Jie Zhou. 2019. Incremental Transformer with Deliberation Decoder for Document Grounded Conversations. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 12-21. +Rongzhong Lian, Min Xie, Fan Wang, Jinhua Peng, and Hua Wu. 2019. Learning to select knowledge for response generation in dialog systems. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 5081-5087. AAAI Press. +Andrea Madotto, Chien-Sheng Wu, and Pascale Fung. 2018. Mem2Seq: Effectively incorporating knowledge bases into end-to-end task-oriented dialog systems. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1468-1478, Melbourne, Australia. Association for Computational Linguistics. +Chuan Meng, Pengjie Ren, Zhumin Chen, Christof Monz, Jun Ma, and Maarten de Rijke. 2019. RefNet: A reference-aware network for background based conversation. arXiv preprint arXiv:1908.06449. +Sewon Min, Victor Zhong, Richard Socher, and Caiming Xiong. 2018. Efficient and Robust Question Answering from Minimal Context over Documents. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1725-1735. + +Nikita Moghe, Siddhartha Arora, Suman Banerjee, and Mitesh M Khapra. 2018. Towards Exploiting Background Knowledge for Building Conversation Systems. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2322-2332. +Yixin Nie, Songhe Wang, and Mohit Bansal. 2019. Revealing the Importance of Semantic Retrieval for Machine Reading at Scale. 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 2553-2566. +Zheng-Yu Niu, Hua Wu, Haifeng Wang, et al. 2019. Knowledge Aware Conversation Generation with Explainable Reasoning over Augmented Graphs. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 1782-1792. +Prasanna Parthasarathi and Joelle Pineau. 2018. Extending Neural Generative Conversational Model using External Knowledge Sources. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 690-695. +Gabriel Pereyra, George Tucker, Jan Chorowski, Lukasz Kaiser, and Geoffrey Hinton. 2017. Regularizing neural networks by penalizing confident output distributions. arXiv preprint arXiv:1701.06548. +Lianhui Qin, Michel Galley, Chris Brockett, Xiaodong Liu, Xiang Gao, Bill Dolan, Yejin Choi, and Jianfeng Gao. 2019. Conversing by Reading: Contentful Neural Conversation with On-demand Machine Reading. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5427-5436. +Marc'Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. 2015. Sequence level training with recurrent neural networks. arXiv preprint arXiv:1511.06732. +Pengjie Ren, Zhumin Chen, Christof Monz, Jun Ma, and Maarten de Rijke. 2019. Thinking Globally, Acting Locally: Distantly Supervised Global-to-Local Knowledge Selection for Background Based Conversation. arXiv preprint arXiv:1908.09528. +Yajing Sun, Yue Hu, Luxi Xing, Jing Yu, and Yuqiang Xie. 2020. History-adaption Knowledge Incorporation Mechanism for Multi-turn Dialogue System. In AAAI. +Xiangru Tang and Po Hu. 2019. Knowledge-Aware Self-Attention Networks for Document Grounded Dialogue Generation. In International Conference on Knowledge Science, Engineering and Management, pages 400-411. Springer. + +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. +Yiren Wang, Yingce Xia, Fei Tian, Fei Gao, Tao Qin, Cheng Xiang Zhai, and Tie-Yan Liu. 2019. Neural Machine Translation with Soft Prototype. In Advances in Neural Information Processing Systems, pages 6313-6322. +Yingce Xia, Fei Tian, Lijun Wu, Jianxin Lin, Tao Qin, Nenghai Yu, and Tie-Yan Liu. 2017. Deliberation networks: Sequence generation beyond one-pass decoding. In Advances in Neural Information Processing Systems, pages 1784-1794. +Semin Yavuz, Abhinav Rastogi, Guan-Lin Chao, Dilek Hakkani-Tür, and Amazon Alexa AI. 2019. DEEP-COPY: Grounded Response Generation with Hierarchical Pointer Networks. In 20th Annual Meeting of the Special Interest Group on Discourse and Dialogue, page 122. +Hao-Tong Ye, Kai-Lin Lo, Shang-Yu Su, and Yun-Nung Chen. 2020. Knowledge-grounded response generation with deep attentional latent-variable model. Computer Speech & Language, page 101069. +Saizheng Zhang, Emily Dinan, Jack Urbanek, Arthur Szlam, Douwe Kiela, and Jason Weston. 2018. Personalizing Dialogue Agents: I have a dog, do you have pets too? In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2204-2213. +Wen Zhang, Yang Feng, Fandong Meng, Di You, and Qun Liu. 2019. Bridging the gap between training and inference for neural machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4334-4343, Florence, Italy. Association for Computational Linguistics. +Tiancheng Zhao, Kaige Xie, and Maxine Eskenazi. 2019a. Rethinking Action Spaces for Reinforcement Learning in End-to-end Dialog Agents with Latent Variable Models. 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 1208-1218. +Tiancheng Zhao, Ran Zhao, and Maxine Eskenazi. 2017. Learning Discourse-level Diversity for Neural Dialog Models using Conditional Variational Autoencoders. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 654-664. +Xueliang Zhao, Chongyang Tao, Wei Wu, Can Xu, Dongyan Zhao, and Rui Yan. 2019b. A document-grounded matching network for response selection + +in retrieval-based chatbots. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pages 5443-5449. AAAI Press. +Wen Zheng and Ke Zhou. 2019. Enhancing Conversational Dialogue Models with Grounded Knowledge. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management, pages 709-718. +Hao Zhou, Tom Young, Minlie Huang, Haizhou Zhao, Jingfang Xu, and Xiaoyan Zhu. 2018. Common-sense Knowledge Aware Conversation Generation with Graph Attention. In *IJCAI*, pages 4623-4629. \ No newline at end of file diff --git a/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/images.zip b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7ba3669c0f7e8cda771fba260376bb20960f0fa1 --- /dev/null +++ b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:332755d6b4a084e54cffe9a9c151ef3f2b585cf2683bea8f6fa232598fd67ca9 +size 554868 diff --git a/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/layout.json b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..3ee3b6c63c0b5fad0ee73c9e35961accb7cbc05e --- /dev/null +++ b/bridgingthegapbetweenpriorandposteriorknowledgeselectionforknowledgegroundeddialoguegeneration/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97870facb2fb4cb213183c4095c2c7c53f81a6a3562b18f69445ffa35fe65068 +size 437368 diff --git a/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_content_list.json b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..230afb98154019f5e64a8bce5fe71d756dbeded6 --- /dev/null +++ b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:83d456bbd0bed41a3446687003b757175bbcb432ddd70ab8d82a0f7522adbe59 +size 40222 diff --git a/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_model.json b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_model.json new file mode 100644 index 0000000000000000000000000000000000000000..54b9b8f093a0453b8106db22d74aa207b646af8b --- /dev/null +++ b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84ec4077729a9695bb217c146e59be341c66aa8417d0ee5ee76e514cc6ebf8f7 +size 48319 diff --git a/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_origin.pdf b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..04817b0ab0aa96f4b1fc3f65d2442ae2cbad5090 --- /dev/null +++ b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/6dcceaa4-0097-44e4-90f6-5951129f5ab7_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9422386fa1aee38ca3c53c3e8029861cca98962b03ce1e72a6d4a22a64f02c6d +size 297258 diff --git a/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/full.md b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/full.md new file mode 100644 index 0000000000000000000000000000000000000000..2e189b74c492d997941ce39d4deab52e49e2d98c --- /dev/null +++ b/catgenimprovingrobustnessinnlpmodelsviacontrolledadversarialtextgeneration/full.md @@ -0,0 +1,143 @@ +# CAT-Gen: Improving Robustness in NLP Models via Controlled Adversarial Text Generation + +Tianlu Wang†* Xuezhi Wang§ Yao Qin§ Ben Packer§ + +Kang Lee§ Jilin Chen§ Alex Beutel§ Ed Chi§ + +†University of Virginia tw8cb@virginia.edu + +$^{\S}$ Google Research {xuezhiw, yaoqin, bpacker, kanlig, jilinc, alexbeutel, edchi} $@$ google.com + +# Abstract + +NLP models are shown to suffer from robustness issues, i.e., a model's prediction can be easily changed under small perturbations to the input. In this work, we present a Controlled Adversarial Text Generation (CATGen) model that, given an input text, generates adversarial texts through controllable attributes that are known to be irrelevant to task labels. For example, in order to attack a model for sentiment classification over product reviews, we can use the product categories as the controllable attribute which should not change the sentiment of the reviews. Experiments on real-world NLP datasets demonstrate that our method can generate more diverse and fluent adversarial texts, compared to many existing adversarial text generation approaches. We further use our generated adversarial examples to improve models through adversarial training, and we demonstrate that our generated attacks are more robust against model retraining and different model architectures. + +# 1 Introduction + +It has been shown that NLP models are often sensitive to random initialization (Zhou et al., 2020), out-of-distribution data (Hendrycks et al., 2020; Wang et al., 2019), and adversarially generated attacks (Jia and Liang, 2017; Jin et al., 2020; Alzantot et al., 2018). One line of research to improve models' robustness to adversarial attacks is by generating adversarial examples in either the input text space (discrete, e.g., Alzantot et al. (2018); Jin et al. (2020)) or some intermediate representation space (continuous, e.g., Zhao et al. (2018); Zhu et al. (2020)). However, existing adversarial text generation approaches that try to perturb in the input text space might lead to generations lacking diversity or + +fluency. On the other hand, approaches focusing on perturbing in the intermediate representation space can often lead to generations that are not related to the input. We show some adversarial examples generated by existing works in Table 1. + +In this work, we aim to explore adversarial text generation through controllable attributes. We propose to utilize text generation models to produce more diverse and fluent outputs. Meanwhile, we constrain the language generation within certain controllable attributes, leading to high quality outputs that are semantically close to input sentences. Formally, we denote the input text as $x$ , the label for the main task (e.g., text classification) as $y$ , a model's prediction over $x$ as $f(x)$ , and controllable attributes (e.g., category, gender, domain) as $a$ . Our goal is to create adversarial attacks $x'$ that can successfully fool the classifier into making an incorrect prediction $f(x) \neq f(x')$ , while keeping the ground truth task label unchanged, i.e., $(x, y) \to (x', y)$ . + +To achieve these goals, we propose CAT-Gen, a Controlled Adversarial Text Generation model. It consists of an encoder and a decoder for text generation, and a module network that encodes the information of controllable attributes and generates adversarial attacks via changing the controllable attributes. The encoder and decoder are trained over a large text corpus and thus can generate more fluent and diverse output. We control the generated output through an attribute $a$ . We assume the attribute $a$ is pre-specified and is known to be irrelevant to the main task-label, and can be learned through an auxiliary dataset. In this way, the attribute training and task training (for attack) can be disentangled, and note that we do not require a parallel corpus for the auxiliary dataset when learning the attribute. We present experiments on real-world NLP datasets to demonstrate the applicability and generalizability of our proposed methods. We show that our generated attacks are more fluent (defined + +
MethodExamples
Textfooler (Jin et al., 2020)A person is relaxing on his day off → A person is relaxing on his nowadays off The two men are friends → The three men are dudes
NL-adv (Alzantot et al., 2018)A man is talking to his wife over his phone → A guy is chitchat to his girl over his phone A skier gets some air near a mountain... → A skier gets some airplane near a mountain...
Natural-GAN (Zhao et al., 2018)a girl is playing at a looking man . → a white preforming is lying on a beach . two friends waiting for a family together . → the two workers are married .
+ +Table 1: Examples over existing adversarial text generation methods on SNLI (Bowman et al., 2015) dataset. Adversarial text generated by word substitution based methods (Textfooler & NL-adv) may lack fluency or diversity; GAN based methods (Natural-GAN) tend to generate sentences not related to the original sentences. + +by language model perplexity), more diverse (defined by BLEU-4 score) and more robust against model re-training and various model architectures. + +# 2 Related Work + +NLP models' robustness has drawn a lot of attention in recent years, among those, a specific line of work tries to address this issue by generating adversarial examples, including (Guu et al., 2018; Iyyer et al., 2018; Alvarez-Melis and Jaakkola, 2017; Jia and Liang, 2017; Ebrahimi et al., 2018; Naik et al., 2018). For example, both Alzantot et al. (2018) and Jin et al. (2020) generate adversarial texts by substituting words with their synonyms (defined by similarity in the word embedding space) that can lead to a model prediction change. Zhao et al. (2018) propose to generate natural and legible adversarial examples using a Generative Adversarial Network, by searching in the semantic space of continuous data representation. Jia et al. (2019) propose to find the combination of word substitutions by minimizing the upper bound on the worst-case loss. More recently, rather than directly generating text outputs, Zhu et al. (2020) add adversarial perturbations to word embeddings and minimize the adversarial risk around input examples. + +Our work is also closely related to controllable text generation, e.g., Hu et al. (2017) use variational auto-encoders and holistic attribute discriminators, Dathathri et al. (2020) utilize a pretrained language model with one or more simple attribute classifiers to guide text generation, and Shen et al. (2017) propose to achieve style transfer using non-parallel text. In addition, our work is connected with (adversarial) domain adaptation, since the controlled attributes can be different domains. NLP models have been shown to lack robustness when been tested over out-of-distribution data, e.g., + +Hendrycks et al. (2020); Wang et al. (2019). + +# 3 Controlled Adversarial Text Generation Model + +In Figure 1, we present an overview of the CATGen model, where we aim to generate attacks against a main task (e.g., sentiment classification) by controlling the attribute (e.g., product category) over an input sentence (e.g., product reviews). Similar to controlled text generation works (Hu et al., 2017; Shen et al., 2017; Dathathri et al., 2020), the model consists of an encoder and a decoder, with an attribute classifier. We add components to accommodate both change of attributes and attack generation over an input task model. We assume an auxiliary dataset for training the attribute. Our model training involves three stages: + +Pre-training. We pre-train the encoder and the decoder (both are RNNs in our case but could be other models) to allow the generation model to learn to copy an input sentence $s_a$ (assuming the input sentence has an attribute $a$ ) using teacher-forcing. A cross entropy loss is placed between the input text ids and the output logits of each token: $\ell_{c,z} = -\sum_{t=1}^{T} \log p(s_a^t | s_a^{