SlowGuess commited on
Commit
3ffa4f6
·
verified ·
1 Parent(s): f2d9a6e

Add Batch a85b772f-d65d-4d91-aa5d-c85e08a693f8

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_content_list.json +3 -0
  2. ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_model.json +3 -0
  3. ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_origin.pdf +3 -0
  4. ambigqaansweringambiguousopendomainquestions/full.md +449 -0
  5. ambigqaansweringambiguousopendomainquestions/images.zip +3 -0
  6. ambigqaansweringambiguousopendomainquestions/layout.json +3 -0
  7. analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_content_list.json +3 -0
  8. analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_model.json +3 -0
  9. analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_origin.pdf +3 -0
  10. analogousprocessstructureinductionforsubeventsequenceprediction/full.md +275 -0
  11. analogousprocessstructureinductionforsubeventsequenceprediction/images.zip +3 -0
  12. analogousprocessstructureinductionforsubeventsequenceprediction/layout.json +3 -0
  13. analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_content_list.json +3 -0
  14. analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_model.json +3 -0
  15. analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_origin.pdf +3 -0
  16. analyzingindividualneuronsinpretrainedlanguagemodels/full.md +356 -0
  17. analyzingindividualneuronsinpretrainedlanguagemodels/images.zip +3 -0
  18. analyzingindividualneuronsinpretrainedlanguagemodels/layout.json +3 -0
  19. analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_content_list.json +3 -0
  20. analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_model.json +3 -0
  21. analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_origin.pdf +3 -0
  22. analyzingredundancyinpretrainedtransformermodels/full.md +454 -0
  23. analyzingredundancyinpretrainedtransformermodels/images.zip +3 -0
  24. analyzingredundancyinpretrainedtransformermodels/layout.json +3 -0
  25. ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_content_list.json +3 -0
  26. ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_model.json +3 -0
  27. ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_origin.pdf +3 -0
  28. ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/full.md +271 -0
  29. ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/images.zip +3 -0
  30. ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/layout.json +3 -0
  31. anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_content_list.json +3 -0
  32. anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_model.json +3 -0
  33. anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_origin.pdf +3 -0
  34. anelementawaremultirepresentationmodelforlawarticleprediction/full.md +251 -0
  35. anelementawaremultirepresentationmodelforlawarticleprediction/images.zip +3 -0
  36. anelementawaremultirepresentationmodelforlawarticleprediction/layout.json +3 -0
  37. anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_content_list.json +3 -0
  38. anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_model.json +3 -0
  39. anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_origin.pdf +3 -0
  40. anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/full.md +389 -0
  41. anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/images.zip +3 -0
  42. anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/layout.json +3 -0
  43. anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_content_list.json +3 -0
  44. anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_model.json +3 -0
  45. anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_origin.pdf +3 -0
  46. anempiricalinvestigationofcontextualizednumberprediction/full.md +341 -0
  47. anempiricalinvestigationofcontextualizednumberprediction/images.zip +3 -0
  48. anempiricalinvestigationofcontextualizednumberprediction/layout.json +3 -0
  49. anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_content_list.json +3 -0
  50. anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_model.json +3 -0
ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:920227012980db3f31b5b86c1bb5bfce3caaa5190c11c76ee25862304af6be57
3
+ size 101514
ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cafe03c29a439776b9f228bbc0aba9d1359fda571a7240be85e9cb8826061df
3
+ size 121962
ambigqaansweringambiguousopendomainquestions/c6691302-c59d-4a5d-87c9-f9d78b34b2fa_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0fc5a9cfb01f35f9c0b64070aeb70db7f91096c34c8f5b7c8fdbfdb2d15a143
3
+ size 1543197
ambigqaansweringambiguousopendomainquestions/full.md ADDED
@@ -0,0 +1,449 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AMBIGQA: Answering Ambiguous Open-domain Questions
2
+
3
+ Sewon Min, $^{1,2}$ Julian Michael, $^{1}$ Hannaneh Hajishirzi, $^{1,3}$ Luke Zettlemoyer $^{1,2}$
4
+
5
+ <sup>1</sup>University of Washington <sup>2</sup>Facebook AI Research <sup>3</sup>Allen Institute for Artificial Intelligence
6
+
7
+ {sewon, julianjm, hannaneh, lsz}@cs.washington.edu
8
+
9
+ # Abstract
10
+
11
+ 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.
12
+
13
+ # 1 Introduction
14
+
15
+ 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
16
+
17
+ ![](images/7aa3b76fc49ca5e14d6ffa6006d3cc835964666e79ec915a3344dd915cb2973e.jpg)
18
+
19
+ # AMBIGQA Input
20
+
21
+ When did harry potter and the sorcerer's stone movie come out?
22
+
23
+ Harry Potter and the Philosopher's Stone (film)
24
+ From Wikipedia, the free encyclopedia
25
+
26
+ 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.
27
+
28
+ # AMBIGQA Output
29
+
30
+ Q: When did harry potter and the sorcerer's stone movie come out at the Odeon Leicester Square? A: 4 November 2001
31
+ Q: When did harry potter and the sorcerer's stone movie come out in cinemas?
32
+ A: 16 November 2001
33
+
34
+ ![](images/52406853a35279c3b2c32d3088cdb283bcd3a96508ab4c782b59b0c0e50e15b2.jpg)
35
+ 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.
36
+
37
+ shown in Figure 1, ambiguity is a function of both the question and the evidence provided by a large text corpus.
38
+
39
+ 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.
40
+
41
+ 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,
42
+
43
+ <table><tr><td>Type</td><td>Example</td></tr><tr><td>Event references (39%)</td><td>What season does meredith and derek get married in grey&#x27;s anatomy?
44
+ Q: In what season do Meredith and Derek get informally married in Grey&#x27;s Anatomy? / A: Season 5
45
+ Q: In what season do Meredith and Derek get legally married in Grey&#x27;s Anatomy? / A: Season 7</td></tr><tr><td>Properties (27%)</td><td>How many episode in seven deadly sins season 2?
46
+ Q: How many episodes were there in seven deadly sins season 2, not including the OVA episode? / A: 25
47
+ Q: How many episodes were there in seven deadly sins season 2, including the OVA episode? / A: 26</td></tr><tr><td>Entity references (23%)</td><td>How many sacks does clay matthews have in his career?
48
+ Q: How many sacks does Clay Matthews Jr. have in his career? / A: 69.5
49
+ Q: How many sacks does Clay Matthews III have in his career? / A: 91.5</td></tr><tr><td>Answer types (16%)</td><td>Who sings the song what a beautiful name it is?
50
+ Q: Which group sings the song what a beautiful name it is? / A: Hillsong Live
51
+ Q: Who is the lead singer of the song what a beautiful name it is? / A: Brooke Ligertwood</td></tr><tr><td>Time-dependency (13%)</td><td>When does the new family guy season come out?
52
+ Q: When does family guy season 16 come out? / A: October 1, 2017
53
+ Q: When does family guy season 15 come out? / A: September 25, 2016
54
+ Q: When does family guy season 14 come out? / A: September 27, 2015</td></tr><tr><td>Multiple sub-questions (3%)</td><td>Who was british pm and viceroy during quit india movement?
55
+ Q: Who was british viceroy during quit India movement? / A: Victor Hope
56
+ Q: Who was british pm during quit India movement? / A: Winston Churchill</td></tr></table>
57
+
58
+ 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.
59
+
60
+ 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.
61
+
62
+ 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.
63
+
64
+ To summarize, our contributions are threefold.
65
+
66
+ 1. We introduce AMBIGQA, a new task which requires identifying all plausible answers to
67
+
68
+ an open-domain question, along with disambiguated questions to differentiate them.
69
+
70
+ 2. We construct AMBIGNQ, a dataset with 14,042 annotations on NQ-OPEN questions containing diverse types of ambiguity.
71
+ 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.
72
+
73
+ # 2 Related Work
74
+
75
+ 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.
76
+
77
+ 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
78
+
79
+ 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.
80
+
81
+ 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$ ).
82
+
83
+ 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.
84
+
85
+ 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.
86
+
87
+ # 3 Task: AMBIGQA
88
+
89
+ # 3.1 AMBIGQA Setup
90
+
91
+ 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
92
+
93
+ $q$ whose answer is unambiguously $y_{i}$ . We consider two subtasks.
94
+
95
+ 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.
96
+
97
+ 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$ .
98
+
99
+ 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.
100
+
101
+ # 3.2 Evaluation Metrics
102
+
103
+ 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.
104
+
105
+ 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].
106
+
107
+ $$
108
+ c _ {i} = \max _ {1 \leq j \leq n} \mathbb {I} [ y _ {i} \in \bar {\mathcal {Y}} _ {j} ] f (x _ {i}, \bar {x} _ {j}).
109
+ $$
110
+
111
+ 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:
112
+
113
+ $$
114
+ \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}
115
+ $$
116
+
117
+ 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
118
+
119
+ 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 edits<sup>3</sup> 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.
120
+
121
+ # 4 Data: AMBIGNQ
122
+
123
+ # 4.1 Data Collection
124
+
125
+ We construct AMBIGNQ using prompt questions from NQ-OPEN and English Wikipedia as the evidence corpus. We use Amazon Mechanical Turk for crowdsourcing.
126
+
127
+ 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.
128
+
129
+ 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$
130
+
131
+ 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).
132
+
133
+ 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
134
+
135
+ <table><tr><td rowspan="2">Split</td><td rowspan="2"># data</td><td colspan="4"># QAs %</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4+</td></tr><tr><td>Train</td><td>10,036</td><td>53</td><td>24</td><td>14</td><td>10</td></tr><tr><td>Dev</td><td>2,002</td><td>49</td><td>23</td><td>14</td><td>13</td></tr><tr><td>Test</td><td>2,004</td><td>44</td><td>24</td><td>16</td><td>16</td></tr></table>
136
+
137
+ Table 2: Data statistics. For the number of QA pairs (# QAs), the minimum is taken when there are more than 1 accepted annotations.
138
+
139
+ 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).
140
+
141
+ 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).
142
+
143
+ 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.
144
+
145
+ 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.
146
+
147
+ # 4.2 Data Analysis
148
+
149
+ 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
150
+
151
+ ![](images/2e124062b331ff946932c4144c9f23f3fadd2a615400b54042ca02d401d653ea.jpg)
152
+ (a) Number of unique Wikipedia pages visited by crowdworkers.†
153
+
154
+ ![](images/2449f24123e5aee81fac65e19daf389cc59e149de906fb493374c63f30ca81a1.jpg)
155
+ (b) Number of search queries written by crowdworkers.
156
+ 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.
157
+
158
+ ![](images/26ba859f3912587cc8e0c30f537da9203cd336dc4082dc9bccc83a94366ba34f.jpg)
159
+ (c) Word cloud of the edits made in questions; and indicate added and deleted unigrams, respectively.
160
+
161
+ 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.
162
+
163
+ 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).
164
+
165
+ 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.
166
+
167
+ 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
168
+
169
+ 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\%$ .
170
+
171
+ # 5 Model
172
+
173
+ 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.
174
+
175
+ 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.
176
+
177
+ We develop SPANSEQGEN primarily because Karpukhin et al. (2020) is designed for generating a single answer, but SPANSEQGEN also boosts the
178
+
179
+ Algorithm 1 Democratic co-training with weak supervision (Section 5).
180
+ 1: // Each question in $D_{\text{full}}$ has an answer list annotated
181
+ 2: // Each question in $D_{\text{partial}}$ has one answer annotated
182
+ 3: $\hat{D}_{\text{full}} \gets D_{\text{full}}$
183
+ 4: for iter $\in \{1..N\}$ do
184
+ 5: // Train $C$ sequence-to-sequence QA models
185
+ 6: for $i \in \{1..C\}$ do
186
+ 7: $\phi_i \gets \text{train}(\hat{D}_{\text{full}})$
187
+ 8: $\hat{D}_L \gets D_{\text{full}}$
188
+ 9: for $(q^j, y^j) \in D_{\text{partial}}$ do
189
+ 10: // Get predictions by using $y_j$ as prefix
190
+ 11: $\hat{Y}^j \gets \{\hat{y} \mid \hat{y} \neq y^j$ , and
191
+ 12: $|\{i \mid \hat{y} \in \phi_i(q^j | y^j), 1 \leq i \leq C\}| > \frac{C}{2}$
192
+ 13: }
193
+ 14: if $|\hat{Y}^j| > 0$ then
194
+ 15: // Add it as a multiple answer case
195
+ 16: $\hat{D}_{\text{full}} \gets \hat{D}_L \cup \{(q^j, \{y^j\} \cup \hat{Y}^j)\}$
196
+ 17: else if $\forall i = 1..C, |\phi_i(x^j) - \{y^j\}| = 0$ then
197
+ 18: // Add it as a single answer case
198
+ 19: $\hat{D}_{\text{full}} \gets \hat{D}_L \cup \{(q^j, \{y^j\})\}$
199
+
200
+ performance on NQ-OPEN (41.5→42.2 on the test data). We include ablations on different approaches and models in Section 6.2.
201
+
202
+ 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.
203
+
204
+ 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.
205
+
206
+ # 6 Experiments
207
+
208
+ 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.
209
+
210
+ # 6.1 Baselines
211
+
212
+ 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}$ .
213
+
214
+ 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).
215
+
216
+ # 6.2 Results
217
+
218
+ Table 3 reports the performance of our baselines; example model outputs are provided in Table 5.
219
+
220
+ 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.
221
+
222
+ While SPANSEQGEN outperforms Karpukhin et al. (2020) with thresholding, the difference is
223
+
224
+ <table><tr><td rowspan="2">Model</td><td colspan="2">F1ans (all)</td><td colspan="2">F1ans (multi)</td><td colspan="2">F1BLEU</td><td colspan="2">F1EDIT-F1</td></tr><tr><td>dev</td><td>test</td><td>dev</td><td>test</td><td>dev</td><td>test</td><td>dev</td><td>test</td></tr><tr><td>DISAMBIG-FIRST</td><td>28.1</td><td>24.8</td><td>21.9</td><td>18.8</td><td>4.2</td><td>4.0</td><td>2.7</td><td>2.2</td></tr><tr><td>Thresholding + QD</td><td>37.1</td><td>32.3</td><td>28.4</td><td>24.8</td><td>13.4</td><td>11.3</td><td>6.6</td><td>5.5</td></tr><tr><td>SPANSEQGEN + QD</td><td>39.7</td><td>33.5</td><td>29.3</td><td>24.5</td><td>13.4</td><td>11.4</td><td>7.2</td><td>5.8</td></tr><tr><td>SPANSEQGEN† + QD</td><td>41.2</td><td>35.2</td><td>29.8</td><td>24.5</td><td>13.6</td><td>10.6</td><td>7.4</td><td>5.7</td></tr><tr><td>SPANSEQGEN† (Co-training) + QD</td><td>42.3</td><td>35.9</td><td>31.7</td><td>26.0</td><td>14.3</td><td>11.5</td><td>8.0</td><td>6.3</td></tr></table>
225
+
226
+ 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.
227
+
228
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">q</td><td rowspan="2">yi</td><td rowspan="2">y1...yi-1,yi+1...yn</td><td colspan="2">Full task</td><td colspan="2">Gold answers given</td></tr><tr><td>F1BLEU</td><td>F1EDIT-F1</td><td>F1BLEU</td><td>F1EDIT-F1</td></tr><tr><td>QD model</td><td>✓</td><td>✓</td><td>✓</td><td>14.3</td><td>8.0</td><td>40.1</td><td>19.2</td></tr><tr><td>- prompt question</td><td>-</td><td>✓</td><td>✓</td><td>6.7</td><td>7.7</td><td>15.1</td><td>19.2</td></tr><tr><td>- untargeted answers</td><td>✓</td><td>✓</td><td>-</td><td>14.2</td><td>7.3</td><td>41.2</td><td>17.2</td></tr><tr><td>Always prompt question</td><td>✓</td><td>-</td><td>-</td><td>15.9</td><td>0.0</td><td>47.4</td><td>0.0</td></tr></table>
229
+
230
+ 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).
231
+
232
+ 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.
233
+
234
+ 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.
235
+
236
+ There is a substantial difference in performance between development and test overall, likely due to distributional differences in the original questions
237
+
238
+ in NQ-OPEN; detailed discussion is in Appendix B.
239
+
240
+ 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.
241
+
242
+ 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]
243
+
244
+ 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
245
+
246
+ Prompt question #1: Where was snow white and the huntsman filmed?
247
+
248
+ # Reference:
249
+
250
+ Q: Where were beach scenes for snow white and huntsman predominantly filmed? / A: Marloes Sands Beach
251
+ Q: Where was principal photography for snow white and huntsman filmed? / A: United Kingdom
252
+ Q: Where was castle in snow white and huntsman filmed? / A: Gateholm island
253
+ Prediction of DISAMBIG-FIRST: $(\mathrm{F1}_{\mathrm{ans}} = 0.40, \mathrm{F1}_{\mathrm{EDIT - F1}} = 0.00)$
254
+ Q: Where was snow white and the huntsman filmed in 2017? / A: Marloes Sands Beach
255
+ Q: Where was snow white and the huntsman filmed during the filming of Season 1 of the TV series? / A: Marloes Sands Beach
256
+ Prediction of SPANSEQGEN: $(\mathrm{F1}_{\mathrm{ans}} = 0.80, \mathrm{F1}_{\mathrm{EDIT - F1}} = 0.69)$
257
+ Q: Where was snow white and huntsman principal photography filmed / A: United Kingdom
258
+ Q: Where were beach scenes for snow white and huntsman mostly filmed / A: Marloes Sands Beach
259
+
260
+ Prompt question #2: When was the city of new york founded?
261
+
262
+ # Reference:
263
+
264
+ Q: When was city of new york founded by dutch and initially called new amsterdam? / A: 1624
265
+ Q: When was city of new york under english control and renamed to new york? / A: 1664
266
+ Prediction of SPANSEQGEN: $(\mathrm{F1}_{\mathrm{ans}} = 1.00, \mathrm{F1}_{\mathrm{EDIT - F1}} = 0.67)$
267
+ Q: When was city of new york city founded with dutch protection? / A: 1624
268
+ Q: When was city of new york city founded and renamed with english name? / A: 1664
269
+
270
+ 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.
271
+
272
+ <table><tr><td colspan="2">Reference has multiple answers</td></tr><tr><td>Multiple answer prediction is correct</td><td>2%</td></tr><tr><td>Multiple answer prediction is partially correct†</td><td>40%</td></tr><tr><td>Multiple answer prediction is incorrect</td><td>14%</td></tr><tr><td colspan="2">Reference has one answer</td></tr><tr><td>Over-generated predictions</td><td>2%</td></tr><tr><td>Correct single answer prediction</td><td>26%</td></tr><tr><td>Incorrect single answer prediction</td><td>12%</td></tr><tr><td>Reference is incorrect</td><td>4%</td></tr></table>
273
+
274
+ In 15 out of 20 cases, the model generates only one answer.
275
+
276
+ our QD model conditioned on all available context is better than other variants in overall metrics.
277
+
278
+ 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).
279
+
280
+ Table 6: Analysis of predictions made by SPANSEQGEN with co-training, on 50 samples from the development data. Examples shown in Appendix (Table 10).
281
+
282
+ <table><tr><td>Model</td><td>NQ-OPEN
283
+ EM</td><td>F1ans
284
+ (all)</td><td>F1ans
285
+ (multi)</td></tr><tr><td>Dev</td><td></td><td></td><td></td></tr><tr><td>Min et al. (2019b)</td><td>34.7</td><td>30.8</td><td>20.4</td></tr><tr><td>Asai et al. (2020)</td><td>31.7</td><td>29.7</td><td>19.7</td></tr><tr><td>Karpukhin et al. (2020)</td><td>39.8</td><td>35.2</td><td>26.5</td></tr><tr><td>SPANSEQGEN</td><td>42.0</td><td>36.4</td><td>24.8</td></tr><tr><td>Test</td><td></td><td></td><td></td></tr><tr><td>Min et al. (2019b)</td><td>34.5</td><td>27.5</td><td>17.0</td></tr><tr><td>Asai et al. (2020)</td><td>32.6</td><td>27.9</td><td>17.7</td></tr><tr><td>Karpukhin et al. (2020)</td><td>41.5</td><td>30.1</td><td>23.2</td></tr><tr><td>SPANSEQGEN</td><td>42.2</td><td>30.8</td><td>20.7</td></tr></table>
286
+
287
+ 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.
288
+
289
+ # 6.3 Zero-shot results
290
+
291
+ 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
292
+
293
+ 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).
294
+
295
+ # 6.4 Error Analysis
296
+
297
+ 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.
298
+
299
+ # 7 Conclusion & Future Work
300
+
301
+ 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
302
+
303
+ 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.
304
+
305
+ 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.
306
+
307
+ # Acknowledgments
308
+
309
+ 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.
310
+
311
+ # References
312
+
313
+ Mohammad Aliannejadi, Hamed Zamani, Fabio Crestani, and W Bruce Croft. 2019. Asking clarifying questions in open-domain information-seeking conversations. In SIGIR.
314
+ 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.
315
+ Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on Freebase from question-answer pairs. In EMNLP.
316
+ 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.
317
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. 2017. Reading Wikipedia to answer open-domain questions. In ACL.
318
+ 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*.
319
+
320
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language understanding. In *NAACL*.
321
+ 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.
322
+ Ahmed Elgohary, Denis Peskov, and Jordan L. Boyd-Graber. 2019. Can you unpack that? learning to rewrite questions-in-context. In EMNLP.
323
+ Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020. REALM: Retrieval-augmented language model pre-training. In ICML.
324
+ Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. 2017. TriviaQA: A large scale distantly supervised challenge dataset for reading comprehension. In ACL.
325
+ 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.
326
+ 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.
327
+ Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. 2019. Latent retrieval for weakly supervised open domain question answering. In ACL.
328
+ 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.
329
+ Julian Michael, Gabriel Stanovsky, Luheng He, Ido Dagan, and Luke Zettlemoyer. 2018. Crowdsourcing question-answer meaning representations. In NAACL.
330
+ Sewon Min, Danqi Chen, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2019a. A discrete hard EM approach for weakly supervised question answering. In EMNLP.
331
+ 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.
332
+
333
+ 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.
334
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. BLEU: a method for automatic evaluation of machine translation. In ACL.
335
+ 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.
336
+ Sudha Rao and Hal Daumé III. 2018. Learning to ask good questions: Ranking clarification questions using neural expected value of perfect information. In ACL.
337
+ Sudha Rao and Hal Daumé III. 2019. Answer-based adversarial training for generating clarification questions. In *NAACL*.
338
+ Pavel Sountsov and Sunita Sarawagi. 2016. Length bias in encoder decoder models and a case for global conditioning. In EMNLP.
339
+ Felix Stahlberg and Bill Byrne. 2019. On nmt search errors and model errors: Cat got your tongue? In EMNLP.
340
+ Ellen M Voorhees et al. 1999. The TREC-8 question answering track report. In Trec.
341
+ 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.
342
+ 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.
343
+ 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.
344
+ Y. Zhou and S. Goldman. 2004. Democratic co-learning. In IEEE International Conference on Tools with Artificial Intelligence.
345
+
346
+ # A Data Collection Details
347
+
348
+ We use Amazon Mechanical Turk<sup>9</sup> and Spacro (Michael et al., 2018)<sup>10</sup> for crowdsourcing. All data was collected in February and March of 2020. We use the Google Search API<sup>11</sup> restricted to English Wikipedia for the search tool.
349
+
350
+ 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.
351
+
352
+ 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?"
353
+
354
+ 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.
355
+
356
+ 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.
357
+
358
+ 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\%$ .
359
+
360
+ # B Discrepancy between development and test in NQ-OPEN
361
+
362
+ 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.
363
+
364
+ 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.
365
+
366
+ 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.
367
+
368
+ 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
369
+
370
+ <table><tr><td rowspan="2">Model</td><td colspan="2">Any</td><td colspan="2">First</td></tr><tr><td>dev</td><td>test</td><td>dev</td><td>test</td></tr><tr><td>Min et al. (2019b)</td><td>34.7</td><td>34.5</td><td>32.4</td><td>25.7</td></tr><tr><td>Asai et al. (2020)</td><td>31.7</td><td>32.6</td><td>28.9</td><td>23.8</td></tr><tr><td>Karpukhin et al. (2020)</td><td>39.8</td><td>41.5</td><td>37.0</td><td>29.8</td></tr><tr><td>SPANSEQGEN</td><td>42.0</td><td>42.2</td><td>38.8</td><td>31.1</td></tr></table>
371
+
372
+ 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.
373
+
374
+ 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).<sup>13</sup>
375
+
376
+ 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.
377
+
378
+ # C Data Analysis Details
379
+
380
+ 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.
381
+
382
+ # D Baseline Implementation Details
383
+
384
+ Evidence corpus. We use English Wikipedia dump from 2018-12-20 and 2020-01-20 for NQ-OPEN and AMBIGNQ, respectively. Following
385
+
386
+ Karpukhin et al. (2020), we take the plain text and split passages to be up to 100 words each.
387
+
388
+ 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, F1<sub>ans</sub> or F1<sub>EDIT-F1</sub>) 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.
389
+
390
+ 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.
391
+
392
+ # E Error Analysis of SPANSEQGEN
393
+
394
+ 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.
395
+
396
+ ![](images/059cc696fed5d0c0e02fd8321d5a269744f6a4312fb4f81064d645db020202e0.jpg)
397
+
398
+ ![](images/151fdc8fa1aa6a0f3581ba596802d9dbedde7da8a5c1c4b0d373c4cc2cd688a5.jpg)
399
+
400
+ (a) Interface in the generation stage when the workers write a query and see the search results.
401
+
402
+ ![](images/9600dc2e36656187abc065961caa737ffa473ed8e59ce12c589e3942ad226194.jpg)
403
+
404
+ ![](images/798d746d6071c27385fb48662da4ab8ac771c17697c81a81a6c11b6509dc5734.jpg)
405
+
406
+ (b) Interface in the generation stage when the workers click and read one of Wikipedia pages from the search results.
407
+
408
+ ![](images/bc7ab73391859ef0a20fa7336a90cfc2cb6d406c471d15d0604324aa505500c6.jpg)
409
+ Figure 3: Interface for crowdsourcing.
410
+
411
+ ![](images/079315f51131eab3b53981c075f0399327c2c64d9c430e04ed9e3aad5efe318f.jpg)
412
+
413
+ (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.
414
+
415
+ <table><tr><td>Answer span mismatch (44%)</td></tr><tr><td>Q: Who did the artwork for pink floyd&#x27;s wall?
416
+ NQ-OPEN answer: Gerald Anthony Scarfe
417
+ AMBIGNQ answer:
418
+ Q: Who did the art work for the album cover of Pink Floyd&#x27;s The Wall? / A: Gerald Scarfe
419
+ Q: Who was the cinematographer for Pink Floyd - The Wall (1982 film)? / A: Peter Biziou</td></tr><tr><td>NQ-OPEN answer incorporated as a question (2%)</td></tr><tr><td>Q: What award did leonardo dicaprio won for the revenant?
420
+ NQ-OPEN answer: BAFTA Award; Academy Award for Best Actor; Golden Globe Award
421
+ AMBIGNQ answer:
422
+ Q: What British Academy Film Awards award did leonardo dicaprio won for the revenant? / A: Best Actor in a Leading Role
423
+ Q: What Academy award did leonardo dicaprio won for the revenant? / A: Best Actor
424
+ Q: What Golden Globe award did leonardo dicaprio won for the revenant? / A: Best Actor in a Motion Picture - Drama
425
+ (Other question-answer pairs omitted)</td></tr><tr><td>NQ-OPEN answer less specific (10%)</td></tr><tr><td>Q: When was the nba 3 point line introduced?
426
+ NQ-OPEN answer: 1979
427
+ AMBIGNQ answer: June 1979</td></tr><tr><td>NQ-OPEN answer incorrect and our answers include all possible answers (22%)</td></tr><tr><td>Q: Who was inducted into the national inventors hall of fame first?
428
+ NQ-OPEN answer: John Fitch
429
+ AMBIGNQ answer: Thomas Edison
430
+ Comment: Thomas Edison inducted in 1973, John Fitch inducted in 2006. John Fitch is mentioned as the earliest born inventor inducted.†</td></tr><tr><td>Mismatch from time-dependence (14%)</td></tr><tr><td>Q: Who has the most home runs in the home run derby?
431
+ NQ-OPEN answer: Todd Frazier
432
+ AMBIGNQ answer:
433
+ Q: Who has the most home runs in the the TV show the home run derby? / A: Mickey Mantle; Mickey Charles Mantle
434
+ Q: Who has the most home runs in the annual competition the home run derby? / A: Joc Russell Pederson; Joc Pederson</td></tr><tr><td>NQ-OPEN answer is reasonable and our answers miss it (4%)</td></tr><tr><td>Q: Who was the first person to settle dodge city?
435
+ NQ-OPEN answer: civilians
436
+ AMBIGNQ answer: Henry J. Sitler</td></tr><tr><td>NQ-OPEN answer incorrect but our answers miss another possible answer (4%)</td></tr><tr><td>Q: In which year were chips used inside the computer for the first time?
437
+ NQ-OPEN answer: 1975
438
+ AMBIGNQ answer: 1962
439
+ 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.‡</td></tr></table>
440
+
441
+ Table 9: Breakdown of cases that NQ-OPEN answer is not included in AMBIGNQ answers.
442
+ †en.wikipedia.org/wiki/List_of_National_Inventors_Hall_of_Fame_inductees
443
+ ‡en.wikipedia.org/wiki/History_of_computing_hardware_(1960s%E2%80%93present)
444
+
445
+ <table><tr><td>Reference has multiple answers; Multiple answer prediction is correct (2%) Prompt question: Who was england&#x27;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</td></tr><tr><td>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</td></tr><tr><td>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 } \)</td></tr><tr><td>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 } \)</td></tr><tr><td>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</td></tr><tr><td>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</td></tr><tr><td>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</td></tr></table>
446
+
447
+ 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.
448
+ Helena Bonham Carter played Red Queen.
449
+ $^{\ddagger}$ In fact, the model may have found time-dependency, because the eighth event happened only in 2019.
ambigqaansweringambiguousopendomainquestions/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71ac8fc14581b98c7b31579fd324d7013f1eb33123a4fa6e19b24e916dca9cc6
3
+ size 966707
ambigqaansweringambiguousopendomainquestions/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0b284fd1cd8b805d6e52e3e903b3098a34367db39a446e8f877bede6bd02914
3
+ size 521408
analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:502ba5462abf2093e3e37b0a501ec7b218d01c7d5b40b5b64bbc496f9f0bae3d
3
+ size 68791
analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce58fd22a81fecea2bb034105e53b7413f207681173ed81328c019dc7301d58b
3
+ size 86079
analogousprocessstructureinductionforsubeventsequenceprediction/d90e8e63-bf48-455f-897b-d778f8895622_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8095b3fe9834189f18909bff5196d6c97b12519d847078172773556283e642ab
3
+ size 1009438
analogousprocessstructureinductionforsubeventsequenceprediction/full.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Analogous Process Structure Induction for Sub-event Sequence Prediction
2
+
3
+ Hongming Zhang $^{1*}$ , Muhao Chen $^{2}$ , Haoyu Wang $^{2}$ , Yangqiu Song $^{1}$ , & Dan Roth $^{2}$
4
+
5
+ $^{1}$ Department of Computer Science and Engineering, HKUST
6
+
7
+ $^{2}$ Department of Computer and Information Science, UPenn
8
+
9
+ {hzhangal, yqsong}@cse.ust.hk
10
+
11
+ {why16gz1, muhao, danroth}@seas.upenn.edu
12
+
13
+ # Abstract
14
+
15
+ 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.
16
+
17
+ # 1 Introduction
18
+
19
+ 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
20
+
21
+ ![](images/2edebec26f5d45bb93925954833000334598c1e3c161e139a59a74f55861efcf.jpg)
22
+ Figure 1: An illustration of leveraging known processes to predict the sub-event sequence of a new process.
23
+
24
+ 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).
25
+
26
+ 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
27
+
28
+ ![](images/fd9b4b1bfa799e2f8a61d9ddfdd556d32dae4c195bb87583ea0b381af1ba49b2.jpg)
29
+ 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$ .
30
+
31
+ ability to identify vertical relations, that is, to predict the sub-event sequence of a new process<sup>3</sup>. 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.
32
+
33
+ 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
34
+
35
+ ![](images/e54c8ea5987ad2837ecb478bca6007e684fe17b7e4b9d56ced62bbf005ca6c2d.jpg)
36
+ Figure 3: Examples of Sub-Event Representations.
37
+
38
+ 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.
39
+
40
+ 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.
41
+
42
+ # 2 The APSI Framework
43
+
44
+ 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
45
+
46
+ 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.
47
+
48
+ # 2.1 Semantic Decomposition
49
+
50
+ 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$ .
51
+
52
+ # 2.2 Semantic Abstraction
53
+
54
+ 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
55
+
56
+ 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.
57
+
58
+ # 2.2.1 Modeling Event Conceptualization
59
+
60
+ 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:
61
+
62
+ $$
63
+ W \left(\mathcal {E} _ {C}\right) = \frac {1}{\sum_ {E \in \mathcal {E} _ {C}} F (E , C)}, \tag {1}
64
+ $$
65
+
66
+ 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 exclusive<sup>4</sup> 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.
67
+
68
+ 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}$ .
69
+
70
+ Algorithm 1 Event Conceptualization
71
+
72
+ 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}$ .
73
+
74
+ 1: Initialize event partition set $\mathcal{P} := \emptyset$ .
75
+ 2: while $\mathcal{E} \neq \emptyset$ do
76
+ 3: for Each $E \in \mathcal{E}$ do
77
+ 4: for Each $C \in \mathcal{C}_E$ do
78
+ 5: $\mathcal{E}_C\coloneqq \emptyset$
79
+ 6: Compute $F(E, C)$ using Eq. (2).
80
+ 7: end for
81
+
82
+ 8: end for
83
+ 9: for Each $C \in \mathcal{C}$ do
84
+ 10: for Each $E\in \mathcal{E}$ do
85
+ 11: if $C\in \mathcal{C}_E$ then
86
+ 12: $\mathcal{E}_C\coloneqq \mathcal{E}_C\cup \{E\} .$
87
+ 13: end if
88
+ 14: end for
89
+ 15: Compute $W(\mathcal{E}_C)$ using Eq. (1).
90
+ 16: end for
91
+ 17: Select $\mathcal{E}_{C_{min}}$ with the minimum $W$ score.
92
+ 18: $\mathcal{E} := \mathcal{E} \setminus \tilde{\mathcal{E}}_C$ .
93
+ 19: $\mathcal{P} := \mathcal{P} \cup \{\hat{\mathcal{E}}_{C_{min}}\}$ .
94
+ 20: end while
95
+
96
+ 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$ .
97
+
98
+ 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:
99
+
100
+ $$
101
+ F (E, C) = \prod_ {i = 1} ^ {m} w ^ {D \left(w _ {i} ^ {E}, w _ {i} ^ {C}\right)}, \tag {2}
102
+ $$
103
+
104
+ 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.
105
+
106
+ 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
107
+
108
+ 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}|$ .
109
+
110
+ # 2.2.2 Conceptualized Event Ordering
111
+
112
+ 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:
113
+
114
+ $$
115
+ 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}
116
+ $$
117
+
118
+ 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.
119
+
120
+ # 2.3 Sub-event Sequence Prediction
121
+
122
+ 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
123
+
124
+ 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:
125
+
126
+ $$
127
+ \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}
128
+ $$
129
+
130
+ $$
131
+ \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}
132
+ $$
133
+
134
+ 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.
135
+
136
+ # 3 Evaluation
137
+
138
+ 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.
139
+
140
+ # 3.1 Dataset
141
+
142
+ 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.
143
+
144
+ # 3.2 Baseline Methods
145
+
146
+ 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
147
+
148
+ 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).
149
+
150
+ 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.
151
+
152
+ 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.
153
+
154
+ # 3.3 Intrinsic Evaluation
155
+
156
+ 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 length<sup>10</sup> to evaluated systems and ask them to generate a fixed-length sub-event sequence.
157
+
158
+ # 3.3.1 Evaluation Metric
159
+
160
+ 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
161
+
162
+ <table><tr><td rowspan="2">Model</td><td colspan="2">String Match</td><td colspan="2">Hypernym Allowed</td></tr><tr><td>E-ROUGE1</td><td>E-ROUGE2</td><td>E-ROUGE1</td><td>E-ROUGE2</td></tr><tr><td>Random</td><td>2.9165</td><td>0.4664</td><td>23.5873</td><td>8.1089</td></tr><tr><td>Seq2seq (GloVe)</td><td>5.0323</td><td>1.4965</td><td>27.8710</td><td>13.0946</td></tr><tr><td>Seq2seq (RoBERTa)</td><td>4.5455</td><td>0.4831</td><td>28.0032</td><td>12.8502</td></tr><tr><td>Top one similar process (Jaccard)</td><td>8.8589</td><td>5.1000</td><td>28.6548</td><td>14.6231</td></tr><tr><td>Top one similar process (GloVe)</td><td>9.8797</td><td>5.1452</td><td>29.4203</td><td>13.6001</td></tr><tr><td>Top one similar process (RoBERTa)</td><td>9.2599</td><td>4.7390</td><td>30.6599</td><td>15.8417</td></tr><tr><td>Analogous Process Structure Induction (APSI)</td><td>14.8013</td><td>6.6045</td><td>36.1648</td><td>19.2418</td></tr><tr><td>Human</td><td>29.0189</td><td>15.2542</td><td>50.4647</td><td>29.4423</td></tr></table>
163
+
164
+ (a) Basic Setting (for each sub-event, we only predict and evaluate the verb)
165
+
166
+ <table><tr><td rowspan="2">Model</td><td colspan="2">String Match</td><td colspan="2">Hypernym Allowed</td></tr><tr><td>E-ROUGE1</td><td>E-ROUGE2</td><td>E-ROUGE1</td><td>E-ROUGE2</td></tr><tr><td>Random</td><td>0.0000</td><td>0.0000</td><td>0.5104</td><td>0.0903</td></tr><tr><td>Seq2seq (GloVe)</td><td>0.1935</td><td>0.0534</td><td>0.9677</td><td>0.1069</td></tr><tr><td>Seq2seq (RoBERTa)</td><td>0.4870</td><td>0.0000</td><td>1.7857</td><td>0.2899</td></tr><tr><td>Top one similar process (Jaccard)</td><td>0.6562</td><td>0.2257</td><td>2.4797</td><td>0.5867</td></tr><tr><td>Top one similar process (GloVe)</td><td>0.8750</td><td>0.2106</td><td>2.8801</td><td>0.7372</td></tr><tr><td>Top one similar process (RoBERTa)</td><td>0.9479</td><td>0.3009</td><td>3.2811</td><td>0.9929</td></tr><tr><td>Analogous Process Structure Induction (APSI)</td><td>3.4988</td><td>0.4513</td><td>6.1611</td><td>1.1885</td></tr><tr><td>Human</td><td>11.6351</td><td>5.5905</td><td>18.0034</td><td>8.2695</td></tr></table>
167
+
168
+ (b) Advanced Setting (for each sub-event, we predict and evaluate all words)
169
+
170
+ 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.
171
+
172
+ 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.
173
+
174
+ # 3.3.2 Implementation Details
175
+
176
+ 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.
177
+
178
+ # 3.3.3 Result Analysis
179
+
180
+ 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
181
+
182
+ 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.
183
+
184
+ # 3.3.4 Effect of the Instantiation Module
185
+
186
+ One key step in our framework is how to leverage the two abstract representations to predict the fi
187
+
188
+ ![](images/31807b66f922476c618ae418ab5cce9f94a5fecc9340ce5f7d94f862c703420e.jpg)
189
+ 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.
190
+
191
+ ![](images/5434a28192cb87003089f66aa1cc9d2c8dda630901f579d81df06a7d737b798f.jpg)
192
+
193
+ <table><tr><td>Model</td><td>E-ROUGE1</td><td>E-ROUGE2</td></tr><tr><td>Simple Merge</td><td>2.5884</td><td>0.4062</td></tr><tr><td>Normalized</td><td>2.2238</td><td>0.3611</td></tr><tr><td>APSI (Instantiation)</td><td>3.4988</td><td>0.4513</td></tr></table>
194
+
195
+ Table 2: Performance of different merging methods.
196
+
197
+ 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.
198
+
199
+ 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,
200
+
201
+ ![](images/00f7955aa48a9e4ebe7cdbbacf31c67c7887c2ec001bfbb2f79221b25e09b96c.jpg)
202
+ Figure 5: Case Study. We mark the covered and not covered predictions with green and red colors.
203
+
204
+ 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.
205
+
206
+ # 3.3.5 Hyper-parameter Analysis
207
+
208
+ 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.
209
+
210
+ ![](images/101f9d5e8456132180188ca5cf84772ad2fbcb2b3749572e1898e85f5adab0bd.jpg)
211
+ 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.
212
+
213
+ # 3.3.6 Case Study
214
+
215
+ 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.
216
+
217
+ # 3.4 Extrinsic Evaluation
218
+
219
+ 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.
220
+
221
+ The baseline method we are comparing with is the event-based masked language model<sup>11</sup>, whose
222
+
223
+ <table><tr><td>Model</td><td>Accuracy</td><td>Δ</td></tr><tr><td>RoBERTa-based Event LM</td><td>73.59%</td><td>-</td></tr><tr><td>+ Seq2seq (GloVe)</td><td>73.06%</td><td>-0.53%</td></tr><tr><td>+ Seq2seq (RoBERTa)</td><td>72.33%</td><td>-1.26%</td></tr><tr><td>+ Top1 similar (Jaccard)</td><td>72.76%</td><td>-0.83%</td></tr><tr><td>+ Top1 similar (GloVe)</td><td>74.14%</td><td>0.55%</td></tr><tr><td>+ Top1 similar (RoBERTa)</td><td>74.16%</td><td>0.57%</td></tr><tr><td>+ APSI</td><td>74.78%†</td><td>1.19%</td></tr><tr><td>+ Human</td><td>76.97%‡</td><td>3.38%</td></tr></table>
224
+
225
+ 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.
226
+
227
+ 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.
228
+
229
+ 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.
230
+
231
+ # 4 Related Works
232
+
233
+ 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.
234
+
235
+ # 5 Conclusion
236
+
237
+ 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
238
+
239
+ plication method, the process knowledge can help better predict missing events.
240
+
241
+ # Acknowledgements
242
+
243
+ 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.
244
+
245
+ # References
246
+
247
+ Valerie Abbott, John B Black, and Edward E Smith. 1985. The representation of scripts in memory. Journal of memory and language, pages 179-199.
248
+ Collin F. Baker, Charles J. Fillmore, and John B. Lowe. 1998. The Berkeley FrameNet Project. In Proceedings of COLING-ACL 1998, pages 86-90.
249
+ 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.
250
+ Alexander Budanitsky and Graeme Hirst. 2006. Evaluating wordnet-based measures of lexical semantic relatedness. Comput. Linguistics, 32(1):13-47.
251
+ Nathanael Chambers and Daniel Jurafsky. 2008. Unsupervised learning of narrative event chains. In Proceedings of ACL 2008, pages 789-797.
252
+ 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.
253
+ 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.
254
+ 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.
255
+
256
+ 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.
257
+ Richard M. Karp. 1972. Reducibility among combinatorial problems. In Proceedings of a symposium on the Complexity of Computer Computations 1972, pages 85-103.
258
+ Mahnaz Koupae and William Yang Wang. 2018. Wikihow: A large scale text summarization dataset. CoRR, abs/1810.09305.
259
+ Chin-Yew Lin. 2004. ROUGE: A package for automatic evaluation of summaries. In Proceedings of Text Summarization Branches Out 2004, pages 74-81.
260
+ 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.
261
+ Songjian Lu and Xinghua Lu. 2014. An exact algorithm for the weighed mutually exclusive maximum set cover problem. CoRR, abs/1401.6385.
262
+ George A Miller. 1998. WordNet: An electronic lexical database. MIT press.
263
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. Glove: Global vectors for word representation. In Proceedings of EMNLP 2014, pages 1532-1543.
264
+ 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.
265
+ 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.
266
+ 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.
267
+ DE Rumelhart. 1975. Notes on a schema for stories language, thought, and culture. Representation and understanding, pages 211-236.
268
+ Roger C Schank and Robert P Abelson. 1977. Scripts, plans, goals and understanding: An inquiry into human knowledge structures.
269
+ Karin Kipper Schuler. 2005. Verbnet: A broad-coverage, comprehensive verb lexicon.
270
+
271
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. In Proceedings of NeurIPS 2014, pages 3104-3112.
272
+ Jeffrey M Zacks and Barbara Tversky. 2001. Event structure in perception and conception. Psychological bulletin, 127(1):3.
273
+ 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.
274
+ 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.
275
+ 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.
analogousprocessstructureinductionforsubeventsequenceprediction/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e3e16294c887cf5e72b16cfcdeba272b3227721ce1086735544102a07ce508e
3
+ size 412798
analogousprocessstructureinductionforsubeventsequenceprediction/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f004cbf22881d0d3e55ef00368a61395b71cdbe41a0c65aca79143092ab33368
3
+ size 413815
analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e86b3a8954007f9247e51d07a7035bc6c832fe53828348da01d668dc33bfb309
3
+ size 98497
analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ae0ce5b6b958af05259378eaea5d1bfcf323b1920ee40d1c834bafd55817fe9
3
+ size 119840
analyzingindividualneuronsinpretrainedlanguagemodels/bc104b18-3933-4789-890b-bf9cec4c8497_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0530dc1e4929f2d7cc8ac1bc606d3bb12f2c60c59177b55be422bbd155026092
3
+ size 631742
analyzingindividualneuronsinpretrainedlanguagemodels/full.md ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Analyzing Individual Neurons in Pre-trained Language Models
2
+
3
+ Nadir Durrani Hassan Sajjad Fahim Dalvi Yonatan Belinkov\*
4
+
5
+ {ndurrani,hsajjad,faimaduddin}@hbku.edu.qa
6
+
7
+ Qatar Computing Research Institute, HBKU Research Complex, Doha 5825, Qatar
8
+
9
+ *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
10
+
11
+ # Abstract
12
+
13
+ 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.
14
+
15
+ # 1 Introduction
16
+
17
+ 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.
18
+
19
+ 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.,
20
+
21
+ 2016; Adi et al., 2016; Belinkov et al., 2017a,b; Dalvi et al., 2017; Blevins et al., 2018).
22
+
23
+ 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.
24
+
25
+ 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.
26
+
27
+ 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?
28
+
29
+ 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
30
+
31
+ 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.
32
+
33
+ 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:
34
+
35
+ - 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.
36
+ - Low level tasks such as predicting morphology require fewer neurons compared to high level tasks such as predicting syntax.
37
+ - Some phenomena (e.g. Verbs) are distributed across many neurons while others (e.g. Interjections) are localized in a fewer neurons.
38
+ - Lower layers contain more word-level specialized neurons, and higher layers contain neurons specialized in syntax-level information.
39
+ - 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.
40
+
41
+ # 2 Methodology
42
+
43
+ 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.
44
+
45
+ Probe: We go a level deeper and identify neurons within the learned representations to carry out
46
+
47
+ 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:
48
+
49
+ $$
50
+ \mathcal {L} (\theta) = - \sum_ {i} \log P _ {\theta} (t _ {w _ {i}} | w _ {i}) + \lambda_ {1} \| \theta \| _ {1} + \lambda_ {2} \| \theta \| _ {2} ^ {2}
51
+ $$
52
+
53
+ 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.
54
+
55
+ 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
56
+
57
+ 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$ .
58
+
59
+ 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:
60
+
61
+ $$
62
+ \mathcal {S} (\lambda_ {1}, \lambda_ {2}) = \alpha (A _ {t} - A _ {b}) - \beta (A _ {z} - A _ {l})
63
+ $$
64
+
65
+ 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.
66
+
67
+ 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.
68
+
69
+ 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
70
+
71
+ 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.
72
+
73
+ # 3 Experimental Setup
74
+
75
+ 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.
76
+
77
+ Language Tasks: We evaluated our method on 4 linguistic tasks: POS-tagging using the Penn TreeBank (Marcus et al., 1993), syntax tagging (CCG supertagging)<sup>7</sup> 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
78
+
79
+ velopment and test data (See Appendix A.1)
80
+
81
+ 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.
82
+
83
+ # 4 Evaluation
84
+
85
+ # 4.1 Ablation Study
86
+
87
+ 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.
88
+
89
+ # 4.2 Minimal Neuron Set
90
+
91
+ Now that we have established correctness of the rankings, we apply the algorithm incrementally to select minimal neurons for each linguistic task
92
+
93
+ <table><tr><td></td><td>BERT</td><td>XLNet</td><td>T-ELMo</td><td>ELMo</td></tr><tr><td colspan="5">POS</td></tr><tr><td>All</td><td>96.04</td><td>96.13</td><td>96.39</td><td>96.48</td></tr><tr><td>Top</td><td>90.16</td><td>92.28</td><td>91.96</td><td>83.01</td></tr><tr><td>Random</td><td>28.45</td><td>58.17</td><td>48.40</td><td>30.80</td></tr><tr><td>Bottom</td><td>16.86</td><td>44.64</td><td>21.11</td><td>15.56</td></tr><tr><td colspan="5">SEM</td></tr><tr><td>All</td><td>92.09</td><td>92.64</td><td>91.94</td><td>93.29</td></tr><tr><td>Top</td><td>84.32</td><td>90.70</td><td>84.16</td><td>81.23</td></tr><tr><td>Random</td><td>64.28</td><td>72.14</td><td>66.15</td><td>75.82</td></tr><tr><td>Bottom</td><td>59.02</td><td>25.37</td><td>36.14</td><td>58.32</td></tr><tr><td colspan="5">Chunking</td></tr><tr><td>All</td><td>95.01</td><td>94.15</td><td>93.43</td><td>93.14</td></tr><tr><td>Top</td><td>89.01</td><td>89.16</td><td>87.63</td><td>82.51</td></tr><tr><td>Random</td><td>75.83</td><td>75.26</td><td>79.40</td><td>70.23</td></tr><tr><td>Bottom</td><td>66.82</td><td>46.66</td><td>48.11</td><td>64.39</td></tr><tr><td colspan="5">CCG</td></tr><tr><td>All</td><td>92.16</td><td>92.55</td><td>91.70</td><td>91.19</td></tr><tr><td>Top</td><td>75.13</td><td>76.48</td><td>71.31</td><td>68.19</td></tr><tr><td>Random</td><td>71.11</td><td>63.71</td><td>68.23</td><td>41.17</td></tr><tr><td>Bottom</td><td>59.13</td><td>62.42</td><td>67.11</td><td>30.32</td></tr></table>
94
+
95
+ 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.
96
+
97
+ 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.
98
+
99
+ 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
100
+
101
+ <table><tr><td></td><td>BERT</td><td>XLNet</td><td>T-ELMo</td><td>ELMo</td></tr><tr><td>Neuα</td><td>9984</td><td>9984</td><td>7168</td><td>3072</td></tr><tr><td colspan="5">POS</td></tr><tr><td>Neut</td><td>400/4%</td><td>400/4%</td><td>430/6%</td><td>368/12%</td></tr><tr><td>Acca</td><td>96.04</td><td>96.13</td><td>96.39</td><td>96.48</td></tr><tr><td>Acct</td><td>95.86</td><td>96.49</td><td>96.07</td><td>96.22</td></tr><tr><td>Selα</td><td>14.45</td><td>23.49</td><td>22.65</td><td>19.82</td></tr><tr><td>Selt</td><td>31.68</td><td>31.82</td><td>37.31</td><td>38.51</td></tr><tr><td colspan="5">SEM</td></tr><tr><td>Neut</td><td>400/4%</td><td>400/4%</td><td>716/10%</td><td>307/10%</td></tr><tr><td>Acca</td><td>92.09</td><td>92.64</td><td>91.94</td><td>93.29</td></tr><tr><td>Acct</td><td>92.12</td><td>92.62</td><td>91.97</td><td>93.17</td></tr><tr><td>Selα</td><td>5.77</td><td>14.03</td><td>12.78</td><td>11.18</td></tr><tr><td>Selt</td><td>27.17</td><td>26.55</td><td>23.87</td><td>32.28</td></tr><tr><td colspan="5">Chunking</td></tr><tr><td>Neut</td><td>1000/10%</td><td>1000/10%</td><td>860/12%</td><td>983/32%</td></tr><tr><td>Acca</td><td>95.01</td><td>94.62</td><td>93.43</td><td>93.14</td></tr><tr><td>Acct</td><td>94.99</td><td>94.17</td><td>93.37</td><td>93.08</td></tr><tr><td>Selα</td><td>16.30</td><td>22.77</td><td>24.42</td><td>18.13</td></tr><tr><td>Selt</td><td>29.19</td><td>28.42</td><td>30.95</td><td>26.21</td></tr><tr><td colspan="5">CCG</td></tr><tr><td>Neut</td><td>1500/15%</td><td>1500/15%</td><td>2365/33%</td><td>1014/33%</td></tr><tr><td>Acca</td><td>92.16</td><td>92.55</td><td>91.7</td><td>91.19</td></tr><tr><td>Acct</td><td>92.36</td><td>92.39</td><td>91.39</td><td>90.95</td></tr><tr><td>Selα</td><td>7.33</td><td>14.02</td><td>11.99</td><td>11.48</td></tr><tr><td>Selt</td><td>15.06</td><td>24.15</td><td>18.32</td><td>17.88</td></tr></table>
102
+
103
+ 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.
104
+
105
+ 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
106
+
107
+ 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)$ .
108
+
109
+ <table><tr><td></td><td>BERT</td><td>XLNet</td><td>T-ELMo</td><td>ELMo</td></tr><tr><td>Neuα</td><td>9984</td><td>9984</td><td>7168</td><td>3072</td></tr><tr><td colspan="5">POS</td></tr><tr><td>Neut</td><td>250/2.5%</td><td>250/2.5%</td><td>215/3%</td><td>153/5%</td></tr><tr><td>Acca</td><td>96.04</td><td>96.13</td><td>96.39</td><td>96.48</td></tr><tr><td>Acct</td><td>93.70</td><td>95.72</td><td>94.92</td><td>94.45</td></tr><tr><td colspan="5">SEM</td></tr><tr><td>Neut</td><td>250/2.5%</td><td>400/4%</td><td>286/4%</td><td>307/5%</td></tr><tr><td>Acca</td><td>92.09</td><td>92.64</td><td>91.94</td><td>93.29</td></tr><tr><td>Acct</td><td>91.44</td><td>90.92</td><td>90.17</td><td>93.17</td></tr><tr><td colspan="5">Chunking</td></tr><tr><td>Neut</td><td>600/6%</td><td>600/6%</td><td>430/6%</td><td>614/20%</td></tr><tr><td>Acca</td><td>95.01</td><td>94.62</td><td>93.43</td><td>93.14</td></tr><tr><td>Acct</td><td>93.53</td><td>92.83</td><td>92.28</td><td>91.79</td></tr><tr><td colspan="5">CCG</td></tr><tr><td>Neut</td><td>698/7%</td><td>734/8%</td><td>716/10%</td><td>675/22%</td></tr><tr><td>Acca</td><td>92.16</td><td>92.55</td><td>91.70</td><td>91.19</td></tr><tr><td>Acct</td><td>91.73</td><td>91.11</td><td>89.79</td><td>89.08</td></tr></table>
110
+
111
+ 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.
112
+
113
+ (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.
114
+
115
+ 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
116
+
117
+ 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).
118
+
119
+ # 5 Analysis
120
+
121
+ # 5.1 Layer-wise Distribution
122
+
123
+ 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
124
+
125
+ imum contribution in XLNet consistently across the tasks. Let us analyze the results with respect to each linguistic task.
126
+
127
+ 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.
128
+
129
+ 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.
130
+
131
+ 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.
132
+
133
+ 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.
134
+
135
+ 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
136
+
137
+ ![](images/150eeba2511644295ca707acae8706038080b86fc78a97d27239e334b52a0ea2.jpg)
138
+ (a) POS-BERT
139
+
140
+ ![](images/50f9c97af2d2c45c264e843b24da1d522f81b65f8df49c37702af445ef5ad3f1.jpg)
141
+ (b) POS-XLNet
142
+
143
+ ![](images/c12f5e8e99fef25148b1310911c6447d9645c9dd6e84a64d32853f0aa354c66d.jpg)
144
+ (c) POS - T-ELMo
145
+
146
+ ![](images/3a17e1c9938451a23ce4df5a79f3e358e2ca9c3da1c85080eeb54d459aca4348.jpg)
147
+ (d) POS - ELMo
148
+
149
+ ![](images/ac863742d5d63e931a2d8217fa6012822cdc65fe56f189faa0d0e0d13f94cf42.jpg)
150
+ (e) SEM-BERT
151
+
152
+ ![](images/79afef706c204ef09c20ef534e07c42e54b7326619047a9209299d3f445bde54.jpg)
153
+ (f) SEM-XLNet
154
+
155
+ ![](images/faaf4b3e5046307db1a7a21b3d1fbc5495ca0cf3c91957f45b63e23875e32c32.jpg)
156
+ (g) SEM - T-ELMo
157
+
158
+ ![](images/7a07d437c57bf0c5e30d176b34cdeb32aa65166f1bbb5e5ffa057daf84e9114d.jpg)
159
+ (h) SEM - ELMo
160
+
161
+ ![](images/1da1a36551cf5b07fe2897977699363e07031decd743041ec83d0b5729267b47.jpg)
162
+ (i)Chunking-BERT
163
+
164
+ ![](images/ccbe8be2dc9fbbc513b67522c39d568a7fa9fe951fc3c57d3f76914ec0b1f9b4.jpg)
165
+
166
+ ![](images/4fd7d1d135f0be9d2c9376cc7611a48e92c66b5dcc1552ccee097c3ed96274c1.jpg)
167
+ (k)Chunking-T-ELMo
168
+
169
+ ![](images/73ef557409049ee9a0b63cdc31be732bebb719401dacf61cf8900e8c51808ebf.jpg)
170
+
171
+ ![](images/0c342b917d66e89454fba3980e4f768c5c5bde28aa35a0e1b2c65d35d504849e.jpg)
172
+ (m) CCG-BERT
173
+
174
+ ![](images/88ac51f83006a580149aa2d8e476a81ae78f45111dc59a5f7341163d441352ec.jpg)
175
+ (j)Chunking-XLNet
176
+ (n) CCG-XLNet
177
+
178
+ ![](images/1718de93416beda989a5153a07f178dfcab79c288165e134989f8626247fd757.jpg)
179
+ (o) CCG - T-ELMo
180
+
181
+ ![](images/abb4e2939975beb0a8a91bfb635ffadcc48256abf532d832cc1ddfe79f95ae04.jpg)
182
+ (1)Chunking-ELMo
183
+ (p) CCG - ELMo
184
+
185
+ 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).
186
+
187
+ # 5.2 Localization versus Distributedness
188
+
189
+ 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.
190
+
191
+ ![](images/53ac336b7137010f064a61b68b98ed5eddef3580b1f6c16c634e59590a3f48f7.jpg)
192
+ 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
193
+ 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
194
+
195
+ 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
196
+
197
+ ![](images/19b10b13db8e2ca3cd4380336ae4f8acbbc1f7f12387da458ba4bccd6aaed214.jpg)
198
+ Figure 3: Top neurons in XLNet are more localized towards individual properties compared to other architectures
199
+
200
+ ![](images/882885f48bb1b1a7052c4481f315fe1912a406ec4bfd7a95ff6e9e1c730ec311.jpg)
201
+
202
+ 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.
203
+
204
+ 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.
205
+
206
+ 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 labels<sup>10</sup> 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
207
+
208
+ 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.
209
+
210
+ # 6 Related Work
211
+
212
+ 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.
213
+
214
+ 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.
215
+
216
+ Our work is most similar to Dalvi et al. (2019) who conducted neuron analysis of representations learned from sequence-to-sequence machine trans
217
+
218
+ 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).
219
+
220
+ 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.
221
+
222
+ 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
223
+
224
+ 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.
225
+
226
+ # 7 Conclusion
227
+
228
+ 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.
229
+
230
+ # Acknowledgements
231
+
232
+ 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).
233
+
234
+ # References
235
+
236
+ 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.
237
+ 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.
238
+ Srinivas Bangalore and Aravind K. Joshi. 1999. Supertagging: An approach to almost parsing. Computational Linguistics, 25(2).
239
+ 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.
240
+ 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.
241
+ 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.
242
+ Yonatan Belinkov and James Glass. 2019. Analysis methods in neural language processing: A survey. Transactions of the Association for Computational Linguistics, 7:49-72.
243
+ 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).
244
+ 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.
245
+ 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.
246
+
247
+ 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).
248
+ 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).
249
+ 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).
250
+ 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.
251
+ 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.
252
+ 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.
253
+ 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.
254
+ 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.
255
+ Julia Hockenmaier. 2006. Creating a CCGbank and a wide-coverage CCG lexicon for German. In Proceedings of the 21st International Conference on
256
+
257
+ Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, ACL '06, pages 505-512, Sydney, Australia.
258
+ 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.
259
+ Andrej Karpathy, Justin Johnson, and Li Fei-Fei. 2015. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078.
260
+ 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.
261
+ Diederik Kingma and Jimmy Ba. 2014. Adam: A Method for Stochastic Optimization. arXiv preprint arXiv:1412.6980.
262
+ 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.
263
+ 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.
264
+ 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.
265
+ 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.
266
+ 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.
267
+
268
+ 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.
269
+ 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.
270
+ 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.
271
+ 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.
272
+ 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.
273
+ 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.
274
+ Xavier Suau, Luca Zappella, and Nicholas Apostoloff. 2020. Finding experts in transformer models. CoRR, abs/2005.07647.
275
+ 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.
276
+ 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.
277
+ 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
278
+
279
+ 37-42, Florence, Italy. Association for Computational Linguistics.
280
+ 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.
281
+ 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.
282
+ 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.
283
+ 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.
284
+ 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.
285
+
286
+ # A Appendices
287
+
288
+ # A.1 Data and Representations
289
+
290
+ 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 repository<sup>11</sup> 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.
291
+
292
+ <table><tr><td>Task</td><td>Train</td><td>Dev</td><td>Test</td><td>Tags</td></tr><tr><td>POS</td><td>36557</td><td>1802</td><td>1963</td><td>44</td></tr><tr><td>SEM</td><td>36928</td><td>5301</td><td>10600</td><td>73</td></tr><tr><td>Chunking</td><td>8881</td><td>1843</td><td>2011</td><td>22</td></tr><tr><td>CCG</td><td>39101</td><td>1908</td><td>2404</td><td>1272</td></tr></table>
293
+
294
+ # A.2 Hyperparameters
295
+
296
+ 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.
297
+
298
+ 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
299
+
300
+ <table><tr><td></td><td>BERT</td><td>XLNet</td><td>T-ELMo</td><td>ELMo</td></tr><tr><td colspan="5">L1, L2 = λ1, λ2</td></tr><tr><td>POS</td><td>.001, .01</td><td>.001, .01</td><td>.001, .001</td><td>.001, .0001</td></tr><tr><td>SEM</td><td>.001, .01</td><td>.001, .01</td><td>.001, .001</td><td>.001, .0001</td></tr><tr><td>Chunk</td><td>1e-4, 1e-5</td><td>1e-4, 1e-4</td><td>.001, .001</td><td>.001, .01</td></tr><tr><td>CCG</td><td>1e-5, 1e-6</td><td>1e-5, 1e-6</td><td>1e-4, 1e-6</td><td>1e-5, 1e-6</td></tr></table>
301
+
302
+ # A.3 Infrastructure and Run Time
303
+
304
+ 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$
305
+
306
+ Table 5: Best elastic-net lambdas parameters for each task
307
+
308
+ <table><tr><td></td><td>BERT</td><td>XLNet</td><td>T-ELMo</td><td>ELMo</td></tr><tr><td colspan="5">POS</td></tr><tr><td>All</td><td>96.10</td><td>96.38</td><td>96.61</td><td>96.45</td></tr><tr><td>Top</td><td>90.32</td><td>93.07</td><td>92.13</td><td>85.03</td></tr><tr><td>Rand</td><td>29.43</td><td>57.32</td><td>49.14</td><td>32.18</td></tr><tr><td>Bot</td><td>17.99</td><td>45.61</td><td>23.01</td><td>17.36</td></tr><tr><td colspan="5">SEM</td></tr><tr><td>All</td><td>92.63</td><td>92.16</td><td>92.40</td><td>93.35</td></tr><tr><td>Top</td><td>85.17</td><td>90.91</td><td>84.13</td><td>83.01</td></tr><tr><td>Rand</td><td>65.12</td><td>71.11</td><td>65.11</td><td>74.18</td></tr><tr><td>Bot</td><td>58.19</td><td>26.11</td><td>35.99</td><td>57.11</td></tr><tr><td colspan="5">Chunking</td></tr><tr><td>All</td><td>95.11</td><td>94.19</td><td>93.93</td><td>93.85</td></tr><tr><td>Top</td><td>90.13</td><td>90.03</td><td>88.13</td><td>83.12</td></tr><tr><td>Rand</td><td>74.12</td><td>75.63</td><td>78.19</td><td>71.48</td></tr><tr><td>Bot</td><td>64.13</td><td>45.43</td><td>47.16</td><td>65.12</td></tr><tr><td colspan="5">CCG</td></tr><tr><td>All</td><td>92.23</td><td>92.43</td><td>91.66</td><td>91.23</td></tr><tr><td>Top</td><td>75.61</td><td>76.31</td><td>71.22</td><td>68.09</td></tr><tr><td>Rand</td><td>70.01</td><td>63.11</td><td>68.03</td><td>41.37</td></tr><tr><td>Bot</td><td>61.12</td><td>62.31</td><td>67.99</td><td>30.12</td></tr></table>
309
+
310
+ 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).
311
+
312
+ (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).
313
+
314
+ # A.4 Ablation Study
315
+
316
+ 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.
317
+
318
+ <table><tr><td></td><td>BERT</td><td>XLNet</td><td>T-ELMo</td><td>ELMo</td></tr><tr><td>Neuα</td><td>9984</td><td>9984</td><td>7168</td><td>3072</td></tr><tr><td colspan="5">POS</td></tr><tr><td>Neut</td><td>400/4%</td><td>400/4%</td><td>430/6%</td><td>368/12%</td></tr><tr><td>Acca</td><td>96.10</td><td>96.38</td><td>96.61</td><td>96.45</td></tr><tr><td>Acct</td><td>96.48</td><td>96.52</td><td>96.33</td><td>96.07</td></tr><tr><td>Selα</td><td>15.51</td><td>23.43</td><td>22.69</td><td>19.12</td></tr><tr><td>Selt</td><td>31.81</td><td>31.62</td><td>37.61</td><td>38.52</td></tr><tr><td colspan="5">SEM</td></tr><tr><td>Neut</td><td>400/4%</td><td>400/4%</td><td>716/10%</td><td>307/10%</td></tr><tr><td>Acca</td><td>92.63</td><td>92.16</td><td>92.40</td><td>93.35</td></tr><tr><td>Acct</td><td>92.19</td><td>92.59</td><td>92.17</td><td>93.21</td></tr><tr><td>Selα</td><td>5.82</td><td>14.01</td><td>12.19</td><td>11.37</td></tr><tr><td>Selt</td><td>27.19</td><td>26.46</td><td>23.97</td><td>32.33</td></tr><tr><td colspan="5">Chunking</td></tr><tr><td>Neut</td><td>1000/10%</td><td>1000/10%</td><td>860/12%</td><td>983/32%</td></tr><tr><td>Acca</td><td>95.11</td><td>94.19</td><td>93.93</td><td>93.85</td></tr><tr><td>Acct</td><td>95.07</td><td>94.13</td><td>93.61</td><td>93.48</td></tr><tr><td>Selα</td><td>16.33</td><td>22.87</td><td>24.31</td><td>18.09</td></tr><tr><td>Selt</td><td>29.32</td><td>28.19</td><td>31.05</td><td>26.38</td></tr><tr><td colspan="5">CCG</td></tr><tr><td>Neut</td><td>1500/15%</td><td>1500/15%</td><td>2365/33%</td><td>1014/33%</td></tr><tr><td>Acca</td><td>92.23</td><td>92.43</td><td>91.66</td><td>91.23</td></tr><tr><td>Acct</td><td>92.13</td><td>92.49</td><td>91.89</td><td>91.09</td></tr><tr><td>Selα</td><td>7.48</td><td>14.21</td><td>11.42</td><td>11.99</td></tr><tr><td>Selt</td><td>15.91</td><td>24.82</td><td>18.31</td><td>17.34</td></tr></table>
319
+
320
+ 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)$ .
321
+
322
+ # A.5 Minimal Neuron Set
323
+
324
+ 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.
325
+
326
+ # A.6 Localized versus Distributed Labels
327
+
328
+ 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.
329
+
330
+ # A.7 XLNet versus Others
331
+
332
+ 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.
333
+
334
+ # A.8 Layer-wise Distribution
335
+
336
+ 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.
337
+
338
+ ![](images/5550f5cc153b414d4137b3968fb71b89283d6c46feb0f50b7093830bea45014d.jpg)
339
+ (a) POS Tagging
340
+
341
+ ![](images/1fd5effa7ab514b76f74ab8b7c13e56387743cbd9322de90507a00bb4e007612.jpg)
342
+ (b) SEM Tagging
343
+
344
+ ![](images/143506a554fcba7ad70dc2c6f22212b9a27fb3f480c8583105db83ce9a8697d0.jpg)
345
+ (c) Chunking Tagging
346
+ Figure 4: Number of neurons per label across architectures
347
+
348
+ ![](images/dc08719f2786c2d6d0149f2f275fb487b81b3946b4a14534246fee897c64c57a.jpg)
349
+ (a) POS Tagging
350
+
351
+ ![](images/7aa59c5b9462947ef8c0a4dc6550a3a5dc5680ac9692e92a5d09cdfec704871b.jpg)
352
+ (b) SEM Tagging
353
+
354
+ ![](images/d4151c78f7ca3b9f9627b8c3035bf70a516761662b2e5f8e6db3fc34d6283fdd.jpg)
355
+ (c) Chunking Tagging
356
+ Figure 5: Layer that predominately captures each label
analyzingindividualneuronsinpretrainedlanguagemodels/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdb05485a625f108ee5f9dc2fcb9de4a2a6949fd1756e3e1a15e3367fa597887
3
+ size 798776
analyzingindividualneuronsinpretrainedlanguagemodels/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdc626f3b001849293df06d7036bbcebd575db66c528cfb312a15ac3b25de242
3
+ size 472863
analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64c4e85d1235a0cfd574281c53bbf1f907b69cd25dec8460b2f5f8ab8b0d94b5
3
+ size 123807
analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca42206caf648969aea9f5de92646e138a04e376a7603be9b0184999cfe9430f
3
+ size 151189
analyzingredundancyinpretrainedtransformermodels/1bbb70bb-a5c6-4b28-9bc6-e0eed8b892a7_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6585a1a798e6bdead3b972f9ecb22d05ba665cdcb586244e07771f6338467b8
3
+ size 5021007
analyzingredundancyinpretrainedtransformermodels/full.md ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Analyzing Redundancy in Pretrained Transformer Models
2
+
3
+ Fahim Dalvi Hassan Sajjad Nadir Durrani Yonatan Belinkov\*
4
+
5
+ {faimaduddin,hsajjad,ndurrani}@hbku.edu.qa
6
+
7
+ Qatar Computing Research Institute, HBKU Research Complex, Doha 5825, Qatar
8
+
9
+ *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
10
+
11
+ # Abstract
12
+
13
+ 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}$
14
+
15
+ # 1 Introduction
16
+
17
+ 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.
18
+
19
+ 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;
20
+
21
+ 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.
22
+
23
+ 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.
24
+
25
+ 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
26
+
27
+ enable efficiency?
28
+
29
+ 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.
30
+
31
+ 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:
32
+
33
+ # General Redundancy:
34
+
35
+ - Adjacent layers are most redundant in the network, with lower layers having greater redundancy with adjacent layers.
36
+ - Up to $85\%$ of the neurons across the network are redundant in general, and can be pruned to substantially reduce the number of parameters.
37
+ - Up to $94\%$ of neuron-level redundancy is exhibited within the same or neighbouring layers.
38
+
39
+ # Task-specific Redundancy:
40
+
41
+ - Layers in a network are more redundant w.r.t. core language tasks such as learning morphology as compared to sequence-level tasks.
42
+ - 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.
43
+ - Comparing models, XLNet is more redundant than BERT.
44
+ - Our analysis guides research in model distillation and suggests preserving knowledge of lower layers and aggressive pruning of higher-layers.
45
+
46
+ 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
47
+
48
+ 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.
49
+
50
+ # 2 Related Work
51
+
52
+ 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.
53
+
54
+ 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
55
+
56
+ compression.
57
+
58
+ # 3 Experimental Setup
59
+
60
+ # 3.1 Datasets and Tasks
61
+
62
+ 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).
63
+
64
+ 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.
65
+
66
+ 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.
67
+
68
+ # 3.2 Models
69
+
70
+ 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.
71
+
72
+ 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.
73
+
74
+ # 4 Problem Definition
75
+
76
+ 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$ .
77
+
78
+ 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.
79
+
80
+ 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.
81
+
82
+ # 5 General Redundancy
83
+
84
+ Neural networks are designed to be distributed in nature and are therefore innately redundant. Addi
85
+
86
+ ![](images/54822f7d777b49d88c368b9d02b7c4c4b59993ae75eeeafaa0fae7b94c9c9a3c.jpg)
87
+ (a) BERT
88
+
89
+ ![](images/de70d1a48b45b8f6a5c46f3fe07a5b8f6354856961ebdc3cedc55ca23117cd0a.jpg)
90
+ (b) XLNet
91
+
92
+ 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.
93
+
94
+ # 5.1 Layer-level Redundancy
95
+
96
+ 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.
97
+
98
+ 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
99
+
100
+ ![](images/6ec2f105c38f8ac7e1f38ac4f503172e25de76c356ebf188c4bba048933cb9b5.jpg)
101
+
102
+ ![](images/1f55127829b6200d94a78abbd9225f670d32e6a534a335ceb0b46d06bace7454.jpg)
103
+ Figure 1: Pairwise Similarity between the layers. Brighter colors indicate higher similarity.
104
+ (a) BERT
105
+ (b) XLNet
106
+ 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.
107
+
108
+ 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).
109
+
110
+ # 5.2 Neuron-level Redundancy
111
+
112
+ 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
113
+
114
+ ![](images/5eae3788854df5ebd51dc2d573ba999d36ca2aa1978dfc2cbc8afc5b29ec6c8d.jpg)
115
+ Figure 3: Percentage of clusters which contain neurons from the same layers, adjacent layers, within three neighboring layers and more than three layers apart.
116
+
117
+ 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 linkage<sup>5</sup> 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.
118
+
119
+ 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
120
+
121
+ $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.
122
+
123
+ 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.
124
+
125
+ # 6 Task-specific Redundancy
126
+
127
+ 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.
128
+
129
+ # 6.1 Layer-level Redundancy
130
+
131
+ 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.
132
+
133
+ We compare each layer-classifier with an oracle-classifier trained over concatenation of all layers
134
+
135
+ ![](images/12ca4dd5d7418f43ddc5e9373ab288054d59c09e919e96217fffe534f79ce56e.jpg)
136
+ Figure 4: Task-specific layer-wise redundant layers represented by the colored blocks. Appendix A.3 presents fine-grained graphs for a few tasks.
137
+
138
+ 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.
139
+
140
+ 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.
141
+
142
+ 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
143
+
144
+ at the higher-layers of the model. Lower layers do not have the sufficient sentence-level context to perform these tasks well.
145
+
146
+ 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).
147
+
148
+ # 6.2 Neuron-level Redundancy
149
+
150
+ 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.
151
+
152
+ 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.
153
+
154
+ Complex core language tasks require more neurons CCG and Chunking are relatively complex tasks compared to POS and SEM. On average
155
+
156
+ <table><tr><td>Task</td><td># Neurons</td><td>Task</td><td># Neurons</td></tr><tr><td>POS</td><td>290</td><td>POS</td><td>280</td></tr><tr><td>SEM</td><td>330</td><td>SEM</td><td>290</td></tr><tr><td>CCG</td><td>330</td><td>CCG</td><td>690</td></tr><tr><td>Chunk.</td><td>750</td><td>Chunk.</td><td>660</td></tr><tr><td colspan="2">(a) BERT</td><td colspan="2">(b) XLNet</td></tr></table>
157
+
158
+ Table 1: Task-specific neuron-level analysis for sequence labeling tasks.
159
+
160
+ <table><tr><td>Task</td><td># Neurons</td><td>Task</td><td># Neurons</td></tr><tr><td>SST-2</td><td>30</td><td>SST-2</td><td>70</td></tr><tr><td>MRPC</td><td>190</td><td>MRPC</td><td>170</td></tr><tr><td>MNLI</td><td>30</td><td>MNLI</td><td>90</td></tr><tr><td>QNLI</td><td>40</td><td>QNLI</td><td>20</td></tr><tr><td>QQP</td><td>10</td><td>QQP</td><td>20</td></tr><tr><td>RTE</td><td>320</td><td>RTE</td><td>400</td></tr><tr><td>STS-B</td><td>290</td><td>STS-B</td><td>300</td></tr><tr><td colspan="2">(a) BERT</td><td colspan="2">(b) XLNet</td></tr></table>
161
+
162
+ Table 2: Task-specific neuron-level analysis for sequence classification tasks.
163
+
164
+ 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.
165
+
166
+ 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.
167
+
168
+ # 7 Efficient Transfer Learning
169
+
170
+ 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
171
+
172
+ 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:
173
+
174
+ - A full forward pass over the pretrained model to extract the contextualized vector, a costly affair given the large number of parameters.
175
+ - 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).
176
+
177
+ We propose a three step process to target these two sources of computation bottlenecks:
178
+
179
+ 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.
180
+ 2. Given the contextualized embeddings extracted in the previous step, use CC (Section 5.2) to filter-out redundant neurons.
181
+ 3. Apply FS (Section 6.2) to select a minimal set of neurons that are needed to achieve optimum performance on the task.
182
+
183
+ 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.
184
+
185
+ # 7.1 Results
186
+
187
+ 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
188
+
189
+ <table><tr><td></td><td colspan="2">Sequence Classification</td><td colspan="2">Sequence Labeling</td></tr><tr><td></td><td>BERT</td><td>XLNet</td><td>BERT</td><td>XLNet</td></tr><tr><td rowspan="2">Oracle Neurons</td><td>93.0%</td><td>93.4%</td><td>85.5%</td><td>84.8%</td></tr><tr><td></td><td>9984</td><td></td><td></td></tr><tr><td rowspan="2">LS Layers</td><td>92.3%</td><td>93.2%</td><td>85.0%</td><td>84.5%</td></tr><tr><td>5.3</td><td>2.5</td><td>11.6</td><td>8.1</td></tr><tr><td rowspan="2">CCFS Neurons</td><td>92.0%</td><td>92.2%</td><td>84.0%</td><td>84.0%</td></tr><tr><td>425</td><td>400</td><td>90</td><td>150</td></tr><tr><td>% Reduct.</td><td>95.7%↓</td><td>96.0%↓</td><td>99.0%↓</td><td>98.5%↓</td></tr></table>
190
+
191
+ 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.
192
+
193
+ 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.
194
+
195
+ 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.
196
+
197
+ 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%).
198
+
199
+ 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
200
+
201
+ ![](images/971e22ded530321c178bf7d27096ba92f1be37125c16ef5c04cb5c6206a77c76.jpg)
202
+ 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.
203
+
204
+ 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.
205
+
206
+ # 7.2 Efficiency Analysis
207
+
208
+ 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.
209
+
210
+ 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.
211
+
212
+ 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
213
+
214
+ 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.
215
+
216
+ 1. Feature extraction from pre-trained model: Extraction time scales linearly with the number of tokens $T$ .
217
+ 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$ .
218
+ 3. Correlation clustering CC: With a constant number of neurons $N$ , running correlation clustering scales linearly with the number of tokens $T$ .
219
+ 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$ .
220
+ 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.
221
+
222
+ Appendix A.5.3 provides additional experiments and results used to analyze the training time complexity of our application.
223
+
224
+ # 8 Conclusion and Future Directions
225
+
226
+ 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
227
+
228
+ 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.
229
+
230
+ 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.
231
+
232
+ # Acknowledgements
233
+
234
+ 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).
235
+
236
+ # References
237
+
238
+ 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.
239
+ 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.
240
+ Nikhil Bansal, Avrim Blum, and Shuchi Chawla. 2004. Correlation clustering. Machine Learning, 56(13):89113.
241
+ D. Anthony Bau, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. 2019.
242
+
243
+ Identifying and controlling important neurons in neural machine translation. In International Conference on Learning Representations (ICLR).
244
+ 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.
245
+ 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.
246
+ 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.
247
+ 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.
248
+ Qingqing Cao, Harsh Trivedi, Aruna Balasubramanian, et al. 2020. Faster and just as accurate: A simple decomposition for transformer models. *ICLR Open-review*.
249
+ 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.
250
+ 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.
251
+ 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.
252
+ 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).
253
+
254
+ 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).
255
+ 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.
256
+ William B. Dolan and Chris Brockett. 2005. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005).
257
+ 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.
258
+ 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.
259
+ 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.
260
+ 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.
261
+ 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.
262
+ Isabelle Guyon and André Elisseeff. 2003. An introduction to variable and feature selection. Journal of Machine Learning Research, 3:1157-1182.
263
+
264
+ 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.
265
+ 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.
266
+ 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.
267
+ 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.
268
+ 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.
269
+ 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.
270
+ 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.
271
+ Nikolaus Kriegeskorte, Marieke Mur, and Peter Bandettini. 2008. Representational similarity analysis - connecting the branches of systems neuroscience. Frontiers in Systems Neuroscience, 2:4.
272
+ 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.
273
+
274
+ 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.
275
+ 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.
276
+ 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.
277
+ 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.
278
+ 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.
279
+ 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.
280
+ 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.
281
+ 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.
282
+ Hassan Sajjad, Fahim Dalvi, Nadir Durrani, and Preslav Nakov. 2020. Poor man's bert: Smaller and faster transformer models. ArXiv, abs/2004.03844.
283
+ 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
284
+
285
+ 2000, Held in cooperation with ICGI-2000, Lisbon, Portugal, September 13-14, 2000, pages 127-132. ACL.
286
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter.
287
+ 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.
288
+ 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.
289
+ 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.
290
+ 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.
291
+ Xavier Suau, Luca Zappella, and Nicholas Apostoloff. 2020. Finding experts in transformer models. CoRR, abs/2005.07647.
292
+ 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.
293
+ 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.
294
+
295
+ 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.
296
+ 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.
297
+ 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.
298
+ 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.
299
+ 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.
300
+ 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.
301
+ 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.
302
+ 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.
303
+
304
+ # A Appendices
305
+
306
+ # A.1 Data
307
+
308
+ 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.
309
+
310
+ <table><tr><td>Task</td><td>Train</td><td>Dev</td><td>Test</td><td>Tags</td></tr><tr><td>POS</td><td>149973</td><td>44320</td><td>47344</td><td>44</td></tr><tr><td>SEM</td><td>149986</td><td>112537</td><td>226426</td><td>73</td></tr><tr><td>Chunking</td><td>150000</td><td>44346</td><td>47372</td><td>22</td></tr><tr><td>CCG</td><td>149990</td><td>45396</td><td>55353</td><td>1272</td></tr></table>
311
+
312
+ 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.
313
+
314
+ # A.2 General Neuron-level Redundancy
315
+
316
+ 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.
317
+
318
+ 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.
319
+
320
+ 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
321
+
322
+ <table><tr><td>Task</td><td>Train</td><td>Dev</td></tr><tr><td>SST-2</td><td>67349</td><td>872</td></tr><tr><td>MRPC</td><td>3668</td><td>408</td></tr><tr><td>MNLI</td><td>392702</td><td>9815</td></tr><tr><td>QNLI</td><td>104743</td><td>5463</td></tr><tr><td>QQP</td><td>363846</td><td>40430</td></tr><tr><td>RTE</td><td>2490</td><td>277</td></tr><tr><td>STS-B</td><td>5749</td><td>1500</td></tr></table>
323
+
324
+ 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.
325
+
326
+ # A.3 Task-Specific Layer-wise redundancy
327
+
328
+ Tables 7a and 7a provide detailed results used to produce the illustrations in Figure 4.
329
+
330
+ 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).
331
+
332
+ # A.4 Task-Specific Neuron-level Redundancy
333
+
334
+ Tables 8a and 8b provide the per-task detailed results along with reduced accuracies after running task-specific neuron-level redundancy analysis.
335
+
336
+ # A.5 Application: Efficient Feature Selection
337
+
338
+ # A.5.1 Transfer Learning Detailed Results
339
+
340
+ Tables 9 and 10 show the detailed per-task results for our proposed feature selection algorithm.
341
+
342
+ # A.5.2 Pretrained model timing analysis
343
+
344
+ 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).
345
+
346
+ # A.5.3 Training time analysis
347
+
348
+ Figures 12, 13 and 14 show the runtimes of the various steps of the proposed efficient feature se
349
+
350
+ ![](images/09c5be1146d42181a40e26a34b38c8888014db67428de81316705461da529bab.jpg)
351
+ 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.
352
+
353
+ 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.
354
+
355
+ # A.6 Center Kernel Alignment
356
+
357
+ 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$ ,
358
+
359
+ $$
360
+ \mathbf {X}, \mathbf {Y} = \mathbf {Z} z ^ {x}, \mathbf {Z} z ^ {y}
361
+ $$
362
+
363
+ the CKA similarity is
364
+
365
+ $$
366
+ \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} \|}
367
+ $$
368
+
369
+ where $\| \cdot \|$ is the Frobenius norm.
370
+
371
+ ![](images/5e43fb64c3925f20f9b9ee8b0305b991fd393e2f433ec178ebca355f2e82bddd.jpg)
372
+
373
+ ![](images/d78b5accf806cbfe2d07f797342b1eeadec12cccf3dce8a15286e4d3c15792a2.jpg)
374
+ (a) BERT
375
+ (b) XLNet
376
+
377
+ ![](images/28b2d9820719027bbcc296925638c7074f62485aeb71f147e606fbf6b7db7b77.jpg)
378
+ Figure 7: Layer-wise task specific redundancy for POS task. Redundant layers are represented by the colored blocks.
379
+
380
+ ![](images/1601f30ae273ebfeb598f57f7a051e72a790d26933131cb3356580a2ca25e96b.jpg)
381
+ (a) BERT
382
+ (b) XLNet
383
+ Figure 8: Layer-wise task specific redundancy for SEM task. Redundant layers are represented by the colored blocks.
384
+
385
+ <table><tr><td>Threshold</td><td>POS</td><td>SEM</td><td>CCG</td><td>Chunking</td><td>SST-2</td><td>MRPC</td><td>MNLI</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td><td>Average</td></tr><tr><td>0.0</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td></tr><tr><td>0.0</td><td>95.7%</td><td>92.0%</td><td>89.8%</td><td>94.5%</td><td>90.5%</td><td>85.8%</td><td>81.7%</td><td>90.3%</td><td>91.2%</td><td>70.0%</td><td>89.5%</td><td>88.3%</td></tr><tr><td>0.1</td><td>6841</td><td>6809</td><td>6844</td><td>6749</td><td>7415</td><td>9441</td><td>9398</td><td>8525</td><td>8993</td><td>9647</td><td>8129</td><td>8072</td></tr><tr><td>0.1</td><td>95.4%</td><td>92.3%</td><td>90.3%</td><td>94.8%</td><td>89.8%</td><td>86.3%</td><td>81.7%</td><td>90.2%</td><td>91.2%</td><td>69.3%</td><td>89.7%</td><td>88.3%</td></tr><tr><td>0.2</td><td>4044</td><td>4045</td><td>4052</td><td>4008</td><td>6207</td><td>8486</td><td>8376</td><td>7225</td><td>7697</td><td>8705</td><td>6377</td><td>6293</td></tr><tr><td>0.2</td><td>95.9%</td><td>92.9%</td><td>90.6%</td><td>95.0%</td><td>90.6%</td><td>86.8%</td><td>81.7%</td><td>90.1%</td><td>91.2%</td><td>69.0%</td><td>89.6%</td><td>88.5%</td></tr><tr><td>0.3</td><td>2556</td><td>2566</td><td>2570</td><td>2573</td><td>4994</td><td>7328</td><td>7049</td><td>6131</td><td>6413</td><td>7157</td><td>4949</td><td>4935</td></tr><tr><td>0.3</td><td>96.2%</td><td>93.1%</td><td>91.3%</td><td>95.1%</td><td>90.6%</td><td>86.0%</td><td>81.8%</td><td>89.9%</td><td>91.1%</td><td>67.1%</td><td>89.5%</td><td>88.3%</td></tr><tr><td>0.4</td><td>1729</td><td>1752</td><td>1729</td><td>1709</td><td>3812</td><td>5779</td><td>5681</td><td>4961</td><td>5077</td><td>5587</td><td>3674</td><td>3772</td></tr><tr><td>0.4</td><td>96.2%</td><td>93.3%</td><td>91.4%</td><td>95.2%</td><td>90.4%</td><td>86.5%</td><td>81.7%</td><td>89.4%</td><td>91.0%</td><td>67.5%</td><td>89.3%</td><td>88.4%</td></tr><tr><td>0.5</td><td>1215</td><td>1190</td><td>1221</td><td>1217</td><td>2746</td><td>4420</td><td>4289</td><td>3747</td><td>3789</td><td>4241</td><td>2721</td><td>2800</td></tr><tr><td>0.5</td><td>96.4%</td><td>93.2%</td><td>91.6%</td><td>94.9%</td><td>90.3%</td><td>86.3%</td><td>81.6%</td><td>89.6%</td><td>91.1%</td><td>66.4%</td><td>89.0%</td><td>88.2%</td></tr><tr><td>0.6</td><td>876</td><td>869</td><td>873</td><td>876</td><td>1962</td><td>3287</td><td>3041</td><td>2712</td><td>2767</td><td>3170</td><td>1962</td><td>2036</td></tr><tr><td>0.6</td><td>96.2%</td><td>93.3%</td><td>91.5%</td><td>94.4%</td><td>90.0%</td><td>85.5%</td><td>81.8%</td><td>89.7%</td><td>91.1%</td><td>66.8%</td><td>88.8%</td><td>88.1%</td></tr><tr><td>0.7</td><td>792</td><td>789</td><td>792</td><td>795</td><td>1404</td><td>2258</td><td>2025</td><td>1867</td><td>1907</td><td>2315</td><td>1419</td><td>1488</td></tr><tr><td>0.7</td><td>96.2%</td><td>93.2%</td><td>91.6%</td><td>94.1%</td><td>89.8%</td><td>86.3%</td><td>81.7%</td><td>89.3%</td><td>91.1%</td><td>69.0%</td><td>87.8%</td><td>88.2%</td></tr><tr><td>0.8</td><td>764</td><td>758</td><td>762</td><td>748</td><td>982</td><td>1367</td><td>1239</td><td>1191</td><td>1226</td><td>1531</td><td>982</td><td>1050</td></tr><tr><td>0.8</td><td>96.1%</td><td>93.2%</td><td>91.3%</td><td>94.0%</td><td>89.2%</td><td>85.0%</td><td>80.6%</td><td>88.3%</td><td>90.0%</td><td>62.8%</td><td>82.6%</td><td>86.7%</td></tr><tr><td>0.9</td><td>443</td><td>378</td><td>429</td><td>357</td><td>778</td><td>812</td><td>798</td><td>797</td><td>814</td><td>854</td><td>785</td><td>659</td></tr><tr><td>0.9</td><td>95.6%</td><td>91.8%</td><td>89.9%</td><td>91.0%</td><td>56.5%</td><td>70.3%</td><td>53.2%</td><td>80.0%</td><td>77.6%</td><td>59.2%</td><td>32.5%</td><td>72.5%</td></tr></table>
386
+
387
+ (a) BERT
388
+
389
+ <table><tr><td>Threshold</td><td>POS</td><td>SEM</td><td>CCG</td><td>Chunking</td><td>SST-2</td><td>MRPC</td><td>MNLI</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td><td>Average</td></tr><tr><td>0.0</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td><td>9984</td></tr><tr><td>0.0</td><td>96.2%</td><td>91.8%</td><td>90.6%</td><td>93.5%</td><td>93.2%</td><td>86.5%</td><td>78.9%</td><td>89.1%</td><td>87.4%</td><td>69.7%</td><td>89.0%</td><td>87.8%</td></tr><tr><td>0.1</td><td>9019</td><td>9021</td><td>9046</td><td>8941</td><td>7435</td><td>9206</td><td>7913</td><td>8056</td><td>5844</td><td>9931</td><td>9125</td><td>9006.75</td></tr><tr><td>0.1</td><td>96.3%</td><td>92.2%</td><td>90.7%</td><td>93.9%</td><td>93.0%</td><td>86.5%</td><td>80.3%</td><td>89.2%</td><td>89.7%</td><td>71.8%</td><td>89.0%</td><td>88.4%</td></tr><tr><td>0.2</td><td>5338</td><td>5392</td><td>5346</td><td>5302</td><td>6257</td><td>7685</td><td>6668</td><td>7393</td><td>4952</td><td>9244</td><td>8011</td><td>5344.5</td></tr><tr><td>0.2</td><td>96.2%</td><td>92.3%</td><td>90.5%</td><td>93.9%</td><td>93.0%</td><td>86.8%</td><td>80.4%</td><td>89.9%</td><td>90.2%</td><td>70.4%</td><td>88.9%</td><td>88.4%</td></tr><tr><td>0.3</td><td>3646</td><td>3651</td><td>3660</td><td>3606</td><td>5206</td><td>6241</td><td>5988</td><td>6613</td><td>4482</td><td>7635</td><td>6407</td><td>3640.75</td></tr><tr><td>0.3</td><td>96.2%</td><td>92.5%</td><td>91.0%</td><td>93.8%</td><td>92.9%</td><td>86.8%</td><td>80.8%</td><td>89.8%</td><td>90.1%</td><td>71.5%</td><td>88.7%</td><td>88.5%</td></tr><tr><td>0.4</td><td>2592</td><td>2571</td><td>2599</td><td>2573</td><td>4181</td><td>4896</td><td>5252</td><td>5583</td><td>3987</td><td>5996</td><td>4932</td><td>2583.75</td></tr><tr><td>0.4</td><td>96.3%</td><td>92.7%</td><td>90.8%</td><td>93.7%</td><td>93.1%</td><td>88.0%</td><td>81.0%</td><td>89.7%</td><td>90.1%</td><td>70.4%</td><td>88.5%</td><td>88.6%</td></tr><tr><td>0.5</td><td>1754</td><td>1746</td><td>1756</td><td>1758</td><td>3207</td><td>3675</td><td>4172</td><td>4426</td><td>3271</td><td>4573</td><td>3669</td><td>1753.5</td></tr><tr><td>0.5</td><td>96.5%</td><td>92.8%</td><td>91.3%</td><td>94.4%</td><td>93.2%</td><td>87.7%</td><td>80.8%</td><td>89.6%</td><td>90.1%</td><td>71.8%</td><td>88.3%</td><td>88.8%</td></tr><tr><td>0.6</td><td>1090</td><td>1085</td><td>1091</td><td>1072</td><td>2355</td><td>2549</td><td>2905</td><td>3248</td><td>2370</td><td>3346</td><td>2666</td><td>1084.5</td></tr><tr><td>0.6</td><td>96.7%</td><td>93.0%</td><td>91.8%</td><td>93.8%</td><td>93.1%</td><td>88.0%</td><td>81.0%</td><td>90.4%</td><td>90.0%</td><td>70.4%</td><td>88.4%</td><td>88.8%</td></tr><tr><td>0.7</td><td>833</td><td>833</td><td>830</td><td>824</td><td>1663</td><td>1735</td><td>1883</td><td>2224</td><td>1627</td><td>2348</td><td>1859</td><td>830</td></tr><tr><td>0.7</td><td>96.6%</td><td>93.0%</td><td>91.9%</td><td>93.2%</td><td>92.0%</td><td>88.2%</td><td>79.9%</td><td>90.1%</td><td>89.7%</td><td>71.1%</td><td>87.7%</td><td>88.5%</td></tr><tr><td>0.8</td><td>773</td><td>775</td><td>773</td><td>762</td><td>1127</td><td>1108</td><td>1189</td><td>1399</td><td>1091</td><td>1469</td><td>1232</td><td>770.75</td></tr><tr><td>0.8</td><td>96.5%</td><td>92.9%</td><td>91.9%</td><td>93.0%</td><td>92.4%</td><td>85.5%</td><td>77.3%</td><td>89.4%</td><td>87.4%</td><td>69.3%</td><td>84.5%</td><td>87.3%</td></tr><tr><td>0.9</td><td>470</td><td>412</td><td>471</td><td>414</td><td>799</td><td>790</td><td>805</td><td>839</td><td>791</td><td>832</td><td>801</td><td>441.75</td></tr><tr><td>0.9</td><td>96.0%</td><td>91.5%</td><td>91.0%</td><td>90.5%</td><td>84.4%</td><td>75.0%</td><td>65.8%</td><td>79.7%</td><td>88.3%</td><td>63.9%</td><td>46.6%</td><td>79.3%</td></tr></table>
390
+
391
+ (b) XLNet
392
+
393
+ 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.
394
+
395
+ <table><tr><td></td><td>POS</td><td>SEM</td><td>CCG</td><td>Chunking</td><td>SST-2</td><td>MRPC</td><td>MNLI</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td></tr><tr><td>Oracle</td><td>95.2%</td><td>92.0%</td><td>90.1%</td><td>94.6%</td><td>90.6%</td><td>86.0%</td><td>81.7%</td><td>90.2%</td><td>91.2%</td><td>69.3%</td><td>89.7%</td></tr><tr><td>1% Loss</td><td>94.2%</td><td>91.1%</td><td>89.2%</td><td>93.6%</td><td>89.7%</td><td>85.2%</td><td>80.9%</td><td>89.3%</td><td>90.2%</td><td>68.6%</td><td>88.8%</td></tr><tr><td>Embedding</td><td>89.6%</td><td>81.5%</td><td>70.0%</td><td>77.5%</td><td>50.9%</td><td>68.4%</td><td>31.8%</td><td>49.5%</td><td>63.2%</td><td>52.7%</td><td>0.0%</td></tr><tr><td>Layer 1</td><td>93.1%</td><td>87.6%</td><td>78.9%</td><td>82.1%</td><td>78.4%</td><td>68.9%</td><td>42.8%</td><td>59.7%</td><td>71.4%</td><td>52.7%</td><td>6.0%</td></tr><tr><td>Layer 2</td><td>95.3%</td><td>91.7%</td><td>86.6%</td><td>91.0%</td><td>80.2%</td><td>71.3%</td><td>45.0%</td><td>61.2%</td><td>73.3%</td><td>56.0%</td><td>10.4%</td></tr><tr><td>Layer 3</td><td>95.5%</td><td>92.3%</td><td>88.0%</td><td>92.0%</td><td>80.6%</td><td>69.6%</td><td>54.0%</td><td>74.4%</td><td>77.2%</td><td>54.9%</td><td>54.5%</td></tr><tr><td>Layer 4</td><td>96.0%</td><td>93.0%</td><td>89.6%</td><td>94.0%</td><td>81.2%</td><td>75.5%</td><td>61.8%</td><td>81.3%</td><td>80.1%</td><td>55.6%</td><td>84.9%</td></tr><tr><td>Layer 5</td><td>96.0%</td><td>93.2%</td><td>90.4%</td><td>94.0%</td><td>82.3%</td><td>76.2%</td><td>65.9%</td><td>82.9%</td><td>84.4%</td><td>59.6%</td><td>85.8%</td></tr><tr><td>Layer 6</td><td>96.3%</td><td>93.4%</td><td>91.6%</td><td>94.9%</td><td>86.2%</td><td>77.5%</td><td>71.6%</td><td>83.2%</td><td>85.8%</td><td>62.1%</td><td>86.4%</td></tr><tr><td>Layer 7</td><td>96.2%</td><td>93.3%</td><td>91.9%</td><td>95.1%</td><td>88.6%</td><td>79.4%</td><td>74.9%</td><td>83.8%</td><td>86.9%</td><td>62.5%</td><td>86.8%</td></tr><tr><td>Layer 8</td><td>96.0%</td><td>93.1%</td><td>91.9%</td><td>94.8%</td><td>90.6%</td><td>77.5%</td><td>76.4%</td><td>84.4%</td><td>87.1%</td><td>63.5%</td><td>87.1%</td></tr><tr><td>Layer 9</td><td>95.8%</td><td>92.9%</td><td>91.6%</td><td>94.5%</td><td>90.5%</td><td>83.3%</td><td>79.8%</td><td>84.8%</td><td>87.7%</td><td>63.2%</td><td>87.0%</td></tr><tr><td>Layer 10</td><td>95.6%</td><td>92.5%</td><td>91.2%</td><td>94.1%</td><td>90.6%</td><td>82.6%</td><td>80.3%</td><td>86.1%</td><td>89.0%</td><td>64.3%</td><td>87.3%</td></tr><tr><td>Layer 11</td><td>95.4%</td><td>92.3%</td><td>90.9%</td><td>93.9%</td><td>90.4%</td><td>85.8%</td><td>81.7%</td><td>89.8%</td><td>91.0%</td><td>66.4%</td><td>88.9%</td></tr><tr><td>Layer 12</td><td>95.1%</td><td>92.0%</td><td>90.2%</td><td>93.2%</td><td>90.1%</td><td>87.3%</td><td>82.0%</td><td>90.4%</td><td>91.1%</td><td>66.1%</td><td>89.7%</td></tr></table>
396
+
397
+ (a) BERT
398
+
399
+ <table><tr><td></td><td>POS</td><td>SEM</td><td>CCG</td><td>Chunking</td><td>SST-2</td><td>MRPC</td><td>MNLI</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td></tr><tr><td>Oracle</td><td>95.9%</td><td>92.5%</td><td>90.8%</td><td>94.2%</td><td>92.4%</td><td>86.5%</td><td>78.9%</td><td>88.7%</td><td>87.2%</td><td>71.1%</td><td>88.9%</td></tr><tr><td>1% Loss</td><td>95.0%</td><td>91.5%</td><td>89.9%</td><td>93.3%</td><td>91.5%</td><td>85.7%</td><td>78.1%</td><td>87.8%</td><td>86.4%</td><td>70.4%</td><td>88.0%</td></tr><tr><td>Embedding</td><td>89.5%</td><td>82.6%</td><td>70.5%</td><td>77.0%</td><td>50.9%</td><td>68.4%</td><td>32.7%</td><td>50.5%</td><td>63.2%</td><td>52.7%</td><td>0.6%</td></tr><tr><td>Layer 1</td><td>96.3%</td><td>92.9%</td><td>88.7%</td><td>90.8%</td><td>79.6%</td><td>70.6%</td><td>44.2%</td><td>58.9%</td><td>72.0%</td><td>47.3%</td><td>8.8%</td></tr><tr><td>Layer 2</td><td>96.7%</td><td>93.6%</td><td>91.0%</td><td>93.4%</td><td>81.1%</td><td>70.1%</td><td>45.1%</td><td>58.6%</td><td>73.8%</td><td>45.8%</td><td>11.0%</td></tr><tr><td>Layer 3</td><td>96.8%</td><td>93.5%</td><td>91.8%</td><td>94.2%</td><td>84.7%</td><td>71.1%</td><td>61.6%</td><td>74.2%</td><td>82.4%</td><td>47.3%</td><td>81.1%</td></tr><tr><td>Layer 4</td><td>96.7%</td><td>93.4%</td><td>92.1%</td><td>94.2%</td><td>88.3%</td><td>76.0%</td><td>63.7%</td><td>74.1%</td><td>85.0%</td><td>53.1%</td><td>82.8%</td></tr><tr><td>Layer 5</td><td>96.6%</td><td>93.2%</td><td>92.4%</td><td>93.9%</td><td>88.6%</td><td>79.4%</td><td>68.4%</td><td>81.3%</td><td>89.2%</td><td>62.1%</td><td>84.9%</td></tr><tr><td>Layer 6</td><td>96.3%</td><td>92.6%</td><td>92.0%</td><td>94.2%</td><td>90.1%</td><td>83.1%</td><td>73.9%</td><td>83.3%</td><td>89.9%</td><td>63.5%</td><td>85.9%</td></tr><tr><td>Layer 7</td><td>96.1%</td><td>92.3%</td><td>91.9%</td><td>94.0%</td><td>92.9%</td><td>85.3%</td><td>79.1%</td><td>88.1%</td><td>89.9%</td><td>67.1%</td><td>86.7%</td></tr><tr><td>Layer 8</td><td>95.8%</td><td>91.9%</td><td>91.6%</td><td>93.5%</td><td>93.6%</td><td>87.7%</td><td>80.7%</td><td>90.0%</td><td>89.2%</td><td>65.0%</td><td>87.6%</td></tr><tr><td>Layer 9</td><td>95.3%</td><td>91.6%</td><td>91.4%</td><td>93.1%</td><td>94.2%</td><td>87.5%</td><td>80.1%</td><td>90.3%</td><td>88.4%</td><td>69.3%</td><td>88.2%</td></tr><tr><td>Layer 10</td><td>94.9%</td><td>91.2%</td><td>90.8%</td><td>92.1%</td><td>93.8%</td><td>86.5%</td><td>80.1%</td><td>90.4%</td><td>88.9%</td><td>71.8%</td><td>88.2%</td></tr><tr><td>Layer 11</td><td>94.6%</td><td>90.8%</td><td>90.2%</td><td>91.1%</td><td>94.5%</td><td>86.8%</td><td>80.1%</td><td>90.5%</td><td>88.5%</td><td>71.8%</td><td>88.5%</td></tr><tr><td>Layer 12</td><td>92.0%</td><td>87.4%</td><td>86.0%</td><td>85.9%</td><td>93.8%</td><td>86.5%</td><td>80.8%</td><td>90.6%</td><td>89.3%</td><td>71.1%</td><td>88.5%</td></tr></table>
400
+
401
+ (b) XLNet
402
+ 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
403
+
404
+ <table><tr><td>Task</td><td>Oracle</td><td>#Neurons</td><td>Reduced Accuracy</td></tr><tr><td>POS</td><td>95.7%</td><td>290</td><td>94.3%</td></tr><tr><td>SEM</td><td>92.2%</td><td>330</td><td>90.8%</td></tr><tr><td>CCG</td><td>89.9%</td><td>330</td><td>88.7%</td></tr><tr><td>Chunking</td><td>94.4%</td><td>750</td><td>93.8%</td></tr><tr><td>Word Average</td><td>93.1%</td><td>425</td><td>91.9%</td></tr><tr><td>SST-2</td><td>90.6%</td><td>30</td><td>88.4%</td></tr><tr><td>MRPC</td><td>86.3%</td><td>190</td><td>85.0%</td></tr><tr><td>MNLI</td><td>81.7%</td><td>30</td><td>81.8%</td></tr><tr><td>QNLI</td><td>90.3%</td><td>40</td><td>89.1%</td></tr><tr><td>QQP</td><td>91.2%</td><td>10</td><td>90.8%</td></tr><tr><td>RTE</td><td>69.7%</td><td>320</td><td>68.6%</td></tr><tr><td>STS-B</td><td>89.6%</td><td>290</td><td>88.3%</td></tr><tr><td>Sentence Average</td><td>85.6%</td><td>130</td><td>84.6%</td></tr></table>
405
+
406
+ (a) BERT
407
+
408
+ <table><tr><td>Task</td><td>Oracle</td><td>#Neurons</td><td>Reduced Accuracy</td></tr><tr><td>POS</td><td>96.1%</td><td>280</td><td>95.6%</td></tr><tr><td>SEM</td><td>92.2%</td><td>290</td><td>91.1%</td></tr><tr><td>CCG</td><td>90.2%</td><td>690</td><td>89.8%</td></tr><tr><td>Chunking</td><td>94.1%</td><td>660</td><td>93.0%</td></tr><tr><td>Word Average</td><td>93.2%</td><td>480</td><td>92.4%</td></tr><tr><td>SST-2</td><td>92.9%</td><td>70</td><td>91.3%</td></tr><tr><td>MRPC</td><td>85.8%</td><td>170</td><td>85.0%</td></tr><tr><td>MNLI</td><td>79.0%</td><td>90</td><td>77.9%</td></tr><tr><td>QNLI</td><td>88.3%</td><td>20</td><td>88.5%</td></tr><tr><td>QQP</td><td>87.4%</td><td>20</td><td>88.0%</td></tr><tr><td>RTE</td><td>70.4%</td><td>400</td><td>71.1%</td></tr><tr><td>STS-B</td><td>88.9%</td><td>300</td><td>86.6%</td></tr><tr><td>Sentence Average</td><td>84.7%</td><td>152</td><td>84.1%</td></tr></table>
409
+
410
+ (b) XLNet
411
+
412
+ Table 8: Accuracies after running linguistic correlation analysis and extracting the minimal set of neurons from all 9984 neurons
413
+
414
+ ![](images/02fc9ca67bda12263ed10fbfd96fbbb540d89265dfa0d6f9277ca797da653676.jpg)
415
+ (a) BERT
416
+
417
+ ![](images/2bcc4962280f8b10162a16b5d2f7e25030b9f93372052596e1a0d654bd02d3e7.jpg)
418
+ (b) XLNet
419
+
420
+ <table><tr><td></td><td></td><td>POS</td><td>SEM</td><td>CCG</td><td>Chunking</td></tr><tr><td rowspan="7">BERT</td><td rowspan="2">Oracle
421
+ Neurons</td><td>95.2%</td><td>92.0%</td><td>90.1%</td><td>94.6%</td></tr><tr><td></td><td>9984</td><td></td><td></td></tr><tr><td rowspan="2">LS
422
+ Layers</td><td>94.8%</td><td>91.2%</td><td>89.2%</td><td>94.0%</td></tr><tr><td>3</td><td>3</td><td>8</td><td>7</td></tr><tr><td rowspan="2">CCFS
423
+ Neurons</td><td>93.9%</td><td>90.1%</td><td>90.2%</td><td>93.7%</td></tr><tr><td>300</td><td>400</td><td>400</td><td>600</td></tr><tr><td>% Reduct.</td><td>97%↓</td><td>96%↓</td><td>96%↓</td><td>94%↓</td></tr><tr><td rowspan="7">XLNet</td><td rowspan="2">Oracle
424
+ Neurons</td><td>95.9%</td><td>92.5%</td><td>90.8%</td><td>94.2%</td></tr><tr><td></td><td>9984</td><td></td><td></td></tr><tr><td rowspan="2">LS
425
+ Layers</td><td>96.3%</td><td>92.9%</td><td>90.3%</td><td>93.5%</td></tr><tr><td>2</td><td>2</td><td>3</td><td>3</td></tr><tr><td rowspan="2">CCFS
426
+ Neurons</td><td>95.6%</td><td>91.9%</td><td>89.5%</td><td>91.8%</td></tr><tr><td>300</td><td>400</td><td>300</td><td>600</td></tr><tr><td>% Reduct.</td><td>97%↓</td><td>96%↓</td><td>97%↓</td><td>94%↓</td></tr></table>
427
+
428
+ 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.
429
+
430
+ ![](images/64bed3ecffb138058552baa489258bc983ffb399fe8895202f2cffdf9ab5e22c.jpg)
431
+ 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.
432
+
433
+ ![](images/3455cda3171250304226b7eff8e88b85e6ca7ce36ba09579ca9c552970120ca2.jpg)
434
+ Figure 9: Layer-wise task specific redundancy for Chunking task. Redundant layers are represented by the colored blocks.
435
+ 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.
436
+
437
+ <table><tr><td></td><td></td><td>SST-2</td><td>MRPC</td><td>MNLI</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>STS-B</td></tr><tr><td rowspan="7">BERT</td><td rowspan="2">Oracle
438
+ Neurons</td><td>90.6%</td><td>86.0%</td><td>81.7%</td><td>90.2%</td><td>91.2%</td><td>69.3%</td><td>89.7%</td></tr><tr><td></td><td></td><td></td><td>9984</td><td></td><td></td><td></td></tr><tr><td rowspan="2">LS
439
+ Layers</td><td>88.2%</td><td>86.0%</td><td>81.6%</td><td>89.9%</td><td>90.9%</td><td>69.3%</td><td>89.1%</td></tr><tr><td>8</td><td>12</td><td>12</td><td>12</td><td>12</td><td>13</td><td>12</td></tr><tr><td rowspan="2">CCFS
440
+ Neurons</td><td>87.0%</td><td>86.3%</td><td>81.3%</td><td>89.1%</td><td>89.9%</td><td>65.7%</td><td>88.6%</td></tr><tr><td>30</td><td>100</td><td>30</td><td>10</td><td>20</td><td>30</td><td>400</td></tr><tr><td>% Reduction</td><td>99.7%↓</td><td>99.0%↓</td><td>99.7%↓</td><td>99.9%↓</td><td>99.8%↓</td><td>99.9%↓</td><td>96.0%↓</td></tr><tr><td rowspan="7">XLNet</td><td rowspan="2">Oracle
441
+ Neurons</td><td>92.4%</td><td>86.5%</td><td>78.9%</td><td>88.7%</td><td>87.2%</td><td>71.1%</td><td>88.9%</td></tr><tr><td></td><td></td><td></td><td>9984</td><td></td><td></td><td></td></tr><tr><td rowspan="2">LS
442
+ Layers</td><td>88.2%</td><td>86.0%</td><td>79.9%</td><td>88.8%</td><td>89.3%</td><td>71.1%</td><td>88.1%</td></tr><tr><td>6</td><td>9</td><td>8</td><td>8</td><td>6</td><td>11</td><td>9</td></tr><tr><td rowspan="2">CCFS
443
+ Neurons</td><td>87.5%</td><td>89.0%</td><td>78.4%</td><td>88.3%</td><td>88.8%</td><td>69.0%</td><td>87.2%</td></tr><tr><td>50</td><td>100</td><td>50</td><td>200</td><td>100</td><td>100</td><td>400</td></tr><tr><td>% Reduction</td><td>99.5%↓</td><td>99.0%↓</td><td>99.5%↓</td><td>98.0%↓</td><td>99.0%↓</td><td>99.0%↓</td><td>96.0%↓</td></tr></table>
444
+
445
+ 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.
446
+
447
+ ![](images/46640d36eed0db48cd946f006e5ae0c3c4729ea633dc4b93b5f2665f8b2feb44.jpg)
448
+ Figure 12: Runtime vs number of examples when extracting contextual embeddings using BERT
449
+
450
+ ![](images/0149917b61bbdd077fd20d0cb12d79351051e853d2dd84c99846c1202b243f2c.jpg)
451
+ Figure 13: Runtime vs number of examples when performing correlation clustering
452
+
453
+ ![](images/bb7ae1bde726607c468a34b810f29693d24c92cdbca99a24a0138f32250218f9.jpg)
454
+ Figure 14: Runtime vs number of features when performing feature ranking using the weights of a trained classifier
analyzingredundancyinpretrainedtransformermodels/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d83e8db5c998e9f2f37a9927b86d8079a67da6578015405d675ea3517dfe1ef
3
+ size 1598130
analyzingredundancyinpretrainedtransformermodels/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f26499ca9a2493f473b0cad5d60775f00b9f232daf050ce60957e2a2dffd170
3
+ size 573566
ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73ad4d5ef3f153aedb68c27226d0ed41c6e7e818281d1c42746992a903032644
3
+ size 87141
ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bb0a9ff692991c0eba1a12ca123bd5c2bf9a120dae253bfe0590a3ba09c71da
3
+ size 106079
ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/59fb8a50-7a9c-4407-963c-c28a35abb729_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8c939891037e3dff05be448e05188b4f383a2793e40c180f50f4fc08e1809b3
3
+ size 330304
ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/full.md ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # An Analysis of Natural Language Inference Benchmarks through the Lens of Negation
2
+
3
+ Md Mosharaf Hossain, $^{e}$ Venelin Kovatchev, $^{3}$ Pranoy Dutta, $^{e}$ Tiffany Kao, $^{e}$ Elizabeth Wei, $^{e}$ and Eduardo Blanco $^{e}$
4
+
5
+ <sup>6</sup>University of North Texas <sup>5</sup>University of Barcelona
6
+
7
+ mdmosharafhossain@my.unt.edu vkovatchev@ub.edu
8
+
9
+ {PranoyDutta,TiffanyKao,ElizabethWei}@my.unt.edu eduardo.blanco@unt.edu
10
+
11
+ # Abstract
12
+
13
+ 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.
14
+
15
+ # 1 Introduction
16
+
17
+ 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.
18
+
19
+ 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
20
+
21
+ 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.
22
+
23
+ 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).
24
+
25
+ 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:
26
+
27
+ 1. We show that negation is underrepresented and often irrelevant in existing benchmarks.
28
+ 2. We create new benchmarks for natural language inference in which negation plays a critical role to make inference judgments.
29
+ 3. We demonstrate that state-of-the-art trans
30
+
31
+ formers trained with the original benchmarks are not robust when negation is present.
32
+
33
+ 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.
34
+
35
+ # 2 Background
36
+
37
+ 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.
38
+
39
+ 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.
40
+
41
+ # 3 Previous Work
42
+
43
+ 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
44
+
45
+ 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.
46
+
47
+ 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.
48
+
49
+ 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.
50
+
51
+ 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
52
+
53
+ <table><tr><td></td><td>#sents.</td><td>% w/ neg.</td></tr><tr><td colspan="3">General English Online Reviews</td></tr><tr><td>books</td><td>4,845,154</td><td>22.64</td></tr><tr><td>movies</td><td>616,287</td><td>28.97</td></tr><tr><td colspan="3">Conversations</td></tr><tr><td>oral</td><td>538,973</td><td>27.43</td></tr><tr><td>written</td><td>510,458</td><td>29.92</td></tr><tr><td>Wikipedia</td><td>2,735,930</td><td>8.69</td></tr><tr><td>Books</td><td>1,809,184</td><td>28.45</td></tr><tr><td>OntoNotes</td><td>63,918</td><td>17.14</td></tr><tr><td colspan="3">NLI benchmarks</td></tr><tr><td>RTE</td><td>16,389</td><td>7.16</td></tr><tr><td>SNLI</td><td>1,138,598</td><td>1.19</td></tr><tr><td>MNLI</td><td>883,436</td><td>22.63</td></tr></table>
54
+
55
+ 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.
56
+
57
+ 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.
58
+
59
+ # 4 Negation in English and Natural Language Inference Benchmarks
60
+
61
+ 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.
62
+
63
+ Table 1 details the percentage of sentences with at least one negation in several large general-purpose English corpora. We work with online
64
+
65
+ 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\%)$ .
66
+
67
+ 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).
68
+
69
+ 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:
70
+
71
+ - are particles (no, not, n't, etc.) whose only function is to indicate negation (RTE: $62\%$ , SNLI: $60\%$ , MNLI: $84\%$ ),
72
+ - grammatically modify a verb (RTE: $62\%$ , SNLI: $55\%$ , MNLI: $81\%$ ), and
73
+ - scope over the main predicate (RTE: 52%, SNLI: 53%, MNLI: 62%).
74
+
75
+ These percentages are roughly uniformly distributed across labels.
76
+
77
+ 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
78
+
79
+ <table><tr><td></td><td>Example</td></tr><tr><td rowspan="3">RTE</td><td>1) T: Mr Lopez Obrador, who lost July&#x27;s presidential election by less than one percentage point, declared himself Mexico&#x27;s &quot;legitimate&quot; president. H: Mr Lopez Obrador didn&#x27;t loose the presidential election in July.</td></tr><tr><td>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.</td></tr><tr><td>3) T: Toshiba has produced a fuel cell with no moving parts. H: Toshiba has no moving parts.</td></tr><tr><td rowspan="3">SNLI</td><td>4) T: A fighter jet plane is landed outside. H: The fighter jet plane is not moving.</td></tr><tr><td>5) T: A man with no shirt on is performing with a baton. H: A man is doing things with a baton.</td></tr><tr><td>6) T: A homeless man carries a sign that says &quot;hungry&quot;. H: The man does not have a home.</td></tr><tr><td rowspan="2">MNLI</td><td>7) T: It was summertime the air conditioner was on the door was closed and i couldn&#x27;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&#x27;t ring the doorbell because it was frozen.</td></tr><tr><td>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&#x27;s not commercial. H: It runs ads for its supporters at shows and strikes business deals, but insists it is not commercial.</td></tr></table>
80
+
81
+ 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.
82
+
83
+ 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.
84
+
85
+ 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:
86
+
87
+ - 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).
88
+ - 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).
89
+
90
+ <table><tr><td></td><td colspan="3">RTE</td><td colspan="4">SNLI</td><td colspan="4">MNLI</td></tr><tr><td></td><td>E</td><td>→E</td><td>All</td><td>E</td><td>C</td><td>N</td><td>All</td><td>E</td><td>C</td><td>N</td><td>All</td></tr><tr><td>% unimportant</td><td>77</td><td>75</td><td>76</td><td>38</td><td>24</td><td>93</td><td>48</td><td>78</td><td>24</td><td>83</td><td>52</td></tr><tr><td>% aligned</td><td>25</td><td>17</td><td>20</td><td>62</td><td>76</td><td>17</td><td>55</td><td>39</td><td>76</td><td>23</td><td>53</td></tr><tr><td>w/ negation</td><td>15</td><td>4</td><td>10</td><td>25</td><td>0</td><td>13</td><td>10</td><td>26</td><td>2</td><td>9</td><td>8</td></tr></table>
91
+
92
+ 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.
93
+
94
+ 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).
95
+
96
+ # 5 A Benchmark for Natural Language Understanding with Negation
97
+
98
+ 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
99
+
100
+ 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.
101
+
102
+ 1. Add negation manually to the main verb in T and H to obtain $\mathrm{T}_{\text{neg}}$ and $\mathrm{H}_{\text{neg}}$ .
103
+ 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}}$ .
104
+ 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).
105
+
106
+ 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.
107
+
108
+ 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
109
+
110
+ <table><tr><td></td><td>Original pair</td><td>New pair w/ negation</td></tr><tr><td rowspan="6">RTE</td><td>T: Tropical Storm Debby is blamed for several deaths across the Caribbean.</td><td>Tneg: Tropical Storm Debby is not blamed for several deaths across the Caribbean.</td></tr><tr><td>H: A tropical storm has caused loss of life.</td><td>Hneg: A tropical storm has not caused loss of life.</td></tr><tr><td colspan="2">Judgments: T-H: entailment, Tneg-H: no_ entailment, T-Hneg: no_ entailment, Tneg-Hneg: entailment</td></tr><tr><td>T: Dr. Pridi was forced into exile, and Field Marshal Pibul again assumed power.</td><td>Tneg: Dr. Pridi was not forced into exile, and Field Marshal Pibul again assumed power.</td></tr><tr><td>H: Pibul was a field marshal.</td><td>Hneg: Pibul was not a field marshal.</td></tr><tr><td colspan="2">Judgments: T-H: entailment, Tneg-H: entailment, T-Hneg: no_ entailment, Tneg-Hneg: no_ entailment</td></tr><tr><td rowspan="6">SNLI</td><td>T: Two people are working on computers.</td><td>Tneg: Two people are not working on computers.</td></tr><tr><td>H: Two people are near the computers.</td><td>Hneg: Two people are not near computers.</td></tr><tr><td colspan="2">Judgments: T-H: entailment, Tneg-H: neutral, T-Hneg: contradiction, Tneg-Hneg: neutral</td></tr><tr><td>T: Young man walking dog.</td><td>Tneg: Young man is not walking dog.</td></tr><tr><td>H: The man is walking his cat.</td><td>Hneg: The man is not walking his cat.</td></tr><tr><td colspan="2">Judgments: T-H: contradiction, Tneg-H: neutral, T-Hneg: entailment, Tneg-Hneg: neutral</td></tr><tr><td rowspan="6">MNLI</td><td>T: The lot upon which it is built had been vacant.</td><td>Tneg: The lot upon which it is built had not been vacant.</td></tr><tr><td>H: The lot had been vacant.</td><td>Hneg: The lot had not been vacant.</td></tr><tr><td colspan="2">Judgments: T-H: entailment, Tneg-H: contradiction, T-Hneg: contradiction, Tneg-Hneg: entailment</td></tr><tr><td>T: Thursday&#x27;s judge, the Honorable Charles Adams of the Coconino County Superior Court, agreed, but highly discouraged self-representation.</td><td>Tneg: Thursday&#x27;s judge, the Honorable Charles Adams of the Coconino County Superior Court, did not agree, but highly discouraged self-representation.</td></tr><tr><td>H: Self-representation was encouraged by the Honorable Charles Adams.</td><td>Hneg: Self-representation was not encouraged by the Honorable Charles Adams.</td></tr><tr><td colspan="2">Judgments: T-H: contradiction, Tneg-H: contradiction, T-Hneg: entailment, Tneg-Hneg: entailment</td></tr></table>
111
+
112
+ 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.
113
+
114
+ 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.
115
+
116
+ Annotation Process and Agreements. Three annotators and an additional adjudicator did the annotations described above in two phases.
117
+
118
+ 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
119
+
120
+ 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).
121
+
122
+ 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).
123
+
124
+ <table><tr><td></td><td colspan="2">RTE</td><td colspan="3">SNLI</td><td colspan="3">MNLI</td></tr><tr><td></td><td>%E</td><td>%-E</td><td>%E</td><td>%C</td><td>%N</td><td>%E</td><td>%C</td><td>%N</td></tr><tr><td>Tneg-H</td><td>19.8</td><td>80.2</td><td>6.0</td><td>32.0</td><td>62.0</td><td>11.8</td><td>45.8</td><td>42.4</td></tr><tr><td>T-Hneg</td><td>9.0</td><td>91.0</td><td>21.4</td><td>41.0</td><td>37.6</td><td>24.0</td><td>47.6</td><td>28.4</td></tr><tr><td>Tneg-Hneg</td><td>34.4</td><td>65.6</td><td>22.2</td><td>8.0</td><td>69.8</td><td>38.6</td><td>14.4</td><td>47.0</td></tr><tr><td>All</td><td>21.1</td><td>78.9</td><td>16.5</td><td>27.0</td><td>56.5</td><td>24.8</td><td>35.9</td><td>39.3</td></tr></table>
125
+
126
+ 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\%$ ).
127
+
128
+ <table><tr><td></td><td colspan="3">RTE</td><td colspan="4">SNLI</td><td colspan="4">MNLI</td></tr><tr><td></td><td>E</td><td>→E</td><td>All</td><td>E</td><td>C</td><td>N</td><td>All</td><td>E</td><td>C</td><td>N</td><td>All</td></tr><tr><td>% unimportant</td><td>52</td><td>56</td><td>56</td><td>17</td><td>24</td><td>61</td><td>42</td><td>12</td><td>19</td><td>63</td><td>43</td></tr><tr><td>% aligned</td><td>76</td><td>60</td><td>62</td><td>78</td><td>76</td><td>42</td><td>59</td><td>84</td><td>84</td><td>42</td><td>61</td></tr><tr><td>w/ negation</td><td>52</td><td>10</td><td>17</td><td>28</td><td>0</td><td>2</td><td>5</td><td>48</td><td>3</td><td>7</td><td>14</td></tr></table>
129
+
130
+ 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).
131
+
132
+ 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).
133
+
134
+ 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.
135
+
136
+ 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\%$ ,
137
+
138
+ 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\%$ ).
139
+
140
+ # 6 Experiments and Results
141
+
142
+ 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.
143
+
144
+ 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).
145
+
146
+ <table><tr><td rowspan="2">Test pairs</td><td colspan="4">RTE</td><td colspan="4">SNLI</td><td colspan="4">MNLI</td></tr><tr><td>MB</td><td>[1]</td><td>[2]</td><td>[3]</td><td>MB</td><td>[1]</td><td>[2]</td><td>[3]</td><td>MB</td><td>[1]</td><td>[2]</td><td>[3]</td></tr><tr><td>Original</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>dev</td><td>52.7</td><td>75.8</td><td>69.9</td><td>66.1</td><td>33.8</td><td>91.6</td><td>90.6</td><td>89.9</td><td>35.5</td><td>87.9</td><td>86.7</td><td>83.2</td></tr><tr><td>\( dev_{neg} \)</td><td>51.2</td><td>78.1</td><td>73.2</td><td>63.4</td><td>54.4</td><td>91.7</td><td>90.3</td><td>89.4</td><td>50.2</td><td>88.0</td><td>86.7</td><td>83.0</td></tr><tr><td>New w/ neg.</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>\( T_{neg}-H \)</td><td>80.2</td><td>70.8</td><td>69.0</td><td>65.2</td><td>62.0</td><td>46.4</td><td>39.8</td><td>32.6</td><td>45.8</td><td>66.2</td><td>63.8</td><td>65.6</td></tr><tr><td>T-\( H_{neg} \)</td><td>91.0</td><td>51.4</td><td>44.2</td><td>39.2</td><td>41.0</td><td>63.6</td><td>67.4</td><td>58.8</td><td>47.6</td><td>70.4</td><td>69.8</td><td>62.4</td></tr><tr><td>\( T_{neg}-H_{neg} \)</td><td>65.6</td><td>65.4</td><td>69.6</td><td>68.4</td><td>69.8</td><td>45.8</td><td>47.2</td><td>41.8</td><td>47.0</td><td>63.6</td><td>65.4</td><td>63.6</td></tr><tr><td>All</td><td>78.9</td><td>62.5</td><td>60.9</td><td>57.6</td><td>56.5</td><td>51.9</td><td>51.5</td><td>44.4</td><td>39.3</td><td>66.7</td><td>66.3</td><td>63.9</td></tr></table>
147
+
148
+ 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).
149
+
150
+ <table><tr><td rowspan="2">Train pairs</td><td colspan="3">RTE</td><td colspan="3">SNLI</td><td colspan="3">MNLI</td></tr><tr><td>[1]</td><td>[2]</td><td>[3]</td><td>[1]</td><td>[2]</td><td>[3]</td><td>[1]</td><td>[2]</td><td>[3]</td></tr><tr><td>Original</td><td>64.4</td><td>61.1</td><td>59.3</td><td>52.0</td><td>53.1</td><td>43.3</td><td>64.0</td><td>64.4</td><td>63.8</td></tr><tr><td>+ 70% new w/ neg.</td><td>88.2</td><td>87.3</td><td>83.8</td><td>75.3</td><td>74.2</td><td>69.1</td><td>67.3</td><td>70.4</td><td>66.4</td></tr></table>
151
+
152
+ 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.
153
+
154
+ # 6.1 Training with Existing Benchmarks
155
+
156
+ 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.
157
+
158
+ We make a couple additional observations from the results in Table 7. First, the transformers solve the few text-hypothesis pairs including negation in
159
+
160
+ 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.
161
+
162
+ # 6.2 Fine-Tuning with New Pairs Containing Negation
163
+
164
+ 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.
165
+
166
+ 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
167
+
168
+ 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.
169
+
170
+ # 7 Conclusions
171
+
172
+ 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).
173
+
174
+ 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
175
+
176
+ tion, our experimental results show that transformers struggle even after fine-tuning with new pairs containing negation.
177
+
178
+ # Acknowledgements
179
+
180
+ 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.
181
+
182
+ # References
183
+
184
+ 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.
185
+ 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.
186
+ Ron Artstein and Massimo Poesio. 2008. Inter-coder agreement for computational linguistics. Computational Linguistics, 34(4):555-596.
187
+ 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.
188
+ 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.
189
+ Luisa Bentivogli, Peter Clark, Ido Dagan, and Danilo Giampiccolo. 2009. The fifth pascal recognizing textual entailment challenge.
190
+
191
+ 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.
192
+ 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.
193
+ Jonathan P. Chang, Caleb Chiam, Liye Fu, Andrew Wang, Justine Zhang, and Cristian Danescu-Niculescu-Mizil. 2019. Convokit: The cornell conversational analysis toolkit.
194
+ Jacob Cohen. 1960. A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20(1):37-46.
195
+ 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.
196
+ 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.
197
+ 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.
198
+ 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.
199
+ 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
200
+
201
+ Conference on Computational Linguistics, pages 350-356, Geneva, Switzerland. COLING.
202
+ 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.
203
+ 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.
204
+ 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.
205
+ 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.
206
+ Matthew Honnibal and Ines Montani. 2017. spacy 2: Natural language understanding with bloom embeddings, convolutional neural networks and incremental parsing. To appear, 7.
207
+ 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.
208
+ 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.
209
+ 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.
210
+ 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
211
+
212
+ 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.
213
+ 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.
214
+ 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.
215
+ 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.
216
+ 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.
217
+ 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.
218
+ 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).
219
+ Roser Morante and Caroline Sporleder. 2012. Modality and negation: An introduction to the special issue. Computational Linguistics, 38(2):223-260.
220
+ 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.
221
+
222
+ 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.
223
+ 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.
224
+ Bo Pang and Lillian Lee. 2008. Opinion mining and sentiment analysis. Foundations and trends in information retrieval, 2(1-2):1-135.
225
+ 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.
226
+ 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.
227
+ 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.
228
+ 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.
229
+ 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.
230
+ Nils Reimers and Iryna Gurevych. 2017. Optimal hyperparameters for deep LSTM-networks for sequence labeling tasks. arXiv preprint arXiv:1707.06799.
231
+ 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.
232
+
233
+ 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.
234
+ 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.
235
+ 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.
236
+ 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.
237
+ 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.
238
+ 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.
239
+ 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.
240
+ 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.
241
+
242
+ 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.
243
+ 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.
244
+ 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.
245
+
246
+ # A Identifying Negations
247
+
248
+ 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).
249
+
250
+ 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.
251
+
252
+ 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,
253
+
254
+ <table><tr><td rowspan="2">Hyperparameter</td><td colspan="3">RTE</td><td colspan="3">SNLI</td><td colspan="3">MNLI</td></tr><tr><td>[1]</td><td>[2]</td><td>[3]</td><td>[1]</td><td>[2]</td><td>[3]</td><td>[1]</td><td>[2]</td><td>[3]</td></tr><tr><td>Batch size</td><td>16</td><td>8</td><td>8</td><td>32</td><td>32</td><td>32</td><td>32</td><td>32</td><td>32</td></tr><tr><td>Learning rate</td><td>2e-5</td><td>2e-5</td><td>2e-5</td><td>1e-5</td><td>1e-5</td><td>1e-5</td><td>2e-5</td><td>2e-5</td><td>2e-5</td></tr><tr><td>Epochs</td><td>10</td><td>50</td><td>50</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td><td>3</td></tr><tr><td>Weight decay</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.0</td><td>0.0</td><td>0.0</td></tr></table>
255
+
256
+ 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).
257
+
258
+ ![](images/61c84553349e36bb4546b83f3b56e4ccdae6b92bc6dae11ecf429b908051eae8.jpg)
259
+ 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."
260
+
261
+ e.g., inconsistent), SF_C (suffixal negation, e.g., emotionless), and N_C (not a cue).
262
+
263
+ 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,
264
+
265
+ 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.
266
+
267
+ 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.
268
+
269
+ # B Fine-tuning Hyperparameters for State-of-the-Art Systems
270
+
271
+ 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).
ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81d8a87fa5e1aa007ed189f26a5992b5822f95888d5de12846bd38ef3171cdbb
3
+ size 655539
ananalysisofnaturallanguageinferencebenchmarksthroughthelensofnegation/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:383dab421af37a14e83f5a559945437a46d0e79cff648bb2d4bab95e0fb9d10d
3
+ size 379906
anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10faf4eb650d470aedbbb542408a4412e0fd2a13c70c5cfb7a76784aee6d3f32
3
+ size 42771
anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0eea0a51507ca2f71bcdf6a05b50006233dccc0570bbdd09d5544ec7ea629dc5
3
+ size 50816
anelementawaremultirepresentationmodelforlawarticleprediction/e958525f-e09f-4738-9aa3-f6442be69862_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cbdc9c4b3d292a8b4ceb72a3d2d31c6556589e7049774cfb24b03f940007eed
3
+ size 1511809
anelementawaremultirepresentationmodelforlawarticleprediction/full.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # An Element-aware Multi-representation Model for Law Article Prediction
2
+
3
+ Huilin Zhong $^{1}$ , Junsheng Zhou $^{*1}$ , Weiguang $\mathbf{Q}^{\mathbf{u}}$ $^{1}$ , Yunfei Long $^{2}$ , and Yanhui Gu $^{1}$
4
+
5
+ <sup>1</sup> School of Computer and Electronic Information, Nanjing Normal University, China
6
+
7
+ $^{2}$ School of Computer Science and Electronic Engineering, University of Essex, Colchester, UK CO2 8JT
8
+
9
+ {zhoujs, wgqu}@njnu.edu.cn, yanhgu@gmail.com
10
+
11
+ yl20051@essex.ac.uk, elaine1027zhl@hotmail.com
12
+
13
+ # Abstract
14
+
15
+ 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\%$ .
16
+
17
+ # 1 Introduction
18
+
19
+ 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.
20
+
21
+ 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
22
+
23
+ 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).
24
+
25
+ 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).
26
+
27
+ 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.
28
+
29
+ ![](images/4a0f19418eeb77029f2eee7805aeca5ce78864ece6e8e324b89119ce6c3943dc.jpg)
30
+ Figure 1: Labeled Law Article
31
+
32
+ # 2 Structurally Labeling the Law Articles
33
+
34
+ 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.
35
+
36
+ # 3 LEMM Model
37
+
38
+ 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}\}$ .
39
+
40
+ Our model contains five components:
41
+
42
+ Encoder: encode law article elements and fact.
43
+
44
+ Feature Extraction: use element representa
45
+
46
+ tions to extract word-level and document-level fact representation by attention mechanism.
47
+
48
+ Fusion: fuse the word-level and document-level fact representation to law-aware representations.
49
+
50
+ Relation Extraction: extract the dependencies between law articles by self-attention.
51
+
52
+ Classification: classify whether the law article is relevant.
53
+
54
+ # 3.1 Encoder
55
+
56
+ The Encoder component contains two encoders, which are element encoder and fact encoder.
57
+
58
+ # 3.1.1 Element Encoder
59
+
60
+ 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:
61
+
62
+ $$
63
+ 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}
64
+ $$
65
+
66
+ $$
67
+ e l e _ {i} = B i G R U _ {i} \left(\left\{w _ {1}, w _ {2}, \dots , w _ {i k} \right\}\right) \tag {2}
68
+ $$
69
+
70
+ # 3.1.2 Fact Encoder
71
+
72
+ 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}$ .
73
+
74
+ $$
75
+ F = \left\{\overrightarrow {h _ {0}}; \overrightarrow {h _ {m}} \right\} \tag {3}
76
+ $$
77
+
78
+ $$
79
+ x _ {i} = \left\{\overrightarrow {h _ {i}}; \overrightarrow {h _ {i} ^ {\prime}} \right\} \tag {4}
80
+ $$
81
+
82
+ $$
83
+ \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)
84
+ $$
85
+
86
+ ![](images/3a337082bc6507947c613907f0be899d1aec27043f205513e0f973782b67e8a5.jpg)
87
+ Figure 2: Overview of our LEMM for law article prediction
88
+
89
+ ![](images/c9fcb64309b762362a1f6b4e8b22f367804a7e2dd9fef61e71604c14c24dbb2d.jpg)
90
+ Figure 3: The components of LEMM for law article prediction
91
+
92
+ # 3.2 Feature Extraction
93
+
94
+ 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.
95
+
96
+ # 3.2.1 Word-level Feature Extraction
97
+
98
+ 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.
99
+
100
+ $$
101
+ \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}
102
+ $$
103
+
104
+ $$
105
+ r e p _ {w i} = \sum_ {j = 1} ^ {m} \alpha_ {i j} x _ {j} \tag {7}
106
+ $$
107
+
108
+ # 3.2.2 Document-level Feature Extraction
109
+
110
+ To further strengthen the interaction between the fact and the law articles, we also use crime name
111
+
112
+ representations to extract the document-level features of the fact $rep_d$ via element-wise product.
113
+
114
+ $$
115
+ r e p _ {d} = f _ {c h} (c h) \cdot f _ {F} (F) \tag {8}
116
+ $$
117
+
118
+ # 3.3 Fusion
119
+
120
+ 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.
121
+
122
+ # 3.3.1 Crime-aware Fusion
123
+
124
+ 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.
125
+
126
+ $$
127
+ 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}
128
+ $$
129
+
130
+ $f$ is a linear function and $[\cdot ,]$ means concatenate. chAwareiscrime-aware representation.
131
+
132
+ # 3.3.2 Law-aware Fusion
133
+
134
+ 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.
135
+
136
+ $$
137
+ a r t i c l e A w a r e _ {s} = c h A w a r e _ {u} \tag {10}
138
+ $$
139
+
140
+ 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.
141
+
142
+ 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.
143
+
144
+ $$
145
+ 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}
146
+ $$
147
+
148
+ $$
149
+ 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}
150
+ $$
151
+
152
+ $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.
153
+
154
+ # 3.4 Relation Extraction
155
+
156
+ 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.
157
+
158
+ $$
159
+ 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}
160
+ $$
161
+
162
+ $$
163
+ \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}
164
+ $$
165
+
166
+ $$
167
+ i n p u t _ {i} = \sum_ {j = 1} ^ {| k |} \beta_ {i} v _ {j} \tag {15}
168
+ $$
169
+
170
+ $input_{i}$ is the new fact representation used to discriminate whether the $i$ -th law article is relevant.
171
+
172
+ # 3.5 Classification
173
+
174
+ 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.
175
+
176
+ $$
177
+ 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}
178
+ $$
179
+
180
+ MLP is a multi-layer perceptron.
181
+
182
+ # 4 Experiments
183
+
184
+ This part includes data selection, experimental parameter setting, baseline model, and detailed experimental results.
185
+
186
+ # 4.1 Dataset and Evaluation
187
+
188
+ 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.
189
+
190
+ We use the correct rate, micro/macro accuracy, precision, recall, and F1 as evaluation indicators.
191
+
192
+ # 4.2 Experimental Parameter Setting
193
+
194
+ 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.
195
+
196
+ # 4.3 Experimental Results
197
+
198
+ 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].
199
+
200
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Acc</td><td colspan="3">Macro</td><td colspan="3">Micro</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>TopJudge</td><td>71.41</td><td>81.20</td><td>73.88</td><td>76.04</td><td>80.31</td><td>79.40</td><td>79.85</td></tr><tr><td>CNN</td><td>71.36</td><td>78.60</td><td>73.88</td><td>75.54</td><td>79.32</td><td>78.89</td><td>79.10</td></tr><tr><td>LSTM</td><td>72.08</td><td>80.51</td><td>76.58</td><td>77.66</td><td>79.87</td><td>80.42</td><td>80.14</td></tr><tr><td>BiLSTM</td><td>72.27</td><td>79.45</td><td>78.01</td><td>78.07</td><td>78.59</td><td>81.81</td><td>80.17</td></tr><tr><td>LEMM</td><td>77.25</td><td>83.91</td><td>82.11</td><td>82.46</td><td>83.73</td><td>84.55</td><td>84.13</td></tr></table>
201
+
202
+ Table 1: Results on CAIL 2018 small (filtered)
203
+
204
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Acc</td><td colspan="3">Macro</td><td colspan="3">Micro</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>TopJudge</td><td>65.45</td><td>61.11</td><td>46.65</td><td>50.17</td><td>78.13</td><td>72.47</td><td>75.19</td></tr><tr><td>CNN</td><td>67.18</td><td>62.55</td><td>51.02</td><td>53.91</td><td>77.66</td><td>75.20</td><td>76.41</td></tr><tr><td>LSTM</td><td>68.99</td><td>64.52</td><td>56.71</td><td>58.57</td><td>77.05</td><td>78.26</td><td>77.65</td></tr><tr><td>BiLSTM</td><td>70.32</td><td>65.07</td><td>59.63</td><td>60.51</td><td>76.73</td><td>80.53</td><td>78.58</td></tr><tr><td>LEMM</td><td>72.13</td><td>73.53</td><td>61.21</td><td>64.69</td><td>81.47</td><td>81.65</td><td>81.56</td></tr></table>
205
+
206
+ 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:
207
+
208
+ (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.
209
+ (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.
210
+
211
+ # 4.4 Ablation Experiment
212
+
213
+ 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
214
+
215
+ Table 2: Results on CAIL 2018 small (whole)
216
+
217
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Acc</td><td colspan="3">Macro</td><td colspan="3">Micro</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>LEMM</td><td>77.25</td><td>83.91</td><td>82.11</td><td>82.46</td><td>83.73</td><td>84.55</td><td>84.13</td></tr><tr><td>-R</td><td>75.85</td><td>85.13</td><td>78.77</td><td>81.18</td><td>84.48</td><td>82.93</td><td>83.70</td></tr><tr><td>fact-art</td><td>72.68</td><td>83.05</td><td>79.66</td><td>80.62</td><td>82.06</td><td>82.88</td><td>82.47</td></tr></table>
218
+
219
+ Table 3: Ablation Experiment Results
220
+
221
+ law article into BiGRU for encoding and use the law article representation to extract features of the fact.
222
+
223
+ 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.
224
+
225
+ The performance has a sharp drop without manual labeling law article elements. This verifies the labeled law article information is useful in extracting facts.
226
+
227
+ # 5 Conclusion
228
+
229
+ 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.
230
+
231
+ # Acknowledgments
232
+
233
+ 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).
234
+
235
+ # References
236
+
237
+ Jianpeng Cheng, Li Dong, and Mirella Lapata. 2016. Long short-term memory-networks for machine reading. CoRR, abs/1601.06733.
238
+ 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.
239
+ Zikun Hu, Xiang Li, Cunchao Tu, Zhiyuan Liu, and Maosong Sun. 2018. Few-shot charge prediction
240
+
241
+ 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.
242
+ Yoon Kim. 2014. Convolutional neural networks for sentence classification. CoRR, abs/1408.5882.
243
+ Zhongguo Li and Maosong Sun. 2009. Punctuation as implicit annotations for chinese word segmentation. Computational Linguistics.
244
+ 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.
245
+ 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.
246
+ Xin Rong. 2014. word2vec parameter learning explained. CoRR, abs/1411.2738.
247
+ 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.
248
+ 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.
249
+ 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.
250
+ 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.
251
+ 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.
anelementawaremultirepresentationmodelforlawarticleprediction/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d87c97b0b6df639735b2d334d213f36e8623009e2641d6efebb40bb2ccffe31
3
+ size 315541
anelementawaremultirepresentationmodelforlawarticleprediction/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e55fbd5aff3f32df56c20cde9f171ba59b366a6ae079e1ef63bbca60197793e6
3
+ size 212782
anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1feda2bd88aa9ace8622298c6eaa25b0d0bfafc67a9fce91abe85b8500c18237
3
+ size 95562
anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbcf3535dffc7262d5519f1f164181c72e5f6ef0ffc00b663f9b85d9fcc1f607
3
+ size 111673
anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/69c0dfe4-c3ca-4931-a04b-723cb5c80e36_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e58e6f4ed8764b976577b5bbbcc7437f74e65532f21e2167634d5074e75b9ca
3
+ size 2127032
anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/full.md ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # An Embedding Model for Estimating Legislative Preferences from the Frequency and Sentiment of Tweets
2
+
3
+ Gregory P. Spell
4
+
5
+ Duke University / Durham, N.C.
6
+
7
+ gregory.spell@duke.edu
8
+
9
+ D. Sunshine Hillygus
10
+
11
+ Duke University / Durham, N.C.
12
+
13
+ hillygus@duke.edu
14
+
15
+ Brian Guay
16
+
17
+ Duke University / Durham, N.C.
18
+
19
+ brian.guay@duke.edu
20
+
21
+ Lawrence Carin
22
+
23
+ Duke University / Durham, N.C.
24
+
25
+ carin@duke.edu
26
+
27
+ # Abstract
28
+
29
+ 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.
30
+
31
+ # 1 Introduction
32
+
33
+ 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
34
+
35
+ 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.
36
+
37
+ 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.<sup>1</sup> 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
38
+
39
+ 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.
40
+
41
+ # 2 Measuring Legislator Preferences
42
+
43
+ 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).
44
+
45
+ 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.
46
+
47
+ 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
48
+
49
+ beddings, to model bill text.
50
+
51
+ 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.
52
+
53
+ 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.
54
+
55
+ # 3 Tweet Dataset
56
+
57
+ 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
58
+
59
+ ![](images/525acaf5800e9aa89078876e34b2a357a5a46d005dc32f01b33fd48a9df12611.jpg)
60
+ Figure 1: Number of tweets by Republican and Democratic legislators about Trump, as well as tweets by Trump, over time.
61
+
62
+ "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.
63
+
64
+ 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.
65
+
66
+ 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.
67
+
68
+ 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
69
+
70
+ tweet² from November 2016 to February 2018.
71
+
72
+ 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.
73
+
74
+ <table><tr><td></td><td># Days</td><td># Labeled</td><td># Total</td></tr><tr><td>Training</td><td>324</td><td>3069</td><td>20116</td></tr><tr><td>Validation</td><td>47</td><td>412</td><td>2441</td></tr><tr><td>Test</td><td>95</td><td>1180</td><td>7139</td></tr></table>
75
+
76
+ Table 1: Split of Training, Validation, and Test sets.
77
+
78
+ # 4 Legislator Tweet Model Formulation
79
+
80
+ 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.
81
+
82
+ 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.
83
+
84
+ # 4.1 Tweet Count Model
85
+
86
+ 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.
87
+
88
+ 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)$ :
89
+
90
+ $$
91
+ 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)
92
+ $$
93
+
94
+ 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.
95
+
96
+ 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:
97
+
98
+ $$
99
+ \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}
100
+ $$
101
+
102
+ # 4.2 Tweet Sentiment Model
103
+
104
+ Let $y_{it}$ be an ordinal variable that encodes the sentiment legislator $i$ expresses in a tweet about Donald
105
+
106
+ 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.
107
+
108
+ 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:
109
+
110
+ $$
111
+ p (y _ {i t} = l | z _ {i t}; \mathcal {C}) = \sigma (c _ {l} - z _ {i t}) - \sigma (c _ {l - 1} - z _ {i t}) (3)
112
+ $$
113
+
114
+ 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:
115
+
116
+ $$
117
+ 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)
118
+ $$
119
+
120
+ where $\mathbf{H}_g\in \mathbb{R}^{K\times K}$ is a learned weight matrix.
121
+
122
+ 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:
123
+
124
+ $$
125
+ \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}
126
+ $$
127
+
128
+ where $\mathbb{I}(\cdot)$ denotes the indicator function, in which $\mathbb{I}(\cdot) = 1$ when the argument is true and 0 otherwise.
129
+
130
+ # 4.3 Trump Embedding Construction
131
+
132
+ 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
133
+
134
+ 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.
135
+
136
+ 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:
137
+
138
+ $$
139
+ \boldsymbol {\tau} _ {t} = \mathbf {M} \boldsymbol {\alpha} _ {t} + \mathbf {a} \tag {6}
140
+ $$
141
+
142
+ 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:
143
+
144
+ $$
145
+ \boldsymbol {\tau} _ {t} = \mathbf {M} _ {2} \phi \left(\mathbf {M} _ {1} \boldsymbol {\alpha} _ {t} + \mathbf {a} _ {1}\right) + \mathbf {a} _ {2} \tag {7}
146
+ $$
147
+
148
+ where an additional weight matrix and bias vector have been appended.
149
+
150
+ # 4.4 Model Training & Parameter Learning
151
+
152
+ 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:
153
+
154
+ $$
155
+ \mathcal {L} (\Theta) = \gamma \mathcal {L} _ {\text {c o u n t}} + (1 - \gamma) \mathcal {L} _ {\text {o r d}} \tag {8}
156
+ $$
157
+
158
+ 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}$ .
159
+
160
+ # 5 Predictive Results
161
+
162
+ 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.
163
+
164
+ 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.
165
+
166
+ # 5.1 $\gamma = 1$ (only count model):
167
+
168
+ 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.
169
+
170
+ <table><tr><td rowspan="2"></td><td colspan="2">Text</td><td colspan="2">No Text</td></tr><tr><td>Loss</td><td>MAE</td><td>Loss</td><td>MAE</td></tr><tr><td>Poisson</td><td>20,882</td><td>0.692</td><td>49,128</td><td>0.693</td></tr><tr><td>Neg. Bin.</td><td>16,692</td><td>0.726</td><td>18,461</td><td>0.696</td></tr></table>
171
+
172
+ 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.
173
+
174
+ # 5.2 $\gamma = 0$ (only sentiment model):
175
+
176
+ 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
177
+
178
+ 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.
179
+
180
+ 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.
181
+
182
+ <table><tr><td rowspan="2"></td><td colspan="2">Text</td><td colspan="2">No Text</td></tr><tr><td>Loss</td><td>MAE</td><td>Loss</td><td>MAE</td></tr><tr><td>No Bias</td><td>549.63</td><td>0.140</td><td>1714.48</td><td>0.878</td></tr><tr><td>Bias</td><td>548.80</td><td>0.140</td><td>831.24</td><td>0.390</td></tr></table>
183
+
184
+ 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
185
+
186
+ 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.
187
+
188
+ 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.
189
+
190
+ # 5.3 $\gamma = 0.03$ (both counts & sentiment):
191
+
192
+ 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
193
+
194
+ 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.
195
+
196
+ <table><tr><td></td><td>Count NLL</td><td>MAE</td><td>Total Loss</td></tr><tr><td>No Text</td><td>28,571</td><td>0.213</td><td>1583.97</td></tr><tr><td>Text</td><td>16,782</td><td>0.127</td><td>994.76</td></tr></table>
197
+
198
+ Table 4: Predictive evaluation metrics on test for our model with $\gamma = {0.03}$ . Best model result bolded
199
+
200
+ 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.
201
+
202
+ # 6 Legislator Embeddings
203
+
204
+ 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
205
+
206
+ 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
207
+
208
+ ![](images/2604e4fd0ad3be693ab3f1b49eba806e323f734c749d8e0733266990bcfd0611.jpg)
209
+ Legislator Embeddings
210
+ 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.
211
+
212
+ 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.
213
+
214
+ 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]
215
+
216
+ 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
217
+
218
+ ![](images/e204901bb6f33a90d1175238e5e9d09a02a5c2fe9354fd23864265a20f81e20d.jpg)
219
+ Comparisons of Embeddings with: DW-NOMINATE Voting with Trump
220
+
221
+ ![](images/7be5a41c63e31d76c1acaddb12d1299f8b5a3a4e417c586e0d0c99bcb5eb928d.jpg)
222
+ 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.
223
+
224
+ 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.
225
+
226
+ 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.
227
+
228
+ 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-
229
+
230
+ 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.
231
+
232
+ 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
233
+
234
+ 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.
235
+
236
+ # 7 Conclusion
237
+
238
+ 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.
239
+
240
+ 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).
241
+
242
+ 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
243
+
244
+ 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.
245
+
246
+ 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.
247
+
248
+ # Acknowledgments
249
+
250
+ 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.
251
+
252
+ # References
253
+
254
+ 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.
255
+ Pablo Barbera. 2015. Birds of the same feather tweet together: Bayesian ideal point estimation using twitter data. Political Analysis.
256
+ Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Janvin. 2003. A neural probabilistic language model. The Journal of Machine Learning Research.
257
+ Adam Bonica. 2018. Inferring roll-call scores from campaign contributions using supervised machine learning. American Journal of Political Science.
258
+ Joshua Clinton, Simon Jackman, and Douglas Rivers. 2004. The statistical analysis of roll call data. *The American Political Science Review*.
259
+ Skyler J. Cranmer and Bruce A. Desmarais. 2017. What can we learn from predictive modeling? Political Analysis, 25(2):145-166.
260
+ Sean Gerrish and David M. Blei. 2011. Predicting legislative roll calls from text. International Conference of Machine Learning 28.
261
+ Sean Gerrish and David M. Blei. 2012. How they vote: Issue-adjusted models of legislative behavior. Advances in Neural Information Processing Systems 25.
262
+ Yupeng Gu, Yizhou Sun, Ning Jiang, Bingyu Wang, and Ting Chen. 2014. Topic-factorized ideal point estimation model for legislative voting network. KDD 2014.
263
+ 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.
264
+ Kosuke Imai, James Lo, and Jonathan Olmsted. 2016. Fast estimation of ideal points with massive data. American Political Science Review, 110(4):631-656.
265
+ Nal Kalchbrenner, Edward Grefenstette, and Phil Blumson. 2014. A convolutional neural network for
266
+
267
+ modelling sentences. Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics.
268
+ Yoon Kim. 2014. Convolutional neural networks for sentence classification. Conference on Empirical Methods in Natural Language Processing.
269
+ Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. Proceedings of the 3rd Annual International Conference for Learning Representations.
270
+ 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.
271
+ 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.
272
+ 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.
273
+ 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.
274
+ 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.
275
+ Keith T. Poole and Howard Rosenthal. 1997. Congress: A Political-Economic History of Roll Call Voting. Oxford University Press.
276
+ 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.
277
+ Ludovic Rheault and Christopher Cochrane. 2020. Word embeddings for the analysis of ideological placement in parliamentary corpora. Political Analysis, 28(1):112-133.
278
+ 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
279
+
280
+ mechanisms. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics.
281
+
282
+ Nate Silver and Aaron Bycoffe. 2019. Tracking Congress In The Age Of Trump. Available online at https://projects.fivethirtyeight.com/ congress-trump-score/.
283
+
284
+ 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.
285
+
286
+ 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.
287
+
288
+ 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.
289
+
290
+ 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.
291
+
292
+ Yu Wang, Richard Niemi, and Jiebo Luo. 2016. Tactics and tallies: A study of the 2016 u.s. presidential campaign using twitter 'likes'. KDD.
293
+
294
+ 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.
295
+
296
+ # A Data Description
297
+
298
+ 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$ ).
299
+
300
+ 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,
301
+
302
+ 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.
303
+
304
+ 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).
305
+
306
+ 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.
307
+
308
+ <table><tr><td></td><td>% Positive</td><td>% Negative</td><td>% Neutral</td></tr><tr><td>Democratic</td><td>1.56</td><td>92.04</td><td>6.40</td></tr><tr><td>Republican</td><td>81.87</td><td>2.17</td><td>15.96</td></tr></table>
309
+
310
+ Table 5: Breakdown of labeled tweet sentiment classes according to party
311
+
312
+ See Section 3 for description of the splits into training, validation, and test datasets.
313
+
314
+ # B Model Selection Decisions
315
+
316
+ 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.
317
+
318
+ 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.
319
+
320
+ # B.1 Tuning Model Dimension
321
+
322
+ 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.
323
+
324
+ 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;
325
+
326
+ 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.
327
+
328
+ # B.2 Tuning Loss Tradeoff Parameter $\gamma$
329
+
330
+ 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.
331
+
332
+ 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.
333
+
334
+ # B.3 Comparing Model with Nonlinear Map
335
+
336
+ 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).
337
+
338
+ 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.
339
+
340
+ ![](images/90821e81effaaac985ad768747f363b7bf3c6f1fd9b6000528de1c07a195b8bb.jpg)
341
+ Evaluation Metrics Across Model Dimension Sweep
342
+
343
+ ![](images/cfcada91ea1da3e953905b3dd349da28e0e8ccfc2c3173c2982e67805b7efcb9.jpg)
344
+
345
+ ![](images/adc48026f786723fc955ffcb1c27789b9fd36c6925f3b4b0ed2910993208b3b6.jpg)
346
+ Figure 4: Evaluation metrics for the Basic model across a sweep of different model dimensions
347
+
348
+ ![](images/3e425fa0a84d27985307183d517958f67a56a0ac3f5d00382c48944bc7e453e4.jpg)
349
+ Evaluation Metrics Across Loss Tradeoff Parameter
350
+
351
+ ![](images/5d42cc8559e88d39003d108a518a56a8c04c2a71e07211cf27420d8df0c0c131.jpg)
352
+
353
+ ![](images/5f2f716688f4047210564d439ac4a91794c2b7702c22f2bac5f6d9315180b114.jpg)
354
+ Figure 5: Evaluation metrics for the Basic model across a sweep of different loss tradeoff parameter values
355
+
356
+ ![](images/4211a319eb2d465cb2718222233f9aa62bede571863683619e9ab5179de01ee0.jpg)
357
+ Evaluation Metrics Across Model Dimension Sweep
358
+
359
+ ![](images/3af8a1fcee8b0a3a3cb4273ecdebd935c8925c560fdb0f898ac9452bb99eef3e.jpg)
360
+
361
+ ![](images/4612b83941f495b67f217d6bb74d62bcb63cce86e15cc10fe31e3959e6f25d3d.jpg)
362
+ Figure 6: Evaluation metrics for the nonlinear and affine models over a sweep of model dimension
363
+
364
+ ![](images/7480d1f38c50ed73dd06eacf7af15747ce7c47cd3a16baefec5d705e308afc64.jpg)
365
+ Comparison of Model Embeddings to Other Measures
366
+
367
+ ![](images/8f54f12c9938c79933ab960f861f3720ab215b523068d4149ce3de504b5a5163.jpg)
368
+ Campaign Finance Score
369
+
370
+ 2016 Trump Vote Margin in District
371
+ Figure 7: Comparisons of the learned legislator embeddings to general measures of legislator preferences and proxies for a legislator's support for Trump.
372
+ ![](images/b53693bc0aef8bbe5aefd5cf2271f1ec1482754e868a8a0bfcd27a725c528901.jpg)
373
+ Party Democrats Republicans
374
+
375
+ Voting Against Trump
376
+ ![](images/2f6d30d826b94111dfdf40d0a9f6060a9e0923a4c3ae670f11335539b632b3df.jpg)
377
+ Chamber House Senate
378
+
379
+ # C Comparison with Other Preference Measures
380
+
381
+ 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.
382
+
383
+ # D Legislator Embeddings with Labels
384
+
385
+ 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.
386
+
387
+ ![](images/f1d77a1733c690c21ccf61cb226d2e35883e760ab24ec2671dc41c63931a7a0f.jpg)
388
+ Legislator Embeddings
389
+ 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.
anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d3dacdaab9d50a42b1dc9aab73f3d73c719f96e5c51ba647b558994ff01931f
3
+ size 475590
anembeddingmodelforestimatinglegislativepreferencesfromthefrequencyandsentimentoftweets/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52e19d3c01fb756390e8aff0c18bca6b7ce0d41a7aed05a6527c991013adf6ef
3
+ size 452504
anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8eb2e364ee4426a77d450297734520d5a998a59bb516df808a637147cd6028ef
3
+ size 75444
anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:805f6ad8b1055cdd0a8f4069f6bbb877448fc73e2d31d88851a6f29548d4d95f
3
+ size 88610
anempiricalinvestigationofcontextualizednumberprediction/3516ac12-1142-4fa4-b5cb-d2528bd1fae1_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:680738177664439a67b334e1e1b967668e9a044a256a5546b5378f8b956d8a31
3
+ size 579293
anempiricalinvestigationofcontextualizednumberprediction/full.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # An Empirical Investigation of Contextualized Number Prediction
2
+
3
+ Daniel Spokoyny
4
+
5
+ Carnegie Mellon University
6
+
7
+ dspokoyn@cs.cmu.edu
8
+
9
+ Taylor Berg-Kirkpatrick
10
+
11
+ UC San Diego
12
+
13
+ tberg@ucsd.edu
14
+
15
+ # Abstract
16
+
17
+ 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.<sup>1</sup>
18
+
19
+ # 1 Introduction
20
+
21
+ 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
22
+
23
+ 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.
24
+
25
+ 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
26
+
27
+ 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.
28
+
29
+ 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.
30
+
31
+ # 2 Models
32
+
33
+ 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.
34
+
35
+ 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
36
+
37
+ 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].
38
+
39
+ 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.
40
+
41
+ # 2.1 Input Context Representation
42
+
43
+ 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.
44
+
45
+ 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}}$ .
46
+
47
+ # 2.1.1 Digit-RNN Embedding
48
+
49
+ 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
50
+
51
+ ![](images/1385b9e582adca18087751adf16408c07e717019b402b025413a7290b95b1bcd.jpg)
52
+ 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.
53
+
54
+ a string. We then use a digit-RNN to encode the string and use the last output as $e^{\mathrm{NUM}}$ .
55
+
56
+ # 2.1.2 Exponent Embedding
57
+
58
+ 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.
59
+
60
+ # 2.2 Context Encoder
61
+
62
+ 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.
63
+
64
+ # 2.2.1 Transformer Encoder
65
+
66
+ 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.
67
+
68
+ # 2.2.2 BiGru Encoder
69
+
70
+ 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.
71
+
72
+ # 2.3 Real-valued Output Distributions
73
+
74
+ 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})$ .
75
+
76
+ # 2.3.1 Log Laplace
77
+
78
+ 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
79
+
80
+ ![](images/dd0e9e97ab4ff5683cbf222bc258e57d8a7f1074125c79b912e923cb8e90953c.jpg)
81
+ (a) Transformed Laplace
82
+ 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.
83
+
84
+ ![](images/b415edf3e46f2ed035198ef3d10b7d23e140bb01e4133d4adc77ed86d21ccde2.jpg)
85
+ (b) Latent Exponent
86
+
87
+ 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.
88
+
89
+ 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:
90
+
91
+ # Generative Process:
92
+
93
+ $$
94
+ z \sim L a p l a c e (\mu_ {\theta} (H), 1)
95
+ $$
96
+
97
+ $$
98
+ y = g _ {\theta} (z) = \exp z
99
+ $$
100
+
101
+ # Training Objective:
102
+
103
+ $$
104
+ g _ {\theta} ^ {- 1} (y) = \log y
105
+ $$
106
+
107
+ $$
108
+ \log P (y \mid \mathbf {X}) = - \left| g _ {\theta} ^ {- 1} (y) - \mu_ {\theta} (H) \right| - C + \log J _ {d e t} (y)
109
+ $$
110
+
111
+ $$
112
+ \log J _ {d e t} (y) = \log \left| \frac {d g ^ {- 1}}{d y} (y) \right| = \log \left| \frac {1}{y} \right| \tag {1}
113
+ $$
114
+
115
+ # 2.3.2 Flow-transformed Laplace
116
+
117
+ 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
118
+
119
+ 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.
120
+
121
+ # Generative Process:
122
+
123
+ $$
124
+ z \sim L a p l a c e (\mu_ {\theta} (H), 1)
125
+ $$
126
+
127
+ $$
128
+ y = g _ {\theta} (z) = \frac {\exp (\frac {z - a}{b})}{c}
129
+ $$
130
+
131
+ # Training Objective:
132
+
133
+ $$
134
+ g _ {\theta} ^ {- 1} (y) = a + b \log c y
135
+ $$
136
+
137
+ $$
138
+ \log P (y \mid \mathbf {X}) = - \left| g _ {\theta} ^ {- 1} (y) - \mu_ {\theta} (H) \right| - C + \log J _ {d e t} (y)
139
+ $$
140
+
141
+ $$
142
+ \log J _ {d e t} (y) = \log \left| \frac {d g ^ {- 1}}{d y} (y) \right| = \log \left| \frac {b}{y} \right| \tag {2}
143
+ $$
144
+
145
+ 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.
146
+
147
+ # 2.3.3 Discrete Latent Exponent
148
+
149
+ 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
150
+
151
+ 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.
152
+
153
+ 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.
154
+
155
+ # Generative Process:
156
+
157
+ $$
158
+ e \sim M u l t (\pi_ {\theta} (H))
159
+ $$
160
+
161
+ $$
162
+ y \sim \mathcal {N} _ {\text {t r u n k} [ 0. 1, 1 ]} \left(\mu_ {\theta} (H, e), 0. 0 5\right)
163
+ $$
164
+
165
+ # Training Objective:
166
+
167
+ $$
168
+ e ^ {*} (y) = \left\lfloor \log_ {1 0} (y) \right\rfloor
169
+ $$
170
+
171
+ $$
172
+ \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}
173
+ $$
174
+
175
+ # 2.3.4 Gaussian Mixture Model
176
+
177
+ 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
178
+
179
+ weights $P(e|X)$
180
+
181
+ # Generative Process:
182
+
183
+ $$
184
+ \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}
185
+ $$
186
+
187
+ Training Objective:
188
+
189
+ $$
190
+ \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}
191
+ $$
192
+
193
+ # 3 Data
194
+
195
+ 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 Reuters<sup>4</sup>. We randomly break the documents into [train, valid, test] splits with [246065, 30000, 30000] respectively.
196
+
197
+ 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.
198
+
199
+ 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.
200
+
201
+ # 3.1 Preprocessing
202
+
203
+ 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
204
+
205
+ 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.
206
+
207
+ 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.
208
+
209
+ 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.
210
+
211
+ # 4 Experiments
212
+
213
+ 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).
214
+
215
+ # 4.1 Evaluation
216
+
217
+ 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
218
+
219
+ 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.
220
+
221
+ $$
222
+ 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}
223
+ $$
224
+
225
+ $$
226
+ 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}
227
+ $$
228
+
229
+ # 4.2 Numerical Anomaly Detection
230
+
231
+ 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.
232
+
233
+ # 4.3 Implementation Details
234
+
235
+ 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}$ .
236
+
237
+ 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
238
+
239
+ <table><tr><td rowspan="2"></td><td colspan="3">FinNews</td><td colspan="3">FinNews-\$</td><td colspan="3">Sci</td></tr><tr><td>train</td><td>valid</td><td>test</td><td>train</td><td>valid</td><td>test</td><td>train</td><td>valid</td><td>test</td></tr><tr><td>#instances</td><td>522996</td><td>58095</td><td>64433</td><td>188286</td><td>22338</td><td>23281</td><td>360514</td><td>36523</td><td>36104</td></tr><tr><td>avg-length</td><td>102.5</td><td>108.3</td><td>108.9</td><td>115.2</td><td>115.4</td><td>116.1</td><td>125.6</td><td>126.4</td><td>126.5</td></tr><tr><td>%numbers</td><td>8.8</td><td>9.3</td><td>9.6</td><td>13.0</td><td>12.7</td><td>13.2</td><td>7.1</td><td>7.2</td><td>7.1</td></tr><tr><td>min</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td></tr><tr><td>median 50</td><td>313.0</td><td>250.0</td><td>329.0</td><td>2016.0</td><td>2016.0</td><td>2016.0</td><td>9.0</td><td>8.0</td><td>9.0</td></tr><tr><td>median 75</td><td>3141.0</td><td>2558.0</td><td>3500.0</td><td>~ 10^4</td><td>~ 10^4</td><td>~ 10^4</td><td>42.0</td><td>40.0</td><td>43.0</td></tr><tr><td>median 90</td><td>~ 10^6</td><td>~ 10^6</td><td>~ 10^6</td><td>~ 10^7</td><td>~ 10^7</td><td>~ 10^7</td><td>1959.0</td><td>1948.0</td><td>1972.1</td></tr><tr><td>max</td><td>~ 10^15</td><td>~ 10^14</td><td>~ 10^15</td><td>~ 10^15</td><td>~ 10^14</td><td>~ 10^15</td><td>~ 10^15</td><td>~ 10^14</td><td>~ 10^15</td></tr></table>
240
+
241
+ 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.
242
+
243
+ randomly substituting it with a number from train, and $10\%$ of the time leaving it unchanged.
244
+
245
+ 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.
246
+
247
+ # 4.4 Results
248
+
249
+ 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.
250
+
251
+ 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.
252
+
253
+ 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.
254
+
255
+ 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})$ .
256
+
257
+ 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.
258
+
259
+ 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.
260
+
261
+ # 4.5 Ablations
262
+
263
+ 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.
264
+
265
+ <table><tr><td>Model</td><td>LMAE↓</td><td>E-Acc ↑</td><td>r-AUC↑</td><td>s-AUC↑</td></tr><tr><td>Train-Mean</td><td>7.69</td><td>1.03</td><td>-</td><td>-</td></tr><tr><td>Train-Median</td><td>1.88</td><td>5.52</td><td>-</td><td>-</td></tr><tr><td>BiGRU-Disc</td><td>-</td><td>55.8</td><td>0.756</td><td>0.646</td></tr><tr><td>BiGRU-LogLP</td><td>0.671</td><td>58.8</td><td>0.675</td><td>0.548</td></tr><tr><td>BiGRU-FlowLP</td><td>0.622</td><td>61.8</td><td>0.694</td><td>0.591</td></tr><tr><td>BiGRU-DExp</td><td>0.576</td><td>71.5</td><td>0.843</td><td>0.821</td></tr><tr><td>BERT-Disc</td><td>-</td><td>62.7</td><td>0.762</td><td>0.656</td></tr><tr><td>BERT-GMM K=255</td><td>1.18</td><td>21.3</td><td>0.585</td><td>0.440</td></tr><tr><td>BERT-LogLP</td><td>0.5666</td><td>64.9</td><td>0.686</td><td>0.557</td></tr><tr><td>BERT-FlowLP</td><td>0.5732</td><td>65.5</td><td>0.717</td><td>0.609</td></tr><tr><td>BERT-DExp</td><td>0.500</td><td>74.6</td><td>0.861</td><td>0.828</td></tr></table>
266
+
267
+ 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.
268
+
269
+ <table><tr><td>Ablation Type</td><td>LMAE↓</td><td>E-Acc ↑</td><td>r-AUC↑</td><td>s-AUC↑</td><td>all-LMAE↓</td><td>all-E-Acc ↑</td></tr><tr><td colspan="7">Numerical Input Embedding</td></tr><tr><td>BERT-DExp (All #&#x27;s Masked)</td><td>0.656</td><td>66.5</td><td>0.831</td><td>0.809</td><td>0.656</td><td>66.5</td></tr><tr><td>BERT-DExp + embexp</td><td>0.500</td><td>74.6</td><td>0.861</td><td>0.828</td><td>0.888</td><td>62.2</td></tr><tr><td>BERT-DExp + embdig</td><td>0.506</td><td>74.4</td><td>0.858</td><td>0.826</td><td>0.920</td><td>62.1</td></tr><tr><td>BERT-DExp + embdig + embdig</td><td>0.498</td><td>74.9</td><td>0.861</td><td>0.828</td><td>0.899</td><td>62.3</td></tr><tr><td colspan="7">No Pretraining</td></tr><tr><td>BERT-DExp + embexp</td><td>0.615</td><td>68.8</td><td>0.840</td><td>0.810</td><td>0.889</td><td>60.6</td></tr><tr><td>BERT-FlowLP + embexp</td><td>0.769</td><td>57.9</td><td>0.670</td><td>0.563</td><td>0.861</td><td>54.4</td></tr><tr><td>BERT-Disc + embexp</td><td>-</td><td>26.9</td><td>0.632</td><td>0.599</td><td>-</td><td>-</td></tr><tr><td>BERT-LogLP + embexp</td><td>0.630</td><td>63.2</td><td>0.678</td><td>0.550</td><td>0.850</td><td>57.1</td></tr></table>
270
+
271
+ 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.
272
+
273
+ 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.
274
+
275
+ 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.
276
+
277
+ 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
278
+
279
+ 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.
280
+
281
+ 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.
282
+
283
+ 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.
284
+
285
+ <table><tr><td rowspan="2">Model</td><td colspan="4">FinNews-\$</td><td colspan="4">Sci</td></tr><tr><td>LMAE↓</td><td>E-Acc ↑</td><td>r-AUC↑</td><td>s-AUC↑</td><td>LMAE↓</td><td>E-Acc ↑</td><td>r-AUC↑</td><td>s-AUC↑</td></tr><tr><td>BERT-Disc</td><td>-</td><td>46.9</td><td>0.828</td><td>0.588</td><td>-</td><td>68.8</td><td>0.722</td><td>0.657</td></tr><tr><td>BERT-LogLP</td><td>1.04</td><td>43.6</td><td>0.641</td><td>0.528</td><td>0.374</td><td>78.2</td><td>0.624</td><td>0.609</td></tr><tr><td>BERT-DExp</td><td>0.91</td><td>56.9</td><td>0.867</td><td>0.678</td><td>0.385</td><td>81.0</td><td>0.786</td><td>0.836</td></tr><tr><td>BERT-FlowLP</td><td>1.11</td><td>39.3</td><td>0.538</td><td>0.518</td><td>0.374</td><td>77.6</td><td>0.658</td><td>0.672</td></tr></table>
286
+
287
+ Table 4: Results on FinNews-\$ and Sci where all models use input exponent embeddings $emb_{exp}$ and all BERT encoders are pretrained.
288
+
289
+ # 5 Related Work
290
+
291
+ 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.
292
+
293
+ 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.
294
+
295
+ 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.
296
+
297
+ 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.
298
+
299
+ # 6 Conclusion
300
+
301
+ 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.
302
+
303
+ # Acknowledgements
304
+
305
+ 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.
306
+
307
+ # References
308
+
309
+ Daniel Andor, Luheng He, Kenton Lee, and Emily Pitler. 2019. Giving bert a calculator: Finding operations and arguments with reading comprehension. In EMNLP/IJCNLP.
310
+ Daniel Ansari. 2016. Number symbols in the brain. In Development of Mathematical Cognition, pages 27-50. Elsevier.
311
+ 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.
312
+ 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.
313
+ 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.
314
+ 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.
315
+ Mor Geva, Ankit Gupta, and Jonathan Berant. 2020. Injecting numerical reasoning skills into language models. In ACL.
316
+ Guillaume Lample and François Charton. 2020. Deep learning for symbolic mathematics. In International Conference on Learning Representations.
317
+ 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.
318
+ Dennis Lee, Christian Szegedy, Markus Rabe, Sarah Loos, and Kshitij Bansal. 2020. Mathematical reasoning in latent space. In International Conference on Learning Representations.
319
+ 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.
320
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis,
321
+
322
+ Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692.
323
+ 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.
324
+ Andreas Madsen and Alexander Rosenberg Johansen. 2020. Neural arithmetic units. In International Conference on Learning Representations.
325
+ 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.
326
+ 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.
327
+ 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.
328
+ Subhro Roy and Dan Roth. 2016. Solving general arithmetic word problems. arXiv preprint arXiv:1608.01413.
329
+ 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.
330
+ David Saxton, Edward Grefenstette, Felix Hill, and Pushmeet Kohli. 2019. Analysing mathematical reasoning abilities of neural models. In International Conference on Learning Representations.
331
+ Georgios P Spithourakis and Sebastian Riedel. 2018. Numeracy for language models: Evaluating and improving their ability to predict numbers. arXiv preprint arXiv:1805.08154.
332
+ 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.
333
+ 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.
334
+
335
+ 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.
336
+ 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.
337
+ John Whalen, Charles R Gallistel, and Rochel Gelman. 1999. Nonverbal counting in humans: The psychophysics of number representation. *Psychological science*, 10(2):130-137.
338
+ 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.
339
+ 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.
340
+ 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.
341
+ 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.
anempiricalinvestigationofcontextualizednumberprediction/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d8aa082fbdef9b028bbc874656cf18a9aa18cb4cd9ee36afc4fc4f0500f5d8c
3
+ size 386604
anempiricalinvestigationofcontextualizednumberprediction/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8c353e9361b358511ad893518a3fa55f680ee71fde719ac1f33afd7305c98c4
3
+ size 378211
anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dabd45fda090ddd80ae849343e612a910292cccd1a9f3a5619824c0496867720
3
+ size 78955
anempiricalinvestigationtowardsefficientmultidomainlanguagemodelpretraining/0a67e6fd-a9c5-4955-80a2-8017406d0c66_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae77e77dbc20baaa3eff4261b43ec907aaea6bf073a26d1f7f57978ad500d8e1
3
+ size 94983