SlowGuess commited on
Commit
db75c4c
·
verified ·
1 Parent(s): d71c05b

Add Batch 9436a7da-2e86-421f-9e1c-3507bbbbcf8d

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/183368ab-287f-477a-8935-78b9db5184d2_content_list.json +3 -0
  2. knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/183368ab-287f-477a-8935-78b9db5184d2_model.json +3 -0
  3. knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/183368ab-287f-477a-8935-78b9db5184d2_origin.pdf +3 -0
  4. knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/full.md +300 -0
  5. knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/images.zip +3 -0
  6. knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/layout.json +3 -0
  7. labelsemanticsforfewshotnamedentityrecognition/7a56e1c7-2661-4e17-bd67-30b5f7477cad_content_list.json +3 -0
  8. labelsemanticsforfewshotnamedentityrecognition/7a56e1c7-2661-4e17-bd67-30b5f7477cad_model.json +3 -0
  9. labelsemanticsforfewshotnamedentityrecognition/7a56e1c7-2661-4e17-bd67-30b5f7477cad_origin.pdf +3 -0
  10. labelsemanticsforfewshotnamedentityrecognition/full.md +360 -0
  11. labelsemanticsforfewshotnamedentityrecognition/images.zip +3 -0
  12. labelsemanticsforfewshotnamedentityrecognition/layout.json +3 -0
  13. lackingtheembeddingofawordlookitupintoatraditionaldictionary/4a5144bd-93c0-47a4-84d8-b90801cf035c_content_list.json +3 -0
  14. lackingtheembeddingofawordlookitupintoatraditionaldictionary/4a5144bd-93c0-47a4-84d8-b90801cf035c_model.json +3 -0
  15. lackingtheembeddingofawordlookitupintoatraditionaldictionary/4a5144bd-93c0-47a4-84d8-b90801cf035c_origin.pdf +3 -0
  16. lackingtheembeddingofawordlookitupintoatraditionaldictionary/full.md +345 -0
  17. lackingtheembeddingofawordlookitupintoatraditionaldictionary/images.zip +3 -0
  18. lackingtheembeddingofawordlookitupintoatraditionaldictionary/layout.json +3 -0
  19. lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/191a2c0b-1c8d-4857-8c14-c187eeb11187_content_list.json +3 -0
  20. lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/191a2c0b-1c8d-4857-8c14-c187eeb11187_model.json +3 -0
  21. lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/191a2c0b-1c8d-4857-8c14-c187eeb11187_origin.pdf +3 -0
  22. lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/full.md +389 -0
  23. lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/images.zip +3 -0
  24. lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/layout.json +3 -0
  25. learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/550cbed8-a7a7-46bf-b0ad-384447212dcc_content_list.json +3 -0
  26. learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/550cbed8-a7a7-46bf-b0ad-384447212dcc_model.json +3 -0
  27. learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/550cbed8-a7a7-46bf-b0ad-384447212dcc_origin.pdf +3 -0
  28. learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/full.md +318 -0
  29. learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/images.zip +3 -0
  30. learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/layout.json +3 -0
  31. learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/ce8f1f86-f163-433e-aaee-966bd5ff84fb_content_list.json +3 -0
  32. learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/ce8f1f86-f163-433e-aaee-966bd5ff84fb_model.json +3 -0
  33. learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/ce8f1f86-f163-433e-aaee-966bd5ff84fb_origin.pdf +3 -0
  34. learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/full.md +351 -0
  35. learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/images.zip +3 -0
  36. learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/layout.json +3 -0
  37. learningandevaluatingcharacterrepresentationsinnovels/1faa467d-85d6-4412-80e4-5e8f2a70ba11_content_list.json +3 -0
  38. learningandevaluatingcharacterrepresentationsinnovels/1faa467d-85d6-4412-80e4-5e8f2a70ba11_model.json +3 -0
  39. learningandevaluatingcharacterrepresentationsinnovels/1faa467d-85d6-4412-80e4-5e8f2a70ba11_origin.pdf +3 -0
  40. learningandevaluatingcharacterrepresentationsinnovels/full.md +320 -0
  41. learningandevaluatingcharacterrepresentationsinnovels/images.zip +3 -0
  42. learningandevaluatingcharacterrepresentationsinnovels/layout.json +3 -0
  43. learningbiasreducedwordembeddingsusingdictionarydefinitions/02ed04d2-bf51-4138-9bb1-95f1065577f5_content_list.json +3 -0
  44. learningbiasreducedwordembeddingsusingdictionarydefinitions/02ed04d2-bf51-4138-9bb1-95f1065577f5_model.json +3 -0
  45. learningbiasreducedwordembeddingsusingdictionarydefinitions/02ed04d2-bf51-4138-9bb1-95f1065577f5_origin.pdf +3 -0
  46. learningbiasreducedwordembeddingsusingdictionarydefinitions/full.md +473 -0
  47. learningbiasreducedwordembeddingsusingdictionarydefinitions/images.zip +3 -0
  48. learningbiasreducedwordembeddingsusingdictionarydefinitions/layout.json +3 -0
  49. learningfrommissingrelationscontrastivelearningwithcommonsenseknowledgegraphsforcommonsenseinference/2527e2a3-c784-400e-949e-fa375f54f325_content_list.json +3 -0
  50. learningfrommissingrelationscontrastivelearningwithcommonsenseknowledgegraphsforcommonsenseinference/2527e2a3-c784-400e-949e-fa375f54f325_model.json +3 -0
knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/183368ab-287f-477a-8935-78b9db5184d2_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:585d466a0e97ff7661481abc81427e58d93d61caa41094514c7586ec0626860c
3
+ size 85424
knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/183368ab-287f-477a-8935-78b9db5184d2_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8ee76a64dc2a1427de577623c51591bfd41ac899a67cfce2e73adbad8e5d0fe
3
+ size 100962
knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/183368ab-287f-477a-8935-78b9db5184d2_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fef42d5ee6124304cf7921ba4f0db072e3c7093a481be2ddbaca9b130e71436e
3
+ size 1237918
knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/full.md ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Knowledge Graph Embedding by Adaptive Limit Scoring Loss Using Dynamic Weighting Strategy
2
+
3
+ Jinfa Yang, Xianghua Ying*, Yongjie Shi, Xin Tong, Ruibin Wang, Taiyan Chen, Bowei Xing
4
+
5
+ Key Laboratory of Machine Perception (MOE)
6
+ School of Artificial Intelligence, Peking University
7
+ {jinfayang, xhying, shiyongjie, xin_tong, robin_wang} @pku.edu.cn, chenty@stu.pku.edu.cn, 2017xbw@pku.edu.cn
8
+
9
+ # Abstract
10
+
11
+ Knowledge graph embedding aims to represent entities and relations as low-dimensional vectors, which is an effective way for predicting missing links in knowledge graphs. Designing a strong and effective loss framework is essential for knowledge graph embedding models to distinguish between correct and incorrect triplets. The classic margin-based ranking loss limits the scores of positive and negative triplets to have a suitable margin. The recently proposed Limit-based Scoring Loss independently limits the range of positive and negative triplet scores. However, these loss frameworks use equal or fixed penalty terms to reduce the scores of positive and negative sample pairs, which is inflexible in optimization. Our intuition is that if a triplet score deviates far from the optimum, it should be emphasized. To this end, we propose Adaptive Limit Scoring Loss, which simply re-weights each triplet to highlight the less-optimized triplet scores. We apply this loss framework to several knowledge graph embedding models such as TransE, TransH and ComplEx. The experimental results on link prediction and triplet classification show that our proposed method has achieved performance on par with the state of the art.
12
+
13
+ # 1 Introduction
14
+
15
+ Knowledge graphs are usually collections of factual triplets — (head entity, relation, tail entity), also known as (subject, predicate, object), which represent human knowledge of the real world in a structured way. There are some outstanding knowledge graphs, such as WordNet (Miller, 1995), Freebase (Bollacker et al., 2008), DBpedia (Lehmann et al., 2015), YAGO (Suchanek et al., 2007). They have gained widespread attention for their successful usage in various applications, e.g., question answering (Bordes et al., 2014; Huang et al., 2019),
16
+
17
+ ![](images/d61d67af2fe342f60fb843f707f2525fcc08c4fa428e15fd7d92a0148154f4f2.jpg)
18
+ (a)
19
+ Figure 1: Comparison between the popular optimization manner of reducing $(S_{n}, S_{p})$ and the proposed reducing $(\alpha_{n}S_{n}, \alpha_{p}S_{p})$ . (a) Reducing $(S_{n}, S_{p})$ is prone to inflexible optimization $(P_{1}, P_{2}$ and $P_{3}$ all have equal gradients with respect to $S_{n}$ and $S_{p}$ ), as well as potential overlapping problem (both $T$ and $T^{\prime}$ on the decision boundary are acceptable). (b) With $(\alpha_{n}S_{n}, \alpha_{p}S_{p})$ , the $L_{AS}$ dynamically adjusts its gradients on $S_{p}$ and $S_{n}$ , and thus benefits from a flexible optimization process. For $P_{1}$ , it emphasizes on increasing $S_{n}$ ; for $P_{3}$ , it emphasizes on reducing $S_{p}$ . Moreover, it aggregates $T$ and $T^{\prime}$ on the circular decision boundary, which can alleviate the overlap problem.
20
+
21
+ ![](images/3c547cbb5e678326531569d9f731d137d24a6dc313bdbb868b714144b6c1bbfd.jpg)
22
+ (b)
23
+
24
+ recommendation systems (Zhou et al., 2020), medical science (Hasan et al., 2020), etc.
25
+
26
+ Similar to word embedding, knowledge graph embedding is one of the basic research fields of knowledge graph, which can be applied to tasks such as knowledge graph completion (Bordes et al., 2013; Sun et al., 2019), triplet classification (Socher et al., 2013; Nguyen et al., 2020), search personalization (Lu et al., 2020). For a knowledge graph embedding model, there are two major components, the scoring triplets and the optimizing loss function. In the last few years, negative sampling with margin-based ranking loss framework has been commonly used for modelling knowledge graph embedding. In this framework, a positive triplet $(h,r,t)$ can get its score $S_{p} = f_{r}(h,t)$ and the corresponding negative triplet $(h^{\prime},r,t^{\prime})$ score value is $S_{n} = f_{r}(h^{\prime},t^{\prime})$ , where $f_{r}$ is the scoring function. Finally, optimize the margin-based
27
+
28
+ ranking loss function $\max(0, \mu + S_p - S_n)$ . In $\max(0, \mu + S_p - S_n)$ , increasing $S_p$ is equivalent to reducing $S_n$ . We argue that this symmetric optimization manner is prone to the following two problems.
29
+
30
+ Lack of flexibility in optimization. The penalty strength on $S_{p}$ and $S_{n}$ is restricted to be equal or fixed. Given the specified loss function, the gradients of $S_{p}$ and $S_{n}$ have the same amplitude or fixed multiples. In some corner cases, e.g., when both $S_{p}$ and $S_{n}$ are small (" $P_{1}$ " in Figure 1a), we expect positive samples $S_{p}$ to be small and negative samples $S_{n}$ to be large, so we need a smaller penalty for $S_{p}$ and a larger penalty for $S_{n}$ . However, the aforementioned loss framework also retains a large gradient magnitude for $S_{p}$ , which is inefficient and irrational.
31
+
32
+ Overlapping between $S_{p}$ and $S_{n}$ . Under a margin-based ranking loss(exclude $\{S_{p}^{h}, S_{n}^{l}\}$ here), there are three kinds of value distributions for a pair of positive and negative triplets $\{(h, t), (h', t')\}$ , including $\{S_{p}^{l0}, S_{n}^{h0}\}$ , $\{S_{p}^{l1}, S_{n}^{l1}\}$ , $\{S_{p}^{h2}, S_{n}^{h2}\}$ , where the superscript $l$ indicates a low value, $h$ indicates a high value, and the number indicates three cases. As long as $S_{p}^{*i} - S_{n}^{*i} < -\mu, i = 1, 2, 3$ is satisfied, there may be an overlap phenomenon of $S_{p}^{h2} > S_{n}^{l1}$ . For example, $T$ (one of the optimized states) has $\{S_{p}, S_{n}\} = \{1, 4\}$ and $T'$ has $\{S_{p}', S_{n}'\} = \{5, 8\}$ . They are both satisfied with the margin of $\mu = 3$ . However, when comparing them against each other, we find $S_{p}' > S_{n}$ . The overlap between $S_{p}$ and $S_{n}$ damages the separability of positive and negative triplets.
33
+
34
+ Limit-based scoring loss (Zhou et al., 2017) proposes to add an upper-limit scoring loss on $f_{r}(h,t)$ to guarantee low scores for the positive triplets, which can effectively avoid $\{S_p^{h2}, S_n^{h2}\}$ case; Double limit scoring loss (Zhou et al., 2021) adds a lower-limit score for negative triplets on this basis, and finally alleviates the overlap problem. However, neither method can solve the problem of inflexible optimization. Our intuition is that if a triplet score deviates far from the optimum, it should be emphasized. To this end, we propose Adaptive Limit Scoring Loss, which simply reweights each triplet to highlight the less-optimized triplet scores. The main contributions of this paper are summarized as follows:
35
+
36
+ - We propose adaptive limit scoring loss, which benefits knowledge graph embedding with flexible optimization and definite positive and
37
+
38
+ negative triplet separation.
39
+
40
+ - Compared with the recent knowledge graph embedding negative sample loss framework limit-based scoring loss and double limit scoring loss (Zhou et al., 2017, 2021), our method not only reduces the amount of tuning parameters but also improves the performances.
41
+ - Experiments are carried out on WordNet and Freebase datasets with link prediction and triplet classification task, and the results show the superiority of our proposed method with performance on par with the state of the art.
42
+
43
+ # 2 Related Works
44
+
45
+ # 2.1 Knowledge Graph Embedding Models
46
+
47
+ Roughly speaking, we can divide knowledge graph embedding models into translational distance models and semantic matching models
48
+
49
+ Translational distance models describe relations as translations from source entities to target entities. TransE (Bordes et al., 2013) is the most widely used translation distance constraint model. It assumes that entities and relations satisfy $\mathbf{h} + \mathbf{r} \approx \mathbf{t}$ , where $\mathbf{h}, \mathbf{r}, \mathbf{t} \in \mathbb{R}^k$ . However, TransE cannot handle 1-N, N-1, and N-N relations well (Wang et al., 2014). TransH (Wang et al., 2014) is proposed to compensate for the shortcomings of TransE. It projects entities onto relation-specific hyperplanes with $\mathbf{h}_{\perp} = \mathbf{h} - \mathbf{w}_r^\top \mathbf{h} \mathbf{w}_r$ and $\mathbf{t}_{\perp} = \mathbf{t} - \mathbf{w}_r^\top \mathbf{t} \mathbf{w}_r$ . TransR (Lin et al., 2015) has a very similar idea to TransH, which introduces relation-specific spatial transformations instead of hyperplanes. TransE_AT (Yang et al., 2021) improves TransE's ability to express symmetric relations by introducing affine transformation. TranSparse (Ji et al., 2016) simplifies TransR by forcing the projection matrix to be sparse. Moreover, RotatE (Sun et al., 2019) defines each relation as a rotation from the source entity to the target entity in a complex vector space, which can represent various relation patterns including symmetry/asymmetry, inversion and composition.
50
+
51
+ Semantic matching models use the similarity scoring function to evaluate the latent semantics of entities and relations. RESCAL (Nickel et al., 2011) is a tensor factorization model which represents each relation as a full-rank matrix and defines score function as $f_{r}(\mathbf{h},\mathbf{t}) = \langle \mathbf{h}^{\top}\mathbf{M}_{r}\mathbf{t}\rangle$ . DistMult (Yang et al., 2015) simplifies the embedding of relations $\mathbf{M}_r$ as a diagonal matrix, which
52
+
53
+ can reduce the number of parameters and make the model easier to train. However, Distmult assumes that all relations are symmetric, and is not friendly to other types of relations, such as antisymmetry and composition. To solve this problem, ComplEx (Trouillon et al., 2016) extends DistMult to complex space: $\mathbf{h},\mathbf{r},\mathbf{t}\in \mathbb{C}^k$ , and uses conjugate-transpose $\bar{\mathbf{t}}$ to model asymmetric relations. MLP (Dong et al., 2014) and NTN (Socher et al., 2013) use a fully connected neural network to calculate the scores of given triplets. ConvE (Dettmers et al., 2018), ConvR (Jiang et al., 2019) and CoPER-ConvE (Stoica et al., 2020) employ convolutional neural networks to build score functions.
54
+
55
+ # 2.2 Loss Functions
56
+
57
+ For knowledge graph embedding models optimized with negative sampling, we summarize the related loss functions as follows.
58
+
59
+ Margin-based ranking loss $L_{R}$ is a widely used loss function for KG embedding models, which has successfully been used for NTN (Socher et al., 2013), TransE (Bordes et al., 2013), TransH (Wang et al., 2014), TransR (Lin et al., 2015), etc. The $L_{R}$ is formulated by:
60
+
61
+ $$
62
+ L _ {R} = \sum_ {\substack {(h, r, t) \in \mathcal {G} \\ (h ^ {\prime}, r, t ^ {\prime}) \in \mathcal {G} ^ {\prime}}} [ \mu + S _ {p} - S _ {n} ] _ {+}, \qquad (1)
63
+ $$
64
+
65
+ where $[x]_{+} = max(0,x)$ is a rectified linear unit that denotes the positive part of $x$ . $\mu$ is the margin between positive and negative triplets, $S_{p} = f_{r}(h,t), S_{n} = f_{r}(h^{\prime},t^{\prime})$ represents the score of the positive and negative triplets respectively. $\mathcal{G}$ denotes the set of positive triplets, and $\mathcal{G}' = \{(h',r,t) \notin \mathcal{G} | h' \in \mathcal{E}\} \cup \{(h,r,t') \notin \mathcal{G} | t' \in \mathcal{E}\}$ denotes the set of corrupted triplets.
66
+
67
+ Limit-based scoring loss (Zhou et al., 2017) adds an upper-limit scoring loss term $[S_p - \mu_p]_+$ to guarantee low scores for positive triplets. The loss framework has been proved to be successfully applied in TransE and TransH, and its formula is:
68
+
69
+ $$
70
+ L _ {R S} = \sum_ {\substack {(h, r, t) \in \mathcal {G} \\ (h ^ {\prime}, r, t ^ {\prime}) \in \mathcal {G} ^ {\prime}}} [ \mu + S _ {p} - S _ {n} ] _ {+} + \lambda [ S _ {p} - \mu_ {p} ] _ {+}, \tag{2}
71
+ $$
72
+
73
+ where $\lambda, \mu_p > 0$ . On this basis, Double Limit Scoring Loss (Zhou et al., 2021) proposes to replace $[\mu + S_p - S_n]_+$ of $L_{RS}$ with lower-limit scoring loss
74
+
75
+ for negative triplets $[\mu_n - S_n]_+$ . The loss framework is:
76
+
77
+ $$
78
+ L _ {S S} = \sum_ {\substack {(h, r, t) \in \mathcal {G} \\ (h ^ {\prime}, r, t ^ {\prime}) \in \mathcal {G} ^ {\prime}}} [ S _ {p} - \mu_ {p} ] _ {+} + \lambda [ \mu_ {n} - S _ {n} ] _ {+}, \tag{3}
79
+ $$
80
+
81
+ where $\mu_{n} > \mu_{p} > 0$ . Compared with $L_{R}$ and $L_{RS}$ losses, $L_{SS}$ loss expects not only marginal discrimination between positive and negative triplets' scores but also low scores for positive triplets and high scores for negative triplets.
82
+
83
+ Some other negative sampling losses of the knowledge graph embedding model also try to improve the discrimination between positive and negative triplets. HolE (Nickel et al., 2016) suggests to use logistic function instead of rectified linear unit to distinguish the probabilities of positive and negative triplets. ComplEx (Trouillon et al., 2016) propose a negative log-likelihood loss to learn compact representations. ProjE (Shi and Weninger, 2017) uses the pointwise ranking method to optimize the list of candidate entities collectively, so that the probability ranking of positive triplets is higher than that of negative triplets. RotatE (Sun et al., 2019) defines a log-sigmoid function to make the positive and negative triplets away from the same margin in the opposite direction. Sun et al. (Sun et al., 2020) propose the pair similarity optimization and successfully apply the method in visual tasks such as face recognition. Inspired by this, we refine the scoring and weighting strategies and apply them to knowledge graph embedding. Except for negative sampling methods, neural network frameworks with cross-entropy loss (Lacroix et al., 2018) and 1-N binary cross-entropy loss (Dettmers et al., 2018) have been developed for knowledge graph embedding in recent years. In this paper, our work mainly focuses on improving the marginal ranking loss $L_{R}$ and the limited loss $L_{RS} \& L_{SS}$ for knowledge graph embedding.
84
+
85
+ # 3 The Proposed Methods
86
+
87
+ In this section, we firstly present adaptive limit scoring loss $L_{AS}$ for optimizing Knowledge graph embedding models. Secondly, we introduce different metrics of our loss for optimization according to the positioning method of the circle center.
88
+
89
+ # 3.1 Adaptive Limit Scoring Loss
90
+
91
+ We consider enhancing the optimization flexibility by allowing each triplet score to learn at its
92
+
93
+ own pace, depending on its current optimization status. Then, we add adaptive penalty items to the positive and negative triplets scoring respectively. Equation (3) can be changed to:
94
+
95
+ $$
96
+ L _ {A S} = \sum_ {\substack {(h, r, t) \in \mathcal {G} \\ (h ^ {\prime}, r, t ^ {\prime}) \in \mathcal {G} ^ {\prime}}} \alpha_ {p} [ S _ {p} - \mu_ {p} ] _ {+} + \alpha_ {n} [ \mu_ {n} - S _ {n} ] _ {+}. \tag{4}
97
+ $$
98
+
99
+ Where $\alpha_{n}$ and $\alpha_{p}$ are non-negative weighting factors. During training, when back propagating to $S_{p}(S_{n})$ , the gradient with respect to $\alpha_{p}[S_{p} - \mu_{p}]_{+} + \alpha_{n}[\mu_{n} - S_{n}]_{+}$ will be multiplied by $\alpha_{p}(\alpha_{n})$ . When the triplet score deviates far from its optimum (i.e., $\nu_{p}$ for $S_{p}$ and $\nu_{n}$ for $S_{n}$ . $\nu_{p}$ and $\nu_{n}$ are intermediate variables), it should obtain a large weighting factor in order to obtain effective update with large gradient. To this end, we define $\alpha_{p}$ and $\alpha_{n}$ in an adaptive way:
100
+
101
+ $$
102
+ \left\{ \begin{array}{l} \alpha_ {p} = \left[ S _ {p} - v _ {p} \right] _ {+} \\ \alpha_ {n} = \left[ v _ {n} - S _ {n} \right] _ {+}, \end{array} \right. \tag {5}
103
+ $$
104
+
105
+ Overall, the adaptive limit scoring loss in Equation (4) expects $S_{p} < \mu_{p}$ and $S_{n} > \mu_{n}$ . We further analyze the settings of $\mu_{p}$ and $\mu_{n}$ by deriving the decision boundary. In the optimization process, the decision boundary is realized at $\alpha_{p}(S_{p} - \mu_{p}) + \alpha_{n}(\mu_{n} - S_{n}) = 0$ . Combined with Equation (5), we can get:
106
+
107
+ $$
108
+ \left(S _ {p} - \frac {v _ {p} + \mu_ {p}}{2}\right) ^ {2} + \left(S _ {n} - \frac {v _ {n} + \mu_ {n}}{2}\right) ^ {2} = C, \tag {6}
109
+ $$
110
+
111
+ where $C = \left((\nu_p - \mu_p)^2 +(\nu_n - \mu_n)^2\right) / 4$ Equation (6) shows that the decision boundary is the arc of a circle, as shown in Figure 1b. The center of the circle is at $S_{n} = (\nu_{n} + \mu_{n}) / 2,S_{p} = (\nu_{p} + \mu_{p}) / 2,$ and the radius equals $\sqrt{C}$ . Here we have four hyperparameters $\mu_{p}$ and $\mu_{n}$ from Equation (4), $\nu_{p}$ and $\nu_{n}$ from Equation (5). After Positioning the center of the circle, the four hyperparameters can be reduced to two, which is less than $L_{RS}$ and $L_{SS}$
112
+
113
+ # 3.2 Positioning the Center of Circle
114
+
115
+ The center of circle is the ideal optimization target for $(S_{n}, S_{p})$ , and the arc is the actual decision boundary. Usually, we expect lower score for $S_{n}$ and higher for $S_{p}$ . However, our model training is based on the open world assumption, which states that knowledge graphs contain only true facts and
116
+
117
+ ![](images/9778bb9e26982593c12a773a8ccf0e794ab36e3fa8f6a66fa21bcacb44d31e1a.jpg)
118
+ Figure 2: Different embedding states have different optimization trajectories. $P_{1}, P_{2}$ , and $P_{3}$ have different ideal optimization goals and derive three decision boundary arcs (located in light blue, green and red sectors).
119
+
120
+ non-observed facts can be either false or just missing (Drumond et al., 2012). It means that the generated negative triplets may be correct, but they do not appear in the original knowledge graph. Therefore, we do not want $S_{n}$ to be infinite but a finite value. Here we consider two options:
121
+
122
+ Constant Adaptive Limit Scoring Loss (CAS). We set the center of the circle as a constant $(0, \mu_p + \mu_n)$ . Correspondingly, the two hyper-parameters $\nu_p$ , $\nu_n$ in Equation (5) can be reduced by setting $\nu_p = -\mu_p$ , $\nu_n = \mu_n + 2\mu_p$ . And the decision boundary in Equation (6) can be degraded into:
123
+
124
+ $$
125
+ (S _ {p} - 0) ^ {2} + \left(S _ {n} - \left(\mu_ {p} + \mu_ {n}\right)\right) ^ {2} = 2 \mu_ {p} ^ {2}. \tag {7}
126
+ $$
127
+
128
+ The decision boundary defined in Equation (7) aims to optimize $S_{p} \to 0$ and $S_{n} \to \mu_{p} + \mu_{n}$ (Actually $(0, \mu_p + \mu_n)$ cannot be reached, in Equation (4) we limit $S_{p} \geq \mu_{p}, S_{n} \leq \mu_{n}$ ). The choice of the constant $(\mu_p + \mu_n)$ is inspired by the value range of the dynamic weighting in Equation (5). When the model embedding needs to be optimized (that is, $S_{p} > \mu_{p}, S_{n} < \mu_{n}$ ), substituting $\nu_{p} = -\mu_{p}$ into Equation (5), we can get the positive triplet dynamic weight range $\alpha_{p} > 2\mu_{p}$ . Similarly, substituting $\nu_{n} = \mu_{n} + 2\mu_{p}$ into Equation (5), we can get the same range of negative triplets dynamic weight $\alpha_{n} > 2\mu_{p}$ .
129
+
130
+ Independent Adaptive Limit Scoring Loss (IAS). When the model embedding is in different states (such as $P_{1}, P_{2}$ and $P_{3}$ in Figure 2), it should have different optimized trajectories. We expect to find the optimal trajectory for each independent embedding state. Taking point $P_{1}$ (assume its coordinates are $(S_{n}, S_{p})$ ) in Figure 2 as an example, its corresponding decision boundary is the largest arc (located in light blue sector), and the center of the
131
+
132
+ circle is $P_{C1}(C_{1n},0)$ . Based on triangle similarity $\triangle P_{C1}P_0P_0^{\prime}\sim \triangle P_{C1}P_1P_1^{\prime}$ we can get:
133
+
134
+ $$
135
+ C _ {1 n} = \mu_ {n} + \mu_ {p} \frac {\mu_ {n} - S _ {n}}{S _ {p} - \mu_ {p}}, \tag {8}
136
+ $$
137
+
138
+ where $S_{n} < \mu_{n}, S_{p} > \mu_{p}$ . Combining the center of circle defined by Equation (6), the two hyper-parameters $\nu_{p}$ , $\nu_{n}$ in Equation (5) can be reduced by setting $\nu_{p} = -\mu_{p}$ , $\nu_{n} = \mu_{n} + 2\mu_{p} (\mu_{n} - S_{n}) / (S_{p} - \mu_{p})$ . Compared with $L_{CAS}$ , $L_{IAS}$ can independently set the circle center of each sample to obtain an independent optimized trajectory.
139
+
140
+ Adaptive Limit Scoring $L_{AS}$ further improves double scoring loss $L_{SS}$ by adding adaptive penalty terms to dynamically adjust the optimization process. In the early stage of model training, the scores of the positive and negative triplets are far from optimization, which increases the weight of the penalty item and obtains a larger gradient. This is conducive to the early rapid convergence for the model. During training, when there is a bias in the optimization of the paired positive and negative triplets, e.g., the positive triplet is close to the optimum while the negative triplet is still far from the requirement, the penalty term will increase the weight of the negative triplet so that the negative triplet can be adjusted in time. In addition to the separate limits for the positive and negative scores, the differentiated pace adjustment with penalty items can also alleviate the overlap problem (see $T'$ in Figure 1 a and b).
141
+
142
+ # 4 Experiments
143
+
144
+ We comprehensively evaluate the effectiveness of Adaptive Limit Scoring Loss for link prediction (Bordes et al., 2013) and triplet classification (Socher et al., 2013) tasks under different knowledge graph embedding models. Our experiments are carried out on two popular knowledge graphs FreeBase (Bollacker et al., 2008) and WordNet (Miller, 1995). Freebase contains a large number of world facts such as movies, sports. WordNet is a large-scale lexical knowledge graph. Some subsets of the two knowledge graphs are used in our experiments, including WN18, WN18RR and WN11 from WordNet, and FB15k, FB15K-237 and FB13 from Freebase. The statistics of these subsets are shown in Table 1. FB15k-237 (Toutanova and Chen, 2015) and WN18RR (Dettmers et al.,
145
+
146
+ 2018) are subsets of FB15k and WN18, respectively, where inverse relations are deleted.
147
+
148
+ <table><tr><td>Dataset</td><td>#En</td><td>#Re</td><td>#train</td><td>#valid</td><td>#test</td></tr><tr><td>WN18</td><td>40,943</td><td>18</td><td>141,442</td><td>5,000</td><td>5,000</td></tr><tr><td>FB15K</td><td>14,951</td><td>1,345</td><td>483,142</td><td>50,000</td><td>59,071</td></tr><tr><td>WN18RR</td><td>40,943</td><td>11</td><td>86,835</td><td>3,034</td><td>3,134</td></tr><tr><td>FB15k-237</td><td>14,541</td><td>237</td><td>272,115</td><td>17,535</td><td>20,466</td></tr><tr><td>WN11</td><td>38,696</td><td>11</td><td>112,581</td><td>2,609</td><td>10,544</td></tr><tr><td>FB13</td><td>75,043</td><td>13</td><td>316,232</td><td>5,908</td><td>23,733</td></tr></table>
149
+
150
+ Table 1: Number of entities, relations, and observed triplets in each split for benchmarks.
151
+
152
+ Parameters Settings. We compare the series of TransE, TransH, RotatE and ComplEx with different losses. The ranges of the main hyperparameters for the grid search are set as follows: learning rate $\alpha \in \{0.00005, 0.0001, 0.0005, 0.001, 0.005, 0.01\}$ , the embedding dimension $m \in \{50, 80, 100, 150, 200\}$ , the batch size $B \in \{50, 100, 200, 500, 1000, 2000, 5000\}$ , $\{L1, L2\}$ distances for loss functions. For TransE and TransH with Adaptive Limit Scoring, upper limit score for positive triplets $\mu_p \in \{0.25, 1, 2, 3, 4, 5, 6, 7, 8, 10, 15\}$ , and lower limit score for negative triplet $\mu_n \in \{\mu_p + \{0.1, 0.25, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\}\}$ . Parameter $C$ for TransH series from $\{0.0005, 0.0625, 0.25, 1.0\}$ . For ComplEx, upper limit $\mu_p$ score for positive triplets is $log(p_+)$ , $p_+ \in \{0.1, 0.2, 0.3, 0.4, 0.5, 0.6\}$ , and lower limit score $\mu_n$ for negative triplet $log(p_-)$ , $p_- \in \{p_+ + \{0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9\}\}$ . We train WN18 and FB15K with 1000 times, WN18RR and FB15K237 with 3000 times for Link prediction, WN11, FB13 and FB15K with 1000 times for triplet classification. For RotatE, we use the parameters recommended by Sun et al. (2019) (with larger epoch, embedding dim and self-adversarial negative sampling) and the same $\mu_p$ , $\mu_n$ parameter search range as TransE and TransH. We use SGD for TransE, TransH and Adam (Kingma and Ba, 2014) for RotatE, ComplEx as the optimizer and fine-tune the hyperparameters on the validation dataset.
153
+
154
+ # 4.1 Link Prediction
155
+
156
+ Link prediction (Bordes et al., 2012, 2013) aims to predict the missing triplets such as head entity prediction $(?,r,t)$ or tail entity prediction $(h,r,?)$ based on the known triplets. For a testing triplet $(h,r,t)$ , either the head entity $h$ or the tail entity $t$ will be replaced with the total list of the embedding entities to construct the predicted triplets. Then
157
+
158
+ <table><tr><td rowspan="3">Models</td><td colspan="4">WN18</td><td colspan="4">FB15k</td></tr><tr><td colspan="2">Mean</td><td colspan="2">Hits@10(%)</td><td colspan="2">Mean</td><td colspan="2">Hits@10(%)</td></tr><tr><td>raw</td><td>filt</td><td>raw</td><td>filt</td><td>raw</td><td>filt</td><td>raw</td><td>filt</td></tr><tr><td>RESCAL</td><td>1,180</td><td>1,163</td><td>37.2</td><td>52.8</td><td>828</td><td>683</td><td>28.4</td><td>44.1</td></tr><tr><td>SME(linear)</td><td>545</td><td>533</td><td>65.1</td><td>74.1</td><td>274</td><td>154</td><td>30.7</td><td>40.8</td></tr><tr><td>SME(bilinear)</td><td>526</td><td>509</td><td>54.7</td><td>61.3</td><td>284</td><td>158</td><td>31.3</td><td>41.3</td></tr><tr><td>TransR(unif)</td><td>232</td><td>219</td><td>78.3</td><td>91.7</td><td>226</td><td>78</td><td>43.8</td><td>65.5</td></tr><tr><td>TransR(bern)</td><td>238</td><td>225</td><td>79.8</td><td>92.0</td><td>198</td><td>77</td><td>48.2</td><td>68.7</td></tr><tr><td>TransSparse(unif)</td><td>233</td><td>221</td><td>79.6</td><td>93.4</td><td>216</td><td>66</td><td>50.3</td><td>78.4</td></tr><tr><td>TransSparse(bern)</td><td>223</td><td>211</td><td>80.1</td><td>93.2</td><td>190</td><td>82</td><td>53.7</td><td>79.9</td></tr><tr><td>DistMult</td><td>987</td><td>902</td><td>79.2</td><td>93.6</td><td>224</td><td>97</td><td>51.8</td><td>82.4</td></tr><tr><td>STransE</td><td>217</td><td>206</td><td>80.9</td><td>93.4</td><td>219</td><td>69</td><td>51.6</td><td>79.7</td></tr><tr><td>TransE(unif)</td><td>263</td><td>251</td><td>75.4</td><td>89.2</td><td>243</td><td>125</td><td>34.9</td><td>47.1</td></tr><tr><td>TransE-RS(unif)</td><td>362</td><td>348</td><td>80.3</td><td>93.7</td><td>161</td><td>62</td><td>53.1</td><td>72.3</td></tr><tr><td>TransE-RS(bern)</td><td>385</td><td>371</td><td>80.4</td><td>93.7</td><td>161</td><td>63</td><td>53.2</td><td>72.1</td></tr><tr><td>TransE-SS(unif)</td><td>285</td><td>279</td><td>83.1</td><td>94.4</td><td>170</td><td>39</td><td>54.3</td><td>78.7</td></tr><tr><td>TransE-SS(bern)</td><td>276</td><td>263</td><td>83.6</td><td>95.0</td><td>155</td><td>54</td><td>55.8</td><td>76.5</td></tr><tr><td>TransE-CAS(unif)(ours)</td><td>164</td><td>153</td><td>83.0</td><td>95.2</td><td>178</td><td>55</td><td>54.8</td><td>83.3</td></tr><tr><td>TransE-CAS(bern)(ours)</td><td>163</td><td>153</td><td>83.1</td><td>95.3</td><td>160</td><td>54</td><td>55.8</td><td>81.4</td></tr><tr><td>TransE-IAS(unif)(ours)</td><td>182</td><td>172</td><td>83.4</td><td>95.1</td><td>174</td><td>46</td><td>55.4</td><td>85.1</td></tr><tr><td>TransE-IAS(bern)(ours)</td><td>176</td><td>166</td><td>83.5</td><td>95.4</td><td>155</td><td>50</td><td>56.2</td><td>81.6</td></tr><tr><td>TransH(unif)</td><td>318</td><td>303</td><td>75.4</td><td>86.7</td><td>211</td><td>84</td><td>42.5</td><td>58.5</td></tr><tr><td>TransH(bern)</td><td>401</td><td>388</td><td>73.0</td><td>82.3</td><td>212</td><td>87</td><td>45.7</td><td>64.4</td></tr><tr><td>TransH-RS(unif)</td><td>401</td><td>389</td><td>81.2</td><td>94.7</td><td>163</td><td>64</td><td>53.4</td><td>72.6</td></tr><tr><td>TransH-RS(bern)</td><td>371</td><td>357</td><td>80.3</td><td>94.5</td><td>178</td><td>77</td><td>53.6</td><td>75.0</td></tr><tr><td>TransH-SS(unif)</td><td>182</td><td>170</td><td>81.8</td><td>95.1</td><td>166</td><td>54</td><td>55.3</td><td>82.5</td></tr><tr><td>TransH-SS(bern)</td><td>184</td><td>173</td><td>82.1</td><td>95.1</td><td>177</td><td>61</td><td>54.6</td><td>83.5</td></tr><tr><td>TransH-CAS(unif)(ours)</td><td>209</td><td>196</td><td>83.6</td><td>95.1</td><td>215</td><td>58</td><td>54.1</td><td>83.7</td></tr><tr><td>TransH-CAS(bern)(ours)</td><td>203</td><td>194</td><td>84.1</td><td>95.2</td><td>165</td><td>53</td><td>55.1</td><td>83.2</td></tr><tr><td>TransH-IAS(unif)(ours)</td><td>186</td><td>175</td><td>83.1</td><td>95.1</td><td>178</td><td>51</td><td>54.9</td><td>85.1</td></tr><tr><td>TransH-IAS(bern)(ours)</td><td>195</td><td>186</td><td>83.8</td><td>95.4</td><td>156</td><td>49</td><td>56.0</td><td>83.1</td></tr><tr><td>ComplEx</td><td>-</td><td>-</td><td>-</td><td>94.7</td><td>-</td><td>-</td><td>-</td><td>84.0</td></tr><tr><td>ComplEx-SS</td><td>431</td><td>418</td><td>84.0</td><td>95.9</td><td>179</td><td>53</td><td>53.8</td><td>85.9</td></tr><tr><td>ComplEx-CAS(ours)</td><td>445</td><td>434</td><td>85.2</td><td>95.9</td><td>184</td><td>72</td><td>54.7</td><td>86.6</td></tr><tr><td>ComplEx-IAS(ours)</td><td>441</td><td>432</td><td>84.3</td><td>95.8</td><td>197</td><td>83</td><td>54.6</td><td>85.9</td></tr></table>
159
+
160
+ Table 2: Evaluation results on WN18 and FB15k datasets. In each column, the top-1 result with bold marker and top-2-4 results with underline markers are given.
161
+
162
+ such triplets are ranked in descending order according to the scoring function. Based on the score rank, several metrics are usually reported: mean rank (MR), Mean Reciprocal Rank (MRR) and the proportion of top-k rank (Hits@k) for correct entities. A good model should have low "MR", high "MRR" and high "Hits@k". For constructing the corrupted triplets, "unif" means that the head or tail entity is replaced with equal probability traditionally, and "bern" denotes reducing false negative labels by replacing head or tail with different probabilities (Wang et al., 2014). The settings "raw" and "filt" for the metrics distinguish whether or not to consider the impact of a corrupted triplet existing in the correct Knowledge graph.
163
+
164
+ # 4.1.1 Results on WN18 and FB15K
165
+
166
+ Firstly, we follow the experimental procedures of most negative sampling knowledge graph embedding models (such as Bordes et al. (2013); Wang
167
+
168
+ et al. (2014), etc.), and use MR and Hits@10 to evaluate WN18 and FB15K. The optimal configurations are illustrated in Appendix A Table 5.
169
+
170
+ Table 2 shows the evaluation results on two datasets WN18 and FB15K. The original results of TransE, TransH and ComplEx are from the references (Bordes et al., 2013; Wang et al., 2014; Trouillon et al., 2016). And their extension with limit-based scoring loss (-RS), double limit scoring Los (-SS) are from Zhou et al. (2017, 2021) For the other compared models, we report the original results from Lin et al. (2015); Ji et al. (2016); Yang et al. (2014); Nguyen et al. (2016).
171
+
172
+ From Table 2, we can see that models with $L_{AS}$ (Including CAS and IAS refer to Section 3.2) loss have improved in different degrees. Compared to WN18 (95% + on hit@10) whose results are already high, FB15K has been improved significantly. On FB15K, the results (Compare in the best results for Hit@10) are increased by TransE 6.4%,
173
+
174
+ <table><tr><td rowspan="2">Models</td><td colspan="5">WN18RR</td><td colspan="5">FB15k-237</td></tr><tr><td>MR</td><td>MRR(%)</td><td>@1</td><td>Hits(%) @3</td><td>@10</td><td>MR</td><td>MRR</td><td>@1</td><td>Hits(%) @3</td><td>@10</td></tr><tr><td>RESCAL</td><td>10077</td><td>24.7</td><td>19.9</td><td>27.7</td><td>35.2</td><td>508</td><td>22.1</td><td>13.9</td><td>24.3</td><td>39.2</td></tr><tr><td>DistMult</td><td>5110</td><td>43</td><td>39</td><td>44</td><td>49</td><td>254</td><td>24.1</td><td>15.5</td><td>26.3</td><td>41.9</td></tr><tr><td>ConvKB</td><td>1295</td><td>26.5</td><td>5.8</td><td>44.5</td><td>55.8</td><td>216</td><td>28.9</td><td>19.8</td><td>32.4</td><td>47.1</td></tr><tr><td>TransE</td><td>3530</td><td>20.7</td><td>2.2</td><td>36.1</td><td>47.8</td><td>189</td><td>27.9</td><td>19.3</td><td>30.5</td><td>44.9</td></tr><tr><td>TransE-RS</td><td>3415</td><td>20.8</td><td>2.3</td><td>36.3</td><td>47.8</td><td>177</td><td>28.2</td><td>19.4</td><td>31.2</td><td>46.1</td></tr><tr><td>TransE-SS</td><td>3199</td><td>20.9</td><td>2.5</td><td>37.1</td><td>47.9</td><td>172</td><td>28.4</td><td>19.6</td><td>31.7</td><td>47.0</td></tr><tr><td>TransE-CAS(ours)</td><td>1868</td><td>22.4</td><td>7.1</td><td>33.6</td><td>48.7</td><td>204</td><td>29.1</td><td>19.7</td><td>32.6</td><td>48.1</td></tr><tr><td>TransE-IAS(ours)</td><td>3276</td><td>21.0</td><td>2.2</td><td>38.1</td><td>49.5</td><td>203</td><td>29.2</td><td>19.7</td><td>32.6</td><td>48.2</td></tr><tr><td>TransH</td><td>3972</td><td>19.8</td><td>0.7</td><td>36.3</td><td>46.3</td><td>218</td><td>26.7</td><td>17.7</td><td>29.9</td><td>44.5</td></tr><tr><td>TransH-RS</td><td>3421</td><td>18.1</td><td>0.9</td><td>36.9</td><td>47.6</td><td>207</td><td>27.3</td><td>17.6</td><td>30.6</td><td>46.4</td></tr><tr><td>TransH-SS</td><td>3242</td><td>20.1</td><td>1.0</td><td>37.3</td><td>47.8</td><td>200</td><td>28.5</td><td>17.8</td><td>31.2</td><td>46.7</td></tr><tr><td>TransH-CAS(ours)</td><td>2890</td><td>21.2</td><td>2.4</td><td>37.9</td><td>47.8</td><td>197</td><td>29.7</td><td>20.1</td><td>32.9</td><td>48.6</td></tr><tr><td>TransH-IAS(ours)</td><td>3145</td><td>21.1</td><td>0.8</td><td>38.7</td><td>49.6</td><td>204</td><td>29.6</td><td>20.3</td><td>32.8</td><td>48.5</td></tr><tr><td>ComplEx</td><td>5246</td><td>40.1</td><td>36.2</td><td>42.5</td><td>47.1</td><td>305</td><td>24</td><td>15.2</td><td>26.4</td><td>42.3</td></tr><tr><td>ComplEx-SS</td><td>5152</td><td>41.3</td><td>37.8</td><td>44.5</td><td>50.6</td><td>301</td><td>24.7</td><td>15.7</td><td>27.3</td><td>43.4</td></tr><tr><td>ComplEx-CAS(ours)</td><td>4788</td><td>43.6</td><td>39.2</td><td>46.0</td><td>50.5</td><td>247</td><td>25.0</td><td>17.1</td><td>27.3</td><td>41.1</td></tr><tr><td>ComplEx-IAS(ours)</td><td>4814</td><td>44.3</td><td>40.9</td><td>46.0</td><td>50.6</td><td>481</td><td>27.6</td><td>19.4</td><td>30.5</td><td>44.4</td></tr><tr><td>RotatE$</td><td>3735</td><td>47.1</td><td>42.3</td><td>48.7</td><td>56.4</td><td>216</td><td>33.3</td><td>24.0</td><td>37.1</td><td>52.8</td></tr><tr><td>RotatE-CAS(ours)$</td><td>3651</td><td>47.9</td><td>43.5</td><td>49.6</td><td>56.4</td><td>192</td><td>33.7</td><td>24.1</td><td>37.1</td><td>53.1</td></tr><tr><td>RotatE-IAS(ours)$</td><td>3862</td><td>48.3</td><td>46.7</td><td>50.2</td><td>57.0</td><td>195</td><td>33.9</td><td>24.2</td><td>37.4</td><td>53.2</td></tr></table>
175
+
176
+ TransH-SS $1.6\%$ and ComplEx-SS $0.7\%$ .
177
+
178
+ # 4.1.2 Results on WN18RR and FB15K-237
179
+
180
+ FB15K-237 (Toutanova and Chen, 2015) and WN18RR (Dettmers et al., 2018) are two more challenging datasets for Knowledge graph completions, where the inverse relations are deleted and the main relation patterns are symmetry/antisymmetry and composition patterns. In recent years, many embedding models (Dettmers et al., 2018; Sun et al., 2019) are tested on FB15K-237 and WN18RR by five metrics, MR, MRR, Hits@1, Hits@3 and Hits@10. In this experiment, by the five metrics, we compare our loss framework on TransE, TransH, ComplEx and RotatE with their former loss models Zhou et al. (2017, 2021); Bordes et al. (2013); Wang et al. (2014); Trouillon et al. (2016); Sun et al. (2019) and some baseline models Rescal (Nickel et al., 2011), DisMult (Yang et al., 2015) and ConvKB (Nguyen et al., 2018). We evaluate the models in the "bern" and "filt" settings. The optimal configurations are illustrated in Appendix A Table 6.
181
+
182
+ The experimental results on FB15K-237 and WN18RR are given in Table 3. In each column, the top-1 result with bold marker and top-2-4 results with underline markers are given. Our presented models with $L_{AS}$ loss outperform the corresponding former models with $L_R$ , $L_{RS}$ and $L_{SS}$ on all the metrics. The results also prove the effective
183
+
184
+ ness of our $L_{AS}$ loss. Detailed improved results for MRR (Compare in the best results) metric are as follows. On WN18RR, the results are increased by TransE $1.5\%$ , TransH $1.1\%$ , ComplEx $3.0\%$ and RotatE $1.2\%$ than corresponding $L_{SS}$ loss models. On FB15K237, the results are increased by TransE $0.8\%$ , TransH-SS $1.2\%$ , ComplEx-SS $2.9\%$ and RotatE $0.6\%$ .
185
+
186
+ Table 3: Evaluation results on WN18RR, FB15k-237 datasets. $\S$ donates trained with larger epoch, embedding dim and self-adversarial negative sampling (Sun et al., 2019).
187
+
188
+ <table><tr><td>Models</td><td>WN11</td><td>FB13</td><td>FB15K</td></tr><tr><td>RESCAL</td><td>50.2</td><td>61.5</td><td>51.0</td></tr><tr><td>SE</td><td>53.0</td><td>75.2</td><td>-</td></tr><tr><td>LMF</td><td>73.8</td><td>84.3</td><td>68.3</td></tr><tr><td>SME(linear)</td><td>68.4</td><td>62.8</td><td>69.7</td></tr><tr><td>SME(bilinear)</td><td>70.0</td><td>63.7</td><td>71.6</td></tr><tr><td>TransE</td><td>75.9</td><td>81.5</td><td>79.8</td></tr><tr><td>TransE-SS</td><td>83.4</td><td>82.2</td><td>89.0</td></tr><tr><td>TransE-CAS(ours)</td><td>84.5</td><td>82.4</td><td>89.6</td></tr><tr><td>TransE-IAS(ours)</td><td>84.1</td><td>82.4</td><td>89.1</td></tr><tr><td>TransH</td><td>78.8</td><td>83.3</td><td>87.7</td></tr><tr><td>TransH-SS</td><td>81.5</td><td>80.1</td><td>89.6</td></tr><tr><td>TransH-CAS(ours)</td><td>84.0</td><td>80.9</td><td>91.6</td></tr><tr><td>TransH-IAS(ours)</td><td>84.1</td><td>82.7</td><td>91.2</td></tr></table>
189
+
190
+ Table 4: Accuracies(%) on Triplets Classification.
191
+
192
+ # 4.2 Triplet Classification
193
+
194
+ Triplet classification is a binary classification problem used to decide whether a given triplet $(h,r,t)$ is correct or not. This task is usually tested by trans
195
+
196
+ lation models, but it is rarely validated by nonlinear models (Bordes et al., 2013; Dettmers et al., 2018). Therefore, in this experiment, we only test the series of the compared translation models. We use three datasets, WN11, FB13 and FB15K (see Table 1) for the experiment. The training procedures are the same as the experiments of link predictions. For a testing triplet $(h,r,t)$ , it will be predicted positive if the score $f_{r}(h,t)$ is below a relation-specific threshold, otherwise negative. The relation-specific threshold is optimized by maximizing classification accuracies on the validation set.
197
+
198
+ We compare our loss framework $L_{AS}$ used in TransE and TransH with baseline methods reported in Wang et al. (2014); Ji et al. (2015); Lin et al. (2015) who used the same datasets. TransE-SS and TransH-SS (Zhou et al., 2021) are retrained with the best configure in our framework. In the test phase, we need negative triplets for the binary classification evaluation. The datasets WN11 and FB13 released by NTN (Socher et al., 2013) with negative triplets. For FB15k, we construct the negative triplets following (Socher et al., 2013). The optimal configurations are illustrated in Appendix A Table 7.
199
+
200
+ The experimental results on triplet classification are shown in Table 4. In each column, the top-1 result with bold marker and top-2-3 results with underline markers are given. On WN11, models with $L_{AS}$ all can reach an accuracy of $84\%$ . On FB13, models with $L_{AS}$ are comparable to former loss models. On FB15K, models with $L_{AS}$ have significant improvement compared to former models, and TransH-CAS performs best resulting $91.6\%$ accuracy among the compared models.
201
+
202
+ ![](images/cba4c049b149b653bc79345ebbf0dc9e05d61d6cecb443d140c98be582d263da.jpg)
203
+
204
+ ![](images/151a813a95f2497e2c3092b849cf874e2c61b92f6ea603278b0050b1e2eedfbf.jpg)
205
+ Figure 3: The impact of hyper-parameter $\mu_{n} - \mu_{p}$
206
+ Figure 4: (a) Convergence of Loss Function. (b) Changes of dynamic weight
207
+
208
+ # 4.3 Discussion
209
+
210
+ Impact of the hyper-parameters. We analyze the impact of two hyper-parameters $\mu_p$ (the upper score margin for all positive triplets) and $\mu_n$ (the lower score margin for all negative triplets). On the WN18 dataset, we first select a fixed value of $\mu_p$ , and test the impact of different values of $\mu_n = \mu_p + \{0.1, 0.25, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}$ on the experimental results. Figure 3 shows that good results can be obtained when $\mu_p - \mu_n$ is in the range of 2-7. Compared with $L_{SS}$ , $L_{AS}$ is more robust when $\mu_p - \mu_n$ takes a larger value.
211
+
212
+ Analysis of the convergence. We analyze the convergence of $L_{AS}$ and $L_{R}, L_{RS}, L_{SS}$ with TransE model on the FB15K dataset. Figure 4a shows the convergence curve of different loss functions after normalization. From the figure, we can see that $L_{AS}$ can converge more quickly and reach lower states. This phenomenon confirms that $L_{AS}$ has a more definite convergence target, which promotes separability for positive and negative triplets.
213
+
214
+ Analysis of the dynamic weight. We analyze the mean valid weights of positive and negative triplets $(S_{p} - \nu_{p} > 0$ and $S_{p} - \mu_{p} > 0$ for $\alpha_{p}$ , $\nu_{n} - S_{n} > 0$ and $\mu_{p}S_{p} > 0$ for $\alpha_{p}$ ). Figure 4b shows the dynamic changes of $\alpha_{p}, \alpha_{n}$ of TransH on the WN18 dataset ( $i$ donates IAS, $c$ donates CAS). Normally, the positive triplets are further away from optimization at the beginning, so the value of $\alpha_{p}$ is larger. From Figure 4b we can see that the weight change of $L_{IAS}$ is more sensitive than $L_{CAS}$ , and the overall weight dynamic changes of the two are closer. For practical applications, we recommend using the simpler $L_{CAS}$ first, and $L_{IAS}$ may bring some better results.
215
+
216
+ ![](images/ba3e78150aec88c3912017953a7539502e1a917b9dc693a5da2f88d1c3f744f4.jpg)
217
+ (a)
218
+
219
+ ![](images/7f737eecf35168dd417e8fe2aef0e2f33c3a2104e2d1c936e9f2bdac961a8102.jpg)
220
+ (b)
221
+
222
+ # 5 Conclusion
223
+
224
+ In this paper, we propose a novel adaptive limit scoring loss framework for learning knowledge
225
+
226
+ graph embeddings. The key idea of our proposal adaptive scoring loss is to re-weight each triplet and highlight the less-optimized triplet scores. For the setting of dynamic weights, we propose constant adaptive and independent adaptive methods according to the positioning of the circle center. We apply our loss framework on several knowledge graph embedding models such as TransE, TransH, ComplEx and RotatE, and conduct experiments on WordNet and Freebase datasets with link prediction and triplet classification tasks. The experimental results show the superiority of our proposed method.
227
+
228
+ # Acknowledgement
229
+
230
+ This work was supported in part by State Key Development Program Grand No. 2020YFB1708002, and NNSFC Grant No. 61971008.
231
+
232
+ # References
233
+
234
+ Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In Proc. of ACM International Conference on Management of Data, pages 1247-1250.
235
+ Antoine Bordes, Sumit Chopra, and Jason Weston. 2014. Question answering with subgraph embeddings. In Proc. of Conference on Empirical Methods in Natural Language Processing, pages 615-620.
236
+ Antoine Bordes, Xavier Glorot, Jason Weston, and Yoshua Bengio. 2012. Joint learning of words and meaning representations for open-text semantic parsing. In Proc. of Artificial Intelligence and Statistics, pages 127-135.
237
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In Proc. of Annual Conference on Neural Information Processing Systems, pages 1-9.
238
+ Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. 2018. Convolutional 2d knowledge graph embeddings. In Proc. of AAAI Conference on Artificial Intelligence, volume 32, pages 1811-1818.
239
+ Xin Dong, Evgeniy Gabrilovich, Geremy Heitz, Wilko Horn, Ni Lao, Kevin Murphy, Thomas Strohmann, Shaohua Sun, and Wei Zhang. 2014. Knowledge vault: A web-scale approach to probabilistic knowledge fusion. In Proc. of ACM International Conference on Knowledge Discovery and Data Mining, pages 601-610.
240
+ Lucas Drumond, Steffen Rendle, and Lars Schmidt-Thieme. 2012. Predicting rdf triples in incomplete knowledge bases with tensor factorization. In Proc.
241
+
242
+ of Annual ACM Symposium on Applied Computing, pages 326-331.
243
+ SM Shamimul Hasan, Donna Rivera, Xiao-Cheng Wu, Eric B Durbin, J Blair Christian, and Georgia Tourassi. 2020. Knowledge graph-enabled cancer data analytics. IEEE journal of biomedical and health informatics, 24(7):1952-1967.
244
+ Xiao Huang, Jingyuan Zhang, Dingcheng Li, and Ping Li. 2019. Knowledge graph embedding based question answering. In Proc. of ACM International Conference on Web Search and Data Mining, pages 105-113.
245
+ Guoliang Ji, Shizhu He, Liheng Xu, Kang Liu, and Jun Zhao. 2015. Knowledge graph embedding via dynamic mapping matrix. In Proc. of Annual Meeting of the Association for Computational Linguistics and International Joint Conference on Natural Language Processing, pages 687-696.
246
+ Guoliang Ji, Kang Liu, Shizhu He, and Jun Zhao. 2016. Knowledge graph completion with adaptive sparse transfer matrix. In Proc. of AAAI Conference on Artificial Intelligence, pages 985-991.
247
+ Xiaotian Jiang, Quan Wang, and Bin Wang. 2019. Adaptive convolution for multi-relational learning. In Proc. of Annual Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 978-987.
248
+ Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
249
+ Timothée Lacroix, Nicolas Usunier, and Guillaume Obozinski. 2018. Canonical tensor decomposition for knowledge base completion. In Proc. of International Conference on Machine Learning, pages 2863-2872.
250
+ Jens Lehmann, Robert Isele, Max Jakob, Anja Jentzsch, Dimitris Kontokostas, Pablo N Mendes, Sebastian Hellmann, Mohamed Morsey, Patrick Van Kleef, Soren Auer, et al. 2015. Dbpedia-a large-scale, multilingual knowledge base extracted from wikipedia. Semantic web, 6(2):167-195.
251
+ Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. 2015. Learning entity and relation embeddings for knowledge graph completion. In Proc. of AAAI Conference on Artificial Intelligence, volume 29, pages 2181-2187.
252
+ Shuqi Lu, Zhicheng Dou, Chenyan Xiong, Xiaojie Wang, and Ji-Rong Wen. 2020. Knowledge enhanced personalized search. In Proc. of ACM International Conference on Research and Development in Information Retrieval, pages 709-718.
253
+ George A Miller. 1995. Wordnet: a lexical database for english. Communications of the ACM, 38(11):39-41.
254
+
255
+ Dat Quoc Nguyen, Kairit Sirts, Lizhen Qu, and Mark Johnson. 2016. Stranse: a novel embedding model of entities and relationships in knowledge bases. In Proc. of Annual Conference of the North American Chapter of the Association for Computational Linguistics, pages 460-466.
256
+ Tu Nguyen, Dinh Phung, et al. 2020. A relational memory-based embedding model for triple classification and search personalization. In Proc. of Annual Meeting of the Association for Computational Linguistics, pages 3429-3435.
257
+ Tu Dinh Nguyen, Dat Quoc Nguyen, Dinh Phung, et al. 2018. A novel embedding model for knowledge base completion based on convolutional neural network. In Proc. of North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 327-333.
258
+ Maximilian Nickel, Lorenzo Rosasco, and Tomaso Poggio. 2016. Holographic embeddings of knowledge graphs. In Proc. of AAAI Conference on Artificial Intelligence, volume 30, pages 1955-1961.
259
+ Maximilian Nickel, Volker Tresp, and Hans-Peter Kriegel. 2011. A three-way model for collective learning on multi-relational data. In Proc. of International Conference on Machine Learning, volume 11, pages 809-816.
260
+ Baoxu Shi and Tim Weninger. 2017. Proje: Embedding projection for knowledge graph completion. In Proc. of AAAI Conference on Artificial Intelligence, volume 31, pages 1236-1242.
261
+ Richard Socher, Danqi Chen, Christopher D Manning, and Andrew Ng. 2013. Reasoning with neural tensor networks for knowledge base completion. In Proc. of Annual Conference on Neural Information Processing Systems, pages 926-934.
262
+ George Stoica, Otilia Stretcu, Emmanouil Antonios Platanios, Tom Mitchell, and Barnabás Póczos. 2020. Contextual parameter generation for knowledge graph link prediction. In Proc. of AAAI Conference on Artificial Intelligence, volume 34, pages 3000-3008.
263
+ Fabian M Suchanek, Gjergji Kasneci, and Gerhard Weikum. 2007. Yago: a core of semantic knowledge. In Proc. of International Conference on World Wide Web, pages 697-706.
264
+ Yifan Sun, Changmao Cheng, Yuhan Zhang, Chi Zhang, Liang Zheng, Zhongdao Wang, and Yichen Wei. 2020. Circle loss: A unified perspective of pair similarity optimization. In Proc. of Computer Vision and Pattern Recognition, pages 6398-6407.
265
+ Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. 2019. Rotate: Knowledge graph embedding by relational rotation in complex space. In Proc. of International Conference on Learning Representations, pages 1-18.
266
+
267
+ Kristina Toutanova and Danqi Chen. 2015. Observed versus latent features for knowledge base and text inference. In Proc. of Workshop on Continuous Vector Space Models and their Compositionality, pages 57-66.
268
+ Théo Trouillon, Johannes Welbl, Sebastian Riedel, Éric Gaussier, and Guillaume Bouchard. 2016. Complex embeddings for simple link prediction. In Proc. of International Conference on Machine Learning, volume 48, pages 2071-2080.
269
+ Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. 2014. Knowledge graph embedding by translating on hyperplanes. In Proc. of AAAI Conference on Artificial Intelligence, volume 28, pages 1112-1119.
270
+ Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. 2014. Learning multi-relational semantics using neural-embedding models. arXiv preprint arXiv:1411.4072.
271
+ Bishan Yang, Wen-tau Yih, Xiaodong He, Jianfeng Gao, and Li Deng. 2015. Embedding entities and relations for learning and inference in knowledge bases. In Proc. of International Conference on Learning Representations, pages 1-12.
272
+ Jinfa Yang, Yongjie Shi, Xin Tong, Robin Wang, Taiyan Chen, and Xianghua Ying. 2021. Improving knowledge graph embedding using affine transformations of entities corresponding to each relation. In *Findings of the Association for Computational Linguistics: EMNLP* 2021, pages 508-517.
273
+ Kun Zhou, Wayne Xin Zhao, Shuqing Bian, Yuanhang Zhou, Ji-Rong Wen, and Jingsong Yu. 2020. Improving conversational recommender systems via knowledge graph based semantic fusion. In Proc. of ACM International Conference on Knowledge Discovery and Data Mining, pages 1006-1014.
274
+ Xiaofei Zhou, Lingfeng Niu, Qiannan Zhu, Xingquan Zhu, Ping Liu, Jianlong Tan, and Li Guo. 2021. Knowledge graph embedding by double limit scoring loss. IEEE Transactions on Knowledge and Data Engineering.
275
+ Xiaofei Zhou, Qiannan Zhu, Ping Liu, and Li Guo. 2017. Learning knowledge embeddings by combining limit-based scoring loss. In Proc. of ACM on Conference on Information and Knowledge Management, pages 1009-1018.
276
+
277
+ # A Parameter Settings
278
+
279
+ Table 5 shows the parameter settings of TransE, TransH, ComplEx with adaptive limit scoring loss for link prediction on WN18, FB15K datasets. Table 6 shows the parameter settings of TransE, TransH, ComplEx, RotatE with adaptive Limit Scoring Loss for link prediction on the WN18NN,
280
+
281
+ FB15K237 datasets, where $t$ represents the sampling temperature for self-adversarial negative sampling. Table 7 shows the parameter settings of TransE, TransH with adaptive Limit Scoring Loss for triplet classification on the WN18, FB13 and FB15K datasets.
282
+
283
+ <table><tr><td>WN18</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C</td></tr><tr><td>TransE-CAS</td><td>1000</td><td>200</td><td>0.00001</td><td>4.0</td><td>9.0</td><td>-</td></tr><tr><td>TransE-IAS</td><td>1000</td><td>100</td><td>0.00005</td><td>4.0</td><td>8.0</td><td>-</td></tr><tr><td>TransH-CAS</td><td>500</td><td>80</td><td>0.00005</td><td>4.0</td><td>9.0</td><td>0.0005</td></tr><tr><td>TransH-IAS</td><td>500</td><td>80</td><td>0.00005</td><td>3.0</td><td>7.0</td><td>0.0005</td></tr><tr><td>ComplEx-CAS</td><td>1000</td><td>200</td><td>0.00005</td><td>0.3</td><td>0.7</td><td>-</td></tr><tr><td>ComplEx-IAS</td><td>500</td><td>200</td><td>0.00005</td><td>0.1</td><td>0.7</td><td>-</td></tr><tr><td>FB15k</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C</td></tr><tr><td>TransE-CAS</td><td>1000</td><td>200</td><td>0.0001</td><td>6.0</td><td>6.5</td><td>-</td></tr><tr><td>TransE-IAS</td><td>1000</td><td>200</td><td>0.00005</td><td>6.0</td><td>7.0</td><td>-</td></tr><tr><td>TransH-CAS</td><td>1000</td><td>200</td><td>0.0001</td><td>10.0</td><td>11.0</td><td>0.0625</td></tr><tr><td>TransH-IAS</td><td>500</td><td>200</td><td>0.0001</td><td>7.0</td><td>8.0</td><td>0.0625</td></tr><tr><td>ComplEx-CAS</td><td>1000</td><td>200</td><td>0.00005</td><td>0.6</td><td>0.7</td><td>-</td></tr><tr><td>ComplEx-IAS</td><td>1000</td><td>200</td><td>0.00005</td><td>0.6</td><td>0.8</td><td>-</td></tr></table>
284
+
285
+ Table 5: Parameter Configurations for WN18 and FB15K
286
+
287
+ <table><tr><td>WN18RR</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C/t</td></tr><tr><td>TransE-CAS</td><td>50</td><td>50</td><td>0.00005</td><td>2.0</td><td>12.0</td><td>-</td></tr><tr><td>TransE-IAS</td><td>500</td><td>150</td><td>0.00005</td><td>5.0</td><td>10.0</td><td>-</td></tr><tr><td>TransH-CAS</td><td>200</td><td>50</td><td>0.005</td><td>3.0</td><td>10.0</td><td>0.0005</td></tr><tr><td>TransH-IAS</td><td>200</td><td>150</td><td>0.00001</td><td>5.0</td><td>10.0</td><td>0.0005</td></tr><tr><td>ComplEx-CAS</td><td>1000</td><td>200</td><td>0.00001</td><td>0.1</td><td>0.3</td><td>-</td></tr><tr><td>ComplEx-IAS</td><td>100</td><td>200</td><td>0.00001</td><td>0.1</td><td>0.5</td><td>-</td></tr><tr><td>RotatE-CAS</td><td>500</td><td>500</td><td>0.00001</td><td>1.0</td><td>4.0</td><td>t=0.5</td></tr><tr><td>RotatE-IAS</td><td>500</td><td>500</td><td>0.00001</td><td>1.0</td><td>4.0</td><td>t=0.5</td></tr><tr><td>FB15k-237</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C/t</td></tr><tr><td>TransE-CAS</td><td>100</td><td>200</td><td>0.00005</td><td>7.0</td><td>9.0</td><td>-</td></tr><tr><td>TransE-IAS</td><td>500</td><td>200</td><td>0.00001</td><td>7.0</td><td>9.0</td><td>-</td></tr><tr><td>TransH-CAS</td><td>100</td><td>200</td><td>0.00005</td><td>6.0</td><td>8.0</td><td>0.0625</td></tr><tr><td>TransH-IAS</td><td>100</td><td>200</td><td>0.00001</td><td>6.0</td><td>8.0</td><td>0.0625</td></tr><tr><td>ComplEx-CAS</td><td>2000</td><td>200</td><td>0.000005</td><td>0.6</td><td>0.65</td><td>-</td></tr><tr><td>ComplEx-IAS</td><td>2000</td><td>200</td><td>0.00005</td><td>0.6</td><td>0.7</td><td>-</td></tr><tr><td>RotatE-CAS</td><td>1000</td><td>1000</td><td>0.00001</td><td>3.0</td><td>5.0</td><td>t=1.0</td></tr><tr><td>RotatE-IAS</td><td>1000</td><td>1000</td><td>0.00001</td><td>3.0</td><td>4.0</td><td>t=1.0</td></tr></table>
288
+
289
+ # B Training Process
290
+
291
+ Training process of knowledge graph embedding models with adaptive scoring loss $L_{AS}$ is given in Algorithm 1. Where $\mathcal{G}$ donates a knowledge graph composed of several triplets; $N_{e}, N_{r}$ donate the number of entities and relations respectively; $d, k$ represent the embedding dimensions of entities and relations, usually $d = k$ ; $\mathbf{m} \in \mathbb{R}^{N_e \times d}$ , $\mathbf{m} \in \mathbb{R}^{N_r \times k}$ donate the embedding of entities and relations respectively.
292
+
293
+ Table 6: Parameter Configurations for WN18RR and FB15K-237
294
+
295
+ <table><tr><td>WN11</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C/pd</td></tr><tr><td>TransE-CAS</td><td>1000</td><td>100</td><td>0.01</td><td>2.0</td><td>13.0</td><td>-</td></tr><tr><td>TransE-IAS</td><td>100</td><td>80</td><td>0.001</td><td>2.0</td><td>13.0</td><td>-</td></tr><tr><td>TransH-CAS</td><td>100</td><td>100</td><td>0.0001</td><td>2.0</td><td>13.0</td><td>0.0005</td></tr><tr><td>TransH-IAS</td><td>50</td><td>80</td><td>0.00005</td><td>2.0</td><td>13.0</td><td>0.0005</td></tr><tr><td>FB13</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C</td></tr><tr><td>TransE-CAS</td><td>200</td><td>100</td><td>0.01</td><td>5.0</td><td>12.0</td><td>-</td></tr><tr><td>TransE-IAS</td><td>100</td><td>100</td><td>0.01</td><td>5.0</td><td>12.0</td><td>-</td></tr><tr><td>TransH-CAS</td><td>1000</td><td>100</td><td>0.01</td><td>5.0</td><td>12.0</td><td>0.0625</td></tr><tr><td>TransH-IAS</td><td>500</td><td>50</td><td>0.01</td><td>5.0</td><td>9.0</td><td>0.0625</td></tr><tr><td>FB15k</td><td>B</td><td>m</td><td>α</td><td>μp</td><td>μn</td><td>C</td></tr><tr><td>TransE-CAS</td><td>50</td><td>50</td><td>0.005</td><td>5.0</td><td>6.0</td><td>-</td></tr><tr><td>TransE-IAS</td><td>100</td><td>50</td><td>0.01</td><td>4.0</td><td>4.5</td><td>-</td></tr><tr><td>TransH-CAS</td><td>50</td><td>200</td><td>0.005</td><td>4.0</td><td>5.0</td><td>0.0625</td></tr><tr><td>TransH-IAS</td><td>100</td><td>200</td><td>0.005</td><td>4.0</td><td>5.0</td><td>0.0625</td></tr></table>
296
+
297
+ Table 7: Parameter Configurations for WN11, FB13 and FB15K
298
+
299
+ <table><tr><td colspan="2">Algorithm 1: Learning knowledge graph embedding models with LAS</td></tr><tr><td colspan="2">Input: Positive training triplets G = {(h,r,t)|h,t ∈ E, r ∈ R}, E and R are respectively the set of entities and relations. Negative training triplets G&#x27; = ∅. Output: Entity and relation embedding mE and mR</td></tr><tr><td colspan="2">Stage1: Initialization of Knowledge Graphs.</td></tr><tr><td>1</td><td>Entity embedding mE ← initialization (Ne,d);</td></tr><tr><td>2</td><td>Entity embedding mR ← initialization (Nr,k); // initialization(a,b) produces a matrix with size by initialized randomly or the results of basic models such as TransE (Bordes et al., 2013);</td></tr><tr><td>3</td><td>Stage2: Construct Negative Triplets.</td></tr><tr><td>4</td><td>for each (h,r,t) in positive sample set G do
300
+ (h&#x27;,r,t&#x27;) = generate_negative((h,r,t)) using unif/bern strategy in (Wang et al., 2014) for generating negative samples;</td></tr><tr><td>5</td><td>G&#x27; = G&#x27; ∪ (h&#x27;,r,t&#x27;)</td></tr><tr><td>6</td><td>end</td></tr><tr><td>7</td><td>Stage3: Learning Embeddings of Entities and Relations.</td></tr><tr><td>8</td><td>for e← 1 to MaxEpoch do</td></tr><tr><td>9</td><td>for i← 1 to MaxSample do</td></tr><tr><td>10</td><td>Sampi = sample_batchi(G, G&#x27;, B) // sample a mini-batch of size B at random from positive and negative training samples;</td></tr><tr><td>11</td><td>Update entity and relation embeddings w.r.t. the gradients of Σ(h,r,t), (h&#x27;,r,t&#x27;) ∈ Sampi αp [Sp - μp] + αn [μn - Sn] + ;</td></tr><tr><td>12</td><td>Handle additional constraints or regularization terms;</td></tr><tr><td>13</td><td>end</td></tr></table>
knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:305a680c9e1827664359b6a68b856d2914e8a012a4289f219b9fe47d0c5dc575
3
+ size 827852
knowledgegraphembeddingbyadaptivelimitscoringlossusingdynamicweightingstrategy/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:750723fe4c6a549bccc208f285ef8aa9e48fb95412783024999f7d59d07d941e
3
+ size 497066
labelsemanticsforfewshotnamedentityrecognition/7a56e1c7-2661-4e17-bd67-30b5f7477cad_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d916a99ae3b2181bd9df3cf77cba6863802992129384a53a1d8e1bc20077005
3
+ size 101938
labelsemanticsforfewshotnamedentityrecognition/7a56e1c7-2661-4e17-bd67-30b5f7477cad_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:393de7eeba38c8fdd4d85e679ace8b4a2f3738432f2cec1022fefe4aebb9d0a1
3
+ size 121469
labelsemanticsforfewshotnamedentityrecognition/7a56e1c7-2661-4e17-bd67-30b5f7477cad_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9e234e8c9c4b28dd1e08d2102fc817c952579a45cd4293fe5785f4ca1b3fd6b
3
+ size 617420
labelsemanticsforfewshotnamedentityrecognition/full.md ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Label Semantics for Few Shot Named Entity Recognition
2
+
3
+ Jie Ma $^{1}$ Miguel Ballesteros $^{1}$ Srikanth Doss $^{1}$ Rishita Anubhai $^{1}$ Sunil Mallya $^{1*}$ Yaser Al-Onaizan $^{1*}$ Dan Roth $^{1,2}$ ${}^{1}\mathrm{AWS}$ AI Labs
4
+
5
+ $^{2}$ Computer and Information Science, University of Pennsylvania
6
+
7
+ {jieman, ballemig, srikad, ranubhai, drot}@amazon.com mallya16@gmail.com, onaizan2000@yahoo.com
8
+
9
+ # Abstract
10
+
11
+ We study the problem of few shot learning for named entity recognition. Specifically, we leverage the semantic information in the names of the labels as a way of giving the model additional signal and enriched priors. We propose a neural architecture that consists of two BERT encoders, one to encode the document and its tokens and another one to encode each of the labels in natural language format. Our model learns to match the representations of named entities computed by the first encoder with label representations computed by the second encoder. The label semantics signal is shown to support improved state-of-the-art results in multiple few-shot NER benchmarks and on-par performance in standard benchmarks. Our model is especially effective in low resource settings.
12
+
13
+ # 1 Introduction
14
+
15
+ Named entity recognition (NER) seeks to locate named entity spans in unstructured text and classify them into pre-defined categories such as PERSON, LOCATION and ORGANIZATION (Tjong Kim Sang and De Meulder, 2003a). As a fundamental natural language understanding task, NER often serves as an upstream component for more complex tasks such as question answering (Mollá et al., 2006), relation extraction (Chan and Roth, 2011) and coreference resolution (Clark and Manning, 2015). However, building an accurate NER system has traditionally required large amounts of high quality annotated in-domain data (Lison et al., 2020; Chen et al., 2020). This usually involves well defined annotation guidelines and training of annotators, which requires rich domain knowledge and can be prohibitively expensive (Huang et al., 2020).
16
+
17
+ Few shot learning (FSL) (Vinyals et al., 2017; Finn et al., 2017; Snell et al., 2017) aims at performing a task using only very few annotated examples (i.e. support set).
18
+
19
+ Similarity-based methods, such as prototypical networks, are extensively studied and show great success for FSL (Vinyals et al., 2017; Snell et al., 2017; Yu et al., 2018a; Hou et al., 2020). The core idea is to classify input examples from a new domain based on their similarities with representations of each class in the support set. These methods do not utilize the semantics of label names and usually represent labels by directly averaging the embedding of support set examples, oversimplifying the learning of label representations. The main premise of our work is that label names carry meaning that our models can induce from data; the labels are themselves words that appear in text in various contexts and are thus semantically related to other words that appear in text, and this relatedness can be leveraged. For example, the representation of "Lionel Messi" is more similar to that of PERSON than to the representations of LOCATION or DATE when similar priors are used for labels and words or phrases.
20
+
21
+ In this work, we propose a neural architecture that uses two separate BERT-based encoders (Devlin et al., 2019) to leverage semantics of label names for NER. One encoder (a) is used to encode the document and its words while the other encoder (b) is used to encode label names (e.g. PERSON, LOCATION etc.). The model is trained to match word representations from encoder (a) with label representations from encoder (b), and assign a label for each word by maximizing the
22
+
23
+ similarity. We also experiment by replacing the BERT label encoder with GloVe embeddings (Pennington et al., 2014) as a simplified architecture.
24
+
25
+ We report experimental results in multiple NER datasets from different domains. We summarize our contribution as follows:
26
+
27
+ - We propose a simple and effective model architecture that leverages label semantics for NER.
28
+ - We show that the proposed model is particularly effective in low resource settings and gives on-par results with the state-of-the-art models in high resource settings.
29
+ - We achieve a new state-of-the-art in multiple few shot NER benchmarks. Specifically, our model outperforms prior work by 1.2 to 6.6 F1 points on CoNLL'03, WNUT'17, JNLPBA, NCBI-disease and I2B2'14 datasets on various few shot shots settings (§3.6).
30
+ - We show that the proposed model is robust to variations of label names and that it is able to differentiate semantically similar labels.
31
+
32
+ # 2 Model
33
+
34
+ We present our NER model. As shown in Figure 1, it consists of two BERT-based encoders where one encoder is used to encode the document and its tokens and the other to encode labels. We formalize the differences between datasets used in our experimentation (§2.1), then present how two BERT-based encoders (and the modification with GloVe-based encoder for labels) are used to leverage semantics in labels for NER (§2.2). Finally we discuss the training procedure (§2.3) and how labels are represented (§2.4).
35
+
36
+ # 2.1 Source and Target Datasets
37
+
38
+ For few shot NER, we use a setup similar to meta-learning. We first train our models on source datasets $\{\mathcal{D}_1^S,\mathcal{D}_2^S,\ldots \}$ , then evaluate the model on unseen few shot target datasets $\{\mathcal{D}_1^T,\mathcal{D}_2^T,\ldots \}$ with or without finetuning. Each target dataset only contains a few examples and a different taxonomy of labels compared to the source datasets.
39
+
40
+ # 2.2 Architecture
41
+
42
+ We use two BERT-based encoders as shown in Figure 1: a BERT document encoder and a BERT label encoder (we also experiment with GloVe embeddings as label encoder, described in §3.5). Like the traditional NER models (Carreras et al., 2003; Collobert et al., 2011; Lample et al., 2016, inter alia), we predict the label of each token with BIO scheme. For each token we get an embedding $e$ from the first BERT document encoder. For the unique set of labels $\mathcal{L}_D$ associated with dataset $D$ , we apply three steps to get the representations: First, we manually convert the label names to their natural language forms, e.g. "PER" to "person", "ORG" to "organization" etc. Second, we convert each of the label names to BIO scheme, in the form of natural language, e.g. "person" to "begin person" or "inside person". Finally, we use the second BERT label encoder to embed each of the labels in natural language BIO scheme. We compute the BERT [CLS] token embedding as the representation for the corresponding label. We form a label vector $\pmb{b}$ of all label embeddings $b_i$ for all $i$ in $\{1, 2, \dots, 2 \times N_L - 1\}^3$ . The label encoder acts like a lookup table for label embeddings. Finally, to find the most appropriate label for this token, we use:
43
+
44
+ $$
45
+ y = \underset {i} {\arg \max } \operatorname {s o f t m a x} (e \cdot \boldsymbol {b})
46
+ $$
47
+
48
+ # 2.3 Training
49
+
50
+ Comparing with prior work on neural architectures for NER, our model does not require a new randomly initialized top layer classifier for a new dataset with new unseen label names. Instead, we generate label representations from the BERT label encoder. We hypothesize that this is beneficial because it prevents the model from forgetting priors since no parameters are dropped or randomly initialized for different datasets.
51
+
52
+ We propose a simple two stage training procedure. In the first stage, we pre-finetune our model on the mix of all source datasets (which usually have different label set taxonomies), then we fine
53
+
54
+ ![](images/36d738f21eca69b3d3da5e2a7c64307472983f410222e153c134ae6a7a77524c.jpg)
55
+ Figure 1: The architecture of our NER model. The diagram shows how representation of labels and tokens are produced, and how we use them to calculate final model prediction. The top part of the figure shows how labels are encoded; the bottom part of the figure shows how sentence are encoded.
56
+
57
+ tune the trained model on the target dataset. This process is also known as pre-finetuning (Aghajanyan et al., 2021) and finetuning. For scenarios where no source datasets are available, we simply skip the first stage. During model training time, both encoders are updated for every iteration at both stages, which helps to align the token embedding space and the label embedding space.
58
+
59
+ During inference time, the learned label encoder is only required to produce label representations once. This is because the label representations may be cached and the label encoder is no longer needed to recompute representations. Our model is therefore not introducing additional memory overhead (since label encoder is removed) or latency overhead (since label representation is cached).
60
+
61
+ # 2.4 Label Representation
62
+
63
+ Given that our label encoder is based on BERT and contains the priors from pretraining, our architecture allows any textual form as input for the generation of label representations. In order to make our results comparable with previous studies, we use only the natural language form of label names for our primary results. We discuss more label representations in Appendix E.
64
+
65
+ # 3 Experiments
66
+
67
+ We evaluate our model and we compare it against existing few shot methods in two scenarios: high
68
+
69
+ resource and low resource (few shot). In both cases, we assume there is a source dataset (which may be a set) with abundant data, and our goal is to maximize model performance on unseen target datasets which follow different taxonomies from the source dataset.
70
+
71
+ # 3.1 Datasets
72
+
73
+ We perform experiments on 6 NER datasets from 5 different domains: OntoNotes 5.0 (Weischedel et al., 2013) (Mixed), CoNLL-2003 (Tjong Kim Sang and De Meulder, 2003a) (News), WNUT-2017 (Derczynski et al., 2017) (Social), JNLPBA (Collier and Kim, 2004) (Biology), NCBI-disease (Dogan et al., 2014) (Biology) and I2B2-2014 (Stubbs and Uzuner, 2015) (Medical). In all our experiments and following the definition in 2.1, we treat OntoNotes as the source dataset and all other as target datasets. $^{4}$
74
+
75
+ # 3.2 Settings and Evaluation
76
+
77
+ In this Section, we present the different experiments, and how do we carry out the evaluation.
78
+
79
+ High Resource: Given a target dataset, we simply take all available data and evaluate on the standard held-out test set.
80
+
81
+ <table><tr><td colspan="2"></td><td>1 Shot</td><td>5 Shot</td><td>20 Shot</td><td>50 Shot</td><td>Full Dataset</td></tr><tr><td rowspan="7">CoNLL-2003</td><td>TransferBERT</td><td>44.8 ±15.0</td><td>66.9 ±6.7</td><td>77.5 ±1.2</td><td>82.0 ±1.1</td><td>91.3 ±0.2</td></tr><tr><td>Prototypical Network</td><td>7.5 ±2.6</td><td>11.5 ±5.6</td><td>18.6 ±7.5</td><td>16.3 ±2.7</td><td>N/A</td></tr><tr><td>WPN-CRF</td><td>56.26 ±9.1</td><td>67.7 ±4.4</td><td>67.4 ±2.0</td><td>69.0 ±1.7</td><td>N/A</td></tr><tr><td>Struct NN shot</td><td>63.7 ±3.7</td><td>70.0 ±3.0</td><td>73.1 ±1.9</td><td>75.7 ±1.8</td><td>N/A</td></tr><tr><td>TANL</td><td>54.7 ±9.4</td><td>65.6 ±3.8</td><td>71.0 ±2.4</td><td>74.4 ±1.9</td><td>91.7 ±0.4</td></tr><tr><td>Our model - GloVe</td><td>63.1 ±6.9</td><td>73.5 ±2.4</td><td>78.3 ±1.1</td><td>82.0 ±1.5</td><td>91.6 ±0.2</td></tr><tr><td>Our model - BERT</td><td>68.4 ±6.7</td><td>76.6 ±2.1</td><td>79.7 ±1.1</td><td>83.1 ±1.2</td><td>91.5 ±0.2</td></tr><tr><td rowspan="7">WNUT-2017</td><td>TransferBERT</td><td>27.6 ±6.8</td><td>35.2 ±3.4</td><td>40.9 ±1.6</td><td>42.5 ±1.2</td><td>44.0 ±0.2</td></tr><tr><td>Prototypical Network</td><td>1.7 ±1.2</td><td>2.1 ±1.0</td><td>2.7 ±1.6</td><td>3.5 ±1.7</td><td>N/A</td></tr><tr><td>WPN-CRF</td><td>23.1 ±2.8</td><td>29.9 ±3.2</td><td>32.9 ±1.2</td><td>33.2 ±1.1</td><td>N/A</td></tr><tr><td>Struct NN shot</td><td>31.1 ±6.4</td><td>33.2 ±2.0</td><td>30.8 ±2.2</td><td>31.8 ±1.8</td><td>N/A</td></tr><tr><td>TANL</td><td>25.6 ±6.3</td><td>33.3 ±4.4</td><td>34.1 ±2.1</td><td>34.4 ±2.4</td><td>45.2 ±0.6</td></tr><tr><td>Our model - GloVe</td><td>36.6 ±2.4</td><td>39.6 ±1.9</td><td>42.5 ±1.3</td><td>43.0 ±1.1</td><td>45.7 ±0.6</td></tr><tr><td>Our model - BERT</td><td>38.3 ±1.7</td><td>40.8 ±2.1</td><td>42.7 ±1.1</td><td>43.3 ±0.8</td><td>45.0 ±0.6</td></tr><tr><td rowspan="7">JNLPBA</td><td>TransferBERT</td><td>26.6 ±7.8</td><td>40.3 ±2.8</td><td>53.2 ±2.9</td><td>59.7 ±1.3</td><td>71.0 ±0.5</td></tr><tr><td>Prototypical Network</td><td>2.1 ±1.5</td><td>4.0 ±3.2</td><td>6.8 ±3.6</td><td>5.7 ±3.0</td><td>N/A</td></tr><tr><td>WPN-CRF</td><td>6.5 ±5.0</td><td>10.3 ±5.7</td><td>10.3 ±4.9</td><td>9.4 ±2.7</td><td>N/A</td></tr><tr><td>Struct NN shot</td><td>15.9 ±5.3</td><td>19.2 ±2.9</td><td>23.1 ±2.1</td><td>26.8 ±0.7</td><td>N/A</td></tr><tr><td>TANL</td><td>32.4 ±4.0</td><td>41.1 ±5.0</td><td>51.7 ±2.6</td><td>58.8 ±0.6</td><td>74.3 ±0.2</td></tr><tr><td>Our model - GloVe</td><td>25.4 ±6.1</td><td>39.7 ±2.3</td><td>52.3 ±3.1</td><td>59.3 ±1.4</td><td>71.8 ±0.3</td></tr><tr><td>Our model - BERT</td><td>32.7 ±3.0</td><td>43.15 ±2.4</td><td>53.8 ±2.7</td><td>59.8 ±1.3</td><td>71.0 ±0.5</td></tr><tr><td rowspan="7">NCBI-disease</td><td>TransferBERT</td><td>16.8 ±9.5</td><td>24.1 ±6.3</td><td>43.0 ±5.0</td><td>56.7 ±3.0</td><td>84.5 ±0.9</td></tr><tr><td>Prototypical Network</td><td>12.2 ±8.7</td><td>12.5 ±9.6</td><td>14.0 ±11.6</td><td>10.8 ±7.3</td><td>N/A</td></tr><tr><td>WPN-CRF</td><td>5.5 ±4.8</td><td>6.8 ±9.1</td><td>3.5 ±5.4</td><td>5.7 ±5.3</td><td>N/A</td></tr><tr><td>Struct NN shot</td><td>18.5 ±5.6</td><td>20.6 ±5.2</td><td>27.6 ±2.4</td><td>36.7 ±5.0</td><td>N/A</td></tr><tr><td>TANL</td><td>15.8 ±4.0</td><td>21.0 ±6.2</td><td>26.0 ±3.9</td><td>40.9 ±4.2</td><td>85.8 ±0.9</td></tr><tr><td>Our model - GloVe</td><td>15.1 ±8.7</td><td>26.2 ±6.1</td><td>44.6 ±4.2</td><td>56.8 ±3.1</td><td>86.7 ±0.6</td></tr><tr><td>Our model - BERT</td><td>30.7 ±9.1</td><td>34.9 ±4.9</td><td>50.9 ±3.3</td><td>60.5 ±2.2</td><td>85.0 ±0.6</td></tr><tr><td rowspan="7">12B2-2014</td><td>TransferBERT</td><td>58.4 ±5.7</td><td>75.2 ±1.9</td><td>86.2 ±0.9</td><td>90.3 ±0.4</td><td>93.0 ±0.1</td></tr><tr><td>Prototypical Network</td><td>2.1 ±0.7</td><td>2.2 ±0.4</td><td>2.6 ±0.4</td><td>2.7 ±0.1</td><td>N/A</td></tr><tr><td>WPN-CRF</td><td>10.0 ±2.5</td><td>13.1 ±3.3</td><td>13.9 ±2.1</td><td>13.3 ±2.1</td><td>N/A</td></tr><tr><td>Struct NN shot</td><td>46.7 ±6.4</td><td>59.1 ±1.9</td><td>67.4 ±1.3</td><td>72.4 ±0.6</td><td>N/A</td></tr><tr><td>TANL</td><td>47.1 ±5.2</td><td>65.1 ±2.9</td><td>80.7 ±1.2</td><td>87.0 ±0.3</td><td>92.0 ±0.1</td></tr><tr><td>Our model - GloVe</td><td>58.2 ±5.8</td><td>75.5 ±2.3</td><td>85.6 ±1.0</td><td>90.5 ±0.3</td><td>93.5 ±0.1</td></tr><tr><td>Our model - BERT</td><td>61.9 ±4.3</td><td>76.8 ±2.0</td><td>86.7 ±0.8</td><td>90.5 ±0.4</td><td>93.2 ±0.3</td></tr></table>
82
+
83
+ Table 1: Results on held out test sets of all datasets. "Our model - GloVe": this refers to our model with GloVe label encoder. "Our model - BERT": this refers to our model with BERT label encoder. All numbers indicate micro F1 scores unless noted otherwise. Results for low resource settings are average of 10 runs with different support set sampling. Results for high resource setting are average of 5 runs with different random seeds. For some baselines we cannot run the released implementation from originally papers due to GPU out of memory and they are marked as N/A. We visualize the results with bar chart in Appendix D.
84
+
85
+ Low Resource: Given a target dataset, we downsample the data (at sentence level) in the train split to construct a $K$ -shot support set. This simulates the low resource scenario where only a few training examples are available in the target dataset. The definition of a $K$ -shot support set is that it contains exact $K$ examples for each of the labels. However, unlike the text classification task where each sen
86
+
87
+ tence is associated with one label, in the NER task multiple named entities may co-occur in the same sentence. We cannot guarantee that the support set contains exact $K$ named entities for each label after downsampling. We therefore define the proxy for $K$ -shot support set similar as the one by Hou et al. (2020), with the following two criteria: 1) Each label in the target dataset (except "O") has at least
88
+
89
+ $K$ corresponding named entities in the support set; 2) At least one of the labels in the target dataset will have less than $K$ named entities in the support set if any sentence is removed. We apply the same downsampling algorithm as in (Hou et al., 2020) for the support set. More details can be found in Appendix B.
90
+
91
+ To evaluate the model performance in the $K$ -shot support set, most prior work (Hou et al., 2020; Athiwaratkun et al., 2020; Fritzler et al., 2019) followed the few-shot classification setup, where test sets are also downsampled to $K$ -shot subsets (query set) such that each entity labels are evenly distributed. The model is trained and evaluated on multiple support datasets and query set pairs, and final model performance is reported with average of scores on each query set. However, we argue that in real world cases, entity labels have certain distribution corresponding to the domain, downsampled $K$ -shot query set does not reflect this real distribution. Therefore instead of evaluating on the downsampled query set, we directly evaluate the model in the full test split from the target dataset. This also improves comparability and replicability of our results since the same test set is used across and in prior work (even in papers that are not focused on few-shot experiments).
92
+
93
+ Evaluation To thoroughly test our model, we evaluate it with 1-shot, 5-shot, 20-shot, 50-shot (low resource) and also the full dataset (high resource) settings. Following prior work (Tjong Kim Sang and De Meulder, 2003b), we use micro F1 score as metric. For low resource settings, we repeat the experiments 10 times with randomly sampled support sets. For high resource setting, we repeat the experiments 5 times with different random seeds. In all cases, we report average micro F1 with standard deviation. Table 2 shows an overview of dataset statistics.
94
+
95
+ # 3.3 Baselines
96
+
97
+ TransferBERT trains the same NER model in (Devlin et al., 2019) by pre-finetuning on a source dataset then finetuning on a target dataset. Proto
98
+
99
+ typical Network (Snell et al., 2017) approaches NER as a token level classification task. It assigns label for each token based on similarities between candidate token and tokens in few shot support set. WPN-CRF (Fritzler et al., 2019) pretrains a prototypical network with source dataset and evaluate it on target dataset without finetuning. It uses a conditional random field (CRF) (Huang et al., 2015) to output the final labels of the sentence. Struct NN shot (Yang and Katiyar, 2020) finds nearest token in support set for a given candidate token and assign it the same label as its nearest neighbor. TANL (Paolini et al., 2021) forms NER as sequence to sequence. The model is trained to generate the original input text with entities being decorated in a bracket. $^6$
100
+
101
+ # 3.4 Hyperparameters
102
+
103
+ We use English cased BERT-base (Devlin et al., 2019) as contextual embedder for all baseline models and our model, except for TANL where T5-base is used. We use Adam optimizer (Kingma and Ba, 2014) to train our model with a learning rate of $1 \times 10^{-5}$ and batch size of 10. We pre-finetune our model on the source dataset (Ontonotes) for 3 epochs and continue finetuning on target datasets for 200 epochs for both high resource and low resource settings. We pick the last epoch as the final model. For label names, we manually expand all shortcut names into full natural language names (e.g. "PER" to "person", "LOC" to "location") and lower case all names. Textual forms for all datasets can be found in Appendix A.2. We run all experiments on NVIDIA V100 GPU.
104
+
105
+ # 3.5 GloVe as Label Encoder
106
+
107
+ We experiment with GloVe embeddings (Pennington et al., 2014) as the label encoder. In this case,
108
+
109
+ our model has no extra parameters compared to other baselines. As in the case with BERT, the vectors are updated throughout the training. Given that there is no [CLS] token available, we apply max pooling on all the GloVe embeddings corresponding to each label token. If the label consists only of one token, max pooling will return the actual GloVe embedding for the token as the label representation.
110
+
111
+ <table><tr><td rowspan="2">Dataset</td><td colspan="4">Support Set Shot</td></tr><tr><td>1</td><td>5</td><td>20</td><td>50</td></tr><tr><td>CoNLL&#x27;03</td><td>3.6</td><td>12.3</td><td>38.5</td><td>102.5</td></tr><tr><td>WNUT&#x27;17</td><td>13.4</td><td>44.6</td><td>143.6</td><td>366.3</td></tr><tr><td>JNLPBA</td><td>6.8</td><td>27.5</td><td>99.2</td><td>241.2</td></tr><tr><td>NCBI</td><td>1.8</td><td>3.7</td><td>14.5</td><td>37.2</td></tr><tr><td>I2B2&#x27;14</td><td>155.4</td><td>613.4</td><td>2339.4</td><td>5888.1</td></tr></table>
112
+
113
+ # 3.6 Results
114
+
115
+ We summarize experiment results in Table 1. As shown, our model outperforms all previous methods in low resource settings. In extreme low resource scenarios (1 and 5 shot), our model performs significantly better than previous methods by a margin of 6.6 F1 and 4.8 F1 on average in 1 shot and 5 shot, respectively. This indicates that our model can leverage semantics in label names effectively to improve accuracy when data is extremely scarce. However, we also notice that when the target data size increases, the improvement of our model becomes smaller. This suggests that with more training examples, the model relies less on semantics of labels.
116
+
117
+ In a high resource setting, we find that our model achieves the same level of performance as other baselines, except for JNLPBA dataset where our model is 3.3 F1 behind TANL. $^{10}$ This model is based on T5-base which is pretrained on a much
118
+
119
+ larger unannotated dataset, and with different objectives, than our BERT-base encoders.
120
+
121
+ We also note that when label names in the target dataset are similar to the source ones, few shot models have a much smaller gap with their high resource counterparts, compared to when source and target label names are totally different. Specifically, CoNLL-2003, WNUT-2017 and I2B2 have more similar label names with Ontonotes (the source data), and our model can achieve $84\%$ , $91\%$ and $83\%$ of the score of the high resource model performance with only 5 shot. While for JNLPBA and NCBI-disease, where the label names are totally different from source data, our model can only achieve $61\%$ and $41\%$ of the score of the high resource model performance with 5 shot.
122
+
123
+ # 4 Analysis
124
+
125
+ Here, we show how semantics in label names help in low resource scenarios and how our model benefits from pre-finetuning stage.
126
+
127
+ Table 2: Number of sentences in support set with different shots for all target datasets. Numbers are averaged across 10 different random samplings. NCBI refers to NCBI-disease dataset. More details are reported in Appendix A.1.
128
+
129
+ <table><tr><td rowspan="2">Entity Types</td><td colspan="2">Original Labels</td><td>Renamed Labels</td></tr><tr><td>0 shot</td><td>1 shot</td><td>0 shot</td></tr><tr><td>PER</td><td>92.3</td><td>90.3</td><td>85.4</td></tr><tr><td>LOC</td><td>70.9</td><td>61.2</td><td>54.8</td></tr><tr><td>ORG</td><td>50.3</td><td>59.7</td><td>58.4</td></tr><tr><td>MISC</td><td>0.5</td><td>47.5</td><td>6.8</td></tr></table>
130
+
131
+ Table 3: F1 for 0 and 1 shot performance on CoNLL-2003 development set.
132
+
133
+ # 4.1 Impact of the Label Encoder
134
+
135
+ We hypothesize that encoding label names with a label encoder (either BERT or GloVe) leverages prior knowledge from the pretraining phase and uses it as inductive bias. In addition, by performing pre-finetuning on the source dataset, we are not only aligning the embedding space between labels and tokens in the vocabulary, but also updating the label encoder to produce useful label representations in the source dataset.
136
+
137
+ To further strengthen our hypothesis (besides what is presented in Table 1), we show results in zero shot settings. Specifically, we pre-finetune a model on the source dataset (Ontonotes) and directly test it on CoNLL-2003 without updating its parameters. We also rename the labels to avoid
138
+
139
+ overlapping of label names between source and target datasets while still retaining the semantics. $^{11}$ Particularly, during evaluation we rename “PER” to “individual”, “LOC” to “geographical area” and “ORG” to “corporation”. “MISC” stays the same since it does not overlap with any of the Antonotes labels. The results are shown in Table 3.
140
+
141
+ With original label names, the zero shot performance of our model is comparable to 1 shot performance for all entity types with the exception of "MISC". Even with the renamed labels that do not have any overlap with the source dataset, the zero shot performance still remains comparable with 1 shot. This seems to validate our hypothesis that the model is able to leverage prior knowledge.
142
+
143
+ # 4.2 Semantics of Label Names
144
+
145
+ To demonstrate the impact of semantics of label names, we carry out experiments with our model on target datasets with the following variations of label names: (1) original label names (which is simply our experimental setup as in the experiments above, where we use the natural language form of the label names), (2) meaningless label names and (3) misleading label names.
146
+
147
+ We compare our model with the TransferBERT baseline, since it is the counterpart of our model without label semantics. We pre-finetune our model on Ontonotes as previous experiments. Results on CoNLL2003 and JNLPBA are shown in Figure 2. $^{12}$
148
+
149
+ Meaningless labels We simply use "label 1", "label 2" etc., as input representation for label names, which simulates the case where there is no more semantics information in the form than the fact that they are different labels and they have some sort of ordering. This evaluates the few shot model performance when meaningless (or shallow in semantics, just a differentiation of label indices) inputs are given. Comparing to the original label names, the results drop in 1 and 5 shot settings, then gradually converged to the original label performance as the training data size increases. This shows that
150
+
151
+ label semantics is critical for extreme low resource scenarios (1 and 5 shot).
152
+
153
+ ![](images/d9c94dba6682f016ddfa5fd39328095cd2e192e815824f18ce5247ed0a84d832.jpg)
154
+
155
+ ![](images/e32777c18d3624ada820c188ee4579fc1e5a65549ce19a10d01f27fcac3ed075.jpg)
156
+ Figure 2: Model performance on meaningless and misleading labells. Micro F1 is reported on the development data.
157
+
158
+ Misleading labels We randomly swap the natural language form between labels. For example, in CoNLL2003 dataset, we assign "location" for "PER", "person" for "ORG", "organization" for "MISC" and "miscellaneous" for "PER". The performance drops are larger for CoNLL2003 than the ones in JNLPBA. We hypothesize that since CoNLL2003 label set is closer to Antonotes, there is stronger prior knowledge incorporated in the label encoder from the pre-finetuning phase. Also, we find that more supervised examples are required to correct such wrong strong prior information. JNLPBA needs 5 shot data to achieve the same performance with original labels and misleading labels, but CoNLL2003 needs 50 shot data to match the performance. This indicates that our model is misled by the labels when the number of training examples is small, which indicates that the label semantics signal is critical in few shot settings.
159
+
160
+ # 4.3 Impact of Pre-finetuning
161
+
162
+ Our model does not require a new randomly initialized top layer classifier for a new dataset, we hypothesize that it can prevent the model from forgetting learned prior knowledge from the prefinetuning stage thus benefits the low resource scenarios, where prior knowledge is critical. To validate it, we compare 1-shot results on target datasets with and without pre-finetuning stage, as shown in Table 4. First, when pre-finetuning stage is eliminated, performance of both our model and TransferBERT drop significantly, indicating that prior knowledge from pre-finetuning stage is critical in low resource settings. Second, our model outperforms TransferBERT significantly when pre-finetuning stage is included, however, the performance is similar between our model and TransferBERT when it is excluded. This suggests that our model is highly effective in leveraging knowledge learned from the pre-finetuning stage.
163
+
164
+ <table><tr><td rowspan="2">Datasets</td><td colspan="2">Pre-finetune on Ontonotes</td><td colspan="2">No pre-finetune</td></tr><tr><td>Transfer-BERT</td><td>Ours</td><td>Transfer-BERT</td><td>Ours</td></tr><tr><td>CoNLL&#x27;03</td><td>47.5</td><td>69.0</td><td>9.0</td><td>10.7</td></tr><tr><td>WNUT&#x27;17</td><td>35.6</td><td>48.2</td><td>4.0</td><td>5.7</td></tr><tr><td>JNLPBA</td><td>26.3</td><td>31.5</td><td>14.8</td><td>19.5</td></tr><tr><td>NCBI</td><td>15.1</td><td>31.3</td><td>12.5</td><td>13.9</td></tr><tr><td>I2B2&#x27;14</td><td>56.9</td><td>60.1</td><td>47.5</td><td>46.8</td></tr></table>
165
+
166
+ Table 4: 1-shot performance on development set of corresponding datasets. Micro F1 is reported. NCBI refers to NCBI-disease dataset.
167
+
168
+ # 5 Related Work
169
+
170
+ Few Shot Learning: Meta learning is widely studied for the problem of few shot learning, aiming to quickly adapt a model to new tasks based on tasks learned in an earlier stage. Recent research (Snell et al., 2017; Vinyals et al., 2017; Sung et al., 2017) mostly focused on metric-based methods. Snell et al. (2017) learns a prototype representation for each class and classify test data based on their similarities with prototypes. These methods have been successfully adapted to NLP tasks such as classification (Yu et al., 2018b; Bao et al., 2019), relation classification (Han et al., 2018) and NER (Fritzler et al., 2019; Yang and Katiyar, 2020).
171
+
172
+ However, all these methods do not directly leverage the semantics of label names.
173
+
174
+ Label Semantics: Earlier work has shown the ability to perform zero- and few-shot learning by exploiting the semantic of labels in text classification tasks (Chang et al., 2008; Luo et al., 2021). Zhou et al. (2018) study zero-shot fine-type NER with label semantics by automatically reading from Wikipedia via a linking approach, but assumes that the mentions of the entities are given. Paolini et al. (2021) and Athiwaratkun et al. (2020) approach NER as a generation task and predict named entities in augmented (or decorated) languages. Cui et al. (2021) reformulate NER as a cloze task and use sequence to sequence models to fill named entities in pre-defined templates. Both of these two methods suffer from long inference time due to an autoregressive decoder. Hou et al. (2020) leverage label semantics in Task-Adaptive Projection Network (TapNet), where the core idea is to learn a projection function that separates words that have different labels in the projected space. In contrast, our model learns to align token representations with label representations. Hou et al. (2020) only uses label representations as a reference to guide the learning of the projection function, and in their case label representations are computed once. Our label representations are updated with every update while training.
175
+
176
+ # 6 Conclusion
177
+
178
+ We propose a neural architecture that leverages semantics of label names for Named Entity Recognition. Our model significantly outperforms the state-of-the-art few shot NER baselines on low resource settings, and performs on-par in the high resource setting. We perform extensive experiments to show that the label encoder incorporates strong prior knowledge from BERT and a dataset (source dataset) used in a pre-finetuning stage. We demonstrate that the semantics of label names in target datasets are critical to retrieve the prior knowledge. We also show that our model is robust to variation of label names and that it is able to differentiate between semantically closed labels.
179
+
180
+ # References
181
+
182
+ Armen Aghajanyan, Anchit Gupta, Akshit Shrivastava, Xilun Chen, Luke Zettlemoyer, and Sonal Gupta. 2021. Muppet: Massive multi-task representations with pre-finetuning. CoRR, abs/2101.11038.
183
+ Ben Athiwaratkun, Cicero Nogueira dos Santos, Jason Krone, and Bing Xiang. 2020. Augmented natural language for generative sequence labeling.
184
+ Yujia Bao, Menghua Wu, Shiyu Chang, and Regina Barzilay. 2019. Few-shot text classification with distributional signatures. CoRR, abs/1908.06039.
185
+ Xavier Carreras, Lluís Márquez, and Lluís Padró. 2003. Learning a perceptron-based named entity chunker via online recognition feedback. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003, pages 156-159.
186
+ Yee Seng Chan and Dan Roth. 2011. Exploiting syntactico-semantic structures for relation extraction. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 551-560, Portland, Oregon, USA. Association for Computational Linguistics.
187
+ Ming-Wei Chang, Lev-Arie Ratinov, Dan Roth, and Vivek Srikumar. 2008. Importance of semantic representation: Dataless classification. In AAAI.
188
+ Jiaao Chen, Zhenghui Wang, Ran Tian, Zichao Yang, and Diyi Yang. 2020. Local additivity based data augmentation for semi-supervised NER. CoRR, abs/2010.01677.
189
+ Kevin Clark and Christopher D. Manning. 2015. Entity-centric coreference resolution with model stacking. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1405-1415, Beijing, China. Association for Computational Linguistics.
190
+ Nigel Collier and Jin-Dong Kim. 2004. Introduction to the bio-entity recognition task at JNLPBA. In Proceedings of the International Joint Workshop on Natural Language Processing in Biomedicine and its Applications (NLPBA/BioNLP), pages 73-78, Geneva, Switzerland. COLING.
191
+ Ronan Collobert, Jason Weston, Léon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel P. Kuksa. 2011. Natural language processing (almost) from scratch. CoRR, abs/1103.0398.
192
+ Leyang Cui, Yu Wu, Jian Liu, Sen Yang, and Yue Zhang. 2021. Template-based named entity recognition using BART. CoRR, abs/2106.01760.
193
+
194
+ Leon Derczynski, Eric Nichols, Marieke van Erp, and Nut Limsopatham. 2017. Results of the WNUT2017 shared task on novel and emerging entity recognition. In Proceedings of the 3rd Workshop on Noisy User-generated Text, pages 140-147, Copenhagen, Denmark. Association for Computational Linguistics.
195
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. Bert: Pre-training of deep bidirectional transformers for language understanding.
196
+ Ning Ding, Guangwei Xu, Yulin Chen, Xiaobin Wang, Xu Han, Pengjun Xie, Hai-Tao Zheng, and Zhiyuan Liu. 2021. Few-nerd: A few-shot named entity recognition dataset. CoRR, abs/2105.07464.
197
+ Rezarta Islamaj Dogan, Robert Leaman, and Zhiyong Lu. 2014. Ncbi disease corpus: A resource for disease name recognition and concept normalization. Journal of biomedical informatics, 47:1-10.
198
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. 2017. Model-agnostic meta-learning for fast adaptation of deep networks.
199
+ Alexander Fritzler, Varvara Logacheva, and Maksim Kretov. 2019. Few-shot classification in named entity recognition task. Proceedings of the 34th ACM/SIGAPP Symposium on Applied Computing.
200
+ Xu Han, Hao Zhu, Pengfei Yu, Ziyun Wang, Yuan Yao, Zhiyuan Liu, and Maosong Sun. 2018. Fewrel: A large-scale supervised few-shot relation classification dataset with state-of-the-art evaluation. CoRR, abs/1810.10147.
201
+ Yutai Hou, Wanxiang Che, Yongkui Lai, Zhihan Zhou, Yijia Liu, Han Liu, and Ting Liu. 2020. Few-shot slot tagging with collapsed dependency transfer and label-enhanced task-adaptive projection network. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1381-1393, Online. Association for Computational Linguistics.
202
+ Jiaxin Huang, Chunyuan Li, Krishan Subudhi, Damien Jose, Shobana Balakrishnan, Weizhu Chen, Baolin Peng, Jianfeng Gao, and Jiawei Han. 2020. Few-shot named entity recognition: A comprehensive study. CoRR, abs/2012.14978.
203
+ Zhiheng Huang, Wei Xu, and Kai Yu. 2015. Bidirectional lstm-crf models for sequence tagging.
204
+ 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. CoRR, abs/2004.04906.
205
+ Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
206
+
207
+ Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. 2016. Neural architectures for named entity recognition. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 260-270, San Diego, California. Association for Computational Linguistics.
208
+ Pierre Lison, Jeremy Barnes, Aliaksandr Hubin, and Samia Touileb. 2020. Named entity recognition without labelled data: A weak supervision approach. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1518-1533, Online. Association for Computational Linguistics.
209
+ Lajanugen Logeswaran, Ming-Wei Chang, Kenton Lee, Kristina Toutanova, Jacob Devlin, and Honglak Lee. 2019. Zero-shot entity linking by reading entity descriptions. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3449-3460, Florence, Italy. Association for Computational Linguistics.
210
+ Qiaoyang Luo, Lingqiao Liu, Yuhao Lin, and Wei Zhang. 2021. Don't miss the labels: Label-semantic augmented meta-learner for few-shot text classification. In FINDINGS.
211
+ Diego Mollá, Menno van Zaanen, and Daniel Smith. 2006. Named entity recognition for question answering. In Proceedings of the Australasian Language Technology Workshop 2006, pages 51-58, Sydney, Australia.
212
+ Giovanni Paolini, Ben Athiwaratkun, Jason Krone, Jie Ma, Alessandro Achille, Rishita Anubhai, Cicero Nogueira dos Santos, Bing Xiang, and Stefano Soatto. 2021. Structured prediction as translation between augmented natural languages.
213
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. 2014. Glove: Global vectors for word representation. In Empirical Methods in Natural Language Processing (EMNLP), pages 1532-1543.
214
+ Jake Snell, Kevin Swersky, and Richard S. Zemel. 2017. Prototypical networks for few-shot learning.
215
+ Amber Stubbs and Ozlem Uzuner. 2015. Annotating longitudinal clinical narratives for de-identification. J. of Biomedical Informatics, 58(S):S20-S29.
216
+ Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip H. S. Torr, and Timothy M. Hospedales. 2017. Learning to compare: Relation network for few-shot learning. CoRR, abs/1711.06025.
217
+ Erik F. Tjong Kim Sang and Fien De Meulder. 2003a. Introduction to the CoNLL-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural
218
+
219
+ Language Learning at HLT-NAACL 2003, pages 142-147.
220
+ Erik F. Tjong Kim Sang and Fien De Meulder. 2003b. Introduction to the conll-2003 shared task: Language-independent named entity recognition. In Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003 - Volume 4, CONLL '03, page 142-147, USA. Association for Computational Linguistics.
221
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. 2017. Matching networks for one shot learning.
222
+ Yogarshi Vyas and Miguel Ballesteros. 2020. Linking entities to unseen knowledge bases with arbitrary schemas. CoRR, abs/2010.11333.
223
+ Tian Wang, Yuri M. Brovman, and Sriganesh Madhavanath. 2021. Personalized embedding-based e-commerce recommendations at ebay. CoRR, abs/2102.06156.
224
+ Ralph Weischedel, Martha Palmer, Mitchell Marcus, Eduard Hovy, Sameer Pradhan, Lance Ramshaw, Nianwen Xue, Ann Taylor, Jeff Kaufman, Michelle Franchini, et al. 2013. Ontonotes release 5.0 ldc2013t19. Linguistic Data Consortium, Philadelphia, PA, 23.
225
+ Yi Yang and Arzoo Katiyar. 2020. Simple and effective few-shot named entity recognition with structured nearest neighbor learning.
226
+ Mo Yu, Xiaoxiao Guo, Jinfeng Yi, Shiyu Chang, Saloni Potdar, Yu Cheng, Gerald Tesauro, Haoyu Wang, and Bowen Zhou. 2018a. Diverse few-shot text classification with multiple metrics. 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 1206-1215, New Orleans, Louisiana. Association for Computational Linguistics.
227
+ Mo Yu, Xiaoxiao Guo, Jinfeng Yi, Shiyu Chang, Saloni Potdar, Yu Cheng, Gerald Tesauro, Haoyu Wang, and Bowen Zhou. 2018b. Diverse few-shot text classification with multiple metrics. CoRR, abs/1805.07513.
228
+ Ben Zhou, Daniel Khashabi, Chen-Tse Tsai, and Dan Roth. 2018. Zero-shot open entity typing as type-compatible grounding. In EMNLP.
229
+
230
+ # A Datasets Details
231
+
232
+ # A.1 Statistics
233
+
234
+ Table 5 shows the statistics of original datasets we use in the main experiments.
235
+
236
+ <table><tr><td>Dataset</td><td>Domain</td><td># Sent</td><td># Labels</td></tr><tr><td>Ontonotes</td><td>Mix</td><td>76,714</td><td>18</td></tr><tr><td>CoNLL’03</td><td>News</td><td>20,744</td><td>4</td></tr><tr><td>WNUT’07</td><td>Social</td><td>5,690</td><td>6</td></tr><tr><td>JNLPBA</td><td>Bio</td><td>22,402</td><td>5</td></tr><tr><td>NCBI-disease</td><td>Bio</td><td>7,287</td><td>1</td></tr><tr><td>I2B2’14</td><td>Medical</td><td>75,330</td><td>23</td></tr></table>
237
+
238
+ Table 5: Original dataset statistics.
239
+
240
+ <table><tr><td>Dataset</td><td>Original
241
+ Labels</td><td>Natural
242
+ Language</td></tr><tr><td rowspan="4">CoNLL&#x27;03</td><td>PER</td><td>person</td></tr><tr><td>LOC</td><td>location</td></tr><tr><td>ORG</td><td>organization</td></tr><tr><td>MISC</td><td>miscellaneous</td></tr><tr><td rowspan="19">Ontonotes</td><td>CARDINAL</td><td>cardinal</td></tr><tr><td>DATE</td><td>date</td></tr><tr><td>EVENT</td><td>event</td></tr><tr><td>FAC</td><td>facility</td></tr><tr><td>GPE</td><td>geographical social</td></tr><tr><td>LANGUAGE</td><td>political entity</td></tr><tr><td>LAW</td><td>language</td></tr><tr><td>LOC</td><td>law</td></tr><tr><td>MONEY</td><td>location</td></tr><tr><td>NORP</td><td>money</td></tr><tr><td>ORDINAL</td><td>nationality religion</td></tr><tr><td>ORG</td><td>political</td></tr><tr><td>PERCENT</td><td>ordinal</td></tr><tr><td>PERSON</td><td>organization</td></tr><tr><td>PRODUCT</td><td>percent</td></tr><tr><td>QUANTITY</td><td>product</td></tr><tr><td>TIME</td><td>quantity</td></tr><tr><td>WORK_OF_ART</td><td>time</td></tr><tr><td>corporation</td><td>work of art</td></tr><tr><td rowspan="6">WNUT&#x27;17</td><td>corporation</td><td>corporation</td></tr><tr><td>creative-work</td><td>creative work</td></tr><tr><td>group</td><td>group</td></tr><tr><td>location</td><td>location</td></tr><tr><td>person</td><td>person</td></tr><tr><td>product</td><td>product</td></tr><tr><td rowspan="5">JNLPBA</td><td>DNA</td><td>DNA</td></tr><tr><td>RNA</td><td>RNA</td></tr><tr><td>cell_line</td><td>cell line</td></tr><tr><td>cell_type</td><td>cell type</td></tr><tr><td>protein</td><td>protein</td></tr><tr><td>NCBI-disease</td><td>Disease</td><td>disease</td></tr><tr><td rowspan="23">I2B2&#x27;14</td><td>AGE</td><td>age</td></tr><tr><td>BIOID</td><td>biometric ID</td></tr><tr><td>CITY</td><td>city</td></tr><tr><td>COUNTRY</td><td>country</td></tr><tr><td>DATE</td><td>date</td></tr><tr><td>DEVICE</td><td>device</td></tr><tr><td>DOCTOR</td><td>doctor</td></tr><tr><td>EMAIL</td><td>email</td></tr><tr><td>FAX</td><td>fax</td></tr><tr><td>HEALTHPLAN</td><td>health plan number</td></tr><tr><td>HOSPITAL</td><td>hospital</td></tr><tr><td>IDNUM</td><td>ID number</td></tr><tr><td>LOCATION_OTHER</td><td>location</td></tr><tr><td>MEDICALRECORD</td><td>medical record</td></tr><tr><td>ORGANIZATION</td><td>organization</td></tr><tr><td>PATIENT</td><td>patient</td></tr><tr><td>PHONE</td><td>phone number</td></tr><tr><td>PROFESSION</td><td>profession</td></tr><tr><td>STATE</td><td>state</td></tr><tr><td>STREET</td><td>street</td></tr><tr><td>URL</td><td>url</td></tr><tr><td>USERNAME</td><td>username</td></tr><tr><td>ZIP</td><td>zip code</td></tr></table>
243
+
244
+ # A.2 Label Names
245
+
246
+ Table 6 shows the original label names in each dataset and corresponding natural language forms we use in our experiments.
247
+
248
+ Table 6: Original label names and their corresponding natural language formats.
249
+
250
+ # B Support Set Sampling Algorithm
251
+
252
+ Algorithm 1 Support set sampling
253
+ Require: # shot $K$ , dataset $\mathcal{D}$ , labels $\mathcal{L}_{\mathcal{D}}$
254
+ 1: Initialize support set $\mathcal{S} = \{\}$ , $\mathrm{Count}_{\ell_i} = 0$ ( $\forall \ell_i \in \mathcal{L}_{\mathcal{D}}$ )
255
+ 2: for $\ell$ in $\mathcal{L}_{\mathcal{D}}$ do
256
+ 3: while $\mathrm{Count}_{\ell} < K$ do
257
+ 4: Randomly pick $(t, y)$ from $\mathcal{D} \setminus \mathcal{S}$ that $\mathbf{y}$ include $\ell$
258
+ 5: $\mathcal{S} \gets \mathcal{S} \cup (t, y)$
259
+ 6: Update all $\mathrm{Count}_{\ell_i} (\forall \ell_i \in \mathcal{L}_{\mathcal{D}})$
260
+ 7: end while
261
+ 8: end for
262
+ 9: for $(t, y)$ in $\mathcal{S}$ do
263
+ 10: $\mathcal{S} = \mathcal{S} \setminus (t, y)$
264
+ 11: Update all $\mathrm{Count}_{\ell_i} (\forall \ell_i \in \mathcal{L}_{\mathcal{D}})$
265
+ 12: if Any $\mathrm{Count}_{\ell_i} < K$ then
266
+ 13: $\mathcal{S} = \mathcal{S} \cup (t, y)$
267
+ 14: Update all $\mathrm{Count}_{\ell_i} (\forall \ell_i \in \mathcal{L}_{\mathcal{D}})$
268
+ 15: end if
269
+ 16: end for
270
+
271
+ # C Hardware for Experiments
272
+
273
+ We provide details about hardware we use to produce numbers for each baseline models. We run experiments for Struct NN shot model on NVIDIA V100 GPU with 32GB of memory, while for all other models (including baselines and our models) we use NVIDIA V100 GPU with 16GB of memory.
274
+
275
+ # D Visualization of Results
276
+
277
+ We visualize the results in Table 1 with bar chart, as shown in Figure 3.
278
+
279
+ # E Contextualized Label Representations
280
+
281
+ In this experiment, we compute contextualized label representations by randomly selecting a sentence from the support set that contains an entity of the type, and replace that entity with the label name in the sentence. We encode this sentence with the label encoder and compute the average pooling as the label representation. The label names used are in their natural language form with BIO schemes per 2.2. We depict this process in Figure 4. At inference time, to avoid biasing toward any particular sentence, we randomly choose 10 sentences from the support set for each label and average their representations as the final label representations.[14]
282
+
283
+ ![](images/4a1219d25be9024597c6a07fb983fa5360e037eadb26f8535c2eb78b2ac43554.jpg)
284
+ Figure 4: Differences between contextualized label representations and label representations in isolation.
285
+
286
+ We perform experiments on FEW-NERD dataset (Ding et al., 2021). This dataset consists of 8 coarse-grained and 66 fine-grained entity types in hierarchy. The fine-grained entity types under the same coarse-grained type are semantically close.
287
+
288
+ Results are shown in Table 7 and Appendix E. In the following, we show 1-shot results under "Person" coarse-grained type for FEW-NERD dataset.[16] By using contextual label names, we observe a decrease in model performance by 3.5 F1 points on FEW-NERD, compared to when only label names are used. This suggests that the trained label encoder is capable of capturing critical semantics with only label names, even without contexts to help distinguish semantically close labels.
289
+
290
+ <table><tr><td rowspan="2">Datasets</td><td colspan="2">Model</td></tr><tr><td>Ours</td><td>Ours + context</td></tr><tr><td>CoNLL&#x27;03</td><td>69.0±6.9</td><td>70.8±4.1</td></tr><tr><td>WNUT17</td><td>48.2±1.7</td><td>51.8±1.8</td></tr><tr><td>JNLPBA</td><td>31.5±2.9</td><td>30.1±3.2</td></tr><tr><td>FEW-NERD-Person</td><td>32.5±8.1</td><td>29.0±7.1</td></tr></table>
291
+
292
+ Table 7: 1-shot micro F1 on development set across various datasets and models. Ours: Our model with label names. Ours+context: Our model with contextual label names. Numbers are averaged across 10 different random samplings.
293
+
294
+ ![](images/7ac59ae23cec820e3087fa9822be9b9fe809f26b2650ce518800923eb868a50c.jpg)
295
+
296
+ ![](images/9ff504b35dc4b392dd63982be7049e3c42226e7405d633e688a047004391138e.jpg)
297
+
298
+ ![](images/59faeea1f4fc0092fbf5e582a51a0d14f1e006ac50a9b607936ae503d4bbdc49.jpg)
299
+
300
+ ![](images/782eb942eb36c37dd1b22e576bf4d933b26a3f9c919d7fab024c7ee9ca677f93.jpg)
301
+
302
+ ![](images/a864001ddb5a81af2723c4db9b79b8b7722b36a26c1d7405e8da274fbf3fc8b7.jpg)
303
+ Figure 3: Visualization of the results in Table 1. Results on test set of all datasets. All numbers indicate micro F1 scores except noted otherwise. Results for low resource settings are average of 10 runs with different support set sampling. Results for high resource setting are average of 5 runs with different random seeds. For some baselines we cannot run the released implementation from originally papers due to GPU out of memory and they are marked as 0.
304
+
305
+ # E.1 Additional Experiment 1
306
+
307
+ We present additional experiments on contextual label representations. We will first introduce more details on the FEW-NERD dataset, then describe methods we explore to contextualize labels, finally we will show experiment results. To validate whether contextual label representation can improve model performance in scenarios where labels are semantically close, we perform experiments on one additional dataset: FEW-NERD (Ding et al., 2021). FEW-NERD is a human annotated NER dataset that consists of 188,238 sentences. It has a hierarchy of 8 coarse-grained and 66 fine-grained entity types. The fine-grained entity types under each coarse-grained type are usually semantically close. All sentences are sourced from Wikipedia. We use train/dev/test split from the original dataset distribution.
308
+
309
+ We select "Person" and "Art" coarse-grained entity types for the experiments, because we think fine-grained entity types under them have closest semantic similarities. Specifically, we take one coarse-grained entity type at a time, and remove all entity annotations that do not belong to it, on train, dev and test split. After removal, comparing with the original dataset, the resulting dataset has much more sentences with no annotation than sentences that have at least one annotations. To mitigate this entity distribution shifting, we randomly remove sentences that do not contain any annotations, such that the resulting dataset has the same percentage of sentences with annotations as the original dataset. We perform this process on "Person" and "Art" types and result in two datasets called "FEW-NERD-Person" and "FEW-NERD-Art". The statistics for these two datasets are shown in Table 8. The original entity types and their corresponding natural language format are shown in Table 9
310
+
311
+ <table><tr><td>Dataset</td><td>Original
312
+ Labels</td><td>Natural
313
+ Language</td></tr><tr><td rowspan="7">FEW-NERD-
314
+ Person</td><td>person-actor</td><td>actor</td></tr><tr><td>person-artist/author</td><td>artist author</td></tr><tr><td>person-athlete</td><td>athlete</td></tr><tr><td>person-director</td><td>director</td></tr><tr><td>person-politician</td><td>politician</td></tr><tr><td>person-scholar</td><td>scholar</td></tr><tr><td>person-soldier</td><td>soldier</td></tr><tr><td rowspan="5">FEW-NERD-
315
+ Art</td><td>art-broadcastprogram</td><td>broadcast-program</td></tr><tr><td>art-film</td><td>film</td></tr><tr><td>art-music</td><td>music</td></tr><tr><td>art-painting</td><td>painting</td></tr><tr><td>art-written</td><td>written art</td></tr></table>
316
+
317
+ Table 9: Original label names and their corresponding natural language formats for FEW-NERD-Person and FEW-NERD-Art datasets.
318
+
319
+ # E.2 Additional Experiment 2
320
+
321
+ In this experiment, we replace the entity in the selected sentence with different texts rather than label names.
322
+
323
+ We experiment with various schemes for the new span and use the following terminology to describe them. $TOKEN$ refers to the original token that is replaced. $LABEL$ refers to the label name that the token is annotated with. $BIO-TAG$ refers to the natural BIO tag that the token is annotated with. For the example illustrated in Figure 4, $TOKEN$ corresponds to "Messi", $LABEL$ corresponds to "person", $BIO-TAG$ corresponds to "begin". We hypothesize that the $TOKEN$ gives natural context to the labels since it is unmodified sentence, $LABEL$ captures the semantic information in label names and $BIO-TAG$ helps differentiate the B and I chunks for the label. In addition, we experiment to replace the entity with "[MASK]" token to make the label reprensetation close to BERT pretraining inputs. The various schemes are illustrated with example in Figure 5.
324
+
325
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2"># Labels</td><td colspan="4">Support Set Shot</td><td rowspan="2">Dev</td></tr><tr><td>1</td><td>5</td><td>20</td><td>50</td></tr><tr><td>FEW-NERD-Person</td><td>7</td><td>19.0</td><td>66.7</td><td>212.7</td><td>508.9</td><td>4437.0</td></tr><tr><td>FEW-NERD-Art</td><td>5</td><td>41.5</td><td>123.5</td><td>412.2</td><td>2569.0</td><td>1364.0</td></tr></table>
326
+
327
+ Table 8: Number of sentences in support set and dev set for FEW-NERD-Person and FEW-NERD-Art datasets. Numbers are averaged across 10 different random samplings.
328
+
329
+ # Contextual Label Names Variation Examples
330
+
331
+ 1. Randomly selected sentence from support set:
332
+ "Messi is a soccer player"
333
+ 2. Calculate contextual label representation:
334
+
335
+ ![](images/0e36d34409acacd4915bf09959384cf75b6778f479d2f402c3e90dd0e844d495.jpg)
336
+ Figure 5: Example for contextual label representation.
337
+
338
+ ![](images/a0fdbbb429014930d8b56e9b158e6bf84a401fe3769f2f78d92ef2a74596cdaa.jpg)
339
+
340
+ : Average pooling
341
+
342
+ ![](images/703f6ef565923700731c6555beb47c6c1277616bc20cbedfb6f1c8c717a2a6e8.jpg)
343
+
344
+ : All tokens encoded by label encoder
345
+
346
+ replaced token is same for both B and I chunks in BIO scheme. For example, to get contextualized representation for B-PER in the document "Lionel Messi is a soccer player", the document will be transformed to "person person is a soccer player", where B and I chunks are confused. "BIO-TAG: LABEL" scheme addresses this by prefixing the natural language BIO chunk name to the label name. We see improvements in performance compared with LABEL scheme.
347
+
348
+ When we incorporate the “[MASK]” token from BERT pretraining, we find that this does not perform as well as other schemes that contains label names. This further proves that semantics in label names is critical.
349
+
350
+ # E.3 Results
351
+
352
+ The results from various schemes of the new span is compared with TransferBERT and our model which encodes label names only. This is summarized in Table 10.
353
+
354
+ TOKEN scheme is the simplest way to get a contextualized representation of a label where we pool the representations of all the tokens annotated with the label. Although performance of this scheme is better than TransferBERT, comparing with other schemes, we see that this model performs poorly. Here no new information is added to the model and the text that the label encoder and document encoder encodes is similar. In order to provide our model prior knowledge about the label name from BERT encoder, we use LABEL scheme. We see that this scheme performs better than T oK e n across datasets suggesting that the prior knowledge about label semantics helps to improve performance.
355
+
356
+ One limitation with LABEL scheme is that the
357
+
358
+ <table><tr><td></td><td></td><td>1 Shot</td><td>5 Shot</td><td>20 Shot</td><td>50 Shot</td></tr><tr><td rowspan="9">CoNLI03</td><td>TransferBERT</td><td>47.6 ±15.5</td><td>69.9 ±6.0</td><td>80.1 ±1.7</td><td>85.1 ±1.1</td></tr><tr><td>Ours, label name only</td><td>69.0 ±6.9</td><td>78.6 ±1.8</td><td>82.1 ±1.5</td><td>85.9 ±1.2</td></tr><tr><td>TOKEN</td><td>60.1 ±16.8</td><td>75.0 ±4.2</td><td>80.0 ±1.8</td><td>84.3 ±1.1</td></tr><tr><td>LABEL</td><td>61.4 ±12.7</td><td>74.2 ±2.9</td><td>80.4 ±1.9</td><td>84.6 ±1.2</td></tr><tr><td>[MASK]</td><td>61.2 ±6.1</td><td>72.9 ±5.8</td><td>81.5 ±2.2</td><td>85.3 ±0.9</td></tr><tr><td>BIO-TAG : [MASK]</td><td>60.8 ±15.4</td><td>74.5 ±5.6</td><td>81.3 ±1.5</td><td>85.2 ±0.8</td></tr><tr><td>(BIO-TAG) [MASK]</td><td>66.8 ±6.7</td><td>74.6 ±7.0</td><td>81.6 ±1.8</td><td>85.3 ±1.0</td></tr><tr><td>BIO-TAG : LABEL</td><td>69.2 ±6.4</td><td>76.1 ±2.1</td><td>80.8 ±1.9</td><td>84.9 ±1.1</td></tr><tr><td>(BIO-TAG) LABEL</td><td>70.8 ±4.2</td><td>76.5 ±1.6</td><td>81.2 ±2.0</td><td>84.7 ±1.1</td></tr><tr><td rowspan="9">WNUT17</td><td>TransferBERT</td><td>35.6 ±11.2</td><td>44.7 ±5.6</td><td>50.3 ±1.7</td><td>51.7 ±1.9</td></tr><tr><td>Ours, label name only</td><td>48.3 ±1.7</td><td>51.2 ±1.4</td><td>53.2 ±1.1</td><td>54.1 ±1.3</td></tr><tr><td>TOKEN</td><td>42.8 ±12.3</td><td>49.9 ±1.9</td><td>53.1 ±1.8</td><td>53.9 ±1.8</td></tr><tr><td>LABEL</td><td>48.9 ±3.0</td><td>51.4 ±2.1</td><td>53.0 ±1.6</td><td>53.9 ±1.5</td></tr><tr><td>[MASK]</td><td>45.0 ±3.5</td><td>47.1 ±2.2</td><td>50.2 ±2.3</td><td>51.9 ±1.6</td></tr><tr><td>BIO-TAG : [MASK]</td><td>46.8 ±2.8</td><td>49.6 ±1.7</td><td>51.3 ±2.8</td><td>52.7 ±1.0</td></tr><tr><td>(BIO-TAG) [MASK]</td><td>45.6 ±4.8</td><td>48.5 ±2.6</td><td>51.2 ±2.7</td><td>52.6 ±1.7</td></tr><tr><td>BIO-TAG : LABEL</td><td>51.2 ±2.2</td><td>52.6 ±1.8</td><td>53.6 ±1.4</td><td>54.8 ±0.6</td></tr><tr><td>(BIO-TAG) LABEL</td><td>51.9 ±1.8</td><td>52.3 ±1.2</td><td>53.7 ±1.5</td><td>54.0 ±1.3</td></tr><tr><td rowspan="9">NCBI-diseases</td><td>TransferBERT</td><td>15.1 ±9.4</td><td>19.5 ±6.0</td><td>37.0 ±4.1</td><td>51.2 ±4.1</td></tr><tr><td>Ours, label name only</td><td>31.4 ±9.2</td><td>30.2 ±4.3</td><td>45.8 ±3.4</td><td>57.3 ±2.6</td></tr><tr><td>TOKEN</td><td>18.7 ±10.3</td><td>22.5 ±6.4</td><td>40.9 ±5.6</td><td>53.8 ±4.1</td></tr><tr><td>LABEL</td><td>26.9 ±8.3</td><td>28.7 ±4.2</td><td>40.2 ±3.7</td><td>52.3 ±2.9</td></tr><tr><td>[MASK]</td><td>18.1 ±9.6</td><td>22.2 ±4.0</td><td>38.2 ±5.3</td><td>53.0 ±4.0</td></tr><tr><td>BIO-TAG : [MASK]</td><td>17.7 ±10.0</td><td>22.3 ±4.2</td><td>40.0 ±4.5</td><td>52.1 ±3.7</td></tr><tr><td>(BIO-TAG) [MASK]</td><td>17.5 ±11.5</td><td>23.6 ±4.1</td><td>38.8 ±4.7</td><td>51.9 ±4.0</td></tr><tr><td>BIO-TAG : LABEL</td><td>26.8 ±7.4</td><td>26.2 ±3.8</td><td>42.0 ±4.1</td><td>54.4 ±3.4</td></tr><tr><td>(BIO-TAG) LABEL</td><td>26.8 ±9.2</td><td>26.7 ±3.3</td><td>43.9 ±3.8</td><td>54.6 ±3.3</td></tr><tr><td rowspan="9">JNLPBA</td><td>TransferBERT</td><td>26.3 ±8.0</td><td>41.8 ±3.0</td><td>55.9 ±3.5</td><td>64.3 ±1.3</td></tr><tr><td>Ours, label name only</td><td>31.5 ±3.0</td><td>43.3 ±2.8</td><td>55.8 ±3.4</td><td>63.6 ±1.0</td></tr><tr><td>TOKEN</td><td>29.0 ±6.5</td><td>43.2 ±2.4</td><td>55.9 ±3.6</td><td>63.8 ±1.2</td></tr><tr><td>LABEL</td><td>28.4 ±4.3</td><td>40.8 ±2.5</td><td>54.3 ±3.4</td><td>62.5 ±1.3</td></tr><tr><td>[MASK]</td><td>25.4 ±6.5</td><td>36.5 ±2.2</td><td>51.0 ±3.7</td><td>60.2 ±1.5</td></tr><tr><td>BIO-TAG : [MASK]</td><td>24.9 ±5.1</td><td>36.0 ±2.5</td><td>50.5 ±4.2</td><td>60.5 ±1.7</td></tr><tr><td>(BIO-TAG) [MASK]</td><td>24.8 ±6.5</td><td>37.1 ±2.9</td><td>50.4 ±4.1</td><td>60.3 ±1.7</td></tr><tr><td>BIO-TAG : LABEL</td><td>30.4 ±4.6</td><td>41.9 ±2.5</td><td>55.5 ±3.3</td><td>62.9 ±1.1</td></tr><tr><td>(BIO-TAG) LABEL</td><td>30.1 ±3.2</td><td>41.4 ±2.2</td><td>55.1 ±3.2</td><td>62.8 ±1.5</td></tr><tr><td rowspan="3">FN-Person</td><td>TransferBERT</td><td>13.2 ±5.0</td><td>24.0 ±7.4</td><td>48.7 ±3.4</td><td>66.9 ±3.0</td></tr><tr><td>Ours, label name only</td><td>32.5 ±8.1</td><td>51.0 ±7.0</td><td>66.2 ±2.0</td><td>72.0 ±0.7</td></tr><tr><td>(BIO-TAG) LABEL</td><td>29.0 ±7.2</td><td>50.6 ±6.3</td><td>66.2 ±2.0</td><td>71.2 ±0.9</td></tr><tr><td rowspan="3">FN-Art</td><td>TransferBERT</td><td>19.4 ±10.9</td><td>43.1 ±9.8</td><td>69.5 ±1.7</td><td>98.9 ±0.3</td></tr><tr><td>Ours, label name only</td><td>44.5 ±8.8</td><td>56.3 ±4.6</td><td>70.5 ±1.8</td><td>99.1 ±0.1</td></tr><tr><td>(BIO-TAG) LABEL</td><td>41.3 ±10.8</td><td>56.0 ±3.8</td><td>69.4 ±2.0</td><td>98.9 ±0.2</td></tr></table>
359
+
360
+ Table 10: Results on development set across all datasets. FN-Person = FEW-NERD-Person. FN-Art = FEW-NERD-Art. All numbers indicate micro F1 scores and are average of 10 runs with different support set sampling.
labelsemanticsforfewshotnamedentityrecognition/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3cb43691a3ed705d76f16ad498f1b7cebb5d0cfe3748ef23e2473817a533f59
3
+ size 1061055
labelsemanticsforfewshotnamedentityrecognition/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e5d6cd2a27ba7cd802ff01fc1252c032f1e7d34ac64e39902a16896bb2a2fed
3
+ size 440410
lackingtheembeddingofawordlookitupintoatraditionaldictionary/4a5144bd-93c0-47a4-84d8-b90801cf035c_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:85725db8fb500c0ae4c75b3eef90684145cf3872522b6b927bc34d4a49ec123f
3
+ size 85151
lackingtheembeddingofawordlookitupintoatraditionaldictionary/4a5144bd-93c0-47a4-84d8-b90801cf035c_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f52d936ba9a0096b23c3b1116d48e2791aa845f1f3b8c7562848beefffc7d4a
3
+ size 106723
lackingtheembeddingofawordlookitupintoatraditionaldictionary/4a5144bd-93c0-47a4-84d8-b90801cf035c_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:274d090af6a7734ffe6d8e61883a97f9109e3f4a3c1567d82cf49bed849eab8a
3
+ size 1577617
lackingtheembeddingofawordlookitupintoatraditionaldictionary/full.md ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Lacking the Embedding of a Word? Look it up into a Traditional Dictionary
2
+
3
+ Elena Sofia Ruzzetti
4
+
5
+ University of Rome Tor Vergata, Italy
6
+
7
+ Leonardo Ranaldi
8
+
9
+ Guglielmo Marconi University, Italy
10
+
11
+ Michele Mastromattei
12
+
13
+ Campus Bio-Medico University, Italy
14
+ University of Rome Tor Vergata, Italy
15
+
16
+ Francesca Fallucchi
17
+
18
+ Guglielmo Marconi University, Italy
19
+
20
+ Noemi Scarpato
21
+
22
+ San Raffaele Roma Open University, Italy
23
+
24
+ Fabio Massimo Zanzotto
25
+
26
+ University of Rome Tor Vergata, Italy
27
+
28
+ # Abstract
29
+
30
+ Word embeddings are powerful dictionaries, which may easily capture language variations. However, these dictionaries fail to give sense to rare words, which are surprisingly often covered by traditional dictionaries. In this paper, we propose to use definitions retrieved in traditional dictionaries to produce word embeddings for rare words. For this purpose, we introduce two methods: Definition Neural Network (DefiNNet) and Define BERT (DefBERT). In our experiments, DefiNNet and DefBERT significantly outperform state-of-the-art as well as baseline methods devised for producing embeddings of unknown words. In fact, DefiNNet significantly outperforms FastText, which implements a method for the same task-based on n-grams, and DefBERT significantly outperforms the BERT method for OOV words. Then, definitions in traditional dictionaries are useful to build word embeddings for rare words.
31
+
32
+ # 1 Introduction
33
+
34
+ Words without meaning are like compasses without needles: pointless. Indeed, meaningless words lead compositionally to meaningless sentences and, consequently, to meaningless texts and conversations. Second language learners may grasp grammatical structures of sentences, but, if they are unaware of the meaning of single words in these sentences, they may fail to understand the whole sentences, especially when there is an insufficient context for unfamiliar words. This is why a large body of natural language processing research is devoted to devising ways to capture word meaning.
35
+
36
+ As language is a living body, distributional methods (Turney and Pantel, 2010; Mikolov et al., 2013; Pennington et al., 2014) are seen as the panacea to capture word meaning as opposed to more static models based on dictionaries (Fellbaum, 1998) and
37
+
38
+ other lexical resources (Baker et al., 1998; Kipper et al., 2000). Distributional methods may easily capture new meaning of existing words and, eventually, can easily assign meaning to emerging words. In fact, the different methods can scan corpora and derive the meaning of these new words by observing them in context (Harris, 1954; Firth, 1950; Wittgenstein, 1953). Words are then represented as vectors – now called word embeddings – which are then used to feed neural networks to produce meaning for sentences (Bengio et al., 2003; Irsoy and Cardie, 2014; Kalchbrenner et al., 2014; Tai et al., 2015) and meaning for whole texts (Joulin et al., 2017; Lai et al., 2015).
39
+
40
+ Distributional methods have a strong limitation: word meaning can be assigned only for words where sufficient contexts can be gathered. Rare words are not covered and become the classical out-of-vocabulary words, which may hinder the understanding of specific yet important sentences. To overcome this problem, n-grams based distributional models have emerged (Joulin et al., 2016) where word meaning is obtained by composing "meaning" of character n-grams forming a word. These n-grams act as proto-morphemes and, hence, meaning of unknown words can be obtained by composing meaning of proto-morphemes.
41
+
42
+ Traditional dictionaries can offer a solution to find meaning of rare words. They have been put aside since they cannot easily adapt to language evolution and they cannot easily provide distributed representations for neural networks.
43
+
44
+ In this paper, we propose to use definitions in dictionaries to compositionally produce distributional representations for out-of-vocabulary (OOV) words. Trying to reproduce in a distributional setting the compositional properties that hold between symbols is a debated task since compositional dis
45
+
46
+ ![](images/a7833bc6d053a26da366d87e7f8859a948ed6ea532c2e665eeefad53485a38d5.jpg)
47
+ Figure 1: Exploiting definitions for out-of-vocabulary words: the DefiNNet and the DefBERT models.
48
+
49
+ ![](images/83e5f3eb592b7f3f838c2bf10adee66b1218acd84b0fb1d8d4229d1dffb37d64.jpg)
50
+
51
+ tributional models were proposed (Mitchell and Lapata, 2008; Baroni and Zamparelli, 2010; Zanzotto and Dell'Arciprete, 2011; Paperno et al., 2014; Ferrone and Zanzotto, 2020). Definitions in dictionaries are intended to describe the meaning of a word to a human reader. Then, we propose two models to exploit definitions to derive the meaning of OOV words: (1) Definition Neural Network (DefiNNet), a simple neural network; (2) DefBERT, a model based on pre-trained BERT. We experimented with different tests and datasets derived from WordNet (Fellbaum, 1998). Firstly, we determined if DefiNNet and DefBERT can learn to derive word meaning from definitions. Secondly, we aimed to establish whether DefiNNet and DefBERT can cover OOV words, which are not covered by word2vec (Mikolov et al., 2013) or by the BERT pre-trained encoder, respectively. In our experiments, DefiNNet and DefBERT significantly outperform state-of-the-art as well as baseline methods devised for producing embeddings of unknown words. In fact, DefiNNet significantly outperforms FastText (Joulin et al., 2016), which implements a method for the same task-based on n-grams, and DefBERT significantly outperforms the BERT method for OOV words. Then, definitions in traditional dictionaries are useful to build word embeddings for rare words.
52
+
53
+ # 2 Background and Related Work
54
+
55
+ Out-of-vocabulary (OOV) words have been often a problem as these OOV words may hinder the applicability of many NLP systems. For example,
56
+
57
+ if words are not included in a lexicon of a Probabilistic Context-Free Grammar, interpretations for sentences containing these words may have a null probability. Hence, solutions to this problem date back in time.
58
+
59
+ In the context of word embeddings, three families of solutions have been proposed: (1) context-based methods, (2) form-based methods, (3) combination of previous. The first family includes methods addressing the issue of learning new terms from tiny data either tuning existing models (Herbelot and Baroni, 2017) or performing a linear transformation on the average of all context word embedding (Khodak et al., 2018). In form-based methods, the most common solution is to use word n-grams (Joulin et al., 2016) or word pieces of variable length (Wu et al., 2016) as proxies to model morphemes. Embeddings are learned for 3-grams as well as for word pieces. In Joulin et al. (2016) these 3-grams are then combined to obtain the embedding for the entire word. For example, the word cheerlessness, which contains 3 morphemes (cheer, less and ness), is modeled by using embeddings for chee, hee, ..., ees in the 3-gram approach and by using embeddings for cheer and lessness in the word pieces approach. These embeddings are possibly capturing information about the related morphemes. In this way, OOV word embeddings are correlated with meaningful bits of observed words. These models are our baselines. The last family includes methods taking into account both contextual and morphological information (Schick and Schütze, 2019; Hu et al., 2019; Schick and Schütze, 2020).
60
+
61
+ Deriving word embeddings for OOV words from dictionary definitions is an alternative approach. This approach has shown to be competitive in low resource scenarios in Bahdanau et al. (2017) where an LSTM model was fed with the definition. Dictionary definitions have been used in early attempts to train rudimentary compositional distributional semantic models (Zanzotto et al., 2010), which aimed to build embeddings for sequences of two words. In the word embedding field, several algorithms using definitions were proposed to build new embeddings matrices (Hill et al., 2016; Tissier et al., 2017; Bosc and Vincent, 2018). However, those methods are alternatives to the corpus-based distributional ones while our method is focused on tackling the OOV words problem, complementing existing word embedding spaces. Lexical resources have been also used exploiting their underlying semantic graph as an additional source of information (Pilehvar and Collier, 2017; Prokhorov et al., 2019). However, models based on those semantic graphs rely on a stronger assumption than models based on definitions only.
62
+
63
+ Universal sentence embedders (USEs) (Conneau et al., 2018) can play an important role in this novel approach. In fact, definitions are particular sentences aiming to describe meaning of words. Therefore, USEs should obtain an embedding representing the meaning of a word by composing embeddings of words in the definition.
64
+
65
+ Moreover, deriving word embeddings from definitions can be seen as a semantic stress test of universal sentence embedders. Generally, the ability of USEs (Devlin et al., 2019; Yang et al., 2020; Clark et al., 2020) to semantically model sentences is tested with end-to-end downstream tasks, for example, natural language inference (NLI) (Jiang and de Marneffe, 2019a; Raffel et al., 2020; He et al., 2021), question-answering (Zhang, 2019) as well as dialog systems (Wu et al., 2020). USEs such as BERT (Devlin et al., 2019) are encoding semantic features in hidden layers (Jawahar et al., 2019; Miaschi et al., 2020). However, USEs' success in downstream tasks may be due to superficial heuristics (as supposed in McCoy et al. (2019) and Ranaldi et al. (2022)) and not to deep modeling of semantic features. Therefore, our study can contribute to this debate. In fact, to the best of our knowledge, it is the first study aiming to investigate if USEs can model meaning by producing embedding for words starting from their definitions.
66
+
67
+ # 3 Model
68
+
69
+ This section introduces our proposals to use definitions in generating embeddings for out-of-vocabulary words: Definition Neural Network (DefiNNet) and BERT for Definitions (DefBERT). Section 3.1 describe the basic idea to process WordNet definitions. Section 3.2 describes the definition of the feed-forward neural network DefiNNet. Finally, Section 3.3 describes how we used the Universal Sentence Embedder BERT in producing embeddings for definitions.
70
+
71
+ # 3.1 Basic Idea
72
+
73
+ Our model stems from an observation: when someone steps into a rare unknown word while reading, definitions in traditional dictionaries are the natural resource used to understand the meaning of this rare, out-of-one's-personal-dictionary word. Then, as people rely on dictionaries in order to understand meanings for unknown words, learners of word embeddings could do the same.
74
+
75
+ Indeed, definitions in dictionaries are conceived to define compositionally the meaning of target words. Therefore, these are natural candidates for deriving a word embedding of an OOV word by composing the word embeddings of the words in the definition. The hunch is that universal sentence embedders can be used for this purpose.
76
+
77
+ Moreover, these definitions have a recurrent structure, which can be definitely used to derive a simpler model. Definitions for words $w$ are often organized as a particular sentence that contains the super-type of $w$ and a modifier, which specializes the super-type (Amsler, 1980). For example (Fig. 1), cheerlessness is defined in WordNet as a feeling, which is the super-type, and of dreary and pessimistic sadness, which is the modifier. By using this structure, we propose a simpler model for composing meaning.
78
+
79
+ In the following sections, we propose two models: (1) DefiNNet, a model that exploits the structure of the definitions to focus on relevant words; and (2) DefBERT, a model that utilizes BERT as universal sentence embedder to embed the definition in a single vector.
80
+
81
+ # 3.2 DefiNNet: a feed-forward neural network to learn word embedding from definitions
82
+
83
+ The Definition Neural Network (DefiNNet) is our first model and has two main components (see Figure 1). The first component, DefAnalyzer, aims
84
+
85
+ to spot the two important words of the definition: the super-type $w_{h}$ and the main word $w_{m}$ of the modifier of the super-type. The second component, DeNN, is a feed-forward neural network that takes in input the embeddings, $\vec{w}_{h}$ and $\vec{w}_{m}$ , of the two selected words and produces the embedding for the target word $\vec{w}_{\text{def}}$ .
86
+
87
+ To extract the two main words from a given definition, DefAnalyzer exploits the recurrent structure of definitions by using their syntactic interpretations. In our study, we use constituency parse trees and correlated rules to extract the super-type $w_{h}$ and its closest modifier $w_{m}$ . Basically, the simple algorithm is the following: given a definition $s$ , parse the definition $s$ and select the main constituent. If the main constituent contains a semantic head and a modifier, then those are the two target words. In the other case, select the semantic head of the main constituent as the super-type $w_{h}$ and the semantic head of the first sub-constituent as the relevant modifier $w_{m}$ . For example, the parse tree for the definition of cheerlessness in Fig. 1 is the following:
88
+
89
+ ![](images/33b868192928c7bda207b161964ab4a83acd3c678dc12e82682674f91cc0e704.jpg)
90
+
91
+ In this case, the main constituent is the first NP: the selected $w_{h}$ is the word feeling which is semantic head of the first NP; $w_{m}$ is noun sadness which is the semantic head of PP. The semantic heads are computed according to a slightly modified version of the semantic heads defined by Collins, 2003.
92
+
93
+ The second component is DeNN that, given the words embeddings $\vec{w}_h$ and $\vec{w}_m$ from the Word2Vec embedding space for respectively $w_h$ and $w_m$ from the definition, their POS tag $p_h$ , $p_m$ and the target's POS tag $p_c$ as additional information, outputs the embedding $\vec{w}_c$ for the target word $w_c$ . The input of DefiNNet is illustrated in Fig.1. The general equation for DeNN is:
94
+
95
+ $$
96
+ \vec {w} _ {c} = \mathbf {D e N N} (\vec {w} _ {h}, \vec {w} _ {m}, p _ {h}, p _ {m}, p _ {c})
97
+ $$
98
+
99
+ The DeNN function can be described starting from three simpler subnets: (1) $\mathbf{F}\mathbf{F}_w$ processes word embeddings $\vec{w}_h$ and $\vec{w}_m$ ; (2) $\mathbf{F}\mathbf{F}_p$ embeds and processes $p_h, p_m$ and $p_c$ ; finally, (3) $\mathbf{F}\mathbf{F}$ processes the joint information from the previous steps.
100
+
101
+ The equation describing the subnet $\mathbf{FF}_w$ that takes as input $\vec{w}_h$ and $\vec{w}_m$ is the following:
102
+
103
+ $$
104
+ \vec {s} = \mathbf {F F} _ {w} (\vec {w} _ {h}, \vec {w} _ {m}) = \sigma \left(\mathbf {W} _ {s} \sigma \left(\mathbf {W} _ {h} \vec {w} _ {h} + \mathbf {W} _ {m} \vec {w} _ {m}\right)\right) \tag {1}
105
+ $$
106
+
107
+ where $\mathbf{W}_h$ , $\mathbf{W}_m$ and $\mathbf{W}_s$ are dense layers and $\sigma$ is the LeakyReLU activation function.
108
+
109
+ The subnet $\mathbf{FF}_p$ processes POS tags: $p_h, p_m, p_c$ . Each $p_i$ for $i \in \{h, m, c\}$ is firstly fed into an embedding layer $\epsilon$ which weights are learned from scratch. The resulting embedding $\epsilon(p_i)$ is then fed into a dense layer $\mathbf{W}_i$ . Hence $\vec{p_i}$ is defined as follows:
110
+
111
+ $$
112
+ \vec {p} _ {i} = \mathbf {W} _ {i} \epsilon (p _ {i})
113
+ $$
114
+
115
+ The resulting $\vec{p}_h,\vec{p}_m,\vec{p}_c$ are then concatenated $(\oplus)$ and fed into a dense layer $\mathbf{W}_p$ . The following equation describes the subnet $\mathbf{F}\mathbf{F}_p$ :
116
+
117
+ $$
118
+ \vec {p} = \mathbf {F F} _ {p} \left(p _ {h}, p _ {m}, p _ {c}\right) = \sigma \left(\mathbf {W} _ {p} \left(\vec {p} _ {h} \oplus \vec {p} _ {m} \oplus \vec {p} _ {c}\right) \right. \tag {2}
119
+ $$
120
+
121
+ The $\vec{s}$ resulting from Equation 1 and the $\vec{p}$ from Equation 2 are then concatenated $(\oplus)$ :
122
+
123
+ $$
124
+ \vec {h} = \vec {s} \oplus \vec {p}
125
+ $$
126
+
127
+ As final step $\vec{h}$ is fed into a feed-forward subnet $\mathbf{FF}$ composed of the dense layers $\mathbf{W}_1$ , $\mathbf{W}_2$ and $\mathbf{W}_3$ as follows:
128
+
129
+ $$
130
+ \mathbf {F F} (\vec {h}) = \mathbf {W} _ {3} \sigma \left(\mathbf {W} _ {2} \left(\sigma \left(\mathbf {W} _ {1} \vec {h}\right)\right)\right) \tag {3}
131
+ $$
132
+
133
+ Hence the following:
134
+
135
+ $$
136
+ \vec {w} _ {c} = \mathbf {F F} \big (\mathbf {F F} _ {\mathbf {w}} (\vec {w} _ {h}, \vec {w} _ {m}), \mathbf {F F} _ {\mathbf {p}} (p _ {h}, p _ {m}, p _ {c}) \big)
137
+ $$
138
+
139
+ describes how DeNN computes the embedding $\vec{w}_c$ for an OOV word having as input $\vec{w}_h$ , $\vec{w}_m$ , $p_h$ , $p_m$ from DefAnalyzer and $p_c$ .
140
+
141
+ For comparative purposes, we defined two additional baseline models: an hypernym model (Head) and an additive model (Additive) (Mitchell and Lapata, 2008). The Head model derives the embedding for the OOV word $c$ by using the embedding for its hypernym $h$ in WordNet, that is, $\vec{w}_c = \vec{w}_h$ . The Additive model instead adds the embeddings of the two words in the definition used by DefiNNet, that is, $\vec{w}_c = \vec{w}_h + \vec{w}_m$ .
142
+
143
+ # 3.3 DefBERT: Transforming definitions in word embeddings
144
+
145
+ DefBERT aims to use BERT's ability to process sentences to use directly the definition for $w_{c}$ in order to produce its embedding $\vec{w}_{c}$ . DefBERT[CLS]
146
+
147
+ and DefBERT $_{Head}$ are the approaches followed in exploiting the definition.
148
+
149
+ DefBERT $_{[CLS]}$ is the first of these approaches: in this case, the definition of $w_{c}$ is given in input to a pretrained BERT-base model and, as shown in Figure 1, $\vec{b}_{[CLS]}$ , the embedding for the [CLS] token, is taken as sentence embedding in the USE acceptance of BERT.
150
+
151
+ DefBERT $_{Head}$ is the second approach and in this case is selected $\vec{b}_{head}$ , which is contextual embedding of $\vec{w}_h$ from the definition. Since BERT's embedding are contextual, $\vec{b}_{head}$ could benefit from the definition being the input sentence. A BERT pretrained model as USE in DefBERT $_{CLS}$ and its ability in producing contextualized word embeddings in DefBERT $_{Head}$ definition can hence be exploited in producing embeddings for OOV.
152
+
153
+ For comparative purposes, we also define BERTwordpieces and BERTHead-Example. BERTwordpieces is used to see if our model outperforms the classical behavior of BERT when it encounters OOV words. In this case, BERT is fed with a sample sentence containing the target OOV word, for example "... melancholy to pastel cheerlessness" for the target OOV "cheerlessness" (see Figure 1). Then, the word is divided into word pieces. To obtain the embedding for the target word, we sum up vectors of these word pieces. BERTHead-Example instead is used to determine if definitions are really useful for modeling meaning of the head word. BERTHead-Example is similar to DefBERTHead but the input is different. BERTHead-Example has a random sentence that contains the head word. Hence, comparing DefBERTHead with BERTHead-Example gives intuition if the head in definition really absorbs its meaning.
154
+
155
+ # 4 Experiments
156
+
157
+ Experiments aim to investigate three issues: (1) if DefiNNet and DefBERT word embeddings are reasonably better than baseline models for indirectly generating embeddings; (2) the highly debated question whether similarity measures over WordNet are correlated with word embeddings (Lastra-Diaz et al., 2019); (3) finally, if DefiNNet and DefBERT word embeddings for out-of-vocabulary words obtained are good word representations in terms of their correlation with similarity measures on WordNet. Clearly, issue (2) is necessary to investigate issue (3).
158
+
159
+ The rest of the section is organized as follows. Section 4.1 introduces the general settings of our experiments. Section 4.2 presents results and it is organized in four subsections, which address the above three issues. If needed, these subsections introduce additional settings for the experiments.
160
+
161
+ # 4.1 Experimental set-up
162
+
163
+ Our experiments are defined around WordNet (Fellbaum, 1998) and around the two word embedding spaces of Word2Vec (Mikolov et al., 2013) $(W_{w2v})$ and of BERT (Devlin et al., 2019) $(W_{BERT})$ . WordNet (Fellbaum, 1998) is the source of word definitions, it is used to collect testing sets of pairs of similar and dissimilar words and similarity measures over WordNet are used to rank them.
164
+
165
+ Then, $IV_{w2v}$ and $IV_{BERT}$ are WordNet words in the target embedding matrices $W_{w2v}$ and $W_{BERT}$ , respectively, and $OOV_{w2v}$ and $OOV_{BERT}$ are WordNet words outside these matrices.
166
+
167
+ Additionally, $IV_{BERT}$ and $OOV_{BERT}$ are restricted to words with usage example in WordNet as these examples are needed for applying DefBERT. The datasets derived from those sets are described in Table 1.
168
+
169
+ Word2Vec (Mikolov et al., 2013) and BERT (Devlin et al., 2019) offer instead large pre-trained word embedding spaces. Indeed, Word2Vec's embedding space (Mikolov et al., 2013) is pre-trained on part of Google News dataset (about 100 billion words) and the BERT's word embedding space (Devlin et al., 2019) is pre-trained on lower-cased English text from BooksCorpus (800M words) (Zhu et al., 2015) and English Wikipedia (2,500M words) as described by Devlin et al. (2019).
170
+
171
+ <table><tr><td>Dataset</td><td>Subset of</td><td colspan="2">Size</td></tr><tr><td rowspan="2">Trainw2v</td><td rowspan="2">IVw2v</td><td colspan="2">31,471 (train)</td></tr><tr><td colspan="2">7,867 (val)</td></tr><tr><td>Testw2v</td><td>IVw2v</td><td colspan="2">9,931</td></tr><tr><td>TestBERT</td><td>IVBERT</td><td colspan="2">3,218</td></tr><tr><td>Dataset</td><td>Subset of</td><td>Size</td><td># Sublists</td></tr><tr><td>PairsIVw2v</td><td>IVw2v × IVw2v</td><td>14,000</td><td>2,000</td></tr><tr><td>PairsIVBERT</td><td>IVBERT × IVBERT</td><td>560</td><td>80</td></tr><tr><td>PairsIVfasttext</td><td>IVfasttext × IVfasttext</td><td>14,000</td><td>2,000</td></tr><tr><td>Pairsw2v</td><td>OOVw2v × IVw2v</td><td>4,500</td><td>600</td></tr><tr><td>PairsBERT</td><td>OOVBERT × IVBERT</td><td>3,500</td><td>450</td></tr><tr><td>Pairsw2v∩BERT</td><td>Pairsw2v∩PairsBERT</td><td>450</td><td>60</td></tr></table>
172
+
173
+ Table 1: Datasets defined over WordNet
174
+
175
+ To investigate the first issue described at the beginning of this section, we introduced $\text{Train}_{w2v}$ , $\text{Test}_{w2v}$ , and $\text{Test}_{BERT}$ . $\text{Train}_{w2v}$ is DefINNet training set: this dataset contains definition for $IV_{w2v}$ words since they are needed as target of
176
+
177
+ DefiNNet. $Test_{w2v}$ is a test dataset and it is completely analogous to $Train_{w2v}$ (Sec, 4.2.1). Since DefBERT[CLS] is not trained, $Test_{BERT}$ is the dataset prepared. Benchmarks on similarity and relatedness are also introduced in Sec 4.2.2
178
+
179
+ DefiNNet and DefBERT are also tested to assess their ability to produce embeddings for OOV that may replicate some similarity measure between words in pairs. The investigated pairs consist of WordNet "sister terms": two words are sister if they are both immediate hyponyms of the same node. In WordNet sister terms are definitely positive examples of similar words as well as negative example pairs can be generated by selecting pairs of words uniformly at random. Pairs datasets are composed of positive or negative examples of sister terms. To address the second issue presented in Sec 4, $Pairs_{IVw2v}$ , $Pairs_{IVBERT}$ , $Pairs_{IVfasttext}$ datasets are generated. In this datasets both $w_1$ and $w_2$ are IV words. Then, we collected two sets of pairs of words $Pairs_{w2v}$ and $Pairs_{BERT}$ : those datasets are used to test if the correlation with similarity measures holds with OOV word embedding derived from DefiNNet or DefBERT. To capture different degrees of similarity among pairs of words in WordNet, we selected three similarity measures defined over WordNet: path (Rada et al., 1989), wup (Wu and Palmer, 1994) and res (Resnik, 1995). To correctly apply Spearman's correlation between our systems and the expected rank on the list of pairs induced by a similarity measure, we divided Pairs datasets into lists of 7 pairs. Pairs in the list are selected to have 7 clearly different values of the selected similarity (path, wup and res) between the two words. The final Spearman's correlation is a distribution of correlation over these lists.
180
+
181
+ To comparatively investigate our DefiNNet and DefBERT, we used FastText (Bojanowski et al., 2016) as realized in Grave et al. (2018) along with: (1) Additive and Head defined in Section 3.2; (2) BERTwordpieces and BERTHead-Example defined in Section 3.3. FastText defines embeddings unknown words $c$ by combining embeddings of 3grams, for example, the embedding for the OOV word cheerlessness is represented as the vector $\vec{f_c} = c\vec{e} + h\vec{ee} + \ldots + e\vec{ss}$ .
182
+
183
+ As final experimental setting, definitions are parsed using Stanford's CoreNLP probabilistic context-free grammar parser (Manning et al., 2014). NLTK (Loper and Bird, 2002) is used to access WordNet and compute similarity measures over it.
184
+
185
+ # 4.2 Results and discussion
186
+
187
+ For clarity, this section is organized around the three issues we aim to investigate: the ability of proposed methods to build embeddings of words starting from dictionary definitions (Sec. 4.2.1, Sec. 4.2.2); the debated relation between similarity over word embeddings and similarity in WordNet (Sec. 4.2.3); and, finally, the ability of the proposed methods to produce embeddings for OOV words (Sec. 4.2.4).
188
+
189
+ # 4.2.1 Word Embeddings from Dictionary Definitions
190
+
191
+ The first issue to investigate is whether our methods produce word embeddings from dictionary definitions that are similar with respect to word embeddings directly discovered. We then studied the cosine similarity between the two kinds of embeddings, for example, between the embedding of cheerlessness and the embedding of the definition a feeling of ... sadness. For the diffent methods, the comparison is on their own space, that is, $sim(\vec{w}_c, \vec{w}_{def})$ for DefiNNet and $sim(\vec{b}_c, \vec{b}_{[CLS]})$ or $sim(\vec{b}_c, \vec{b}_{head})$ for DefBERT[CLS] and DefBERTHead, respectively (see Fig. 1). Experiments are conducted on In-Vocabulary words for both spaces by using the $Test_{w2v}$ , $Test_{BERT}$ and $Test_{w2v \cap BERT}$ datasets.
192
+
193
+ <table><tr><td>Dataset</td><td>Model</td><td>nouns sim</td><td>verbs sim</td></tr><tr><td rowspan="3">Testw2v</td><td>Additive</td><td>0.25(±0.17)°</td><td>0.29(±0.19)°</td></tr><tr><td>Head</td><td>0.26(±0.21)*</td><td>0.29(±0.25)*</td></tr><tr><td>DefiNNet</td><td>0.39(±0.18)°*</td><td>0.46(±0.14)°*</td></tr><tr><td rowspan="3">TestBERT</td><td>DefBERTHead</td><td>0.46(±0.13)†‡</td><td>0.41(±0.14)†‡</td></tr><tr><td>DefBERT[CLS]</td><td>0.32(±0.08)†</td><td>0.30(±0.09)†</td></tr><tr><td>BERTHead-Example</td><td>0.41(±0.12)‡</td><td>0.39(±0.12)‡</td></tr><tr><td rowspan="3">Testw2v∩BERT</td><td>DefBERTHead</td><td>0.47(±0.13)†△</td><td>0.42(±0.15)†△</td></tr><tr><td>DefBERT[CLS]</td><td>0.28(±0.09)†○</td><td>0.30(±0.09)†○</td></tr><tr><td>DefiNNet</td><td>0.33(±0.13)△○</td><td>0.47(±0.13)△○</td></tr></table>
194
+
195
+ Table 2: Cosine similarity between word embeddings and embeddings of their definitions. The marking signs $\star, \circ, \dagger, \ddagger$ and $\diamond$ indicate pairs of models results for which the higher result is statistically significant better than the other (with a $95\%$ confidence level) according to the one-sided Wilcoxon signed-rank test.
196
+
197
+ Definitions seem to be better sources of word embeddings instead of baseline methods and other solutions. In fact, both DefiNNet and DefBERTHead outperform different methods in their respective tests for both nouns and verbs (see Table 2). For nouns, DefiNNet has an average cosine similarity of $0.39(\pm 0.18)$ , which is well above that of Additive $(0.25(\pm 17))$ and Head $(0.26(\pm 21))$ .
198
+
199
+ In the same syntactic category, DefBERTHead outperforms BERTHead-Example, $0.46(\pm 0.13)$ vs. $0.41(\pm 0.12)$ . For verbs, DefINet has an average cosine similarity of $0.46(\pm 0.14)$ , which is well above the Additive and the Head. In the same category, DefBERTHead slightly outperforms BERTHead-Example. Finally, in the common test, that is, Testw2v∩BERT, definition-based models outperform simpler models. DefBERTHead has a better similarity for nouns and DefINet has a better similarity for verbs.
200
+
201
+ For BERT, the embedding related to the token [CLS] does not seem to represent the good token where to take semantics of the sentence in terms of a real composition of the meaning of component words. DefBERT[CLS] performs poorly with respect to DefBERTHead and also with respect to BERTHead-Example in both syntactic categories for TestBERT (see Table 2). This is confirmed in the restricted set $Test_{w2v\cap BERT}$ . Therefore, even if the embedding in token [CLS] is often used as universal sentence embedding for classification purposes (Devlin et al., 2019; Adhikari et al., 2019; Jiang and de Marneffe, 2019b), it may not contain packed meaning whereas it may contain other kinds of information regarding the sentence.
202
+
203
+ # 4.2.2 Standard Relatedness and Similarity Tests
204
+
205
+ In this section, DefiNNet embeddings are evaluated by measuring their ability to capture similarity and relatedness of words pairs. The used benchmarks contain words pairs and a score of similarity for each pair assigned by human assessors. If the similarity among embeddings correlates with the assigned similarity score, then the embeddings are considered capable of capturing similarity and relatedness. In this scenario, the first word's embedding of each pair is computed according to the examined method, the second embedding comes from the Word2Vec embedding space. The obtained Spearman's coefficients are presented in Table 3. Head and Additive baseline models are also tested.
206
+
207
+ DefiNNet achieves better correlation with all the tested relatedness benchmarks: MEN (Bruni et al., 2014), MTurk-287 (Radinsky et al., 2011) and MTurk-771 (Halawi et al., 2012). Among the similarity benchmarks, DefiNNet outperforms the Additive and Head baseline in different tasks. With RareWords (Luong et al., 2013), composed of words with low occurrences, DefiNNet significantly outperforms both baselines. The corre
208
+
209
+ <table><tr><td>Benchmark</td><td>DefiNNet</td><td>Head</td><td>Additive</td></tr><tr><td>MEN</td><td>0.48(±0.01)°†</td><td>0.37°</td><td>0.39†</td></tr><tr><td>MTurk-287</td><td>0.46(±0.02)°†</td><td>0.39°</td><td>0.39†</td></tr><tr><td>MTurk-771</td><td>0.37(±0.01)°†</td><td>0.33°</td><td>0.33†</td></tr><tr><td>RareWords</td><td>0.32(±0.01)°†</td><td>0.20°</td><td>0.02†</td></tr><tr><td>SimLex999</td><td>0.18(±0.01)°†</td><td>0.15°</td><td>0.19†</td></tr><tr><td>RG-65</td><td>0.43(±0.04)°</td><td>0.63°</td><td>0.41</td></tr><tr><td>MC-30</td><td>0.27(±0.07)°†</td><td>0.71°</td><td>0.33†</td></tr><tr><td>SimVerb-3500</td><td>0.27(±0.01)°†</td><td>0.22°</td><td>0.22†</td></tr><tr><td>Verb-143</td><td>0.41(±0.02)°†</td><td>0.25°</td><td>0.26†</td></tr><tr><td>YP-130</td><td>0.43(±0.02)°†</td><td>0.27°</td><td>0.27†</td></tr></table>
210
+
211
+ lation coefficients calculated with SimLex999 (Hill et al., 2015) are instead closer and relatively lower. Head achieves the best results with the smaller RG-65 (Rubenstein and Goodenough, 1965) and its subset MC-30 (Miller and Charles, 1991). DefINNet achieves a higher Spearman's coefficient in SimVerb-3500 (Gerz et al., 2016), Verb-143 (Baker et al., 2014) and YP-130 (Yang and Powers, 2006) which assess similarity on verbs pair.
212
+
213
+ # 4.2.3 Word Embedding Spaces and WordNet
214
+
215
+ WordNet and its correlated similarly metrics can be an interesting opportunity to extract testsets for assessing whether our methods can be used to derive embeddings of OOV words. However, it is a strongly debated question whether similarities in WordNet are correlated with similarities over word embeddings (Lastra-Díaz et al., 2019).
216
+
217
+ Table 3: Spearman's correlation coefficients on similarity and relatedness benchmarks. Mean and standard deviation results in DefiNNet are obtained from 10 runs. The symbols $\diamond$ and $\dagger$ indicate a statistically significant difference between two results (with a $95\%$ confidence level) according to the one-sided Wilcoxon signed-rank test.
218
+
219
+ <table><tr><td>Model</td><td>Dataset</td><td>Measure</td><td>Spearman</td></tr><tr><td rowspan="3">Word2Vec</td><td rowspan="3">PairsIVw2v</td><td>path</td><td>0.25(±0.39)</td></tr><tr><td>wup</td><td>0.25(±0.38)</td></tr><tr><td>res</td><td>0.50(±0.31)</td></tr><tr><td rowspan="3">FastText</td><td rowspan="3">PairsIVfasttext</td><td>path</td><td>0.31(±0.38)</td></tr><tr><td>wup</td><td>0.40(±0.35)</td></tr><tr><td>res</td><td>0.52(±0.29)</td></tr><tr><td rowspan="3">BERT</td><td rowspan="3">PairsIVBERT</td><td>path</td><td>0.09(±0.41)</td></tr><tr><td>wup</td><td>0.30(±0.39)</td></tr><tr><td>res</td><td>0.28(±0.38)</td></tr></table>
220
+
221
+ Table 4: Average Spearman's coefficient measuring correlation on cosine similarity among embedding and similarity over WordNet taxonomy.
222
+
223
+ The aim of this section is to select WordNet
224
+
225
+ <table><tr><td>Dataset</td><td>Model</td><td>Corr(path)</td><td>Corr(wup)</td><td>Corr(res)</td></tr><tr><td rowspan="4">Pairsw2v</td><td>Additive</td><td>0.24(±0.40)°</td><td>0.46(±0.32)°</td><td>0.44(±0.34)°</td></tr><tr><td>Head</td><td>0.23(±0.37)*</td><td>0.49(±0.30)</td><td>0.49(±0.31)*</td></tr><tr><td>FastText</td><td>0.07(±0.40)</td><td>0.43(±0.36)°</td><td>0.41(±0.35)°</td></tr><tr><td>DefiNNet</td><td>0.03(±0.42)°*</td><td>0.50(±0.31)°</td><td>0.51(±0.31)°*</td></tr><tr><td rowspan="4">PairsBERT</td><td>DefBERTHead</td><td>0.27(±0.36)‡●</td><td>0.33(±0.37)†‡●</td><td>0.31(±0.36)†‡●</td></tr><tr><td>DefBERT[CLS]</td><td>0.26(±0.36)</td><td>0.17(±0.37)†</td><td>0.11(±0.39)†</td></tr><tr><td>BERTHead-Example</td><td>0.15(±0.41)‡</td><td>0.25(±0.38)‡</td><td>0.19(±0.40)‡</td></tr><tr><td>BERTwordpieces</td><td>0.09(±0.37)●</td><td>0.19(±0.37)●</td><td>0.23(±0.38)●</td></tr><tr><td rowspan="4">Pairsw2v∩BERT</td><td>DefBERTHead</td><td>0.12(±0.44)°</td><td>0.33(±0.36)●</td><td>0.27(±0.39)●</td></tr><tr><td>DefiNNet</td><td>0.31(±0.37)◇△</td><td>0.39(±0.33)△</td><td>0.35(±0.36)△</td></tr><tr><td>FastText</td><td>0.19(±0.42)</td><td>0.35(±0.36)</td><td>0.32(±0.37)</td></tr><tr><td>BERTwordpieces</td><td>0.11(±0.37)△</td><td>0.14(±0.42)●△</td><td>0.18(±0.34)●△</td></tr></table>
226
+
227
+ Table 5: Average Spearman's coefficient from the sister terms investigation. The marking signs $\star, \circ, \bullet, \dagger, \ddagger, \triangle$ and $\diamond$ indicate pairs of models results for which the higher result is statistically significant better than the other (with a $95\%$ confidence level) according to the one-sided Wilcoxon signed-rank test.
228
+
229
+ similarity measures that can be used to investigate the quality of embeddings generated for OOV words. For this experimental session, we used the $Pairs_{IV_{w2v}}$ , $Pairs_{IV_{BERT}}$ and $Pairs_{IV_{fasttext}}$ datasets defined in Section 4.1, which are composed of sister terms in WordNet.
230
+
231
+ Sister terms may be very similar or less similar. For example, cheerlessness and depression (see Figure 1) are sister terms and are definitely similar. On the contrary, house and architecture are sister terms but are less similar with respect to the previous pair of words. In WordNet, this difference in similarity is captured by using many different metrics.
232
+
233
+ We investigated three different WordNet similarity measures: path (Rada et al., 1989), wup (Wu and Palmer, 1994) and res (Resnik, 1995). The measure path uses the length of the path connecting two synsets over the WordNet taxonomy. The measure wup is still based on the length of path between the synsets related to the two words and takes into account the number of edges from synsets to their Least Common Subsumer (LCS) and the number of links from the LCS up to the root of the taxonomy. Finally, the measure res belongs to another family of measures as it is based on the Information Content. In res, the similarity between synsets of the related words is a function of the Information Content of their LCS. In this case, a more informative LCS (a rare as well as a specific concept) indicates that the hyponym concepts are more similar.
234
+
235
+ The best correlated WordNet measure is $res$ . In fact, it is highly correlated for two spaces out of
236
+
237
+ three, Word2Vec and FastText, and it is on par with wup in the BERT space (see 4). The average Spearman's correlation between the word embedding spaces of Word2Vec and res is $0.50(\pm 0.31)$ which is well above path and wup. The same happens for the space FastText where the correlation is $0.52(\pm 0.29)$ .
238
+
239
+ As a final consideration, for our purposes, word embedding spaces are correlated and the best measure that captures this correlation is res.
240
+
241
+ # 4.2.4 Testing over out-of-vocabulary words
242
+
243
+ The final analysis is on real OOV words for Word2Vec and for BERT. These last experiments are carried out by considering the positive relation between WordNet similarity measures and the word embedding spaces.
244
+
245
+ Using definitions for deriving word embeddings for OOV words seems to be the good solution compared to alternative available approaches.
246
+
247
+ In its space, DefiNNet achieves very important results for the correlation with the two WordNet similarity measures wup and res (see Table 5). In both cases, it outperforms FastText, which is a standard approach for deriving word embeddings for OOV words $(0.51 \pm 0.31$ vs. $0.41 \pm 0.35$ for res and $0.50 \pm 0.30$ vs. $0.43 \pm 0.36$ for wup). Moreover, DefiNNet outperforms Head, a baseline method based on WordNet, and Additive, the simplest model to use WordNet definitions.
248
+
249
+ The same happens for DefBERTHead in its space (see Table 5). DefBERTHead significantly outperforms BERTwordpieces, showing that DefBERTHead is a better model to treat OOV with respect to that already included in BERT. Results
250
+
251
+ on DefBERTHead confirm that the output related to the token representing the head carries better information than the output related to the token [CLS]. Moreover, the definition has a positive effect on shaping the word embedding of the head word towards the defined word. In fact, DefBERTHead and BERTHead-Example are applied on the same head word and DefBERTHead transforms better the meaning than BERTHead-Example, which is applied to a random sentence containing the head word. Indeed, also for BERT, definitions are important in determining embeddings of OOV words.
252
+
253
+ The final comparison is between DefiNNet and DefBERTHead and it is done on the small dataset $Pairs_{w2n\cap BERT}$ . DefiNNet achieves better results than DefBERTHead for all the three WordNet measures (see Table 5) but statistical significance between them cannot be asserted with the fixed p-value (0.05).
254
+
255
+ # 5 Conclusions and Future Work
256
+
257
+ Building word embedding for rare out-of-vocabulary words is essential in natural language processing systems based on neural networks. In this paper, we proposed to use definitions in dictionaries to solve this problem. Our results show that this can be a viable solution to retrieve word embedding for OOV rare words, which work better than existing methods and baseline systems.
258
+
259
+ Moreover, the use of dictionary definitions in word embedding may open also another possible line of research: a different semantic probe for universal sentence embedders (USEs). Indeed, definitions offer a definitely interesting equivalence between sentences and words. Hence, unlike existing semantic probes, this approach can unveil if USEs are really changing compositionally the meaning of sentences or are just aggregating pieces of sentences in a single representation.
260
+
261
+ Finally, this paper promotes responsible Artificial Intelligence as intended in Human-in-the-Loop Artificial Intelligence (Zanzotto, 2019). In fact, it gives the possibility to track how human knowledge is used by learning algorithms.
262
+
263
+ # Acknowledgments
264
+
265
+ This work is partially funded by the 2019 BRIC INAIL ID32 SfidaNow project. We would like to thank Giorgio Gambosi, Arianna Patrizi and Aria Nourbakhsh for the useful discussions.
266
+
267
+ # References
268
+
269
+ Ashutosh Adhikari, Achyudh Ram, Raphael Tang, and Jimmy Lin. 2019. Docbert: Bert for document classification.
270
+ Robert Amsler. 1980. The structure of the merriam-webster pocket dictionary /
271
+ Dzmitry Bahdanau, Tom Bosc, Stanislaw Jastrzebski, Edward Grefenstette, Pascal Vincent, and Yoshua Bengio. 2017. Learning to compute word embeddings on the fly. CoRR, abs/1706.00286.
272
+ Collin F Baker, Charles J Fillmore, and John B Lowe. 1998. The berkeley framenet project. In COLING 1998 Volume 1: The 17th International Conference on Computational Linguistics.
273
+ Simon Baker, Roi Reichart, and Anna Korhonen. 2014. An unsupervised model for instance level subcategorization acquisition. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 278-289, Doha, Qatar. Association for Computational Linguistics.
274
+ Marco Baroni and Roberto Zamparelli. 2010. Nouns are vectors, adjectives are matrices: Representing adjective-noun constructions in semantic space. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 1183-1193, Cambridge, MA. Association for Computational Linguistics.
275
+ Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Janvin. 2003. A neural probabilistic language model. J. Mach. Learn. Res., 3(null):1137-1155.
276
+ Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. 2016. Enriching word vectors with subword information. arXiv preprint arXiv:1607.04606.
277
+ Tom Bosc and Pascal Vincent. 2018. Auto-encoding dictionary definitions into consistent word embeddings. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1522–1532, Brussels, Belgium. Association for Computational Linguistics.
278
+ Elia Bruni, Nam Khanh Tran, and Marco Baroni. 2014. Multimodal distributional semantics. Journal of Artificial Intelligence Research.
279
+ Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. 2020. ELECTRA: Pretraining text encoders as discriminators rather than generators. In ICLR.
280
+ Michael Collins. 2003. Head-driven statistical models for natural language parsing. Computational Linguistics, 29(4):589-637.
281
+
282
+ 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. ACL 2018 - 56th Annual Meeting of the Association for Computational Linguistics, Proceedings of the Conference (Long Papers), 1:2126-2136.
283
+ 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.
284
+ Christiane Fellbaum. 1998. WordNet: An Electronic Lexical Database. Bradford Books.
285
+ Lorenzo Ferrone and Fabio Massimo Zanzotto. 2020. Symbolic, distributed, and distributional representations for natural language processing in the era of deep learning: A survey. Frontiers in Robotics and AI, 6.
286
+ J. R. Firth. 1950. Personality and language in society. The Sociological Review, a42(1):37-52.
287
+ Daniela Gerz, Ivan Vulic, Felix Hill, Roi Reichart, and Anna Korhonen. 2016. SimVerb-3500: A large-scale evaluation set of verb similarity. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2173-2182, Austin, Texas. Association for Computational Linguistics.
288
+ Edouard Grave, Piotr Bojanowski, Prakhar Gupta, Armand Joulin, and Tomas Mikolov. 2018. Learning word vectors for 157 languages. In Proceedings of the International Conference on Language Resources and Evaluation (LREC 2018).
289
+ Guy Halawi, Gideon Dror, Evgeniy Gabrilovich, and Yehuda Koren. 2012. Large-scale learning of word relatedness with constraints. In Proceedings of the 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '12, page 1406-1414, New York, NY, USA. Association for Computing Machinery.
290
+ Zellig S. Harris. 1954. Distributional structure. <i>WORD</i>, 10(2-3):146-162.
291
+ Pengcheng He, Xiaodong Liu, Jianfeng Gao, and Weizhu Chen. 2021. Deberta: Decoding-enhanced bert with disentangled attention.
292
+ Aurelie Herbelot and Marco Baroni. 2017. High-risk learning: acquiring new word vectors from tiny data. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 304-309, Copenhagen, Denmark. Association for Computational Linguistics.
293
+
294
+ Felix Hill, Kyunghyun Cho, Anna Korhonen, and Yoshua Bengio. 2016. Learning to understand phrases by embedding the dictionary. Transactions of the Association for Computational Linguistics, 4:17-30.
295
+ Felix Hill, Roi Reichart, and Anna Korhonen. 2015. SimLex-999: Evaluating semantic models with (genuine) similarity estimation. Computational Linguistics, 41(4):665-695.
296
+ Ziniu Hu, Ting Chen, Kai-Wei Chang, and Yizhou Sun. 2019. Few-shot representation learning for out-of-vocabulary words. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 4102–4112, Florence, Italy. Association for Computational Linguistics.
297
+ Ozan Irsoy and Claire Cardie. 2014. Opinion mining with deep recurrent neural networks. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 720-728, Doha, Qatar. Association for Computational Linguistics.
298
+ Ganesh Jawahar, , Benoit Sagot, , and Djamé Seddah. 2019. What Does BERT Learn about the Structure of Language? In Proceedings of the Conference of the Association for Computational Linguistics, pages 3651-3657. Association for Computational Linguistics (ACL).
299
+ Nanjiang Jiang and Marie-Catherine de Marneffe. 2019a. Evaluating BERT for natural language inference: A case study on the CommitmentBank. 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 6086-6091, Hong Kong, China. Association for Computational Linguistics.
300
+ Nanjiang Jiang and Marie-Catherine de Marneffe. 2019b. Evaluating BERT for natural language inference: A case study on the CommitmentBank. 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 6086-6091, Hong Kong, China. Association for Computational Linguistics.
301
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2016. Bag of tricks for efficient text classification.
302
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2017. Bag of tricks for efficient text classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 427-431, Valencia, Spain. Association for Computational Linguistics.
303
+
304
+ Nal Kalchbrenner, Edward Grefenstette, and Phil Blun-som. 2014. A convolutional neural network for modelling sentences. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 655-665, Baltimore, Maryland. Association for Computational Linguistics.
305
+ Mikhail Khodak, Nikunj Saunshi, Yingyu Liang, Tengyu Ma, Brandon Stewart, and Sanjeev Arora. 2018. A la carte embedding: Cheap but effective induction of semantic feature vectors. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 12-22, Melbourne, Australia. Association for Computational Linguistics.
306
+ Karin Kipper, Hoa Trang Dang, Martha Palmer, et al. 2000. Class-based construction of a verb lexicon. AAAI/IAAI, 691:696.
307
+ Siwei Lai, Liheng Xu, Kang Liu, and Jun Zhao. 2015. Recurrent convolutional neural networks for text classification. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, AAAI'15, page 2267-2273. AAAI Press.
308
+ Juan J. Lastra-Díaz, Josu Goikoetxea, Mohamed Ali Hadj Taieb, Ana García-Serrano, Mohamed Ben Aouicha, and Eneko Agirre. 2019. A reproducible survey on word embeddings and ontology-based methods for word similarity: Linear combinations outperform the state of the art. Engineering Applications of Artificial Intelligence, 85:645-665.
309
+ Edward Loper and Steven Bird. 2002. Nltk: The natural language toolkit. CoRR, cs.CL/0205028.
310
+ Thang Luong, Richard Socher, and Christopher Manning. 2013. Better word representations with recursive neural networks for morphology. In Proceedings of the Seventeenth Conference on Computational Natural Language Learning, pages 104-113, Sofia, Bulgaria. Association for Computational Linguistics.
311
+ Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. 2014. The Stanford CoreNLP natural language processing toolkit. In Association for Computational Linguistics (ACL) System Demonstrations, pages 55-60.
312
+ R. Thomas McCoy, Ellie Pavlick, and Tal Linzen. 2019. Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference.
313
+ Alessio Miaschi, Dominique Brunato, Felice Dell'Orletta, and Giulia Venturi. 2020. Linguistic profiling of a neural language model.
314
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781.
315
+
316
+ George A Miller and Walter G Charles. 1991. Contextual correlates of semantic similarity. Language and cognitive processes, 6(1):1-28.
317
+ Jeff Mitchell and Mirella Lapata. 2008. Vector-based models of semantic composition. In Proceedings of ACL-08: HLT, pages 236-244, Columbus, Ohio. Association for Computational Linguistics.
318
+ Denis Paperno, Nghia The Pham, and Marco Baroni. 2014. A practical and linguistically-motivated approach to compositional distributional semantics. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 90-99, Baltimore, Maryland. Association for Computational Linguistics.
319
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. GloVe: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1532-1543, Doha, Qatar. Association for Computational Linguistics.
320
+ Mohammad Taher Pilehvar and Nigel Collier. 2017. Inducing embeddings for rare and unseen words by leveraging lexical resources. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers, pages 388-393, Valencia, Spain. Association for Computational Linguistics.
321
+ Victor Prokhorov, Mohammad Taher Pilehvar, Dimitri Kartsaklis, Pietro Lio, and Nigel Collier. 2019. Unseen word representation by aligning heterogeneous lexical semantic spaces. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6900-6907.
322
+ Roy Rada, Hafedh Mili, Ellen Bicknell, and Maria Blettner. 1989. Development and application of a metric on semantic nets. Systems, Man and Cybernetics, IEEE Transactions on, 19:17 - 30.
323
+ Kira Radinsky, Eugene Agichtein, Evgeniy Gabrilovich, and Shaul Markovitch. 2011. A word at a time: Computing word relatedness using temporal semantic analysis. pages 337-346.
324
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer.
325
+ Leonardo Ranaldi, Francesca Fallucchi, and Fabio Massimo Zanzotto. 2022. Dis-cover ai minds to preserve human knowledge. *Future Internet*, 14(1).
326
+ Philip Resnik. 1995. Using information content to evaluate semantic similarity in a taxonomy. arXiv preprint cmp-lg/9511007.
327
+ Herbert Rubenstein and John B Goodenough. 1965. Contextual correlates of synonymy. Communications of the ACM, 8(10):627-633.
328
+
329
+ Timo Schick and Hinrich Schütze. 2019. Attentive mimicking: Better word embeddings by attending to informative contexts. 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 489-494, Minneapolis, Minnesota. Association for Computational Linguistics.
330
+ Timo Schick and Hinrich Schütze. 2020. BERTRAM: Improved word embeddings have big impact on contextualized model performance. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3996-4007, Online. Association for Computational Linguistics.
331
+ Kai Sheng Tai, Richard Socher, and Christopher D. Manning. 2015. Improved semantic representations from tree-structured long short-term memory networks. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1556–1566, Beijing, China. Association for Computational Linguistics.
332
+ Julien Tissier, Christophe Gravier, and Amaury Habrard. 2017. Dict2vec : Learning word embeddings using lexical dictionaries. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 254-263, Copenhagen, Denmark. Association for Computational Linguistics.
333
+ Peter D. Turney and Patrick Pantel. 2010. From frequency to meaning: Vector space models of semantics. J. Artif. Int. Res., 37(1):141-188.
334
+ Ludwig Wittgenstein. 1953. Philosophical Investigations. Wiley-Blackwell.
335
+ Chien-Sheng Wu, Steven Hoi, Richard Socher, and Caiming Xiong. 2020. Tod-bert: Pre-trained natural language understanding for task-oriented dialogue.
336
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. 2016. Google's neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144.
337
+ Zhibiao Wu and Martha Palmer. 1994. Verb semantics and lexical selection. In 32nd Annual Meeting of the Association for Computational Linguistics, pages 133-138, Las Cruces, New Mexico, USA. Association for Computational Linguistics.
338
+ Dongqiang Yang and David Powers. 2006. Verb similarity on the taxonomy of wordnet. Proceedings of the 3rd International WordNet Conference (GWC), pages 121-128.
339
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. 2020. Xlnet: Generalized autoregressive pretraining for language understanding.
340
+
341
+ Fabio Massimo Zanzotto. 2019. Viewpoint: Human-in-the-loop Artificial Intelligence. J. Artif. Intell. Res., 64:243-252.
342
+ Fabio Massimo Zanzotto and Lorenzo Dell'Arciprete. 2011. Distributed structures and distributional meaning. In Proceedings of the Workshop on Distributional Semantics and Compositionality, pages 10-15, Portland, Oregon, USA. Association for Computational Linguistics.
343
+ Fabio Massimo Zanzotto, Ioannis Korkontzelos, Francesca Fallucchi, and Suresh Manandhar. 2010. Estimating linear models for compositional distributional semantics. In Proceedings of the 23rd International Conference on Computational Linguistics (Coling 2010), pages 1263-1271, Beijing, China. Coling 2010 Organizing Committee.
344
+ Y. Zhang. 2019. Bert for question answering on squad 2 . 0.
345
+ Yukun Zhu, Ryan Kiros, Richard S. Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. 2015. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. CoRR, abs/1506.06724.
lackingtheembeddingofawordlookitupintoatraditionaldictionary/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9998557a7f9e733262adff8935018475d065b4b2fc1a1311ed650ec675eb66cd
3
+ size 344510
lackingtheembeddingofawordlookitupintoatraditionaldictionary/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7ef4a80b64a6465ad8bff8904f389e30b8e95cbbd420f954b9b961c67eba087
3
+ size 451129
lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/191a2c0b-1c8d-4857-8c14-c187eeb11187_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff208a946647046dca897f79b2d2f5a85e5d743b921c99398932f9ab4f107fba
3
+ size 103846
lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/191a2c0b-1c8d-4857-8c14-c187eeb11187_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df6b46474aa64d8920d560c186eab946ec952ba6186dfa9b7ebd79e1db49e5aa
3
+ size 126104
lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/191a2c0b-1c8d-4857-8c14-c187eeb11187_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9c6d434f1058a2d65049f7c70af7fd38fc93a0baf60a4dc20f39bac561b6b01
3
+ size 1080997
lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/full.md ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LaPraDoR: Unsupervised Pretrained Dense Retriever for Zero-Shot Text Retrieval
2
+
3
+ Canwen Xu $^{1*}$ , Daya Guo $^{2*}$ , Nan Duan $^{3}$ , Julian McAuley $^{1}$
4
+
5
+ <sup>1</sup>University of California, San Diego, <sup>2</sup>Sun Yat-sen University, <sup>3</sup>Microsoft Research Asia
6
+
7
+ $^{1}\{\mathrm{cxu}, \mathrm{jmcauley}\} @\mathrm{ucsd.edu}, {}^{2}\mathrm{guody5@mail2.sysu.edu.cn}$
8
+
9
+ $^{3}$ nanduan@microsoft.com
10
+
11
+ # Abstract
12
+
13
+ In this paper, we propose LaPraDoR, a pretrained dual-tower dense retriever that does not require any supervised data for training. Specifically, we first present Iterative Contrastive Learning (ICoL) that iteratively trains the query and document encoders with a cache mechanism. ICoL not only enlarges the number of negative instances but also keeps representations of cached examples in the same hidden space. We then propose Lexicon-Enhanced Dense Retrieval (LEDR) as a simple yet effective way to enhance dense retrieval with lexical matching. We evaluate LaPraDoR on the recently proposed BEIR benchmark, including 18 datasets of 9 zero-shot text retrieval tasks. Experimental results show that LaPraDoR achieves state-of-the-art performance compared with supervised dense retrieval models, and further analysis reveals the effectiveness of our training strategy and objectives. Compared to re-ranking, our lexicon-enhanced approach can be run in milliseconds $(22.5\times$ faster) while achieving superior performance.
14
+
15
+ # 1 Introduction
16
+
17
+ Dense retrieval uses dense vectors to represent documents and retrieve documents by similarity scores between query vectors and document vectors. Different from cross-encoders (Reimers and Gurevych, 2019; Gao et al., 2020; MacAvaney et al., 2020) or late-interaction models (Khattab and Zaharia, 2020; Gao et al., 2021a), which predict a match score for each query-document pair thus are computationally costly, dense retrieval can be run in milliseconds, with the help of an approximate nearest neighbor (ANN) retrieval library, e.g., FAISS (Johnson et al., 2021).
18
+
19
+ As a drawback, dense retrieval models often require large supervised datasets like MS
20
+
21
+ MARCO (Nguyen et al., 2016) (533k training examples) or NQ (Kwiatkowski et al., 2019) (133k training examples) for training. Unfortunately, Thakur et al. (2021) empirically show that models trained on one dataset suffer from an out-of-domain (OOD) problem when transferring to another. This hinders the applications of dense retrieval systems. On the other hand, creating a large supervised training dataset for dense retrieval is time-consuming and expensive. For many low-resource languages, there is even no existing supervised dataset for retrieval and it can be extremely difficult to construct one.
22
+
23
+ The recently proposed BEIR benchmark (Thakur et al., 2021) highlights the generalization ability of text retrieval systems. The benchmark features a setting where models are trained on a large supervised dataset MS-MARCO (Nguyen et al., 2016) and then tested on 18 heterogeneous datasets of 9 tasks. In this paper, we propose Large-scale Pretrained Dense Zero-shot Retriever (LaPraDoR), a fully unsupervised pretrained retriever for zero-shot text retrieval. While existing dense retrievers need large supervised data and struggle to compete with a lexical matching approach like BM25 (Robertson and Zaragoza, 2009) for zero-shot retrieval, we take a different approach by complementing lexical matching with semantic matching. Without any supervised data, LaPraDoR outperforms all dense retrievers on BEIR. LaPraDoR achieves state-of-the-art performance on BEIR with a further fine-tuning, outperforming re-ranking, despite being $22.5 \times$ and $42 \times$ faster on GPU and CPU, respectively.
24
+
25
+ Training LaPraDoR faces two challenges: (1) Training Efficiency. For large-scale pretraining, training efficiency can be important. In contrastive learning, more negative instances often lead to better performance (Giorgi et al., 2021; Wu et al., 2020; Gao et al., 2021b). However, traditional in-batch negative sampling is bottlenecked by limited
26
+
27
+ GPU memory. To alleviate this problem, we propose Iterative Contrastive Learning (ICoL), which iteratively trains the query and document encoders with a cache mechanism. Compared to existing solutions MoCo (He et al., 2020) and xMoCo (Yang et al., 2021), ICoL does not introduce extra encoders and can solve the mismatching between representation spaces, thus demonstrating superior performance. (2) Versatility. There are different types of downstream tasks from various domains in both BEIR and real-world applications. We use a large-scale multi-domain corpus, C4 (Raffel et al., 2020), to train our LaPraDoR model. To make LaPraDoR versatile, besides conventional query-document retrieval, we also incorporate document-query, query-query, and document-document retrieval into the pretraining objective. We further share the weights between the query and document encoders and obtain an all-around encoder that fits all retrieval tasks.
28
+
29
+ To summarize, our contribution is three-fold: (1) We train LaPraDoR, an all-around unsupervised pretrained dense retriever that achieves state-of-the-art performance on the BEIR benchmark. (2) We propose Iterative Contrastive Learning (ICoL) for training a retrieval model effectively. (3) We propose Lexicon-Enhanced Dense Retrieval as an efficient way for combining BM25 with a dense retriever, compared to the widely-used re-ranking paradigm.
30
+
31
+ # 2 Related Work
32
+
33
+ Dense Retrieval DPR (Karpukhin et al., 2020) initializes a bi-encoder model with BERT (Devlin et al., 2019) and achieves better results than earlier dense retrieval methods. RocketQA (Qu et al., 2021) exploits a trained retriever to mine hard negatives and then re-train a retriever with the mined negatives. ANCE (Xiong et al., 2021) dynamically mines hard negatives throughout training but requires periodic encoding of the entire corpus. TAS-B (Hofstätter et al., 2021) is a bi-encoder trained with balanced topic-aware sampling and knowledge distillation from a cross-encoder and a ColBERT model (Khattab and Zaharia, 2020), in addition to in-batch negatives. xMoCo (Yang et al., 2021) adapt MoCo (He et al., 2020), a contrastive learning algorithm that is originally proposed for image representation, to text retrieval by doubling its fast and slow encoders. Although these dense retrieval systems demonstrate effectiveness on some
34
+
35
+ ![](images/de181feeb1e9ba1b5b5853ee123d000f899ce0eef284de697c4c14a22632c6f4.jpg)
36
+ Figure 1: Dual-tower architecture for text retrieval.
37
+
38
+ datasets, the BEIR benchmark (Thakur et al., 2021) highlights a main drawback of these dense retrieval systems - failure to generalize to out-of-domain data. This motivates pretraining as a solution for better domain generalization (Gururangan et al., 2020). Dense retrieval has also been applied in many other tasks (Guo et al., 2019, 2020).
39
+
40
+ Pretraining for Retrieval Lee et al. (2019) first propose to pretrain a bi-encoder retriever with an Inverse Cloze Task (ICT), which constructs a training pair by randomly selecting a sentence from a passage as the query and leaving the rest as the document. Chang et al. (2020) propose two pretraining tasks for Wikipedia and attempt to combine them with ICT and masked language modeling (MLM). Guu et al. (2020) pretrain a retriever and a reader together for end-to-end question answering (QA). Very recently, DPR-PAQ (Oğuz et al., 2021) highlight the importance of domain matching by using both synthetic and crawled QA data to pretrain and then fine-tune the model on downstream datasets for dialogue retrieval. Condenser (Gao and Callan, 2021a) is a new Transformer variant for MLM pretraining. It exploits an information bottleneck to facilitate learning for information aggregation. On top of that, coCondenser (Gao and Callan, 2021b) adds an unsupervised corpus-level contrastive loss to warm up the passage embedding space. Different from these works, LaPraDoR is the first pretrained retriever that does not require fine-tuning on a downstream dataset and can perform zero-shot retrieval.
41
+
42
+ # 3 Methodology
43
+
44
+ # 3.1 Dual-Tower Architecture
45
+
46
+ Two Encoders The dual-tower architecture, as illustrated in Figure 1, is widely used in dense retrieval systems (Lee et al., 2019; Karpukhin et al., 2020; Xiong et al., 2021). The dual-tower archi
47
+
48
+ tecture has a query encoder $E_{Q}$ and a document encoder $E_{D}$ , which in our work are both BERT-like bidirectional text encoders (Devlin et al., 2019). Compared with cross-attention models (Reimers and Gurevych, 2019; Gao et al., 2020; MacAvaney et al., 2020), the dual-tower architecture enables pre-indexing and fast approximate nearest neighbor search (to be detailed shortly), thus is popular in production.
49
+
50
+ Dense Representation Given an input document (query) $\pmb{x} = \{[\mathrm{CLS}], w_1, \dots, w_l, [\mathrm{SEP}]\}$ , we use a document (query) encoder $E_D(E_Q)$ to encode the input sequence into hidden states $h = \{v_{[\mathrm{CLS}]}, v_1, \dots, v_l, v_{[\mathrm{SEP}]\}\}$ , where $w_i$ is the $i$ -th token; [CLS] and [SEP] are special tokens that mark the start and end of a sentence, respectively. To obtain a dense representation, we use mean pooling over hidden states $h$ as the representation $h_x$ of the input $x$ . Some prior works (Lee et al., 2019; Chang et al., 2020; Karpukhin et al., 2020) use $v_{[\mathrm{CLS}]}$ as the representation for the input $x$ , but Huang et al. (2021) empirically find that applying mean pooling to hidden states $h$ outperforms taking $v_{[\mathrm{CLS}]}$ as the representation.
51
+
52
+ Similarity Function After obtaining the representation for both the query $q$ and the document $d$ , we use the cosine function as a similarity function to measure the similarity between them:
53
+
54
+ $$
55
+ \operatorname {s i m} (q, d) = \frac {E _ {Q} (q) \cdot E _ {D} (d)}{\| E _ {Q} (q) \| \| E _ {D} (d) \|} \tag {1}
56
+ $$
57
+
58
+ Approximate Nearest Neighbor In practice, for the dual-tower architecture, the documents are encoded offline and their dense representations can be pre-indexed by a fast vector similarity search library (e.g., FAISS, Johnson et al., 2021). The library can utilize GPU acceleration to perform approximate nearest neighbor (ANN) search in sublinear time with almost no loss in recall. Thus, compared to a cross-encoder (i.e., an encoder that accepts the concatenation of the query and every candidate document), a pre-indexed ANN-based retrieval system is at least 10 times faster (to be detailed in Section 4.2).
59
+
60
+ # 3.2 Constructing Positive Instances
61
+
62
+ In this section, we first introduce how we build the positive instances with two self-supervised tasks, namely Inverse Cloze Task (ICT) and Dropout as Positive Instance (DaPI).
63
+
64
+ Inverse Cloze Task (ICT) First introduced in Lee et al. (2019), ICT is an effective way to pretrain a text retrieval model (Chang et al., 2020). Given a passage $p$ consisting of sentences $p = \{s_1, \ldots, s_n\}$ , we randomly select a sentence $s_k$ as query $q$ and treat its context as document $d = \{s_1, \ldots, s_{k-1}, s_{k+1}, \ldots, s_n\}$ . ICT is designed to mimic a text retrieval task where a short query is used to retrieve a longer document which is semantically relevant. Also, unlike some pretraining tasks, e.g., Wiki Link Prediction or Body First Selection (Chang et al., 2020), ICT is fast and does not rely on a specific corpus format (e.g., Wikipedia) thus can be scaled to a large multi-source corpus (e.g., C4, Raffel et al., 2020).
65
+
66
+ Dropout as Positive Instance (DaPI) DaPI is originally proposed in SimCSE (Gao et al., 2021c) as a simple strategy for perturbing intermediate representations and thus can serve as data augmentation. A similar idea is also presented in Liu et al. (2021). We apply a dropout rate of 0.1 to the fully-connected layers and attention probabilities in the Transformer encoders, as in BERT (Devlin et al., 2019). The same input is fed to the encoder twice to obtain two representations, of which one is used as the positive instance of the other. Gao et al. (2021c) conduct experiments and conclude that the dropout strategy outperforms all commonly-used discrete perturbation techniques including cropping, word deletion, masked language modeling and synonym replacement. Note that different from SimCSE, we only calculate gradients for one of the two passes. In our experiments, we find that the addition of DaPI only increases the memory use by $2\%$ , since it mostly reuses the computational graph for the ICT objective.
67
+
68
+ # 3.3 Iterative Contrastive Learning
69
+
70
+ Previous studies (Giorgi et al., 2021; Wu et al., 2020; Gao et al., 2021b) show that the number of negative instances is critical to the performance of the model. Since the batch size on a single GPU is limited, we propose Iterative Contrastive Learning (ICoL) to mitigate the insufficient memory on a single GPU and allow more negative instances for better performance. We illustrate LaPraDoR training in Figure 2.
71
+
72
+ Iterative Training We iteratively train the query encoder and document encoder. To be specific, we
73
+
74
+ ![](images/1cbafbcff045ea5b31d3aa6d2186ca0445fc447dffd4b2ec28c7dacc9481cd0f.jpg)
75
+ (a) Query encoder training.
76
+
77
+ ![](images/0bf88820c94215c10614040fb82b63b554b488c25e2aa715b61a4e67a874f27a.jpg)
78
+ (b) Document encoder training.
79
+ Figure 2: Training of LaPraDoR with Iterative Contrastive Learning (ICoL). We iteratively train the query encoder and document encoder while freezing the other (marked with an ice cube icon). For $\mathcal{L}_{qd}$ and $\mathcal{L}_{dq}$ , we obtain additional negative instances from the cache queue. For each batch of data, we enqueue the representation encoded by the frozen encoder into the cache queue as future negative instances. The cache queue is cleared when switching the encoder to train from one to the other.
80
+
81
+ first arbitrarily select an encoder to start training. Here we assume to start with the query encoder $E_{Q}$ . The training loss consists of two terms. First, we calculate the loss for query-query retrieval with DaPI to optimize the negative log likelihood of the positive instance:
82
+
83
+ $$
84
+ \begin{array}{l} \mathcal {L} _ {q q} \left(q _ {i}, \left\{q _ {i} ^ {+}, q _ {i, 1} ^ {-}, \dots , q _ {i, n} ^ {-} \right\}\right) \\ = - \log \frac {e ^ {\operatorname {s i m} \left(q _ {i} , q _ {i} ^ {+}\right)}}{e ^ {\operatorname {s i m} \left(q _ {i} , q _ {i} ^ {+}\right)} + \sum_ {j = 1} ^ {n} e ^ {\operatorname {s i m} \left(q _ {i} , q _ {i , j} ^ {-}\right)}} \tag {2} \\ \end{array}
85
+ $$
86
+
87
+ where $q_{i}$ and $q_{i}^{+}$ are the same query that are encoded by $E_{Q}$ with different dropout masks; $\{q_{i,1}^{-},\dots,q_{i,n}^{-}\}$ is a set of randomly sampled negative instances; $\mathrm{sim}(\cdot ,\cdot)$ is the cosine similarity function defined in Equation 1.
88
+
89
+ The second term is to retrieve the corresponding document $d_{i}^{+}$ with the query $q_{i}$ , where $q_{i}$ and $d_{i}^{+}$ are a pair constructed with ICT. Similarly, we optimize the negative log likelihood of the positive instance by:
90
+
91
+ $$
92
+ \begin{array}{l} \mathcal {L} _ {q d} \left(q _ {i}, \left\{d _ {i} ^ {+}, d _ {i, 1} ^ {-}, \dots , d _ {i, n} ^ {-}, d _ {\mathcal {Q}, 1} ^ {-}, \dots , d _ {\mathcal {Q}, | \mathcal {Q} |} ^ {-} \right\}\right) \\ = - \log \frac {e ^ {\operatorname* {s i m} \left(q _ {i} , d _ {i} ^ {+}\right)}}{e ^ {\operatorname* {s i m} \left(q _ {i} , d _ {i} ^ {+}\right)} + \sum_ {j = 1} ^ {n} e ^ {\operatorname* {s i m} \left(q _ {i} , d _ {i , j} ^ {-}\right)}} + \sum_ {k = 1} ^ {| Q |} e ^ {\operatorname* {s i m} \left(q _ {i} , d _ {Q , k} ^ {-}\right)}} \tag {3} \\ \end{array}
93
+ $$
94
+
95
+ where $\{d_{i,1}^{-},\dots,d_{i,n}^{-}\}$ is a set of freshly sampled documents that are encoded at the current step $i$ ; $\{d_{\mathcal{Q},1}^{-},\dots,d_{\mathcal{Q},|\mathcal{Q}|}^{-}\}$ is a set of representations that are currently stored in the cache queue $\mathcal{Q}$ . Then, we optimize the sum of the two losses with a weight coefficient $\lambda$ :
96
+
97
+ $$
98
+ \mathcal {L} _ {q} = \mathcal {L} _ {q d} + \lambda \mathcal {L} _ {q q} \tag {4}
99
+ $$
100
+
101
+ Note that the query $q_{i}$ only needs to be encoded once and can be used for calculation of both $\mathcal{L}_{qd}$ and $\mathcal{L}_{qq}$ .
102
+
103
+ After a predefined number of steps, the $E_{Q}$ becomes frozen as the training for $E_{D}$ starts. Similarly, for $d_{i}$ , a document encoded by $E_{D}$ , we have the training objective:
104
+
105
+ $$
106
+ \begin{array}{l} \mathcal {L} _ {d d} \left(d _ {i}, \left\{d _ {i} ^ {+}, d _ {i, 1} ^ {-}, \dots , d _ {i, n} ^ {-} \right\}\right) \\ = - \log \frac {e ^ {\operatorname {s i m} \left(d _ {i} , d _ {i} ^ {+}\right)}}{e ^ {\operatorname {s i m} \left(d _ {i} , d _ {i} ^ {+}\right)} + \sum_ {j = 1} ^ {n} e ^ {\operatorname {s i m} \left(d _ {i} , d _ {i , j} ^ {-}\right)}} \tag {5} \\ \end{array}
107
+ $$
108
+
109
+ $$
110
+ \begin{array}{l} \mathcal {L} _ {d q} \left(d _ {i}, \left\{q _ {i} ^ {+}, q _ {i, 1} ^ {-}, \dots , q _ {i, n} ^ {-}, q _ {\mathcal {Q}, 1} ^ {-}, \dots , q _ {\mathcal {Q}, | \mathcal {Q} |} ^ {-} \right\}\right) \\ = - \log \frac {e ^ {\mathrm {s i m} \left(d _ {i} , q _ {i} ^ {+}\right)}}{e ^ {\mathrm {s i m} \left(d _ {i} , q _ {i} ^ {+}\right)} + \sum_ {j = 1} ^ {n} e ^ {\mathrm {s i m} \left(d _ {i} , q _ {i , j} ^ {-}\right)}} \\ + \sum_ {k = 1} ^ {| \mathcal {Q} |} e ^ {\operatorname {s i m} \left(d _ {i}, q _ {\mathcal {Q}, k} ^ {-}\right)} \tag {6} \\ \end{array}
111
+ $$
112
+
113
+ $$
114
+ \mathcal {L} _ {d} = \mathcal {L} _ {d q} + \lambda \mathcal {L} _ {d d} \tag {7}
115
+ $$
116
+
117
+ where $d_{i}^{+}$ and $q_{i}^{+}$ are positive instances constructed by DaPI and ICT, respectively; $\{d_{i,1}^{-},\ldots ,d_{i,n}^{-}\}$ is a set of randomly sampled document negatives; $\{q_{i,1}^{-},\dots ,q_{i,n}^{-}\}$ is a set of freshly sampled queries encoded at step $i$ . $\{q_{\mathcal{Q},1}^{-},\dots ,q_{\mathcal{Q},|\mathcal{Q}|}^{-}\}$ are the cached query representations. To speed up training, we apply the in-batch negatives technique (Yih et al., 2011; Henderson et al., 2017; Gillick et al., 2019) that can reuse computation and train $b$ queries/documents in a mini-batch simultaneously.
118
+
119
+ Cache Mechanism To enlarge the size of negative instances, we maintain a cache queue $\mathcal{Q}$ that
120
+
121
+ stores previously encoded representations that can serve as negative instances for the current step, extending an earlier study (Wu et al., 2018). Our cache queue is implemented as first-in-first-out (FIFO) with a maximum capacity $m$ , which is a hyperparameter set based on the GPU memory size. When training with multiple GPUs, $\mathcal{Q}$ can be shared across GPUs. Since the representations in the queue are encoded with a frozen encoder and thus do not require gradients, $m$ can be set large to supplement the numbers of negative instances. When $\mathcal{Q}$ is full, the earliest cached representations will be dequeued. When we switch the training from one encoder to the other, the queue will be cleared to ensure that all representations in $\mathcal{Q}$ lie in the same hidden space and are encoded with the currently frozen encoder.
122
+
123
+ ICoL vs. MoCo Previously, similar to our method, MoCo (He et al., 2020) exploits a queue for storing encoded representations. Specifically, MoCo consists of a slow encoder and a fast encoder to encode queries and documents, respectively. The slow encoder is updated as a slow moving average of the fast encoder to reduce inconsistency of encoded document representations between training steps. A queue is maintained to allow the encoded document representations to be reused in later steps as negative instances.
124
+
125
+ However, we argue there are two limitations that make MoCo not ideal for training a text retrieval model: (1) As pointed out by Yang et al. (2021), unlike the image matching task in the original paper of MoCo, in text retrieval, the queries and documents are distinct from each other thus not interchangeable. Yang et al. (2021) propose xMoCo, which incorporates two sets of slow and fast encoders, as a simple fix for this flaw. (2) The cached representations are in different hidden spaces. Although the fast encoders in both MoCo and xMoCo are updated with momentum, the already-encoded representations in the queue will never be updated. This creates a semantic mismatch between newly encoded and cached old representations and creates noise during training. In ICoL, all representations used for contrastive learning are aligned in the same hidden space. Besides, ICoL is more flexible than xMoCo since it does not introduce additional fast encoders and even the weights of its query encoder and document encoder can be shared. We conduct experiments to compare ICoL with MoCo and xMoCo in Section 4.2.1.
126
+
127
+ # 3.4 Lexicon-Enhanced Dense Retrieval
128
+
129
+ Although dense retrieval achieves state-of-the-art performance, its performance significantly degenerates on out-of-domain data (Thakur et al., 2021). On the other hand, BM25 (Robertson and Zaragoza, 2009) demonstrates good performance without training. Early attempts at combining lexical match with dense retrieval often formulate it to a re-ranking task (Nguyen et al., 2016). First, BM25 is used to recall the top- $k$ documents from the corpus. Then, a cross-encoder is applied to further re-rank candidate documents. Recently, COIL (Gao et al., 2021a) highlights the importance of lexical match and incorporates exact lexical matching into dense retrieval. Different from these works, we propose a fast and effective way, namely Lexicon-Enhanced Dense Retrieval (LEDR) to enhance dense retrieval with BM25. The similarity score of BM25 is defined as:
130
+
131
+ $$
132
+ \begin{array}{l} \operatorname {B M 2 5} (q, d) = \sum_ {t \in q \cap d} \operatorname {I D F} (t) h _ {q} (q, t) h _ {d} (d, t) \\ h _ {q} (q, t) = \frac {\mathrm {T F} _ {t , q} \left(1 + k _ {2}\right)}{\mathrm {T F} _ {t , q} + k _ {2}} \\ h _ {d} (d, t) = \frac {\mathrm {T F} _ {t , d} \left(1 + k _ {1}\right)}{\mathrm {T F} _ {t , d} + k _ {1} \left(1 - b + b \frac {| d |}{\mathrm {a v g d l}}\right)} \tag {8} \\ \end{array}
133
+ $$
134
+
135
+ where $\mathrm{TF}_{t,d}$ and $\mathrm{TF}_{t,q}$ refer to term frequency of term $t$ in document $d$ and query $q$ , respectively; $\mathrm{IDF}(t)$ is the inverse document frequency; $b$ , $k_{1}$ and $k_{2}$ are hyperparameters. For inference, we simply multiply the BM25 score with the similarity score for dense retrieval:
136
+
137
+ $$
138
+ \operatorname {s c o r e} (q, d) = \sin (q, d) \times \operatorname {B M 2 5} (q, d) \tag {9}
139
+ $$
140
+
141
+ In this way, we consider both lexical and semantic matching. This combination makes LaPraDoR more robust on unseen data in zero-shot learning.
142
+
143
+ # 4 Experiments
144
+
145
+ # 4.1 Experimental Setting
146
+
147
+ Benchmark We use BEIR (Thakur et al., 2021), a recently released benchmark for zero-shot evaluation of information retrieval models. BEIR includes 18 heterogeneous datasets, focusing on evaluating a retrieval system that works across different domains (bio-medical, scientific, news, social media, etc.). The benchmark uses Normalized Discounted Cumulative Gain (nDCG) (Järvelin and Kekäläinen, 2002) as the evaluation metric, which is a measure
148
+
149
+ <table><tr><td rowspan="2" colspan="2">Model</td><td colspan="4">Dense Retrieval</td><td>Lexical</td><td>Late Interaction</td><td>Re-ranking</td><td colspan="2">Lexicon-Enhanced Dense</td></tr><tr><td>DPR</td><td>ANCE</td><td>GenQ</td><td>TAS-B</td><td>BM25†</td><td>ColBERT</td><td>BM25 + CE</td><td>LaPraDoR†</td><td>LaPraDoR FT</td></tr><tr><td rowspan="2">Encoding Speed</td><td>Qry/s (GPU/CPU)</td><td>4000/170</td><td>4000/170</td><td>4000/170</td><td>7000/350</td><td>-</td><td>4000/170</td><td>7000/350</td><td>7000/350</td><td>7000/350</td></tr><tr><td>Doc/s (GPU/CPU)</td><td>540/30</td><td>540/30</td><td>540/30</td><td>1100/70</td><td>-</td><td>540/30</td><td>1100/70</td><td>1100/70</td><td>1100/70</td></tr><tr><td>Index size</td><td></td><td>3 GB</td><td>3 GB</td><td>3 GB</td><td>3 GB</td><td>0.4 GB</td><td>20 GB</td><td>0.4 GB</td><td>3.4 GB</td><td>3.4 GB</td></tr><tr><td rowspan="2">Retrieval Latency</td><td>GPU</td><td>19 ms</td><td>20 ms</td><td>14 ms</td><td>14 ms</td><td>-</td><td>350 ms</td><td>450 ms</td><td>20 ms</td><td>20 ms</td></tr><tr><td>CPU</td><td>230 ms</td><td>275 ms</td><td>125 ms</td><td>125 ms</td><td>20 ms</td><td>-</td><td>6100 ms</td><td>145 ms</td><td>145 ms</td></tr><tr><td>MS-MARCO</td><td>nDCG@10</td><td>0.177</td><td>0.388</td><td>0.408</td><td>0.408</td><td>0.228</td><td>0.401</td><td>0.413</td><td>0.262</td><td>0.366</td></tr><tr><td rowspan="19">Zero-shot (nDCG@10)</td><td>TREC-COVID</td><td>0.332</td><td>0.654</td><td>0.619</td><td>0.481</td><td>0.656</td><td>0.677</td><td>0.757</td><td>0.728</td><td>0.779</td></tr><tr><td>BIOASQ</td><td>0.127</td><td>0.306</td><td>0.398</td><td>0.383</td><td>0.465</td><td>0.474</td><td>0.523</td><td>0.500</td><td>0.511</td></tr><tr><td>NFCorpus</td><td>0.189</td><td>0.237</td><td>0.319</td><td>0.319</td><td>0.325</td><td>0.305</td><td>0.350</td><td>0.346</td><td>0.347</td></tr><tr><td>NQ</td><td>0.474</td><td>0.446</td><td>0.358</td><td>0.463</td><td>0.329</td><td>0.524</td><td>0.533</td><td>0.359</td><td>0.479</td></tr><tr><td>HotpotQA</td><td>0.391</td><td>0.456</td><td>0.534</td><td>0.584</td><td>0.603</td><td>0.593</td><td>0.707</td><td>0.625</td><td>0.666</td></tr><tr><td>FiQA</td><td>0.112</td><td>0.295</td><td>0.308</td><td>0.300</td><td>0.236</td><td>0.317</td><td>0.347</td><td>0.317</td><td>0.343</td></tr><tr><td>Signal-1M</td><td>0.155</td><td>0.249</td><td>0.281</td><td>0.289</td><td>0.330</td><td>0.274</td><td>0.338</td><td>0.343</td><td>0.344</td></tr><tr><td>TREC-NEWS</td><td>0.161</td><td>0.382</td><td>0.396</td><td>0.377</td><td>0.398</td><td>0.393</td><td>0.431</td><td>0.470</td><td>0.480</td></tr><tr><td>Robust04</td><td>0.252</td><td>0.392</td><td>0.362</td><td>0.427</td><td>0.408</td><td>0.391</td><td>0.475</td><td>0.490</td><td>0.484</td></tr><tr><td>ArguAna</td><td>0.175</td><td>0.415</td><td>0.493</td><td>0.429</td><td>0.315</td><td>0.232</td><td>0.311</td><td>0.507</td><td>0.508</td></tr><tr><td>Touche-2020</td><td>0.131</td><td>0.240</td><td>0.182</td><td>0.162</td><td>0.367</td><td>0.202</td><td>0.271</td><td>0.322</td><td>0.333</td></tr><tr><td>CQADupStack</td><td>0.153</td><td>0.296</td><td>0.347</td><td>0.314</td><td>0.299</td><td>0.350</td><td>0.370</td><td>0.222</td><td>0.290</td></tr><tr><td>Quora</td><td>0.248</td><td>0.852</td><td>0.830</td><td>0.835</td><td>0.789</td><td>0.854</td><td>0.825</td><td>0.863</td><td>0.875</td></tr><tr><td>DBPedia</td><td>0.263</td><td>0.281</td><td>0.328</td><td>0.384</td><td>0.313</td><td>0.392</td><td>0.409</td><td>0.361</td><td>0.391</td></tr><tr><td>SCIDOCS</td><td>0.077</td><td>0.122</td><td>0.143</td><td>0.149</td><td>0.158</td><td>0.145</td><td>0.166</td><td>0.185</td><td>0.184</td></tr><tr><td>FEVER</td><td>0.562</td><td>0.669</td><td>0.669</td><td>0.700</td><td>0.753</td><td>0.771</td><td>0.819</td><td>0.671</td><td>0.763</td></tr><tr><td>Climate-FEVER</td><td>0.148</td><td>0.198</td><td>0.175</td><td>0.228</td><td>0.213</td><td>0.184</td><td>0.253</td><td>0.228</td><td>0.261</td></tr><tr><td>SciFact</td><td>0.318</td><td>0.507</td><td>0.644</td><td>0.643</td><td>0.665</td><td>0.671</td><td>0.688</td><td>0.697</td><td>0.687</td></tr><tr><td>Avg.</td><td>0.237</td><td>0.389</td><td>0.410</td><td>0.415</td><td>0.423</td><td>0.431</td><td>0.476</td><td>0.457</td><td>0.485</td></tr></table>
150
+
151
+ Table 1: Experimental results on the BEIR benchmark (Thakur et al., 2021). The estimated average retrieval latency and index sizes are for a single query in DBPedia. The encoding speed is reported on a 8-core Intel Xeon Platinum 8168 CPU @ 2.70GHz and a single Nvidia V100 GPU, respectively. "LaPraDoR FT" is a LaPraDoR model fine-tuned on MS-MARCO with the official BEIR training script. $^\dagger$ Unsupervised method.
152
+
153
+ of ranking quality and often used to measure effectiveness of search algorithms or retrieval models. Details of the BEIR benchmark and the evaluation metric are included in Appendix A.
154
+
155
+ Model Settings In our preliminary experiments on Wikipedia (see Table 2), we find that sharing weights between the query encoder $E_{Q}$ and document encoder $E_{D}$ has no negative effect on downstream performance. For weight sharing between $E_{Q}$ and $E_{D}$ , we simply copy the weights of $E_{Q}$ to $E_{D}$ when switching to training of $E_{D}$ , vice versa. This design eliminates nearly half of the parameters. An additional benefit is that weight sharing makes the encoder versatile to handle not only query-document retrieval, but also query-query and document-document retrieval.
156
+
157
+ In our preliminary experiments on Wikipedia, we observed a diminishing return when increasing the model size from 6 layers to 12 layers, or 24 layers. Thus, we initialize our encoder with the 6-layer DistilBERT (Sanh et al., 2019), which has $\sim 67\mathrm{M}$ parameters. For BM25, we use the implementation and default settings of Elastic Search<sup>3</sup>. BM25 scores after the top 1,000 retrieved text are
158
+
159
+ set to 0 to save computation.
160
+
161
+ Training Details For pretraining, we optimize the model with the AdamW optimizer with a learning rate of 2e-4. The model is trained with 16 Nvidia V100 32GB GPUs with FP16 mixed precision training. The batch size for each GPU is set to 256. The maximum lengths set for queries and documents are 64 and 350, respectively. Training switches between $E_{Q}$ and $E_{D}$ every 100 steps. The cache queue has a maximum capacity $m$ of 100k. The loss weight hyperparameter $\lambda$ is fixed to 1. For our main results, we train LaPraDoR on C4 (Raffel et al., 2020) for 1M steps, which takes about 400 hours. For the ablation study, since training on C4 is very costly, we train LaPraDoR on Wikipedia for 100k steps. When calculating the loss, we apply a re-scaling trick of multiplying the cosine similarity score by 20 for better optimization (Thakur et al., 2021). Our implementation of LaPraDoR is based on Hugging Face Transformers (Wolf et al., 2020) and Datasets (Lhoest et al., 2021).
162
+
163
+ We test LaPraDoR under two settings: (1) No supervised data at all. We directly use the pretrained model for zero-shot retrieval on BEIR. (2) Fine
164
+
165
+ <table><tr><td colspan="2">Model</td><td>In-Batch (shared)</td><td>MoCo</td><td>xMoCo</td><td>ICoL</td><td>ICoL (shared)</td></tr><tr><td colspan="2">#Encoder</td><td>1</td><td>2</td><td>4</td><td>2</td><td>1</td></tr><tr><td>MS-MARCO</td><td>nDCG@10</td><td>0.255</td><td>0.222</td><td>0.255</td><td>0.255</td><td>0.262</td></tr><tr><td rowspan="19">Zero-shot (nDCG@10)</td><td>TREC-COVID</td><td>0.705</td><td>0.537</td><td>0.724</td><td>0.706</td><td>0.710</td></tr><tr><td>BIOASQ</td><td>0.451</td><td>0.260</td><td>0.423</td><td>0.468</td><td>0.459</td></tr><tr><td>NFCorpus</td><td>0.315</td><td>0.271</td><td>0.312</td><td>0.317</td><td>0.314</td></tr><tr><td>NQ</td><td>0.332</td><td>0.279</td><td>0.355</td><td>0.355</td><td>0.351</td></tr><tr><td>HotpotQA</td><td>0.599</td><td>0.552</td><td>0.584</td><td>0.598</td><td>0.610</td></tr><tr><td>FiQA</td><td>0.213</td><td>0.156</td><td>0.242</td><td>0.256</td><td>0.251</td></tr><tr><td>Signal-1M</td><td>0.329</td><td>0.307</td><td>0.323</td><td>0.327</td><td>0.335</td></tr><tr><td>TREC-NEWS</td><td>0.441</td><td>0.405</td><td>0.441</td><td>0.444</td><td>0.445</td></tr><tr><td>Robust04</td><td>0.419</td><td>0.439</td><td>0.439</td><td>0.465</td><td>0.470</td></tr><tr><td>ArguAna</td><td>0.477</td><td>0.465</td><td>0.491</td><td>0.496</td><td>0.503</td></tr><tr><td>Touche-2020</td><td>0.302</td><td>0.261</td><td>0.330</td><td>0.331</td><td>0.328</td></tr><tr><td>CQADupStack</td><td>0.109</td><td>0.052</td><td>0.118</td><td>0.132</td><td>0.140</td></tr><tr><td>Quora</td><td>0.832</td><td>0.834</td><td>0.822</td><td>0.828</td><td>0.839</td></tr><tr><td>DBPedia</td><td>0.349</td><td>0.318</td><td>0.359</td><td>0.374</td><td>0.364</td></tr><tr><td>SCIDOCS</td><td>0.173</td><td>0.154</td><td>0.170</td><td>0.173</td><td>0.178</td></tr><tr><td>FEVER</td><td>0.537</td><td>0.540</td><td>0.651</td><td>0.686</td><td>0.653</td></tr><tr><td>Climate-FEVER</td><td>0.206</td><td>0.183</td><td>0.244</td><td>0.242</td><td>0.242</td></tr><tr><td>SciFact</td><td>0.660</td><td>0.659</td><td>0.667</td><td>0.683</td><td>0.689</td></tr><tr><td>Avg.</td><td>0.414</td><td>0.371</td><td>0.428</td><td>0.438</td><td>0.438</td></tr></table>
166
+
167
+ tuning on MS-MARCO (Nguyen et al., 2016) and zero-shot transfer to the other datasets. This is the original setting for BEIR. We use BEIR's official script<sup>5</sup> to fine-tune LaPraDoR. The batch size is set to 75 per GPU and the learning rate is 2e-5.
168
+
169
+ Baselines For dense retrieval, we compare our model to the dual-tower models: DPR (Karpukhin et al., 2020), ANCE (Xiong et al., 2021), TAS-B (Hofstätter et al., 2021) and GenQ (Thakur et al., 2021). For lexical matching, we use the BM25 results reported in Thakur et al. (2021). We also consider a late interaction baseline ColBERT (Khattab and Zaharia, 2020). The model computes multiple contextualized embeddings for each token of queries and documents, and then maximizes a similarity function to retrieve relevant documents. For re-ranking, we use the BM25+CE baseline implemented in Thakur et al. (2021) that uses BM25 to retrieve top-100 documents and a cross-encoder model to further re-rank. As shown in Table 1, the latency for both lexical and dense retrieval is low whereas re-ranking introduces significantly higher latency, with late-interaction in-between. Details of the baselines can be found in Appendix B.
170
+
171
+ # 4.2 Experimental Results
172
+
173
+ We list the results of LaPraDoR on the BEIR benchmark in Table 1. Our model achieves state-of-the-art performance on BEIR to date (November 15, 2021). Without any supervised data, LaPraDoR
174
+
175
+ Table 2: Comparison of different methods for contrastive learning. The models are trained on Wikipedia.
176
+
177
+ <table><tr><td rowspan="2">Model</td><td colspan="2">LaPraDoR</td><td colspan="4">LaPraDoR FT</td></tr><tr><td>Full</td><td>w/o LEDR</td><td>Full</td><td>w/o LEDR</td><td>w/o PT</td><td>w/o LEDR &amp; PT</td></tr><tr><td>TREC-COVID</td><td>0.728</td><td>0.227</td><td>0.779</td><td>0.492</td><td>0.735</td><td>0.482</td></tr><tr><td>BIOASQ</td><td>0.500</td><td>0.205</td><td>0.511</td><td>0.308</td><td>0.489</td><td>0.281</td></tr><tr><td>NFCorpus</td><td>0.346</td><td>0.311</td><td>0.347</td><td>0.335</td><td>0.323</td><td>0.267</td></tr><tr><td>NQ</td><td>0.359</td><td>0.181</td><td>0.479</td><td>0.473</td><td>0.454</td><td>0.443</td></tr><tr><td>HotpotQA</td><td>0.625</td><td>0.303</td><td>0.666</td><td>0.495</td><td>0.642</td><td>0.484</td></tr><tr><td>FiQA</td><td>0.317</td><td>0.203</td><td>0.343</td><td>0.314</td><td>0.308</td><td>0.245</td></tr><tr><td>Signal-1M</td><td>0.343</td><td>0.186</td><td>0.344</td><td>0.231</td><td>0.354</td><td>0.247</td></tr><tr><td>TREC-NEWS</td><td>0.470</td><td>0.345</td><td>0.480</td><td>0.374</td><td>0.449</td><td>0.350</td></tr><tr><td>Robust04</td><td>0.490</td><td>0.319</td><td>0.484</td><td>0.368</td><td>0.459</td><td>0.332</td></tr><tr><td>ArguAna</td><td>0.507</td><td>0.459</td><td>0.508</td><td>0.469</td><td>0.495</td><td>0.412</td></tr><tr><td>Touche-2020</td><td>0.322</td><td>0.094</td><td>0.333</td><td>0.182</td><td>0.346</td><td>0.156</td></tr><tr><td>CQADupStack</td><td>0.222</td><td>0.220</td><td>0.290</td><td>0.288</td><td>0.306</td><td>0.250</td></tr><tr><td>Quora</td><td>0.863</td><td>0.787</td><td>0.875</td><td>0.847</td><td>0.867</td><td>0.840</td></tr><tr><td>DBPedia</td><td>0.361</td><td>0.250</td><td>0.391</td><td>0.338</td><td>0.384</td><td>0.303</td></tr><tr><td>SCIDOCS</td><td>0.185</td><td>0.133</td><td>0.184</td><td>0.155</td><td>0.173</td><td>0.127</td></tr><tr><td>FEVER</td><td>0.671</td><td>0.368</td><td>0.763</td><td>0.646</td><td>0.750</td><td>0.664</td></tr><tr><td>Climate-FEVER</td><td>0.228</td><td>0.138</td><td>0.261</td><td>0.209</td><td>0.247</td><td>0.206</td></tr><tr><td>SciFact</td><td>0.697</td><td>0.555</td><td>0.687</td><td>0.599</td><td>0.678</td><td>0.529</td></tr><tr><td>Avg.</td><td>0.457</td><td>0.294</td><td>0.485</td><td>0.396</td><td>0.470</td><td>0.368</td></tr></table>
178
+
179
+ Table 3: Effect of pretraining (PT) and Lexicon-Enhanced Dense Retrieval (LEDR). Pretraining is on C4. The results of "w/o PT" directly use DistilBERT (Sanh et al., 2019) for fine-tuning, which is also used to initialize our model.
180
+
181
+ outperforms the previous state-of-the-art for zero-shot dense retrieval, TAS-B (Hofstätter et al., 2021), on 13 tasks (out of 18) of BEIR with an average advantage of 0.042, though TAS-B applies additional query clustering and knowledge distillation. When further fine-tuned on MS-MARCO, LaPraDoR can outperform all baselines, including late interaction and re-ranking, whose latency on GPU is $17.5 \times$ and $22.5 \times$ higher than our method. Compared to dense retrieval, we only add 0.4 GB of BM25 indices and almost no additional latency.
182
+
183
+ # 4.2.1 Effect of Iterative Contrastive Learning
184
+
185
+ We set a baseline that only uses in-batch negatives and compare our proposed Iterative Contrastive Learning (ICoL) to MoCo (He et al., 2020) and xMoCo (Yang et al., 2021) for training LaPraDoR on Wikipedia in Table 2. The aforementioned two flaws of MoCo hinder its performance and lead to a performance drop instead of an improvement. In contrast, our ICoL approach outperforms the in-batch baseline on all datasets. It also beats the competitive MoCo variant for text retrieval, xMoCo, on 15 out of 18 tasks. ICoL only uses two encoders (which can be further shared) which can alleviate the GPU memory problem and thus can fit more in-batch negatives. Meanwhile, MoCo uses two encoders and xMoCo uses four (two sets of MoCo's encoders). Moreover, we observe no performance drop on average if we share the encoder between query and document (as we do when training LaPraDoR on C4). Thus, we can eliminate half of the parameters by simply sharing the encoder.
186
+
187
+ <table><tr><td>Model</td><td>LaPraDoR</td><td>w/o DaPI</td><td>w/o ICT</td></tr><tr><td>TREC-COVID</td><td>0.710</td><td>0.714</td><td>0.612</td></tr><tr><td>BIOASQ</td><td>0.459</td><td>0.457</td><td>0.270</td></tr><tr><td>NFCorpus</td><td>0.314</td><td>0.316</td><td>0.257</td></tr><tr><td>NQ</td><td>0.351</td><td>0.353</td><td>0.221</td></tr><tr><td>HotpotQA</td><td>0.610</td><td>0.608</td><td>0.431</td></tr><tr><td>FiQA</td><td>0.251</td><td>0.247</td><td>0.145</td></tr><tr><td>Signal-1M</td><td>0.335</td><td>0.330</td><td>0.306</td></tr><tr><td>TREC-NEWS</td><td>0.445</td><td>0.448</td><td>0.336</td></tr><tr><td>Robust04</td><td>0.470</td><td>0.458</td><td>0.307</td></tr><tr><td>ArguAna</td><td>0.503</td><td>0.497</td><td>0.389</td></tr><tr><td>Touche-2020</td><td>0.328</td><td>0.310</td><td>0.248</td></tr><tr><td>CQADupStack</td><td>0.140</td><td>0.137</td><td>0.064</td></tr><tr><td>Quora</td><td>0.839</td><td>0.839</td><td>0.774</td></tr><tr><td>DBPedia</td><td>0.364</td><td>0.363</td><td>0.242</td></tr><tr><td>SCIDOCS</td><td>0.178</td><td>0.173</td><td>0.113</td></tr><tr><td>FEVER</td><td>0.653</td><td>0.639</td><td>0.376</td></tr><tr><td>Climate-FEVER</td><td>0.242</td><td>0.231</td><td>0.118</td></tr><tr><td>SciFact</td><td>0.689</td><td>0.690</td><td>0.533</td></tr><tr><td>Avg.</td><td>0.438</td><td>0.434</td><td>0.319</td></tr></table>
188
+
189
+ Table 4: Effect of ICT and DaPI in the loss function. The "w/o ICT" variant is equal to the original SimCSE approach (Gao et al., 2021c). The pretraining is on Wikipedia.
190
+
191
+ # 4.2.2 Effect of Pretraining and Lexicon-Enhanced Dense Retrieval
192
+
193
+ We conduct an ablation study for both pretraining and Lexicon-Enhanced Dense Retrieval to verify the effectiveness of these designs. As shown in Table 3, Lexicon-Enhanced Dense Retrieval (LEDR) improves performance of dense retrieval on most tasks for both fully unsupervised and fine-tuned LaPraDoR. Furthermore, as illustrated in Table 4, we test the effectiveness of the two components in our loss function. We can see that both ICT and DaPI significantly contribute to the performance of our model $(p < 0.01)$ while ICT has a large impact on the final performance.
194
+
195
+ # 4.3 Case Study
196
+
197
+ We conduct a case study to intuitively demonstrate the effectiveness of LaPraDoR. As shown in Figure 3, for Q1, the lexical method (i.e., BM25) can successfully find the corresponding document in its top-2 retrieved results. However, due to lower lexical overlap, the score of the ground truth is lower than that of the first document. Although the phrase "prepare for his departure" in the first document indicates that Aeneas has not left Carchage yet and provides strong evidence that this document is incorrect, BM25 fails to correctly rank the ground truth due to its lack of ability in semantic matching. By incorporating both lexical and semantic matching, LaPraDoR can successfully retrieve the ground truth.
198
+
199
+ ![](images/0598c626d5cb7206363bcce4592b4507294413f6907facb2a41817065ca7225e.jpg)
200
+ Figure 3: Examples from the NQ dataset (Kwiatkowski et al., 2019). The key clues are highlighted.
201
+
202
+ For Q2, with the powerful semantic matching, LaPraDoR successfully retrieves the ground truth whereas BM25 fails to distinguish among the documents that contain both the keywords Mars and Sun. On the other hand, after removing lexical matching, LaPraDoR without LEDR suffers from noise: the key entity Sun does not appear in its top-1 retrieved document. LEDR helps filter out such noise and allows the dense retriever to focus on fine-grained semantic matching. Please find more cases from other datasets on Appendix C.
203
+
204
+ # 5 Conclusion and Future Work
205
+
206
+ In this paper, we introduce LaPraDoR, an unsupervised pretrained dense retriever that achieves state-of-the-art performance on the zero-shot text retrieval benchmark BEIR. We propose Iterative Contrastive Learning (ICoL) for efficiently training LaPraDoR and Lexicon-Enhanced Dense Retrieval (LEDR) to combine lexical matching with LaPraDoR. Our experiments verify the effectiveness of both ICoL and LEDR, shedding light on a new paradigm for unsupervised text retrieval. For future work, we plan to extend unsupervised LaPraDoR to multilingual and multi-modal retrieval.
207
+
208
+ # Broader Impact
209
+
210
+ Ethical Concerns LaPraDoR is trained with web-crawled data, which may contain inappropriate content. However, due to the nature of text retrieval, our retriever has lower ethical risk compared to a generative auto-regressive language model (Bender et al., 2021). Meanwhile, our unsupervised retrieval model enables high-performance text retrieval for low-resource languages where there is no supervised query-document dataset. This contributes to equality and diversity of language technology.
211
+
212
+ Carbon Footprint To conduct all experiments in this paper, we estimate to have consumed 3,840 kWh of electricity and emitted $1,420.8\mathrm{kg}$ (3,132.3 lbs) of $\mathrm{CO}_{2}$ . All emitted carbon dioxide has already been offset by the cloud service provider.
213
+
214
+ # Acknowledgments
215
+
216
+ We would like to thank the anonymous reviewers for their insightful comments. We would like to thank the authors of BEIR (Thakur et al., 2021), Nandan Thakur and Nils Reimers, for their support. Canwen wants to thank Minghua Liu's Labrador, Jojo, for the inspiration to name this paper. This project is partly supported by NSF Award #1750063.
217
+
218
+ # References
219
+
220
+ J Allan. 2004. Overview of the trec 2004 robust retrieval track. In TREC, volume 13.
221
+ Petr Baudis and Jan Sedivý. 2015. Modeling of the question answering task in the yodaqa system. In CLEF, volume 9283 of Lecture Notes in Computer Science, pages 222-228. Springer.
222
+ Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the dangers of stochastic parrots: Can language models be too big? In FAccT, pages 610-623. ACM.
223
+ Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on freebase from question-answer pairs. In EMNLP, pages 1533-1544. ACL.
224
+ Alexander Bondarenko, Maik Frobe, Meriem Beloucif, Lukas Gienapp, Yamen Ajjour, Alexander Panchenko, Chris Biemann, Benno Stein, Henning Wachsmuth, Martin Potthast, and Matthias Hagen. 2020. Overview of Touché 2020: Argument Retrieval. In Working Notes Papers of the CLEF 2020 Evaluation Labs, volume 2696 of CEUR Workshop Proceedings.
225
+
226
+ Vera Boteva, Demian Gholipour Ghalandari, Artem Sokolov, and Stefan Riezler. 2016. A full-text learning to rank dataset for medical information retrieval. In ECIR, volume 9626 of Lecture Notes in Computer Science, pages 716-722. Springer.
227
+ Wei-Cheng Chang, Felix X. Yu, Yin-Wen Chang, Yiming Yang, and Sanjiv Kumar. 2020. Pre-training tasks for embedding-based large-scale retrieval. In ICLR. OpenReview.net.
228
+ Arman Cohan, Sergey Feldman, Iz Beltagy, Doug Downey, and Daniel S. Weld. 2020. SPECTER: document-level representation learning using citation-informed transformers. In ACL, pages 2270-2282. Association for Computational Linguistics.
229
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL-HLT*, pages 4171–4186. Association for Computational Linguistics.
230
+ Thomas Diggelmann, Jordan Boyd-Graber, Jannis Bulian, Massimiliano Ciaramita, and Markus Leippold. 2020. Climate-fever: A dataset for verification of real-world climate claims.
231
+ Luyu Gao and Jamie Callan. 2021a. Condenser: a pre-training architecture for dense retrieval. arXiv preprint arXiv:2104.08253.
232
+ Luyu Gao and Jamie Callan. 2021b. Unsupervised corpus aware language model pre-training for dense passage retrieval. arXiv preprint arXiv:2108.05540.
233
+ Luyu Gao, Zhuyun Dai, and Jamie Callan. 2020. Modularized transformer-based ranking framework. In EMNLP, pages 4180-4190. Association for Computational Linguistics.
234
+ Luyu Gao, Zhuyun Dai, and Jamie Callan. 2021a. COIL: revisit exact lexical match in information retrieval with contextualized inverted list. In *NAACL-HLT*, pages 3030–3042. Association for Computational Linguistics.
235
+ Luyu Gao, Yunyi Zhang, Jiawei Han, and Jamie Callan. 2021b. Scaling deep contrastive learning batch size under memory limited setup. In The 6th Workshop on Representation Learning for NLP (RepL4NLP), pages 316-321.
236
+ Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021c. Simcse: Simple contrastive learning of sentence embeddings. arXiv preprint arXiv:2104.08821.
237
+ Daniel Gillick, Sayali Kulkarni, Larry Lansing, Alessandro Presta, Jason Baldridge, Eugene Ie, and Diego García-Olano. 2019. Learning dense representations for entity retrieval. In CoNLL, pages 528-537. Association for Computational Linguistics.
238
+ John M. Giorgi, Osvald Nitski, Bo Wang, and Gary D. Bader. 2021. Declutr: Deep contrastive learning
239
+
240
+ for unsupervised textual representations. In ACLIJCNLP, pages 879-895. Association for Computational Linguistics.
241
+ Daya Guo, Duyu Tang, Nan Duan, Jian Yin, Daxin Jiang, and Ming Zhou. 2020. Evidence-aware inferential text generation with vector quantised variational autoencoder. In ACL, pages 6118-6129. Association for Computational Linguistics.
242
+ Daya Guo, Duyu Tang, Nan Duan, Ming Zhou, and Jian Yin. 2019. Coupling retrieval and meta-learning for context-dependent semantic parsing. In ACL, pages 855-866. Association for Computational Linguistics.
243
+ Suchin Gururangan, Ana Marasovic, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and Noah A. Smith. 2020. Don't stop pretraining: Adapt language models to domains and tasks. In ACL, pages 8342-8360. Association for Computational Linguistics.
244
+ Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. 2020. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909.
245
+ Faegheh Hasibi, Fedor Nikolaev, Chenyan Xiong, Krisztian Balog, Svein Erik Bratsberg, Alexander Kotov, and Jamie Callan. 2017. Dbpedia-entity v2: A test collection for entity search. In SIGIR, pages 1265-1268. ACM.
246
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. 2020. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9726-9735. Computer Vision Foundation / IEEE.
247
+ Matthew Henderson, Rami Al-Rfou, Brian Strope, Yun-Hsuan Sung, László Lukács, Ruiqi Guo, Sanjiv Kumar, Balint Miklos, and Ray Kurzweil. 2017. Efficient natural language response suggestion for smart reply. arXiv preprint arXiv:1705.00652.
248
+ Sebastian Hofstätter, Sheng-Chieh Lin, Zheng-Hong Yang, Jimmy Lin, and Allan Hanbury. 2021. Efficiently teaching an effective dense retriever with balanced topic aware sampling. In SIGIR, pages 113-122. ACM.
249
+ Sebastian Hofstätter, Sophia Althammer, Michael Schröder, Mete Sertkan, and Allan Hanbury. 2021. Improving efficient neural ranking models with cross-architecture knowledge distillation.
250
+ Doris Hoogeveen, Karin M Verspoor, and Timothy Baldwin. 2015. Cqadupstack: A benchmark data set for community question-answering research. In Proceedings of the 20th Australasian document computing symposium, pages 1-8.
251
+ Junjie Huang, Duyu Tang, Wanjun Zhong, Shuai Lu, Linjun Shou, Ming Gong, Daxin Jiang, and Nan Duan. 2021. Whiteningbert: An easy unsupervised sentence embedding approach. arXiv preprint arXiv:2104.01767.
252
+
253
+ Kalervo Järvelin and Jaana Kekäläinen. 2002. Cumulated gain-based evaluation of ir techniques. ACM Transactions on Information Systems (TOIS), 20(4):422-446.
254
+ Jeff Johnson, Matthijs Douze, and Hervé Jégou. 2021. Billion-scale similarity search with gpus. IEEE Trans. Big Data, 7(3):535-547.
255
+ Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. 2017. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In ACL, pages 1601-1611. Association for Computational Linguistics.
256
+ Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. 2020. Dense passage retrieval for open-domain question answering. In EMNLP, pages 6769-6781. Association for Computational Linguistics.
257
+ Omar Khattab and Matei Zaharia. 2020. Colbert: Efficient and effective passage search via contextualized late interaction over BERT. In SIGIR, pages 39-48. ACM.
258
+ Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Matthew Kelcey, Jacob Devlin, Kenton Lee, Kristina N. Toutanova, Llion Jones, Ming-Wei Chang, Andrew Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. 2019. Natural questions: a benchmark for question answering research. Transactions of the Association of Computational Linguistics.
259
+ Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. 2019. Latent retrieval for weakly supervised open domain question answering. In ACL, pages 6086-6096. Association for Computational Linguistics.
260
+ Quentin Lhoest, Albert Villanova del Moral, Yacine Jernite, Abhishek Thakur, Patrick von Platen, Suraj Patil, Julien Chaumont, Mariama Drame, Julien Plu, Lewis Tunstall, Joe Davison, Mario Sasko, Gunjan Chhablani, Bhavitvya Malik, Simon Brandeis, Teven Le Scao, Victor Sanh, Canwen Xu, Nicolas Patry, Angelina McMillan-Major, Philipp Schmid, Sylvain Gugger, Clément Delangue, Theo Matussiere, Lysandre Debut, Stas Bekman, Pierric Cistac, Thibault Goehringer, Victor Mustar, François Lagunas, Alexander M. Rush, and Thomas Wolf. 2021. Datasets: A community library for natural language processing. In EMNLP (Demos), pages 175-184. Association for Computational Linguistics.
261
+ Fangyu Liu, Ivan Vulić, Anna Korhonen, and Nigel Collier. 2021. Fast, effective and self-supervised: Transforming masked languagemodels into universal lexical and sentence encoders. arXiv preprint arXiv:2104.08027.
262
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis,
263
+
264
+ Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. arXiv preprint arXiv:1907.11692.
265
+ Sean MacAvaney, Franco Maria Nardini, Raffaele Perego, Nicola Tonellott, Nazli Goharian, and Ophir Frieder. 2020. Efficient document re-ranking for transformers by precomputing term representations. In SIGIR, pages 49-58. ACM.
266
+ Macedo Maia, Siegfried Handschuh, André Freitas, Brian Davis, Ross McDermott, Manel Zarrouk, and Alexandra Balahur. 2018. WWW'18 open challenge: Financial opinion mining and question answering. In WWW (Companion Volume), pages 1941-1942. ACM.
267
+ Tri Nguyen, Mir Rosenberg, Xia Song, Jianfeng Gao, Saurabh Tiwary, Rangan Majumder, and Li Deng. 2016. MS MARCO: A human generated machine reading comprehension dataset. In CoCo@NIPS, volume 1773 of CEUR Workshop Proceedings. CEUR-WS.org.
268
+ Rodrigo Nogueira and Kyunghyun Cho. 2020. Passage Re-ranking with BERT. arXiv preprint arXiv:1901.04085.
269
+ Barlas Oğuz, Kushal Lakhotia, Anchit Gupta, Patrick Lewis, Vladimir Karpukhin, Aleksandra Piktus, Xilun Chen, Sebastian Riedel, Wen-tau Yih, Sonal Gupta, et al. 2021. Domain-matched pretraining tasks for dense retrieval. arXiv preprint arXiv:2107.13602.
270
+ Yingqi Qu, Yuchen Ding, Jing Liu, Kai Liu, Ruiyang Ren, Wayne Xin Zhao, Daxiang Dong, Hua Wu, and Haifeng Wang. 2021. Rocketqa: An optimized training approach to dense passage retrieval for open-domain question answering. In *NAACL-HLT*, pages 5835-5847. Association for Computational Linguistics.
271
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1-140:67.
272
+ Nils Reimers and Iryna Gurevych. 2019. Sentence-bert: Sentence embeddings using siamese bert-networks. In EMNLP-IJCNLP, pages 3980-3990. Association for Computational Linguistics.
273
+ Kirk Roberts, Tasmeer Alam, Steven Bedrick, Dina Demner-Fushman, Kyle Lo, Ian Soboroff, Ellen Voorhees, Lucy Lu Wang, and William R Hersh. 2020. Trec-covid: rationale and structure of an information retrieval shared task for covid-19. Journal of the American Medical Informatics Association, 27(9):1431-1436.
274
+ Stephen Robertson and Hugo Zaragoza. 2009. The probabilistic relevance framework: BM25 and beyond. Now Publishers Inc.
275
+
276
+ Victor Sanh, Lysandre Debut, Julien Chaumont, and Thomas Wolf. 2019. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108.
277
+ Ian Soboroff, Shudong Huang, and Donna Harman. 2019. Trec 2019 news track overview. In TREC.
278
+ Axel Suarez, Dyaa Albakour, David P. A. Corney, Miguel Martinez-Alvarez, and José Esquivel. 2018. A data collection for evaluating the retrieval of related tweets to news articles. In ECIR, volume 10772 of Lecture Notes in Computer Science, pages 780-786. Springer.
279
+ Nandan Thakur, Nils Reimers, Andreas Rückle, Abhishek Srivastava, and Iryna Gurevych. 2021. BEIR: A heterogeneous benchmark for zero-shot evaluation of information retrieval models. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track.
280
+ James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018. FEVER: a large-scale dataset for fact extraction and verification. In *NAACL-HLT*, pages 809-819. Association for Computational Linguistics.
281
+ George Tsatsaronis, Georgios Balikas, Prodromos Malakasiotis, Ioannis Partalas, Matthias Zschunke, Michael R Alvers, Dirk Weissenborn, Anastasia Krithara, Sergios Petridis, Dimitris Polychronopoulos, et al. 2015. An overview of the bioasq large-scale biomedical semantic indexing and question answering competition. BMC bioinformatics, 16(1):1-28.
282
+ Henning Wachsmuth, Shahbaz Syed, and Benno Stein. 2018. Retrieval of the best counterargument without prior topic knowledge. In ACL, pages 241-251. Association for Computational Linguistics.
283
+ David Wadden, Shanchuan Lin, Kyle Lo, Lucy Lu Wang, Madeleine van Zuylen, Arman Cohen, and Hannaneh Hajishirzi. 2020. Fact or fiction: Verifying scientific claims. In EMNLP, pages 7534-7550. Association for Computational Linguistics.
284
+ Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. 2020. Minilm: Deep self-attention distillation for task-agnostic compression of pre-trained transformers. In NeurIPS.
285
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumont, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020. Transformers: State-of-the-art natural language processing. In EMNLP (Demos), pages 38-45. Association for Computational Linguistics.
286
+ Zhirong Wu, Yuanjun Xiong, Stella X. Yu, and Dahua Lin. 2018. Unsupervised feature learning via nonparametric instance discrimination. In CVPR, pages
287
+
288
+ 3733-3742. Computer Vision Foundation / IEEE Computer Society.
289
+
290
+ Zhuofeng Wu, Sinong Wang, Jiatao Gu, Madian Khabsa, Fei Sun, and Hao Ma. 2020. Clear: Contrastive learning for sentence representation. arXiv preprint arXiv:2012.15466.
291
+
292
+ Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul N. Bennett, Junaid Ahmed, and Arnold Overwijk. 2021. Approximate nearest neighbor negative contrastive learning for dense text retrieval. In ICLR. OpenReview.net.
293
+
294
+ Nan Yang, Furu Wei, Binxing Jiao, Daxing Jiang, and Linjun Yang. 2021. xmoco: Cross momentum contrastive learning for open-domain question answering. In ACL-IJCNLP, pages 6120-6129. Association for Computational Linguistics.
295
+
296
+ Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W. Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. 2018. Hotpotqa: A dataset for diverse, explainable multi-hop question answering. In EMNLP, pages 2369-2380. Association for Computational Linguistics.
297
+
298
+ Wen-tau Yih, Kristina Toutanova, John C. Platt, and Christopher Meek. 2011. Learning discriminative projections for text similarity measures. In CoNLL, pages 247-256. ACL.
299
+
300
+ # A The BEIR Benchmark
301
+
302
+ Datasets We list the statistics of the BEIR benchmark in Table 5. The 18 English zero-shot evaluation datasets come from 9 heterogeneous retrieval tasks, including bio-medical information retrieval, question answering, tweet retrieval, news retrieval, argument retrieval, duplicate question retrieval, citation prediction, and fact checking.
303
+
304
+ Metric To measure effectiveness of search algorithms or retrieval models, the benchmark uses Normalized Discounted Cumulative Gain (nDCG) (Jarvelin and Kekalainen, 2002) as the evaluation metric. We will give the definition of the metric in the following.
305
+
306
+ Given top $k$ retrieved documents $\{d_1, d_2,.., d_k\}$ with their relevance $\{r_1, r_2,.., r_k\}$ for a query, the traditional formula of discounted cumulative gain (DCG) accumulated at a particular rank position $k$ is defined in Equation 10, where $r_i$ is 1 if $d_i$ is the ground truth otherwise 0.
307
+
308
+ $$
309
+ D C G @ K = \sum_ {i = 1} ^ {K} \frac {r _ {i}}{\log_ {2} (i + 1)} \tag {10}
310
+ $$
311
+
312
+ Since the length of ground truth list depends on the query, using DCG to compare the performance
313
+
314
+ of retrieval models from one query to the next cannot be consistently achieved. Therefore, the discounted cumulative gain is normalized (nDCG) as:
315
+
316
+ $$
317
+ n D C G @ K = \frac {D C G @ K}{I D C G @ K} \tag {11}
318
+ $$
319
+
320
+ where IDCG@K is the DCG@K score for the list of relevant documents (ordered by their relevance) in the corpus up to position $k$ . Since IDCG@K produces the maximum possible DCG through position $k$ , the value of nDCG@K is in the range 0 to 1.
321
+
322
+ # B Baselines
323
+
324
+ We use the baselines from the current BEIR leaderboard (Thakur et al., 2021). These baselines can be divided into four groups: dense retrieval, lexical retrieval, late interaction and re-ranking.
325
+
326
+ Dense Retrieval For dense retrieval, the baselines are the same dual-tower model as ours. We consider DPR (Karpukhin et al., 2020), ANCE (Xiong et al., 2021), TAS-B (Hofstätter et al., 2021) and GenQ (Thakur et al., 2021) in this paper.
327
+
328
+ - DPR uses a single BM25 retrieval example and in-batch examples as hard negative examples to train the model. Following Thakur et al. (2021), we use Multi-DPR as the baseline. The model is a BERT-base model and is trained on four QA datasets, including NQ (Kwiatkowski et al., 2019), TriviaQA (Joshi et al., 2017), WebQuestions (Berant et al., 2013) and CuratedTREC (Baudis and Sedivy, 2015).
329
+ - ANCE constructs hard negative examples from an ANN index of the corpus. The hard negative training instances are updated in parallel during fine-tuning of the model. The model is a RoBERTa (Liu et al., 2019) model trained on MS-MARCO for 600k steps.
330
+ - TAS-B is trained with Balanced Topic Aware Sampling using dual supervision from a cross-encoder and a ColBERT model (Khattab and Zaharia, 2020). The model is trained with a combination of a pairwise Margin-MSE (Hofstätter et al., 2021) loss and an in-batch negative loss function.
331
+ - GenQ fine-tunes a T5-base (Raffel et al., 2020) model on MS MARCO for 2 epochs
332
+
333
+ <table><tr><td colspan="6">Split (→)</td><td>Train</td><td>Dev</td><td colspan="3">Test</td><td colspan="2">Avg. Word Lengths</td></tr><tr><td>Task (↓)</td><td>Domain (↓)</td><td>Dataset (↓)</td><td>Title</td><td>Relevancy</td><td>#Pairs</td><td>#Query</td><td>#Query</td><td>#Corpus</td><td>Avg. D / Q</td><td>Query</td><td>Document</td><td></td></tr><tr><td>Passage-Retrieval</td><td>Misc.</td><td>MS MARCO (2016)</td><td>X</td><td>Binary</td><td>532,761</td><td>—</td><td>6,980</td><td>8,841,823</td><td>1.1</td><td>5.96</td><td>55.98</td><td></td></tr><tr><td>Bio-Medical</td><td>Bio-Medical</td><td>TREC-COVID (2020)</td><td>✓</td><td>3-level</td><td>—</td><td>—</td><td>50</td><td>171,332</td><td>493.5</td><td>10.60</td><td>160.77</td><td></td></tr><tr><td>Information</td><td>Bio-Medical</td><td>NFCorpus (2016)</td><td>✓</td><td>3-level</td><td>110,575</td><td>324</td><td>323</td><td>3,633</td><td>38.2</td><td>3.30</td><td>232.26</td><td></td></tr><tr><td>Retrieval (IR)</td><td>Bio-Medical</td><td>BioASQ (2015)</td><td>✓</td><td>Binary</td><td>32,916</td><td>—</td><td>500</td><td>14,914,602</td><td>4.7</td><td>8.05</td><td>202.61</td><td></td></tr><tr><td>Question</td><td>Wikipedia</td><td>NQ (2019)</td><td>✓</td><td>Binary</td><td>132,803</td><td>—</td><td>3,452</td><td>2,681,468</td><td>1.2</td><td>9.16</td><td>78.88</td><td></td></tr><tr><td>Answering</td><td>Wikipedia</td><td>HotpotQA (2018)</td><td>✓</td><td>Binary</td><td>170,000</td><td>5,447</td><td>7,405</td><td>5,233,329</td><td>2.0</td><td>17.61</td><td>46.30</td><td></td></tr><tr><td>(QA)</td><td>Finance</td><td>FiQA-2018 (2018)</td><td>X</td><td>Binary</td><td>14,166</td><td>500</td><td>648</td><td>57,638</td><td>2.6</td><td>10.77</td><td>132.32</td><td></td></tr><tr><td>Tweet-Retrieval</td><td>Twitter</td><td>Signal-1M (RT) (2018)</td><td>X</td><td>3-level</td><td>—</td><td>—</td><td>97</td><td>2,866,316</td><td>19.6</td><td>9.30</td><td>13.93</td><td></td></tr><tr><td>News</td><td>News</td><td>TREC-NEWS (2019)</td><td>✓</td><td>5-level</td><td>—</td><td>—</td><td>57</td><td>594,977</td><td>19.6</td><td>11.14</td><td>634.79</td><td></td></tr><tr><td>Retrieval</td><td>News</td><td>Robust04 (2004)</td><td>X</td><td>3-level</td><td>—</td><td>—</td><td>249</td><td>528,155</td><td>69.9</td><td>15.27</td><td>466.40</td><td></td></tr><tr><td>Argument</td><td>Misc.</td><td>ArguAna (2018)</td><td>✓</td><td>Binary</td><td>—</td><td>—</td><td>1,406</td><td>8,674</td><td>1.0</td><td>192.98</td><td>166.80</td><td></td></tr><tr><td>Retrieval</td><td>Misc.</td><td>Touché-2020 (2020)</td><td>✓</td><td>3-level</td><td>—</td><td>—</td><td>49</td><td>382,545</td><td>19.0</td><td>6.55</td><td>292.37</td><td></td></tr><tr><td>Duplicate-Question</td><td>StackEx.</td><td>CQADupStack (2015)</td><td>✓</td><td>Binary</td><td>—</td><td>—</td><td>13,145</td><td>457,199</td><td>1.4</td><td>8.59</td><td>129.09</td><td></td></tr><tr><td>Retrieval</td><td>Quora</td><td>Quora</td><td>X</td><td>Binary</td><td>—</td><td>5,000</td><td>10,000</td><td>522,931</td><td>1.6</td><td>9.53</td><td>11.44</td><td></td></tr><tr><td>Entity-Retrieval</td><td>Wikipedia</td><td>DBPedia (2017)</td><td>✓</td><td>3-level</td><td>—</td><td>67</td><td>400</td><td>4,635,922</td><td>38.2</td><td>5.39</td><td>49.68</td><td></td></tr><tr><td>Citation-Prediction</td><td>Scientific</td><td>SCIDOCS (2020)</td><td>✓</td><td>Binary</td><td>—</td><td>—</td><td>1,000</td><td>25,657</td><td>4.9</td><td>9.38</td><td>176.19</td><td></td></tr><tr><td rowspan="3">Fact Checking</td><td>Wikipedia</td><td>FEVER (2018)</td><td>✓</td><td>Binary</td><td>140,085</td><td>6,666</td><td>6,666</td><td>5,416,568</td><td>1.2</td><td>8.13</td><td>84.76</td><td></td></tr><tr><td>Wikipedia</td><td>Climate-FEVER (2020)</td><td>✓</td><td>Binary</td><td>—</td><td>—</td><td>1,535</td><td>5,416,593</td><td>3.0</td><td>20.13</td><td>84.76</td><td></td></tr><tr><td>Scientific</td><td>SciFact (2020)</td><td>✓</td><td>Binary</td><td>920</td><td>—</td><td>300</td><td>5,183</td><td>1.1</td><td>12.37</td><td>213.63</td><td></td></tr></table>
334
+
335
+ Table 5: Statistics of datasets in the BEIR benchmark. The table is taken from Thakur et al. (2021). Few datasets contain documents without titles. Relevancy indicates the query-document relation: binary (relevant, non-relevant) or graded into sub-levels. Avg. D/Q indicates the average relevant documents per query.
336
+
337
+ and generate 5 queries for each document as additional training data to continue to fine-tune the TAS-B model.
338
+
339
+ Lexical Retrieval Lexical retrieval is a score function for token matching calculated between two high-dimensional sparse vectors with token weights. BM25 (Robertson and Zaragoza, 2009) is the most commonly used lexical retrieval function. We use the BM25 results reported in Thakur et al. (2021) for comparison.
340
+
341
+ Late Interaction We also consider a late interaction baseline, namely ColBERT (Khattab and Zaharia, 2020). The model computes multiple contextualized embeddings for each token of queries and documents, and then uses a maximum similarity function to retrieve relevant documents. This type of matching requires significantly more disk space for indexes and has a higher latency.
342
+
343
+ Re-ranking Re-ranking based approaches use the output of a first-stage retrieval system (e.g., BM25), and then re-rank the retrieved documents using a cross-encoder (Nogueira and Cho, 2020). In this paper, we use the $\mathbf{BM25 + CE}$ baseline implemented in Thakur et al. (2021) that uses BM25 to retrieve top-100 documents and a 6-layer MiniLM (Wang et al., 2020) model to further re-rank the recalled documents.
344
+
345
+ # C More Examples
346
+
347
+ In addition to examples in Section 4.3, we provide more examples here, from a commonsense question
348
+
349
+ answering dataset HotpotQA (Yang et al., 2018).
350
+
351
+ Q1: In what month is the annual documentary film festival, that is presented by the fort nightly published British journal of literary essays, held?
352
+
353
+ # BM25 (Top 1): X
354
+
355
+ The DOXA Documentary Film Festival is a documentary film festival based in Vancouver, British Columbia, Canada. It is held annually held for 10 days in May and is presented by The Documentary Media Society, a non-profit organization.
356
+
357
+ # BM25 (Top 2):
358
+
359
+ The London Review of Books (LRB) is a British journal of literary essays. It is published fortnightly.
360
+
361
+ # LaPraDoR (Top 1):
362
+
363
+ The London International Documentary Festival (or LIDF) is an annual documentary film festival that takes place in the months of March and April every year. [1] The event is presented in association with the London Review of Books. [2]
364
+
365
+ # LaPraDoR (Top 2):
366
+
367
+ The London Review of Books (LRB) is a British journal of literary essays. [3] It is published fortnightly. [4]
368
+
369
+ # Q2: Ethel Winter worked with which avant-garde theater director?
370
+
371
+ # BM25 (Top 1): X
372
+
373
+ Avant-garde refers to a style in experimental work in art, music, culture, or politics.
374
+
375
+ # BM25 (Top 2): X
376
+
377
+ Christoph Marthaler (born October 17, 1951, Erlenbach, Switzerland) is a Swiss director and musician, working in the style of avant-garde theater, such as Expressionism and Dada, a theater of the absurd elements.
378
+
379
+ # LaPraDoR (Top 1):
380
+
381
+ Ethel Winter (June 18, 1924 - March 10, 2012) [5] was an American ballet dancer and
382
+
383
+ dance instructor. Winter was an early ballet dancer with the Martha Graham Dance Company from the 1940s to the 1960s, working with other notable early members of the company, including Martha Graham, Yuriko, Yuriko, Ethel Butler, Jean Erdman, and Patricia Birch. [6] She later taught dance and ballet at the Juilliard School.
384
+
385
+ # LaPraDoR (Top 2):
386
+
387
+ Jean Erdman (born February 20, 1916) [7] is an American dancer and choreographer of modern dance as well as an avant-garde theater director. [8]
388
+
389
+ Figure 4: Examples from the HotpotQA dataset (Yang et al., 2018). The key facts are highlighted. The reasoning path for Q1 is $[3] \rightarrow [4] \rightarrow [2] \rightarrow [1]$ and for Q2 is $[5] \rightarrow [6] \rightarrow [7] \rightarrow [8]$ .
lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5e3f3ed72c8e154e40a488447881fc8c88a84def9fb9246eee8f996470ef80e
3
+ size 701274
lapradorunsupervisedpretraineddenseretrieverforzeroshottextretrieval/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c108144d40a49b027d66f7d3dca781bb9c3ae48d90a34bda10c1ea10ec22270
3
+ size 463093
learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/550cbed8-a7a7-46bf-b0ad-384447212dcc_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72a9d250abd746332c5369cf4bbcf8da008b385f3d4548627e82806f9c9e3c0d
3
+ size 68841
learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/550cbed8-a7a7-46bf-b0ad-384447212dcc_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72097542b6ff2477a76c990fe07e3630532db11b7e45419ede84c00575887c7e
3
+ size 85386
learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/550cbed8-a7a7-46bf-b0ad-384447212dcc_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:512df82a127d28b364a1210924efa90e4ce95372f94b06d29836bebf8c159a68
3
+ size 621828
learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/full.md ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learn and Review: Enhancing Continual Named Entity Recognition via Reviewing Synthetic Samples
2
+
3
+ Yu Xia $^{1}$ , Quan Wang $^{2}$ , Yajuan Lyu $^{2}$ , Yong Zhu $^{2}$ , Wenhao Wu $^{1}$ , Sujian Li $^{1, \dagger}$ , Dai Dai $^{2}$
4
+
5
+ <sup>1</sup>Key Laboratory of Computational Linguistics, Peking University, MOE, China
6
+
7
+ $^{2}$ Baidu Inc., Beijing, China
8
+
9
+ {yuxia, waynewu, lisujian}@pku.edu.cn
10
+
11
+ {wangquan05, lvyajuan, zhuyong, daidai}@baidu.com
12
+
13
+ # Abstract
14
+
15
+ Traditional methods for named entity recognition (NER) classify mentions into a fixed set of pre-defined entity types. However, in many real-world scenarios, new entity types are incrementally involved. To investigate this problem, continual learning is introduced for NER. However, the existing method depends on the relevance between tasks and is prone to inter-type confusion. In this paper, we propose a novel two-stage framework Learn-and-Review (L&R) for continual NER under the type-incremental setting to alleviate the above issues. Specifically, for the learning stage, we distill the old knowledge from teacher to a student on the current dataset. For the reviewing stage, we first generate synthetic samples of old types to augment the dataset. Then, we further distill new knowledge from the above student and old knowledge from the teacher to get an enhanced student on the augmented dataset. This stage has the following advantages: (1) The synthetic samples mitigate the gap between the old and new task and thus enhance the further distillation; (2) Different types of entities are jointly seen during training which alleviates the inter-type confusion. Experimental results show that L&R outperforms the state-of-the-art method on CoNLL-03 and OntoNotes-5.0.
16
+
17
+ # 1 Introduction
18
+
19
+ Traditional Named Entity Recognition (NER) aims at extracting mentions from a given text and classifying them into a fixed set of pre-defined entity types such as Person, Location, Organization, etc (Ma and Hovy, 2016). However, in many real-world scenarios, new entity types emerge periodically by demand and the models are required to recognize new types of entities without forgetting the old ones, which can formulate into the paradigm of
20
+
21
+ continual learning (a.k.a. lifelong learning or incremental learning) (Thrun, 1998; Parisi et al., 2019). For example, voice assistants such as Siri are often expected to grasp new intents (e.g. GetMovie) and thus new entity types (e.g. Actor, Genre) are continually involved. The ability to learn from continuous streams of data after deployment is important for modern NER models in specific scenarios.
22
+
23
+ However, continual learning, as it has long been recognized, suffers severely from catastrophic forgetting, i.e., the loss or disruption of previously learned knowledge when new patterns are learned (McCloskey and Cohen, 1989; Robins, 1995; Goodfellow et al., 2013; Kirkpatrick et al., 2017). Different from human beings, an NER model (particularly that based on deep neural networks) which stores knowledge by its parameters is vulnerable to catastrophic forgetting of old knowledge while updating parameters to learn new entity types.
24
+
25
+ In order to avoid forgetting old types of entities while learning the new ones, a naive solution is to annotate a dataset for both old and new types and retrain the model from scratch. However, this method is computational-inefficient and labor-extensive, especially when the number of entity types is large. To reduce the cost, Monaikul et al. (2021) advocate annotating a training set only for new entity types and retaining previously learned knowledge via knowledge distillation (KD) (Hinton et al., 2015). In their approach, the current NER model acts as the teacher and the target new NER model the student. The student then learns new entity types by using the new training material and retains knowledge of old entities by imitating the teacher's output on this new training set. Despite the initial success, this KD-based approach relies on the co-occurrence of unlabeled old types in the current training data of new types. If the new training set (e.g. annotated only for Restaurant) contains little information related to the old entity types (e.g. Sport), the knowledge of these old types will be hard to be retained
26
+
27
+ ![](images/18a96e161b29424e6be52e973f94aa9edd54e35307ed636fb6181502461d66c9.jpg)
28
+ Figure 1: An overview of L&R. At the $k$ -th step, with the new training data $D_{k}$ and the old models $M_{k-1}, G_{1:k-1}$ available. We firstly distill the teacher model $M_{k-1}$ into the student model $\hat{M}_{k}$ by minimizing $\alpha \mathcal{L}_{\mathrm{CE}} + \beta \mathcal{L}_{\mathrm{KD}}$ on $D_{k}$ . Then, we use the generators $G_{1:k-1}$ to generate some unlabeled contexts $\hat{D}_{1:k-1}$ which contain old types of entities to augment the current dataset $D_{k}$ . We further distill $\hat{M}_{k}$ and $M_{k-1}$ into $M_{k}$ by minimizing $\alpha \mathcal{L}_{\mathrm{CE}} + \beta \mathcal{L}_{\mathrm{KD}}$ on the augmented dataset $\bigcup_{i=1}^{k-1} \hat{D}_{i} \cup D_{k}$ .
29
+
30
+ simply by distillation. Furthermore, the model will also have difficulty discriminating the old and new entity types since they rarely jointly seen. This issue is typically referred to as inter-type confusion (Masana et al., 2020).
31
+
32
+ In this paper, to alleviate the above issues, inspired by the reviewing behavior of human students, we propose Learn-and-Review (L&R), a two-stage framework that introduces a reviewing stage after the common learning stage. To be specific, during the learning stage, we train the student to recognize new types of entities and retain knowledge of old types under the teacher's supervision by knowledge distillation. Then, during the reviewing stage, we first generate synthetic samples containing old types of entities to augment the current training set. With the augmented data obtained, we further distill new knowledge from the above student and old knowledge from the teacher to get an enhanced student. By augmenting the current dataset with the synthetic samples of old types, we mitigate the gap between the old and the new task and thus enhance the further distillation. Moreover, since different types of entities are jointly seen during training, the model will discriminate better between types and thus alleviate the inter-type confusion. Besides, L&R improves the performance at each step and thus mitigates the error propagation caused by the distillation.
33
+
34
+ We evaluate our proposed framework on CoNLL-03 (Sang and De Meulder, 2003) and OntoNotes-5.0 (Hovy et al., 2006). Experimental results show that L&R outperforms the state-of-the-art method. We also conduct extensive analysis to discuss the effectiveness of the reviewing stage in enhancing
35
+
36
+ the distillation and alleviating inter-type confusion. Our contributions can be summarized as follows:
37
+
38
+ - To the best of our knowledge, we are the first to point out the type co-occurrence requirement, which is one particular shortcoming of the existing KD methods for class-incremental learning.
39
+ - We propose a novel augmentation strategy in the reviewing stage to reduce the type co-occurrence requirement.
40
+ - Extensive experimental results show that our method outperforms the state-of-the-art baseline. We also conduct experiments to explain the reasons of the improvement.
41
+
42
+ # 2 Related Work
43
+
44
+ # 2.1 Named Entity Recognition
45
+
46
+ The traditional NER work focuses on extracting predified types of entities from text (Lample et al., 2016; Zhang and Yang, 2018; Yan et al., 2021). Yet in many real-world scenarios, new entity types emerge periodically by demand and the models are required to recognize new types of entities without forgetting the old ones. It is inefficient and sometimes practically impossible to re-train a NER model from scratch every time new types added. Hence, some researchers pay their attention to updating the model by the continual learning approaches. (Monaikul et al., 2021) re-constructed the original setting into the type-incremental setting based on several well-known NER datasets in order to study how to continually train the model with the addition of new types. In this paper, we
47
+
48
+ follow (Monaikul et al., 2021) to study continual NER in a type-incremental setting.
49
+
50
+ # 2.2 Class-incremental Learning
51
+
52
+ In the field of machine learning, most early methods for continual learning considered the task-incremental setting in which a task-ID is available at inference time (Masana et al., 2020). More recently, methods have started addressing the more difficult setting of type/class-incremental learning, where the algorithm does not have access to the task-ID at inference time, and therefore must be able to distinguish between all types/classes from all tasks. Since types are never jointly trained, the network has difficulty discriminating all classes. This problem is referred to as inter-type/task confusion (Masana et al., 2020). To prevent inter-type confusion and learn representations which are optimal to discriminate between all classes, rehearsal based methods are commonly used. These methods keep a small number of exemplars (Rebuffi et al., 2017; Wu et al., 2019) (exemplar rehearsal), or generate synthetic samples (Shin et al., 2017; Sun et al., 2019) or features (Xiang et al., 2019) (pseudo-rehearsal). They prevent the forgetting of previous tasks by replaying the stored or generated data from previous tasks. Inspired by the pseudo rehearsal-based methods, we generate some data containing old types of entities by a language model to augment the current data. However, it is very common for entities introduced in different steps to co-occur in the same context in NER which makes the existing rehearsal approaches fail to be applied. Different from the existing rehearsal methods, we utilize the teacher and the student obtained from the learning stage to provide soft labels (i.e. output probability) for the unlabeled synthetic data to mitigate the type co-occurrence problem.
53
+
54
+ # 3 Preliminary
55
+
56
+ # 3.1 Problem Formulation
57
+
58
+ We adopt the type-incremental setting for NER as (Monaikul et al., 2021). We train the model on a sequence of tasks $T_{1}, T_{2}, \ldots, T_{k}$ , where the $k$ -th task has its own training set $D_{k}$ only annotated for the new entity types $E_{k}$ . Suppose that entity types in different tasks are non-overlapping (i.e., $E_{i} \cap E_{j} = \emptyset$ if $i \neq j$ ). Note that the sentences in $D_{k}$ potentially also contain tokens of types in the past or future step but this information is not annotated. At the $k$ -th incremental step ( $k > 1$ ),
59
+
60
+ with $D_{k}$ and the previous model $M_{k - 1}$ available, our goal is to get a model $M_{k}$ which can recognize entities of all seen types $\bigcup_{i = 1}^{k}E_{i}$
61
+
62
+ # 3.2 NER Model
63
+
64
+ NER models are usually treated as the sequence labeling task which classifies every token in a sequence into a set of entity types or non-entity. The NER model we use consists of an encoder $\mathbf{E}$ and a linear softmax classifier $\mathbf{C}$ . Given a sequence of tokens and their labels $\{x_{i=1}^{L}, y_{i=1}^{L}\}$ , the encoder $\mathbf{E}$ maps the inputs into the hidden vectors $\{h_{i=1}^{L}\}$ . With each $\mathbf{h}_{i}$ derived, the linear softmax classifier $\mathbf{C}$ maps it into the label space and calculates the probability distribution of its labels:
65
+
66
+ $$
67
+ \boldsymbol {z} _ {i} = \boldsymbol {W h} _ {i} + \boldsymbol {b} \tag {1}
68
+ $$
69
+
70
+ $$
71
+ \boldsymbol {P} \left(x _ {i}; \boldsymbol {\theta}\right) = \operatorname {s o f t m a x} \left(\boldsymbol {z} _ {i}\right) = \frac {\exp \left(\boldsymbol {z} _ {i}\right)}{\sum_ {j} \exp \left(\boldsymbol {z} _ {j}\right)} \tag {2}
72
+ $$
73
+
74
+ where $P(x_{i};\theta) \in \mathbb{R}^{n}$ with $n$ being the size of the label space and $\theta$ denotes the learnable model parameters. The size of the label space depends on the tagging scheme used. For example, the BIO format distinguishes begin/inside/outside of named entities under which the label space have a dimensionality of $h \times (2m + 1)$ , where $h$ is the size of hidden vector and $m$ is the size of entity types. In the type-incremental setting, the size of the label space incrementally expands in each step. We minimize the cross entropy loss to encourage the model to correctly predict the true labels:
75
+
76
+ $$
77
+ \mathcal {L} _ {\mathrm {C E}} (\boldsymbol {x}; \boldsymbol {\theta}) = - \sum_ {i = 1} ^ {L} \log P _ {y _ {i}} \left(x _ {i}; \boldsymbol {\theta}\right) \tag {3}
78
+ $$
79
+
80
+ where $P_{y_i}(x_i;\pmb {\theta})$ is the model's output probability of token $x_{i}$ belonging to class $y_{i}$
81
+
82
+ # 4 Method
83
+
84
+ In this section, we first introduce the whole training procedure of our framework which consists of a learning and a reviewing stage. Then, we describe the two stages in detail.
85
+
86
+ # 4.1 Training Procedure
87
+
88
+ The training procedure of our proposed L&R is illustrated in Fig. 1 and detailed in Algorithm 1. Assuming that we are at the $k$ -th incremental step $(k > 1)$ , with the new training data $D_{k}$ and the old models $M_{k-1}, G_{1:k-1}$ at our disposal. L&R includes two stages to learn new types of entities
89
+
90
+ ![](images/96ccc42d81dc2e3241d8be1f2ab72a7dbee46154950263053dbf17a89014a3ae.jpg)
91
+ Figure 2: The distillation process. For a sentence with its labels "France backed Fischler's proposal", "LOC O O O" (Note that the gold label for Fischler's is PER but this information is not annotated at this step). If $y = LOC$ , we compute the cross-entropy between the output of $M_{k}$ and $y$ (blue). Otherwise, we compute the KL divergence between the output of $M_{k - 1}$ and $M_{k}$ (orange).
92
+
93
+ while avoiding forgetting the old ones: (1) At the learning stage (line 6), we distill old knowledge from the teacher $M_{k - 1}$ into the student $\hat{M}_k$ by minimizing the weighted sum of the cross-entropy loss and the knowledge distillation loss on $D_{k}$ . (2) At the reviewing stage (line $8\sim 12$ ), we firstly use the generators $G_{1:k - 1}$ to generate some unlabeled contexts $\hat{D}_{1:k - 1}$ which contain old types of entities to augment the current dataset $D_{k}$ . Then, we further distill new knowledge from $\hat{M}_k$ and old knowledge from $k - 1$ into $M_{k}$ by minimizing the above weighted sum on the augmented dataset $\bigcup_{i = 1}^{k - 1}\hat{D}_i\cup D_k$ . Besides, we train $G_{k}$ by minimizing the language modeling loss on $D_{k}$ .
94
+
95
+ # 4.2 Learning Stage
96
+
97
+ For the $k$ -th incremental step $(k > 1)$ , with the training data $D_{k}$ and the models from the last step $M_{k - 1}, G_{1:k - 1}$ available, the goal of this stage is to get a model capable of recognizing all previously seen types. Firstly, We initialize the student $\hat{M}_k$ with the parameters of $M_{k - 1}$ and expand its linear layer to accommodate the new entity types. To be more specific, suppose we use the BIO tagging schema (introduced in Sec. 3.2), then the original weight matrix with dimension $h\times (2n + 1)$ should be expanded to $h\times (2n + 2m + 1)$ , where $n = |\cup_{i = 1}^{k}E_{i}|$ and $m = |E_k|$ . After initializing the student, we distill the old knowledge from the teacher $M_{k - 1}$ to the student $\hat{M}_{k - 1}$ . Given that the training dataset $D_{k}$ is only annotated for $E_{k}$ , directly training $\hat{M}_{k - 1}$ on it will cause catastrophic forgetting. Therefore, we utilize $M_{k - 1}$ to provide soft labels (i.e. output probability distribution) for old types of entities in $D_{k}$ . At the same time, the
98
+
99
+ gold annotation for $E_{k}$ is used to train $\hat{M}_k$ to recognize entities of new types. With all previously seen types of labels obtained, $\hat{M}_k$ is trained on $D_{k}$ with the weighted sum of the following two losses (Eq. 6): the cross entropy loss (Eq. 3) that penalizes errors of recognizing new entity types and the knowledge distillation loss (Eq. 5) that penalizes forgetting of old entity types.
100
+
101
+ Formally, for each token with its gold label $y$ , we compute either the cross-entropy loss or the KL divergence for that token according to its label $y$ . When $y \in E_k$ , we compute the cross-entropy between the output distribution of $\hat{M}_k$ and $y$ . Otherwise (e.g. $y$ is non-entity), we compute the KL divergence between the output distribution of $M_{k - 1}$ and $\hat{M}_k$ . The process is illustrated in Fig.2.
102
+
103
+ $$
104
+ \boldsymbol {P} (x _ {i}; \boldsymbol {\theta}, T) = \frac {\exp (z _ {i} / T)}{\sum_ {j} \exp (z _ {j} / T)} \tag {4}
105
+ $$
106
+
107
+ where $P(x_{i};\boldsymbol {\theta},T)\in \mathbb{R}^{n}$ with $n$ being the size of the model's label space. $\pmb{\theta}$ denotes the learnable model parameters. $T$ denotes the temperature hyper-parameter that can be tuned to obtain a softer distribution (Hinton et al., 2015).
108
+
109
+ $$
110
+ \mathcal {L} _ {\mathrm {K D}} = - \sum_ {i = 1} ^ {L} \sum_ {j = 1} ^ {| \cup_ {i = 1} ^ {k} E _ {i} |} P _ {j} \left(x _ {i}; \boldsymbol {\theta} _ {k - 1}, T\right) \log P _ {j} \left(x _ {i}; \hat {\boldsymbol {\theta}} _ {k}, T\right) \tag {5}
111
+ $$
112
+
113
+ where $P(x_{i};\pmb{\theta}_{k - 1},T)\in \mathbb{R}^{\lfloor \cup_{i = 1}^{k - 1}E_{i}\rfloor}$ denotes the teacher's output probability and $P(x_{i};\hat{\pmb{\theta}}_{k},T)\in$ $\mathbb{R}^{\lfloor \cup_{i = 1}^{k}E_{i}\rfloor}$ denotes the student's. In order to make the teacher's output the same size as the student's, we fill the teacher's outputs of the new labels with a small constant.
114
+
115
+ $$
116
+ \mathcal {L} = \alpha \mathcal {L} _ {\mathrm {C E}} + \beta \mathcal {L} _ {\mathrm {K D}} \tag {6}
117
+ $$
118
+
119
+ where $\alpha, \beta$ denote the weights of the loss.
120
+
121
+ # 4.3 Reviewing Stage
122
+
123
+ In order to mitigate the gap between tasks and alleviate the problem of inter-task confusion, we introduce a novel reviewing stage after the common learning stage. Firstly, for each old task $i \in \{1,2,\dots,k - 1\}$ , we use the generator $G_{i}$ to generate some unlabeled contexts related to types $E_{i}$ . Then, we concatenate the output probability of old types from $M_{k - 1}$ and the probability of new types from $\hat{M}_k$ to get the probability of all seen types for the unlabeled contexts according to Eq. 7. We calculate the KL divergence between the above probability on all seen types and the output of $M_{k}$ on the generated data using Eq. 8. We calculate the cross-entropy loss on the current data according to Eq. 3. Finally, we initialize $M_{k}$ with $\hat{M}_k$ and train $M_{k}$ using the above weighted losses Eq. 6. The process is similar to Fig. 2 except that the probability of old types is given by $\hat{M}_{k - 1}$ instead of a small constant.
124
+
125
+ $$
126
+ \begin{array}{l} \boldsymbol {P} (x _ {i}; \boldsymbol {\theta} _ {k - 1}, \hat {\boldsymbol {\theta}} _ {k}, T) = \\ \operatorname {c o n c a t} ([ \boldsymbol {P} _ {E _ {1: k - 1}} (x _ {i}; \boldsymbol {\theta} _ {k - 1}, T); \boldsymbol {P} _ {E _ {k}} (x _ {i}; \hat {\boldsymbol {\theta}} _ {k}, T) ]) \end{array} \tag {7}
127
+ $$
128
+
129
+ $$
130
+ \mathcal {L} _ {\mathrm {K D}} = - \sum_ {i = 1} ^ {L} \sum_ {j = 1} ^ {| U | _ {i = 1} ^ {k} E _ {i} |} P _ {j} \left(x _ {i}; \boldsymbol {\theta} _ {k - 1}, \hat {\boldsymbol {\theta}} _ {k}, T\right) \log P _ {j} \left(x _ {i}; \boldsymbol {\theta} _ {k}, T\right) \tag {8}
131
+ $$
132
+
133
+ Besides, we train a generator $G_{k}$ using the unlabeled contexts in $D_{k}$ by minimizing Eq. 11
134
+
135
+ Generator The model we use for generating contexts is a one-layer LSTM language model. We train a separate generator for each task and only use it for inference in the later steps. Specifically, given a sequence of $L$ tokens $\{x_{i = 1}^{L}\}$ , we feed them into an embedding layer and a LSTM layer to get the contextualized representation for each token $\{\pmb {h}_{i = 1}^{L}\}$ . Then, we use a linear softmax classifier to get the probability of the next token:
136
+
137
+ $$
138
+ \boldsymbol {z} _ {i} = \boldsymbol {W} \boldsymbol {h} _ {i} + \boldsymbol {b} \tag {9}
139
+ $$
140
+
141
+ $$
142
+ P \left(x _ {i} \mid x _ {< i}; \boldsymbol {\theta}\right) = \frac {\exp \left(z _ {i , i n d e x} \left(x _ {i}\right)\right)}{\sum_ {j} \exp \left(z _ {i , j}\right)} \tag {10}
143
+ $$
144
+
145
+ where $\mathbf{z}_i \in \mathbb{R}^V$ with $V$ being the vocabulary size and index(*) denotes the index of $x_i$ in the vocabulary. We train the language model by minimizing
146
+
147
+ the negative log-likelihood in predicting the next word:
148
+
149
+ $$
150
+ \mathcal {L} _ {\mathrm {L M}} (\boldsymbol {x}; \boldsymbol {\theta}) = \sum_ {i = 1} ^ {L} - \log P (x _ {i} | x _ {< i}; \boldsymbol {\theta}) \tag {11}
151
+ $$
152
+
153
+ For inference, i.e. generating synthetic samples, given the [BOS] token as the input, the model decodes the sentence autoregressively by sampling on the probability calculated by Eq. 10. By language modeling the contexts of a specific entity type, we extract its common patterns for the student to review and refresh its old knowledge. Owning to the randomness introduced by the sampling process, the generator tends to provide more diverse sentences rather than merely recovering old samples.
154
+
155
+ # Algorithm 1 Procedure of our framework
156
+
157
+ Require: A stream of incoming tasks $T_{1}, T_{2}, \dots, T_{k}, \dots$ , where each task $T_{k}$ is associated with a dataset $D_{k}$ consisting of sentences annotated only w.r.t. previously unseen entity types $E_{k}$ .
158
+ Ensure: The latest NER model $M_{k}$ at each step $k$ which can recognize entities of all seen entity types $\cup_{i=1}^{k} E_{i}$ .
159
+ 1: train $M_{1}$ by minimizing $\mathcal{L}_{\mathrm{CE}}$ on $D_{1}$ ;
160
+ 2: train generator $G_{1}$ by minimizing $\mathcal{L}_{\mathrm{LM}}$ on $D_{1}$ ;
161
+ 3: $k\gets 2$
162
+ 4: while there are still tasks left do
163
+ 5: // Learning Stage
164
+ 6: distill $M_{k - 1}$ into $M_{k}$ by minimizing $\alpha \mathcal{L}_{\mathrm{CE}}$ $+\beta \mathcal{L}_{\mathrm{KD}}$ on $D_{k}$
165
+ 7: // Reviewing Stage
166
+ 8: for $i = 1$ to $k - 1$ do
167
+ 9: generate synthetic sentences $\hat{D}_i$ from previous step $i$ by using $G_{i}$
168
+ 10: end for
169
+ 11: distill $M_{k - 1},\hat{M}_k$ into $M_{k}$ by minimizing $\alpha \mathcal{L}_{\mathrm{CE}} + \beta \mathcal{L}_{\mathrm{KD}}$ on $\bigcup_{i = 1}^{k - 1}\hat{D}_i\cup D_k$
170
+ 12: train $G_{k}$ by minimizing $\mathcal{L}_{\mathrm{LM}}$ on $D_{k}$ ;
171
+ 13: $k = k + 1$
172
+ 14: end while
173
+
174
+ # 5 Experiment Setup
175
+
176
+ # 5.1 Datasets
177
+
178
+ To evaluate our framework, we re-construct the original setting into the type-incremental setting based on several well-known NER datasets including CoNLL-03 English (Sang and De Meulder,
179
+
180
+ <table><tr><td></td><td colspan="4">CoNLL-03</td><td colspan="6">OntoNotes-5.0</td></tr><tr><td></td><td>PER</td><td>LOC</td><td>ORG</td><td>MISC</td><td>PERSON</td><td>GPE</td><td>ORG</td><td>DATE</td><td>CARD</td><td>NORP</td></tr><tr><td>Train</td><td>4373</td><td>5127</td><td>4587</td><td>2698</td><td>12195</td><td>10643</td><td>9537</td><td>8921</td><td>5788</td><td>5297</td></tr><tr><td>Dev</td><td>1120</td><td>1329</td><td>962</td><td>695</td><td>1553</td><td>1592</td><td>1262</td><td>1264</td><td>736</td><td>686</td></tr><tr><td>Test</td><td>1025</td><td>1266</td><td>1229</td><td>563</td><td>1573</td><td>1573</td><td>1230</td><td>1281</td><td>772</td><td>671</td></tr></table>
181
+
182
+ Table 1: The sentence distribution of each entity type in CoNLL-03 and OntoNotes-5.0.
183
+
184
+ 2003) and OntoNotes-5.0 English (Hovy et al., 2006). For OntoNotes-5.0, we select the following types to ensure enough examples for training: Organization, Person, Geo-Political Entity, Date, Cardinal, Nationalities and Religious Political Group.
185
+
186
+ # 5.2 Settings
187
+
188
+ We adopt the following setup to simulate the real-world data collection. When constructing the training/dev sets for the $k$ -th task, for a sample with $L$ tokens $[x_1, x_2, \ldots, x_L]$ and its corresponding labels $[y_1, y_2, \ldots, y_L]$ in the original training/dev sets, we replace the label $y_i$ with $O$ if $y_i \notin E_k$ to get $\hat{y}_i$ . Then, we add $[x_1, x_2, \ldots, x_L]$ and its modified labels $[\hat{y}_1, \hat{y}_2, \ldots, \hat{y}_L]$ into the training/dev sets of the $k$ -th task if $\exists y_i \in E_k, 1 \leq i \leq L$ . When constructing the test sets for the $k$ -th task, we replace the above $E_k$ with $\cup_{i=1}^{k} E_k$ (all seen types up to the current step). Without loss of generality, we consider adding one type at each step. After re-constructing the datasets based on the above rules, the sentence distribution of each entity type across the official training, development, test sets are listed in Table 1.
189
+
190
+ # 5.3 Implementation Details
191
+
192
+ We follow the previous work (Monaikul et al., 2021) for implementation. The details can be found in Appendix A.
193
+
194
+ # 5.4 Compared Methods
195
+
196
+ We compare our framework to ExtendNER and select non-CL complete as the upper bound. We reimplement them according to (Monaikul et al., 2021). For non-CL complete, we train the model from scratch on those samples which contain the entity of all seen types up to the current step.
197
+
198
+ # 5.5 Metrics
199
+
200
+ Following (Monoikul et al., 2021), we compute the precision, recall and F1 scores for each entity type at each step. We report the macro-average F1 score
201
+
202
+ w.r.t. all types seen up to the $k$ -th step, averaged over all sampled permutations:
203
+
204
+ $$
205
+ F _ {a v g} ^ {k, r} = \frac {1}{k \times r} \sum_ {e \in \bigcup_ {i = 1} ^ {k} E _ {i} ^ {r}} F _ {e} ^ {k, r} \tag {12}
206
+ $$
207
+
208
+ where $\bigcup_{i=1}^{k} E_i^r$ denotes all types seen up to the $k$ -th step in the task order $r$ . $F_e^k$ denotes the F1 score of entity $e$ at the $k$ -th step in the order $r$ .
209
+
210
+ We also evaluate the model's overall performance regarding order-sensitivity to have a more thorough understanding. The metric we use is Error Bound (Wu et al., 2021) which is defined as:
211
+
212
+ $$
213
+ E B = Z _ {\frac {\alpha}{2}} \times \frac {\sigma}{\sqrt {n}} \tag {13}
214
+ $$
215
+
216
+ where $Z_{\frac{\alpha}{2}}$ is the confidence coefficient of confidence level $\alpha$ , and $\sigma$ is the standard deviation of average F1 obtained from $n$ different task orders. A model with a lower error bound indicates less order-sensitivity.
217
+
218
+ # 6 Results
219
+
220
+ # 6.1 Main Results
221
+
222
+ We conduct extensive experiments on CoNLL-03 and OntoNotes-5.0 and make the following observations:
223
+
224
+ (1) Table 2 shows that L&R outperforms the baseline among all the steps on the two datasets. For example, L&R achieves 4.01, 6.22, 7.83 average F1 improvement at step 2, 3, 4 on CoNLL-03. Noting that L&R achieves more improvement against ExtendNER on later steps. The reason is that we improve the performance at each step and thus alleviate the error propagation caused by the distillation.
225
+ (2) In addition to the above accumulated improvement of L&R, we also report the instant improvement of the reviewing stage at each step in Table 2. For example, L&R gets 4.01, 4.02, 4.11 improvement at step 2, 3, 4 after
226
+
227
+ <table><tr><td rowspan="2">Method</td><td colspan="4">CoNLL-03</td><td colspan="6">OntoNotes-5.0</td></tr><tr><td>Step 1</td><td>Step 2</td><td>Step 3</td><td>Step 4</td><td>Step 1</td><td>Step 2</td><td>Step 3</td><td>Step 4</td><td>Step 5</td><td>Step 6</td></tr><tr><td rowspan="2">ExtendNER</td><td>92.08</td><td>82.93</td><td>78.90</td><td>77.91</td><td>92.06</td><td>87.60</td><td>83.72</td><td>81.41</td><td>80.63</td><td>79.56</td></tr><tr><td>-</td><td>±4.51</td><td>±3.82</td><td>±1.41</td><td>-</td><td>±2.12</td><td>±1.54</td><td>±1.70</td><td>±1.68</td><td>±0.94</td></tr><tr><td rowspan="2">L&amp;R</td><td>92.08</td><td>86.93</td><td>85.12</td><td>85.74</td><td>92.06</td><td>88.09</td><td>85.69</td><td>83.79</td><td>83.38</td><td>83.02</td></tr><tr><td>-</td><td>±3.43</td><td>±2.38</td><td>±0.44</td><td>-</td><td>±1.82</td><td>±2.02</td><td>±1.13</td><td>±0.93</td><td>±0.63</td></tr><tr><td>before reviewing</td><td>92.08</td><td>82.93</td><td>81.10</td><td>81.63</td><td>92.06</td><td>87.60</td><td>84.53</td><td>82.67</td><td>82.31</td><td>82.03</td></tr><tr><td>non-CL complete</td><td>92.08</td><td>89.86</td><td>88.99</td><td>88.90</td><td>92.06</td><td>91.16</td><td>90.50</td><td>89.69</td><td>89.57</td><td>89.30</td></tr></table>
228
+
229
+ Table 2: The average F1 over seen entity types on the test set of NER datasets at each step. Scores at each step are averaged over all sampled permutations. Error Bound is indicated after the $\pm$ symbol. We set the confidence as 0.95.
230
+
231
+ <table><tr><td></td><td colspan="4">CoNLL-03</td><td colspan="6">OntoNotes-5.0</td></tr><tr><td></td><td>PER</td><td>LOC</td><td>ORG</td><td>MISC</td><td>PERSON</td><td>GPE</td><td>ORG</td><td>DATE</td><td>CARD</td><td>NORP</td></tr><tr><td>Before</td><td>90.53</td><td>85.45</td><td>77.89</td><td>70.37</td><td>89.67</td><td>89.86</td><td>73.06</td><td>76.94</td><td>76.94</td><td>80.55</td></tr><tr><td>After</td><td>95.19</td><td>90.46</td><td>83.30</td><td>71.67</td><td>90.21</td><td>90.32</td><td>73.40</td><td>76.99</td><td>78.26</td><td>82.93</td></tr><tr><td>Δ</td><td>+4.66</td><td>+5.00</td><td>+5.41</td><td>+1.30</td><td>+0.54</td><td>+0.46</td><td>+0.35</td><td>+0.05</td><td>+1.31</td><td>+2.39</td></tr></table>
232
+
233
+ Table 3: The instant improvement of the reviewing stage on different entity types in CoNLL-03 and OntoNotes-5.0
234
+
235
+ the reviewing stage, demonstrating the effectiveness of our proposed reviewing stage.
236
+
237
+ (3) Table 2 shows that L&R obtains tight error bounds among all the steps, demonstrating better stability against the task order. For example, L&R lowers the error bound by $24\%$ , $38\%$ , $69\%$ at step 2, 3, 4 on CoNLL-03.
238
+ (4) Figure 3 shows that the values on the diagonal line of the confusion matrix of L&R are higher compared to those of ExtendNER. This indicates that L&R discriminates more correctly between different entity types which is one of the reasons of its improvement.
239
+
240
+ # 6.2 Improvement of the Reviewing Stage
241
+
242
+ In order to further understand the improvement of the reviewing stage, we break down its source into two parts. The first part comes from the instant improvement after conducting the reviewing stage at each step. We report the average F1 before/after reviewing on the fifth/third line of Table 2. The second part comes from the improvement of the previous steps which alleviates the error propagation caused by the distillation. This accumulated improvement is reported on the third line of Table 2. From the first and the third line of the table, we can observe that L&R achieves more improvement against ExtendNER on later steps. From the third
243
+
244
+ and the fifth line of the table, we can see that L&R achieves an average of 4 and 1 improvement on CoNLL-03 and OnteNotes-5.0 at each step.
245
+
246
+ We also report the instant improvement of the reviewing stage on different entity types in Table 3. From the table we can see that different entity types obtain different gain from the reviewing stage. This is rational because different types have different intrinsic difficulty.
247
+
248
+ # 6.3 Inter-type Confusion
249
+
250
+ To verify our hypothesis that L&R alleviates the inter-type confusion and thus brings improvement, we plot the normalized confusion matrix between different types based on the predictions at the final step (Figure 3). Concretely, we use the 'B-X' (X denotes a specific entity type) label in the ground truth as the true labels, and use the 'B-X' label in the model's predictions as the predicted labels. From the figures we can see that, the values on the diagonal line of the confusion matrix of L&R are higher compared to those of ExtendNER. This indicates that L&R discriminates more correctly between different entity types compared to ExtendNER. These results are in consistent with the improvements in Table 3.
251
+
252
+ # 6.4 Influence of Task Order
253
+
254
+ In order to explore the effect of task orders, we plot the performance of L&R and ExtendNER at
255
+
256
+ ![](images/fdf3d0fa22dc188d41b214e6035e0a982e877edbda9828abef739f46f9ed6d25.jpg)
257
+
258
+ ![](images/ba0ae430acbaa39b4efa9af092cc5d1f1c7c8df657e164152252d0619d055510.jpg)
259
+ Figure 3: The normalized confusion matrices based on the predictions of L&R (up) and Extend (down).
260
+
261
+ each step under 8 sampled task orders on CoNLL-03 in Figure 4. From the figure, we can observe that: (1) Under all task orders, the performance of the methods drops with the step increases. This is in line with our expectation because the test sets and the type sets are incrementally expanding, indicating more difficult tasks. (2) Different methods under the same order show the similar trends where L&R shows a higher average F1 at each step. (3) Although the performance fluctuate at the middle steps, they converge at the final step. L&R gets a more converged result between 0.85 and 0.86 which demonstrates its robustness to the task orders. Besides, we calculate the error bounds to get a quantitative understanding. From Table 2 we can see that, the error bounds of L&R are lower than that of ExtendNER which also demonstrates the performance of L&R is less sensitive to the task orders.
262
+
263
+ # 6.5 Quantity of Synthetic Samples
264
+
265
+ To explore how much does the number of synthetic samples influences our performance, we conduct the experiments on CoNLL-03 with 100, 500, 1000, 3000 synthetic samples per task. From the Figure 5 we can see that, generating 100 samples per
266
+
267
+ ![](images/e5c00e925139c7075aae289e18976431bba6324d317334a4cddccb14205d5a0a.jpg)
268
+ Figure 4: The performance of L&R (red) and Extend-NER (black) at each step under 8 sampled task orders.
269
+
270
+ ![](images/89ec949e89a8981ac52a1c0cee6469632d00ca353a01da44bdead9b5064e13ce.jpg)
271
+ Figure 5: The performance of L&R at each step using different number of synthetic data per task.
272
+
273
+ task is enough for an improvement of 5.05 against ExtendNER at the final step. Besides, the model performance conforms to the general rule of better performance with more data.
274
+
275
+ # 7 Conclusion
276
+
277
+ In this paper, we propose a novel framework introducing the reviewing stage to alleviate the catastrophic forgetting and intra-task confusion issues for NER under the type-incremental setting. After the learning step, we further distill the student and the teacher on the synthetic sample augmented dataset to get an enhanced student. Our experiments on the two benchmarks CoNLL-03 and OntoNotes-5.0 demonstrate that L&R is less prone to the intra-task confusion and outperforms the state-of-the-art method.
278
+
279
+ # Acknowledgements
280
+
281
+ This work is supported by the National Key Research and Development Program of China (No.2020AAA0109400) and the National Natural Science Foundation of China (No.61876009). We thank Yongwei Zhao for his valuable suggestions.
282
+
283
+ # References
284
+
285
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805.
286
+ Ian J Goodfellow, Mehdi Mirza, Da Xiao, Aaron Courville, and Yoshua Bengio. 2013. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211.
287
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. 2015. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531.
288
+ Eduard Hovy, Mitch 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.
289
+ Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
290
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. 2017. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521-3526.
291
+ Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. 2016. Neural architectures for named entity recognition. arXiv preprint arXiv:1603.01360.
292
+ Xuezhe Ma and Eduard Hovy. 2016. End-to-end sequence labeling via bi-directional lstm-cnns-crf. arXiv preprint arXiv:1603.01354.
293
+ Marc Masana, Xialei Liu, Bartlomiej Twardowski, Mikel Menta, Andrew D Bagdanov, and Joost van de Weijer. 2020. Class-incremental learning: survey and performance evaluation on image classification. arXiv preprint arXiv:2010.15277.
294
+ Michael McCloskey and Neal J Cohen. 1989. Catastrophic interference in connectionist networks: The sequential learning problem. In *Psychology of learning and motivation*, volume 24, pages 109-165. Elsevier.
295
+ Natawut Monaikul, Giuseppe Castellucci, Simone Filice, and Oleg Rokhlenko. 2021. Continual learning for named entity recognition. In Proceedings of the Thirty-Fifth AAAI Conference on Artificial Intelligence.
296
+ German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. 2019. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54-71.
297
+
298
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. 2019. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026-8037.
299
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. 2017. icarl: Incremental classifier and representation learning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pages 2001-2010.
300
+ Anthony Robins. 1995. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2):123-146.
301
+ Erik F Sang and Fien De Meulder. 2003. Introduction to the conll-2003 shared task: Language-independent named entity recognition. arXiv preprint cs/0306050.
302
+ Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. 2017. Continual learning with deep generative replay. arXiv preprint arXiv:1705.08690.
303
+ Fan-Keng Sun, Cheng-Hao Ho, and Hung-Yi Lee. 2019. Lamol: Language modeling for lifelong language learning. arXiv preprint arXiv:1909.03329.
304
+ Sebastian Thrun. 1998. Lifelong learning algorithms. In Learning to learn, pages 181-209. Springer.
305
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. 2019. Huggingface's transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771.
306
+ Tongtong Wu, Xuekai Li, Yuan-Fang Li, Reza Haffari, Guilin Qi, Yujin Zhu, and Guoqiang Xu. 2021. Curriculum-meta learning for order-robust continual relation extraction. CoRR, abs/2101.01926.
307
+ Yue Wu, Yinpeng Chen, Lijuan Wang, Yuancheng Ye, Zicheng Liu, Yandong Guo, and Yun Fu. 2019. Large scale incremental learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 374-382.
308
+ Ye Xiang, Ying Fu, Pan Ji, and Hua Huang. 2019. Incremental learning using conditional adversarial networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6619-6628.
309
+ Hang Yan, Tao Gui, Junqi Dai, Qipeng Guo, Zheng Zhang, and Xipeng Qiu. 2021. A unified generative framework for various ner subtasks. arXiv preprint arXiv:2106.01223.
310
+ Yue Zhang and Jie Yang. 2018. Chinese ner using lattice LSTM. arXiv preprint arXiv:1805.02023.
311
+
312
+ <table><tr><td>Order</td><td>CoNLL-03</td><td>OntoNotes-5.0</td></tr><tr><td>1</td><td>LOC → ORG → MISC → PER</td><td>ORG → PER → GPE → DATE → CARD → NORP</td></tr><tr><td>2</td><td>LOC → PER → ORG → MISC</td><td>DATE → NORP → PER → CARD → ORG → GPE</td></tr><tr><td>3</td><td>MISC → ORG → LOC → PER</td><td>GPE → CARD → ORG → NORP → DATE → PER</td></tr><tr><td>4</td><td>MISC → PER → LOC → ORG</td><td>NORP → ORG → DATE → PER → GPE → CARD</td></tr><tr><td>5</td><td>ORG → LOC → MISC → PER</td><td>CARD → GPE → NORP → ORG → PER → DATE</td></tr><tr><td>6</td><td>ORG → MISC → PER → LOC</td><td>PER → DATE → CARD → GPE → NORP → ORG</td></tr><tr><td>7</td><td>PER → LOC → ORG → MISC</td><td></td></tr><tr><td>8</td><td>PER → MISC → LOC → ORG</td><td></td></tr></table>
313
+
314
+ Table 4: The sampled task orders of CoNLL-03 and OntoNotes-5.0.
315
+
316
+ # A Implementation Details
317
+
318
+ We use uncased BERT-base as our encoder (Devlin et al., 2018). The models are implemented in Pytorch (Paszke et al., 2019) on top of the BERT Huggingface implementation (Wolf et al., 2019), and are trained on a single GeForce RTX 3090 GPU. We set the batch size as 32, the max sentence length as 128, the max training epoch number as 20 with early stopping (patience=3). We use Adam (Kingma and Ba, 2014) as our optimizer with the learning rate 5e-5 for all modules. For all student models, we set the temperature as 2 and $\alpha = \beta = 1$ for the weighted sum of the losses. For L&R, we generate 3000 samples for each previous task by default. We sample 8 and 6 task orders for CoNLL-03 and OntoNotes-5.0 respectively (listed in Table 4). For efficiency, we use a one-layer LSTM model as our generator and find it enough to achieve encouraging performance. The average runtime (training and inference) time is $10\mathrm{min}$ /task and the size is $50\mathrm{MB}$ for CoNLL-03.
learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:021622a19b21e46a362a912c7e90f9b62a94c7608a52861410c0efe108ff9f33
3
+ size 462675
learnandreviewenhancingcontinualnamedentityrecognitionviareviewingsyntheticsamples/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ba3449e21172efe3a2803120b76d4fb8251776a14712824b3e2c140dbebd5da
3
+ size 452149
learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/ce8f1f86-f163-433e-aaee-966bd5ff84fb_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:000dea8c62d13659df0600e1425a510ea8eb52533a1efdea5e8c14b2d3954277
3
+ size 81825
learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/ce8f1f86-f163-433e-aaee-966bd5ff84fb_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:610b54cdd458aae4f79b49d6448a1b41ecf792ff30937a150d815f078e1559a3
3
+ size 97164
learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/ce8f1f86-f163-433e-aaee-966bd5ff84fb_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86982155eb7216274c9ec149f3bddeba9ce90d85df64043a013e6f5ec754a3da
3
+ size 438321
learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/full.md ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Adaptive Axis Attentions in Fine-tuning: Beyond Fixed Sparse Attention Patterns
2
+
3
+ Zihan Wang $^{1*}$ Jieuxiang Gu $^{2}$ Jason Kuen $^{2}$ Handong Zhao $^{2}$ Vlad I. Morariu $^{2}$ Ruiyi Zhang $^{2}$ Ani Nenkova $^{2}$ Tong Sun $^{2}$ Jingbo Shang $^{1}$
4
+
5
+ <sup>1</sup>University of California, San Diego <sup>2</sup>Adobe Research
6
+
7
+ $^{1}$ {ziw224, jshang} @ucsd.edu
8
+
9
+ $^{2}$ {jigu, kuen, hazhao, morariu, ruizhang, nenkova, tsun} @adobe.com
10
+
11
+ # Abstract
12
+
13
+ We present a comprehensive study of sparse attention patterns in Transformer models. We first question the need for pre-training with sparse attention and present experiments showing that an efficient fine-tuning only approach yields a slightly worse but still competitive model. Then we compare the widely used local attention pattern and the less-well-studied global attention pattern, demonstrating that global patterns have several unique advantages. We also demonstrate that a flexible approach to attention, with different patterns across different layers of the model, is beneficial for some tasks. Drawing on this insight, we propose a novel Adaptive Axis Attention method, which learns—during fine-tuning—different attention patterns for each Transformer layer depending on the downstream task. Rather than choosing a fixed attention pattern, the adaptive axis attention method identifies important tokens—for each task and model layer—and focuses attention on those. It does not require pre-training to accommodate the sparse patterns and demonstrates competitive and sometimes better performance against fixed sparse attention patterns that require resource-intensive pre-training.
14
+
15
+ # 1 Introduction
16
+
17
+ The wide adoption of the Transformer architecture (Vaswani et al., 2017) in contextual language representations such as BERT (Devlin et al., 2019) has spurred interest in making transformers more efficient via sparse attention patterns (Li et al., 2019; Guo et al., 2019; Gong et al., 2019; Zaheer et al., 2020; Child et al., 2019).
18
+
19
+ The typical process for learning a transformer model (e.g., BERT) with a sparse attention pattern is to replace the full attention calculation with that pattern, then pre-train the model with the usual pre-training task and fine-tune the model to downstream tasks. The use of sparse attention pattern
20
+
21
+ does not necessarily significantly improve the runtime of the models<sup>1</sup> but it does reduce the model memory requirement during inference time. This reduction is helpful when deploying models on mobile devices or other memory-limited devices.
22
+
23
+ In this paper we offer an extensive analysis of attention patterns, organized around the following questions: (1) is pre-training essential or is it possible to employ sparse patterns during fine-tuning only? (2) which types of attention patterns are important? (3) should the same attention pattern be applied to different downstream tasks and to all layers of the model?
24
+
25
+ The answer to the first question carries critical implications for the practical adoption of sparse attention approaches. Most current transformer-based approaches learn fixed patterns during pretraining and then apply these to fine-tuning as well. However, it is costly and impractical to pre-train a new model from scratch when a different attention pattern is expected to be more appropriate for a task. Learning the sparse attention pattern model during fine-tuning is more reasonable.
26
+
27
+ With this motivation in mind, we perform a controlled experiment on the eight tasks in the GLUE (Wang et al., 2019a) benchmark. We find that pre-training with sparse patterns is not a crucial ingredient for good performance—learning the model solely during fine-tuning sacrifices only one or two performance points on most tasks. Grounded in this finding, we perform all other experiments efficiently, starting with the same pretrained model and varying sparse attention patterns during fine-tuning alone.
28
+
29
+ We start to answer the second question by analyzing the two most popular patterns: local and global (Tay et al., 2020). Local patterns allow each token to attend only to other tokens within a given window. Global patterns allow some specially des
30
+
31
+ ![](images/5130f47856ddbdd1bdc571f4b68b64ba11b17241532da2af159a1f054cc70131.jpg)
32
+ (a) Local
33
+
34
+ ![](images/9bf6c852283276c2ceef7a1395113fc4695d10d9e87b24ad3aa515a4120a92e2.jpg)
35
+ (b) Global
36
+
37
+ ![](images/97d017d337a63602702e8daad56a6d02a74db44b4f3249ebc8ab89ad4062fa59.jpg)
38
+ (c) Diagonal
39
+ Figure 1: Five attention patterns (with $N = 8$ ): Local, Global, their generalized forms: Diagonal and Axis, and a combination of Local and Global attention: Local+Global.
40
+
41
+ ![](images/a33c467ec1fa68d4c4f4eca21eea9f896b7f2168b85ffecbd2710630c77734b4.jpg)
42
+ (d) Axis
43
+
44
+ ![](images/fcd0f1062c37c2f7b0ca961e14ab6166b3f9c7af1278c1c067ddbb5b63ab7e49.jpg)
45
+ (e) Local+Global
46
+
47
+ ignated tokens to attend to all other tokens while the remaining tokens are allowed to attend only to the specially designated tokens. We show that global pattern exhibits unique and complementary strengths that local patterns cannot capture. This finding is aligned with the design choices for recent models that benefit from the combination of both patterns (Beltagy et al., 2020; Zaheer et al., 2020).
48
+
49
+ For the third question, we extend Sparse-BERT (Shi et al., 2021) to an adaptive diagonal attention model. With this model, we are able flexibly learn task-wise and/or layer-wise diagonal patterns. Adapting attention patterns to tasks and layers improves performance over fixed attention pattern baselines and yields equivalent memory gains/sparsity levels.
50
+
51
+ Motivated by these findings, we design an adaptive sparse pattern that is learned during fine-tuning and that adapts to the task, layer as well as to the input sample. Our pattern is an instance of axis patterns (Figure 1(d)), which are a more general form of global patterns; we name it Adaptive Axis Attention (AAA). AAA samples the important tokens by applying a fully connected layer that is followed by Gumbel Softmax (Jang et al., 2017) applied to the token representations on each Transformer layer. The tokens identified as important are then designated as the global tokens and are used to form an axis-aligned attention pattern.
52
+
53
+ Through extensive experiments we verify that learning such an adaptive axis attention can outperform the fixed patterns adopted in Longformer (Beltagy et al., 2020), BigBird (Zaheer et al., 2020) and SparseBERT (Shi et al., 2021). AAA rivals or outperforms the fixed patterns even when compared with their pre-trained variants, which require extensive time and resources for pre-training.
54
+
55
+ We also show that AAA can be integrated into lightweight models, e.g., MobileBERT (Sun et al.,
56
+
57
+ 2020). The benefits for MobileBERT indicate that our work is complementary to other methods for reducing hidden dimensions or attention heads.
58
+
59
+ Our comprehensive study of different sparse attention patterns in Transformers advances the field with several key insights.
60
+
61
+ - We show that pre-training sparse attention pattern models does bring benefits but that a finetuned only approach maintains competitive performance while saving cost and time for pretraining.
62
+ - We present an in-depth comparison between the two most common patterns in sparse attention design and verify that they provide different complementary strengths.
63
+ - We demonstrate that adapting attention patterns to tasks and layers is an impactful aspect of sparse pattern designs. We propose a new attention pattern—Adaptive Axis Attention and demonstrate that AAA outperforms fixed attention patterns.
64
+
65
+ # 2 Background
66
+
67
+ Here we highlight some of the core definitions related to self-attention and describe prior work on sparse self-attention.
68
+
69
+ # 2.1 Revisiting Self-Attention
70
+
71
+ BERT (Devlin et al., 2019) uses Masked Language Modeling (MLM), a self-supervised pre-training objective that allows a transformer encoder to encode a sequence from both directions simultaneously. Specifically, for an input sequence of $N$ tokens, let $\mathbf{X}^{\ell}\in \mathbb{R}^{N\times D}$ be the encoded features at the $\ell$ -th transformer layer, where $D$ denotes the embedding dimension. The features at the $(\ell +1)$ -th
72
+
73
+ layer are obtained by applying a transformer block:
74
+
75
+ $$
76
+ \boldsymbol {H} ^ {\ell + 1} = \operatorname {L N} \left(\boldsymbol {X} ^ {\ell - 1} + f _ {\mathrm {M H A}} ^ {\ell} (\boldsymbol {X} ^ {l})\right) \tag {1}
77
+ $$
78
+
79
+ $$
80
+ \boldsymbol {X} ^ {\ell + 1} = \operatorname {L N} \left(\boldsymbol {H} ^ {\ell + 1} + f _ {\mathrm {F F}} ^ {\ell} \left(\boldsymbol {H} ^ {\ell + 1}\right)\right) \tag {2}
81
+ $$
82
+
83
+ where LN denotes the layer normalization, $f_{\mathrm{FF}}(\cdot)$ is composed of two fully-connected sub-layers, wrapped in residual connection.
84
+
85
+ The Multi-Head Self-Attention (MHA) operation $f_{\mathrm{MHA}}^{\ell}(\cdot)$ in Eq. 1 is calculated as:
86
+
87
+ $$
88
+ f _ {\mathrm {M H A}} ^ {\ell} (\boldsymbol {X}) = \left[ f _ {\text {H e a d}} ^ {\ell , 1} (\boldsymbol {X}); \dots ; f _ {\text {H e a d}} ^ {\ell , h} (\boldsymbol {X}) \right] \boldsymbol {U} \tag {3}
89
+ $$
90
+
91
+ $$
92
+ f _ {\text {H e a d}} ^ {\ell , i} (\boldsymbol {X}) = \sigma \left(\boldsymbol {A} / \sqrt {D _ {h}}\right) \boldsymbol {V} \tag {4}
93
+ $$
94
+
95
+ where $\sigma (\cdot)$ is a softmax function, $A = QK^{T}$ is the self-attention matrix, $d$ is the model dimension, $h$ is the number of heads, $Q = XW_{q}, K = XW_{k}, V = XW_{v} \in \mathbb{R}^{N \times D_{h}}$ . $W_{q}, W_{k}, W_{v} \in \mathbb{R}^{D \times D_{h}}$ are the head-specific weights for query, key, and value vectors respectively, $D_{h} = D / h$ is the head dimension size, and $U$ is the weight matrix that combines the outputs of the heads. The computing of self-attention matrix $A \in \mathbb{R}^{N \times N}$ requires multiplying $Q \in \mathbb{R}^{N \times D_{h}}$ and $K^{T} \in \mathbb{R}^{D_{h} \times N}$ , which is $O(N^{2})$ in time and space complexity. This quadratic dependency on the sequence length has become a bottleneck for Transformers (Wang et al., 2020; Mehta et al., 2021).
96
+
97
+ # 2.2 Attention Patterns
98
+
99
+ Attention patterns can be classified into two general categories: (1) the diagonally shaped Diagonal Patterns and their particular case Local Patterns; (2) the vertically and horizontally shaped Axis Patterns, and their particular case Global Patterns. A pictorial representation of the categories is shown in Figure 1.
100
+
101
+ To represent the patterns intelligibly, we view such sparse attention patterns as an attention mask $B^{S} \in \mathbb{R}^{N \times N}$ , and treat it as an additive mask to the original self-attention mask $A$ . The new attention mask $\bar{A}$ can be written as:
102
+
103
+ $$
104
+ \bar {\boldsymbol {A}} = \boldsymbol {A} + \boldsymbol {C} \cdot \boldsymbol {B} ^ {S} \tag {5}
105
+ $$
106
+
107
+ where $C$ is a large negative constant value, and $B_{ij}^{S}\in B^{S}$ is 1 if and only if token $i$ needs to attend to token $j$ , and is zero otherwise.
108
+
109
+ Local vs. Diagonal Patterns Formally, we define diagonal pattern of size $N_{o}$ as a set of user
110
+
111
+ designed offsets $\mathcal{O} = \{o_k\}_{k = 1}^{N_o}$ , and define diagonal attention mask as:
112
+
113
+ $$
114
+ B _ {i j} ^ {L} = 1 \quad \Longleftrightarrow \quad | i - j | \in \mathcal {O} \tag {6}
115
+ $$
116
+
117
+ where $o_k \in [0, N-1]$ is the offset value that measures the distance between token $i$ and token $j$ .
118
+
119
+ Most sparse attention pattern designs contain a local pattern constraint on the window around each token where attention is allowed. Specifically, local patterns can be viewed as a special case of diagonal patterns, where $o_k = k$ , and the offset set is $\{0\} \cup \mathcal{O}$ . For simplicity, and with a slight overriding of the definition of sizes, we refer to a local attention of size $N_o$ as a diagonal attention with offsets $\{0, 1, \dots, N_o\}$ .
120
+
121
+ Global vs. Axis Patterns As shown in Figure 1(d), the Axis Attention mask is composed of two separate sets $\mathcal{R} = \{r_k\}_{k=1}^{N_r}$ and $\mathcal{C} = \{c_l\}_{l=1}^{N_c}$ , and we define the axis attention mask as:
122
+
123
+ $$
124
+ B _ {i j} ^ {G} = 1 \quad \Longleftrightarrow \quad i \in \mathcal {R} \text {o r} j \in \mathcal {C} \tag {7}
125
+ $$
126
+
127
+ where $r_k \in [1, N]$ and $c_l \in [1, N]$ are offset values indicating the selected $k$ -th row or $l$ -th column.
128
+
129
+ Global patterns are a special case of axis patterns, where $r_k = k$ and $c_l = l$ . In other words, in global patterns, there is no difference between horizontal (row) patterns and vertical (column) patterns, and picked rows and columns are at the start of the input. In most prior work, global patterns are discussed as a way to enable long range dependencies.
130
+
131
+ Random Patterns We introduce random patterns mainly for the sake of completeness. They were proposed in BigBird (Zaheer et al., 2020) and are obtained by randomly selecting some positions in the attention mask $B^{S}$ . We refer to the size $N_{r}$ of a random pattern as the number of positions selected divided by $2N$ to approximately match the definition of the size of local and global patterns.
132
+
133
+ Prior work typically combines local and global patterns rather than committing to only using one of these broad categories. The combination of two patterns involves an or operation between them. Given the fixed sparse patterns defined in Eq. 6 and Eq. 7, we have the combined sparse pattern represented by:
134
+
135
+ $$
136
+ \bar {\boldsymbol {A}} = \boldsymbol {A} + C \cdot \left(\boldsymbol {B} ^ {L} \vee \boldsymbol {B} ^ {G}\right) \tag {8}
137
+ $$
138
+
139
+ where $\vee$ denotes the logical OR operation. Note that the size of the attention mask when local pattern size increases by one, is very similar to the
140
+
141
+ size of the mask when the size of a global pattern increases by one. We will use this property to compare local and global patterns.
142
+
143
+ # 2.3 Sparse Self-Attention
144
+
145
+ Several sparse attention variants have been introduced to reduce the quadratic complexity of the full attention model (Guo et al., 2019; Shi et al., 2021). Longformer (Beltagy et al., 2020) and BigBird (Zaheer et al., 2020) are two notable models that make use of pre-defined patterns. Both utilize a combination of local and global attention patterns; BigBird also introduces a randomly generated and a fixed attention pattern.
146
+
147
+ Most closely related to our approach is Sparse-BERT (Shi et al., 2021). The authors of Sparse-BERT study the importance of the main diagonal attention pattern and propose a method to learn diagonal attention. Their method learns layer-agnostic diagonal patterns during pre-training, therefore the pattern is both layer- and task-unaware. Their experiments are designed to show that the main diagonal attention is not important. In contrast we carry out experiments to show that 1) the global attention is an important component in sparse attention designs, and 2) task adaptiveness and layer-awareness can bring good improvements to sparse attention designs, 3) combining the findings above, we can design a task and layer (and also input) adaptive global sparse attention pattern, and such pattern performs extremely well even without pre-training the model to adapt the pattern.
148
+
149
+ Traditional sparse attention approaches usually learn the sparse attention by replacing the full attention with pre-defined sparse attention pattern in a transformer model, then learning to operate with such patterns via a normal pre-training and fine-tuning pipeline. Despite the promising results achieved by the recent sparse attention approaches, rarely have there been studies done to provide a good understanding of such practices. Our paper is a comprehensive study on the roles of pre-training, different attention patterns, and the power of adaptiveness of the patterns.
150
+
151
+ # 3 Fixed Sparse Attention: A Comprehensive Analysis
152
+
153
+ In this section, we address the first two questions related to fixed attention patterns: $(i)$ is pre-training with these really necessary or does fine-tuning alone suffice, and $(ii)$ what are the strengths and
154
+
155
+ complementary aspects of local and global patterns.
156
+
157
+ # 3.1 Pretraining vs. Finetuning
158
+
159
+ We start with a suite of experiments designed to find out if sparse attention models can be successful without pre-training. We compare performance on the tasks in the GLUE benchmark of: a model with full attention in pre-training and fine-tuning; a model with the same sparse attention pattern used in pre-training and fine-tuning; and a model pretrained with full attention (as in standard off-the-shelf models) and fine-tuned on the specific task with sparse attention.
160
+
161
+ We report performance on the eight tasks from the GLUE benchmark (Wang et al., 2019b). Six of these tasks involve predictions about the degree or type of semantic equivalence between pairs of sentences and two are single sentence tasks, one involving linguistic accessibility judgements (CoLA) and the other sentiment prediction (SST-2). The amount of data for each task varies considerably from close to 400K for MNLI (one of the language inference tasks) to 2.5K examples in the RTE task. We do not perform experiments on the WNLI task, which contains fewer than one thousand samples for fine-tuning. In results presented later in the paper, the tasks are listed in decreasing order of fine-tuning data per-task.
162
+
163
+ We adopt all default training settings and hyperparameters from Huggingface (2021) for all experiments. For pre-training, we use eight Nvidia A100 GPUs and train for 1M steps with a per-device batch size of 32 on English Wikipedia<sup>2</sup>. We use all default configurations from bert-base-cased. We pre-train three models, one with full attention as in the official bert-base-cased and two with sparse attention patterns that we describe below.
164
+
165
+ For fine-tuning, we use four Nvidia A100 GPUs and train for 30k steps with a per-device batch size of 32 (effectively, each device runs about three epochs over the largest dataset, MNLI). Compared to the default setting of using one device, this guarantees the model can learn to converge from a full attention model to a sparse attention one.
166
+
167
+ In this section, we consider these patterns:
168
+
169
+ - Full is the full attention pattern as in traditional transformer models.
170
+ - Local + Global are the patterns used for Longformer. We use a subscript to indicate the size of the pattern. For example $\mathbf{Local}_2 + \mathbf{Global}_2$
171
+
172
+ Table 1: Comparison of pre-trained fixed sparse attention patterns designs with fine-tuned only patterns. For the metrics, Acc stands for Accuracy, $\mathrm{F}_1$ is the $\mathrm{F}_1$ score, Mcc stands for Matthews correlation coefficient and Spr stands for Spearman's rank correlation. All metrics are measured out of 100 (percent), and the higher the better. The datasets are sorted by training set size, from largest (MNLI) to the smallest (RTE).
173
+
174
+ <table><tr><td>Dataset</td><td>MNLI</td><td>QQP</td><td>QNLI</td><td>SST-2</td><td>COLA</td><td>STS-B</td><td>MRPC</td><td>RTE</td></tr><tr><td>Metric</td><td>Acc (mm)</td><td>F1</td><td>Acc</td><td>Acc</td><td>Mcc</td><td>Spr</td><td>F1</td><td>Acc</td></tr><tr><td>Full Pattern (pre-train &amp; fine-tune)</td><td>82</td><td>87</td><td>90</td><td>91</td><td>48</td><td>87</td><td>90</td><td>60</td></tr><tr><td>Local2 + Global2 (pre-train &amp; fine-tune)</td><td>77</td><td>85</td><td>86</td><td>89</td><td>41</td><td>52</td><td>80</td><td>54</td></tr><tr><td>Local2 + Global2 (fine-tune)</td><td>75 (↓ 2)</td><td>78 (↓ 7)</td><td>82 (↓ 4)</td><td>89 (↓ 0)</td><td>44 (↑ 3)</td><td>29 (↓ 23)</td><td>76 (↓ 4)</td><td>51 (↓ 3)</td></tr><tr><td>Local2 + Global1 + Random1 (pre-train &amp; fine-tune)</td><td>77</td><td>83</td><td>83</td><td>89</td><td>44</td><td>45</td><td>78</td><td>55</td></tr><tr><td>Local2 + Global1 + Random1 (fine-tune)</td><td>75 (↓ 2)</td><td>81 (↓ 2)</td><td>80 (↓ 3)</td><td>88 (↓ 1)</td><td>40 (↓ 4)</td><td>19 (↓ 26)</td><td>78 (↓ 0)</td><td>53 (↓ 2)</td></tr></table>
175
+
176
+ Table 2: Experiment on the Text dataset in LRA. We vary the size of the Local Pattern with or without Global Patterns. "Pf." means the performance.
177
+
178
+ <table><tr><td colspan="2">w/o Global Pattern</td><td colspan="2">w/ Global Pattern</td></tr><tr><td>Local Pattern</td><td>Pf.</td><td>Local Pattern</td><td>Pf.</td></tr><tr><td>512</td><td>62.80</td><td>512</td><td>61.73</td></tr><tr><td>128</td><td>57.72</td><td>128</td><td>63.12</td></tr><tr><td>16</td><td>55.58</td><td>16</td><td>71.34</td></tr><tr><td>2</td><td>52.88</td><td>2</td><td>77.62</td></tr></table>
179
+
180
+ stands for a Longformer that contains a local pattern of size 2 and a global pattern of size 2.
181
+
182
+ - Local + Global + Random are the patterns used for BigBird. Similarly, we use $\mathbf{Local}_2 + \mathbf{Global}_1 + \mathbf{Random}_1$ to denote a combination of local pattern of size 2, global pattern of size 1, and random pattern of size 1.
183
+
184
+ The last two patterns are also used in Sparse-BERT (Shi et al., 2021) $^3$ .
185
+
186
+ Table 1 shows our comparison between fine-tuning only approach and pre-training approach for $\mathrm{Local}_2 + \mathrm{Global}_2$ and $\mathrm{Local}_2 + \mathrm{Global}_1 + \mathrm{Random}_1$ . The table also gives performance measures for the model using full attention. Performance drops for the sparse compared to full attention models. However the difference between the fine-tuning only approach and the pre-training sparse attention approach is not that big. Notably for the acceptability judgements task (CoLA), the fine-tuned sparse attention model without a random component, results are 3 points higher than for the respective pre-trained model; performance is the same for the fine-tuned only and pre-trained model for the sentiment task (SST-2). The biggest gap in performance is for the STS-B, which requires predictions about the degree of similarity on a five point scale
187
+
188
+ between pairs of sentences. For this task already switching from full to sparse attention leads to a dramatic drop in performance. The average drop of performance across the task excluding this outlier is just under 3 absolute performance points.
189
+
190
+ For the sparse attention patterns with a random component, the pre-trained version is on average 2 absolute performance points better than the finetuned only model (again after the excluding the outlier for the STS-B task).
191
+
192
+ # 3.2 Comparing Local and Global Patterns
193
+
194
+ Global patterns have been somewhat neglected. For example, in the Long Range Arena (LRA) benchmark (Tay et al., 2021), the Longformer baseline does not include a global pattern.
195
+
196
+ In Table 2 we present a comparison between local patterns alone and a combination of local and global patterns on the Text dataset in the LRA benchmark. The comparison reveals the possible reason why partial evidence may suggest that adding global patterns is not helpful but that more complete evidence indicates that a combination of local and global patterns yields substantial benefits.
197
+
198
+ The first row of Table 2, shows that performance with global patterns and a local pattern of size 512 actually is a bit worse than without the global patterns. However, subsequent rows in the table reveal that as we decrease the size of the local pattern while keeping the global pattern, performance improves. Performance can reach as high as 77.62 with the global patterns, while the best performance from other baselines reported in the LRA benchmark paper is about 65.90. Global patterns bring unique information that local patterns do not capture and they should be included in future sparse attention pattern designs or baseline comparisons.
199
+
200
+ We further empirically compare local and global patterns and evaluate the performance of models with different degrees of focus on the two patterns
201
+
202
+ in Figure 2. To obtain the model's performance with a certain pattern, we start with a pre-trained full attention model and fine-tune it on the datasets with the sparse pattern. We compare models that focuses on vastly different amount of local and global patterns, while controlling the overall sparsity of the attention pattern. Comparing local-pattern only models with global-pattern only models would be naive, given that most prior approaches to sparse attention combine the two. In our experiments we consider models with a baseline size of two on both local and global patterns. Then, to analyze how the global pattern affects performance, for example, we fix the size of the local pattern to be 2 and vary the size of global patterns from 1 to 8. A similar set of experiments is done for the local patterns. Recalling the previous observation that we can compare local and global attention patterns with the same size, the experiments with different focus on local and global patterns can be compared.
203
+
204
+ We present experiments only for the three tasks with the largest amount of fine-tuning data in the GLUE benchmark. Figure 2 shows that, for both types of patterns, increasing the size of the patterns from the base size improves the performance. However, the areas of improvement are different on different tasks for local and global patterns. We can see that for MNLI and QNLI, increasing global patterns is more helpful than increasing local ones, while for QQP, the local patterns are more helpful. Intuitively, this is because different tasks require differing information types for language understanding — QQP requires more local information to distinguish the sentence pairs than MNLI and QNLI.
205
+
206
+ ![](images/35a2e14153670ff47262e1c032011053a34fb37bb1c6b05e14bd68cf2b93901a.jpg)
207
+ Figure 2: Comparison of Local Attention Pattern and Global Attention Pattern. We experiment with two sets of models, the first of 8 models of different sizes of local patterns and the second set of 8 models of different sizes of global patterns.
208
+
209
+ # 4 Beyond Fixed Sparse Attention
210
+
211
+ In this part, we discuss the importance of adaptiveness and propose an adaptive axis attention pattern.
212
+
213
+ # 4.1 Adaptiveness of Patterns
214
+
215
+ In the previous section we discussed evidence that global patterns and local patterns contribute differently to performance in different tasks. Should we then design different patterns for different tasks, and how can we do so? Moreover, given that different layers of BERT capture different linguistic knowledge (Clark et al., 2019; Michel et al., 2019; Kovaleva et al., 2019; Li et al., 2019)—should the patterns be adaptive to the layers as well?
216
+
217
+ We set out to study whether such adaptations to task and layer will indeed lead to better perfoam- nce. To this end, we generalize SparseBERT(Shi et al., 2021) to suit our needs and conduct experiments with it. SparseBERT as originally introduced learns a diagonal attention pattern (along with a fixed global pattern) model during pre-training. The learned model is applied to downstream tasks, keeping the patterns learned during pre-training fixed. However, the attention pattern learning aspect of their approach is applicable to fine-tuning as well. In our work we make use of it to train diagonal attention pattern models during fine-tuning only, thus allowing the model to learn different patterns for different tasks.
218
+
219
+ Before proceeding with these comparisons, we introduce the notion of attention sparsity and discuss a controllable method for obtaining models with similar sparsity levels. This is necessary for a meaningful comparison of sparse attention approaches, because in general reductions from full to sparse attention leads to drop in performance, as we saw for example in the tasks from the GLUE benchmark.
220
+
221
+ Sparsity Sparsity measures the size of the sparse attention (fixed or learned) when compared with the full attention. The sparsity used in (Shi et al., 2021) is defined as: $1 - |B^{S}| / N^{2}$ , where $|B^{S}| = |\{(i,j)|B_{ij}^{S} \neq 0\}|$ is the number of ones in the sparse attention mask matrix $B^{S}$ . This definition is suitable for patterns that are fixed during finetuning. In our work, different tasks may yield different patterns. Therefore, we propose a generalized definition of sparsity:
222
+
223
+ $$
224
+ \rho = \frac {1}{| \mathcal {D} | L h} \sum_ {i = 1} ^ {| \mathcal {D} |} \left(\sum_ {l = 1} ^ {L} \sum_ {a = 1} ^ {h} \left(1 - \frac {\left| B _ {i , l , a} ^ {S} \right|}{N _ {i} ^ {2}}\right)\right) \tag {9}
225
+ $$
226
+
227
+ where $|\mathcal{D}|$ is the size of the dataset $\mathcal{D}$ , $N_{i}$ denotes the sequence length of the $i$ -th input sample, which can be different from the fixed value (128) in Shi et al. (2021) $^4$ , $L$ the number of transformer layers, and $h$ the number of attention heads. $B_{i,l,a}^{S}$ refers to the sparse attention mask matrix for the $i$ -th input sample, $l$ -th layer, and $a$ -th attention head.
228
+
229
+ The sparsity definition in Eq. 9 has several key advantages: 1) It is applicable when attention patterns are different across instances, layers, and attention heads rather than fixed; 2) It uses the actual sequence (text) length, more truthfully reflecting how much attention is used when processing a specific input. The original sparsity definition is involves only the model-wise maximum sequence length. For example, a local pattern of size 2 has a sparsity value: $1 - 5 / N + 6 / N^2$ . This is undesirable because by just changing the model maximum sequence length, sparsity changes without impacting the performance on individual inputs.
230
+
231
+ Sparsity Controllable Training Controlling the target sparsity of self-attention is beneficial for comparison purposes. Given the fixed target sparsity $\rho_{\mathrm{target}}$ , we define the training objective as:
232
+
233
+ $$
234
+ \mathcal {L} _ {\text {A l l}} = \underbrace {\mathcal {L} _ {\text {t a s k}}} _ {\text {F i n e t u n e L o s s}} + \underbrace {\alpha \cdot \max (0 , \rho_ {\text {t a r g e t}} - \rho)} _ {\text {S p a r s i t y L o s s}} \tag {10}
235
+ $$
236
+
237
+ where the first term $(\mathcal{L}_{\mathrm{task}})$ denotes the objective loss for the fine-tuning task, $\rho$ is the sparsity during training, $\alpha$ is an amplifying factor of the sparsity loss. The hinge loss encourages the runtime sparsity to be close to the desired sparsity. In our experiments, we consider two variants of $\alpha$ : 1) a constant value and 2) an increasing linear value that reaches its maximum at half of the epochs and then stays constant. We pick the best variant of $\alpha$ among the two and gradually increase its absolute value until the target sparsity has been reached.
238
+
239
+ Results In our experiment, we consider three diagonal attention pattern models that have different levels of adaptiveness:
240
+
241
+ - Fixed is a fixed diagonal attention pattern model, where the pattern is copied from a pre-trained SparseBERT model.
242
+ - Task-adaptive is a model that learns the attention pattern during fine-tuning, therefore is different for different tasks.
243
+
244
+ - Task- & Layer-adaptive further allows different layers of the model to learn different patterns.
245
+
246
+ All attention patterns are paired with global attention, and the results are reported in Table 3. We can see clearly that the task-adaptive model is better than the fixed model, as the patterns are learned from the tasks. Further, adding adaptiveness into the layers also brings a small boost to the performance. These experiments show that having the patterns adaptive and learnable is beneficial for sparse pattern designs.
247
+
248
+ # 4.2 Adaptive Axis Attention
249
+
250
+ We show experiments highlighting the strengths of global attention (in Section 3.2) and of allowing adaptiveness of attention (in Section 4.1). To combine these strengths, we design a novel attention pattern that incorporates the learning of Axis Patterns, a more general form of Global Patterns. Intuitively, we want the model to learn which input tokens are important and focus on rows or columns in the attention map associated with these tokens.
251
+
252
+ Specifically, we learn a row/column-wise importance value for each token representation $\pmb{x}_n \in \pmb{X}$ through a fully-connected layer. This importance value is fed into a Gumbel-sigmoid operation to retrieve a 0/1 indicator:
253
+
254
+ $$
255
+ \tilde {I} _ {n} ^ {k} = f _ {\text {G u m b e l - s i g m o i d}} \left(f _ {\mathrm {F C}} ^ {k} \left(\boldsymbol {x} _ {n}\right)\right), k \in \{r, c \} \tag {11}
256
+ $$
257
+
258
+ where $\tilde{I}_n^k$ is the importance indicator for $n$ -th token retrieved by the Gumbel-sigmoid operation, $k$ indicates the column $(c)$ or row $(r)$ . Specifically, $\tilde{I}_n^r = 1$ indicates that all attention values in row $n$ of the attention matrix are kept. Equivalently, this means this token can attend to all other tokens in the input. Similarly, $\tilde{I}_n^c = 1$ indicates column $n$ of the attention matrix is kept.
259
+
260
+ Given the importance indicators $\tilde{I}_i^r$ and $\tilde{I}_j^c$ , the axis pattern $B_{ij}^{S}\in B^{S}$ can be calculated as follows:
261
+
262
+ $$
263
+ B _ {i j} ^ {S} = \tilde {I} _ {i} ^ {r} + \tilde {I} _ {j} ^ {c} - \tilde {I} _ {i} ^ {r} \cdot \tilde {I} _ {j} ^ {c} \tag {12}
264
+ $$
265
+
266
+ where $B_{ij}^{S} = 1$ means either the importance indicator for row $i$ or column $j$ is on. Usually, this adaptive axis attention pattern is also paired up with some local patterns, especially the main diagonal local attention. This is to ensure that no rows are empty, which is needed because self-attention includes operations such as softmax and linear combinations, which are undefined over empty values.
267
+
268
+ Table 3: Comparison of learnable diagonal attention models that have different levels of adaptiveness. $\rho$ is the sparsity value defined in Eq. 9. We also show the relative difference from each row to the previous row.
269
+
270
+ <table><tr><td rowspan="2">Adaptiveness</td><td colspan="2">MNLI</td><td colspan="2">QQP</td><td colspan="2">QNLI</td><td colspan="2">SST-2</td><td colspan="2">COLA</td><td colspan="2">STS-B</td><td colspan="2">MRPC</td><td colspan="2">RTE</td></tr><tr><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td></tr><tr><td>Fixed</td><td>86</td><td>70</td><td>85</td><td>79</td><td>88</td><td>72</td><td>83</td><td>89</td><td>75</td><td>34</td><td>85</td><td>28</td><td>88</td><td>79</td><td>88</td><td>50</td></tr><tr><td>Task-adaptive</td><td>86</td><td>74(↑ 4)</td><td>87</td><td>79(↑ 0)</td><td>89</td><td>75(↑ 3)</td><td>83</td><td>83(↓ 6)</td><td>81</td><td>38(↑ 4)</td><td>85</td><td>36(↑ 8)</td><td>88</td><td>77(↓ 2)</td><td>89</td><td>56(↑ 6)</td></tr><tr><td>Task &amp; Layer-adaptive</td><td>86</td><td>76(↑ 2)</td><td>85</td><td>81(↑ 2)</td><td>89</td><td>77(↑ 2)</td><td>83</td><td>86(↑ 3)</td><td>78</td><td>35(↓ 3)</td><td>86</td><td>38(↑ 2)</td><td>89</td><td>77(↑ 0)</td><td>89</td><td>55(↓ 1)</td></tr></table>
271
+
272
+ Following designs in Section 3.2, we pair it up with a local pattern of size 2. This adaptive axis pattern is also learned separately for each layer and different tasks, taking full advantage of the benefits of adaptiveness. Similar to the adaptive diagonal attention patterns introduced in Section 4.1, we optimize the model with Eq. 10.
273
+
274
+ # 4.3 Experiments with AAA
275
+
276
+ In this section, we verify empirically the effectiveness of our proposed AAA. Quantitative results are listed in Tables 4, 5, and 7.
277
+
278
+ Experiment Settings In this section, our experiments follow the setting described in Section 3.1. We also include some other patterns to show that findings are stable for different combinations:
279
+
280
+ - $\mathrm{Local}_3 + \mathrm{Global}_1$ is a variant of the Longformer-like pattern in which we increase the size of the local attention but decrease global attention size. As discussed previously, this results in a model with comparable capacity but may provide different benefits.
281
+ - $\mathbf{Local}_1 + \mathbf{Global}_1 + \mathbf{Random}_2$ is similarly a variant for BigBird. Here we increase the size of the random patterns, so the resulting sparsity values are different from the corresponding $\mathbf{Local}_2 + \mathbf{Global}_1 + \mathbf{Random}_1$ attention.
282
+ - Diagonal + Global $_1$ represents patterns coming from SparseBERT. It combines a learned diagonal pattern with global pattern of size 1.
283
+
284
+ AAA outperforms fix pattern models We compare our AAA with several fixed attention patterns. We optimize AAA with Eq. 10, and set different targets of the final sparsity values $\rho_{\mathrm{target}}$ for each task. For all baselines, we report the sparsity values and performance on the development set in Table 4. We first point out an encouraging result related to sparsity: AAA exhibits a similar sparsity value in the development set as in the training set. For all datasets, AAA is able to reach the desired, and sometimes slightly better, sparsity values. Next, we compare the performance of the models. For all
285
+
286
+ tasks, our model performs better than the fixed pattern approaches. For most tasks, the improvement is large. This success further confirms the strength of adaptiveness in designing attention patterns.
287
+
288
+ AAA rivals pre-trained pattern models Now we also compare with the pre-trained variant of the adaptive diagonal attention model. Rather than starting from a pre-trained BERT model with full attention, we pre-train a sparse adaptive diagonal attention model. The results, along with pre-trained variants of fixed pattern models, are shown in Table 5. We already know, from Section 3.1, that the pre-trained variants of fixed patterns improve a moderate amount of performance. The performance for the adaptive patterns is also comparable to the fine-tuned only AAA on most tasks. Furthermore, on the STS-B task where fixed patterns suffered a great drop in performance, AAA shows very strong performance. The pre-trained version of the diagonal patterns shows strong performance and is better than our model in most tasks. Overall, we show that AAA achieves a strong performance that is comparable to other sparse patterns that involve pre-training.
289
+
290
+ AAA focuses more on columns than rows AAA separates the importance learning of row-wise patterns and column-wise patterns. After fine-tuning, we examine for each input sample during evaluation the percentage of important tokens selected for rows and for columns. Table 6 shows the results. There are much more important column tokens than important row tokens. This means that for axis patterns, tokens that other tokens attended to are more important than tokens that attend to other tokens. This finding is another indication that fixed (global) patterns are not ideal.
291
+
292
+ AAA is orthogonal to MobileBERT Improving the efficiency of transformers is needed for real-world applications and several approaches have been developed to improve efficiency on resource-limited devices, such as reducing attention heads and hidden dimensions. To show that gains from
293
+
294
+ Table 4: Comparison of fixed sparse attention map designs with ours. In the first row, we show the performance when using the unchanged full attention. Since our method AAA has the ability to learn to a fixed sparsity ratio, we train our model to adapt to the specific sparsity ratio on each task when compared to other different fixed patterns.
295
+
296
+ <table><tr><td rowspan="2">Fine-tuning Pattern</td><td colspan="2">MNLI</td><td colspan="2">QQP</td><td colspan="2">QNLI</td><td colspan="2">SST-2</td><td colspan="2">COLA</td><td colspan="2">STS-B</td><td colspan="2">MRPC</td><td colspan="2">RTE</td></tr><tr><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td></tr><tr><td>Full</td><td>0</td><td>84</td><td>0</td><td>88</td><td>0</td><td>91</td><td>0</td><td>92</td><td>0</td><td>54</td><td>0</td><td>88</td><td>0</td><td>89</td><td>0</td><td>62</td></tr><tr><td>\( \text{Local}_2 + \text{Global}_2 \)</td><td>76</td><td>77</td><td>70</td><td>85</td><td>82</td><td>84</td><td>64</td><td>90</td><td>34</td><td>48</td><td>70</td><td>42</td><td>83</td><td>78</td><td>84</td><td>53</td></tr><tr><td>\( \text{Local}_3 + \text{Global}_1 \)</td><td>76</td><td>77</td><td>70</td><td>83</td><td>82</td><td>80</td><td>63</td><td>89</td><td>34</td><td>48</td><td>70</td><td>31</td><td>83</td><td>79</td><td>84</td><td>53</td></tr><tr><td>AAA</td><td>77</td><td>81(↑ 4)</td><td>73</td><td>85(↑ 0)</td><td>82</td><td>86(↑ 2)</td><td>65</td><td>89(↓ 1)</td><td>36</td><td>56(↑ 8)</td><td>72</td><td>79(↑ 37)</td><td>86</td><td>83(↑ 5)</td><td>85</td><td>58(↑ 5)</td></tr><tr><td>\( \text{Local}_2 + \text{Global}_1 + \text{Random}_1 \)</td><td>80</td><td>77</td><td>76</td><td>84</td><td>85</td><td>79</td><td>70</td><td>90</td><td>45</td><td>44</td><td>75</td><td>44</td><td>86</td><td>82</td><td>87</td><td>56</td></tr><tr><td>AAA</td><td>81</td><td>80(↑ 3)</td><td>82</td><td>85(↑ 0)</td><td>85</td><td>86(↑ 7)</td><td>84</td><td>89(↓ 1)</td><td>76</td><td>50(↑ 6)</td><td>82</td><td>75(↑ 31)</td><td>89</td><td>80(↓ 2)</td><td>89</td><td>56(↑ 0)</td></tr><tr><td>\( \text{Local}_1 + \text{Global}_1 + \text{Random}_2 \)</td><td>85</td><td>77</td><td>81</td><td>84</td><td>88</td><td>80</td><td>77</td><td>90</td><td>57</td><td>33</td><td>81</td><td>49</td><td>89</td><td>79</td><td>89</td><td>49</td></tr><tr><td>AAA</td><td>86</td><td>80(↑ 3)</td><td>86</td><td>85(↑ 1)</td><td>88</td><td>86(↑ 6)</td><td>84</td><td>89(↓ 1)</td><td>76</td><td>50(↑ 17)</td><td>86</td><td>67(↑ 18)</td><td>89</td><td>80(↑ 1)</td><td>89</td><td>56(↑ 7)</td></tr></table>
297
+
298
+ Table 5: Comparison of pretrained sparse attention map designs with ours.
299
+
300
+ <table><tr><td rowspan="2">Pattern</td><td colspan="2">MNLI</td><td colspan="2">QQP</td><td colspan="2">QNLI</td><td colspan="2">SST-2</td><td colspan="2">COLA</td><td colspan="2">STS-B</td><td colspan="2">MRPC</td><td colspan="2">RTE</td></tr><tr><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td></tr><tr><td>\( \text{Local}_2 + \text{Global}_2 \) (pre-train &amp; fine-tune)</td><td>76</td><td>77</td><td>70</td><td>85</td><td>82</td><td>86</td><td>63</td><td>89</td><td>34</td><td>41</td><td>70</td><td>52</td><td>83</td><td>80</td><td>84</td><td>54</td></tr><tr><td>AAA (fine-tune)</td><td>77</td><td>79(↑ 2)</td><td>72</td><td>84(↓ 1)</td><td>83</td><td>84(↓ 2)</td><td>66</td><td>89(↑ 0)</td><td>48</td><td>41(↑ 0)</td><td>71</td><td>81(↑ 29)</td><td>86</td><td>85(↑ 5)</td><td>87</td><td>53(↓ 1)</td></tr><tr><td>\( \text{Local}_2 + \text{Global}_1 + \text{Random}_1 \) (pre-train &amp; fine-tune)</td><td>80</td><td>77</td><td>76</td><td>83</td><td>85</td><td>83</td><td>70</td><td>89</td><td>45</td><td>44</td><td>75</td><td>45</td><td>86</td><td>78</td><td>87</td><td>55</td></tr><tr><td>AAA (fine-tune)</td><td>81</td><td>80(↑ 3)</td><td>78</td><td>84(↑ 1)</td><td>86</td><td>84(↑ 1)</td><td>71</td><td>88(↓ 1)</td><td>56</td><td>40(↓ 4)</td><td>76</td><td>80(↑ 35)</td><td>89</td><td>84(↑ 6)</td><td>90</td><td>53(↓ 2)</td></tr><tr><td>Diagonal + \( \text{Global}_1 \) (pre-train &amp; fine-tune)</td><td>86</td><td>79</td><td>85</td><td>85</td><td>88</td><td>86</td><td>83</td><td>90</td><td>75</td><td>38</td><td>85</td><td>64</td><td>88</td><td>84</td><td>88</td><td>54</td></tr><tr><td>AA&#x27; (fine-tune)</td><td>87</td><td>78(↓ 1)</td><td>86</td><td>83(↓ 2)</td><td>88</td><td>84(↓ 2)</td><td>84</td><td>87(↓ 3)</td><td>77</td><td>36(↓ 2)</td><td>85</td><td>75(↑ 11)</td><td>91</td><td>86(↑ 2)</td><td>90</td><td>50(↓ 4)</td></tr></table>
301
+
302
+ Table 6: Percentage of row-wise important tokens and column-wise important tokens.
303
+
304
+ <table><tr><td></td><td>MNLI</td><td>QQP</td><td>QNLI</td><td></td><td>MNLI</td><td>QQP</td><td>QNLI</td></tr><tr><td>row</td><td>0.8</td><td>0.6</td><td>1.0</td><td>column</td><td>1.6</td><td>1.3</td><td>1.7</td></tr></table>
305
+
306
+ Table 7: AAA can be integrated with MobileBERT.
307
+
308
+ <table><tr><td rowspan="2">Model</td><td colspan="2">MNLI</td><td colspan="2">QQP</td><td colspan="2">QNLI</td></tr><tr><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td><td>ρ</td><td>Pf.</td></tr><tr><td>BERT</td><td>0</td><td>84</td><td>0</td><td>87</td><td>0</td><td>91</td></tr><tr><td>BERT + AAA</td><td>77</td><td>81</td><td>73</td><td>85</td><td>82</td><td>86</td></tr><tr><td>MobileBERT</td><td>0</td><td>83</td><td>0</td><td>87</td><td>0</td><td>90</td></tr><tr><td>MobileBERT + AAA</td><td>78</td><td>78</td><td>74</td><td>83</td><td>83</td><td>86</td></tr></table>
309
+
310
+ our AAA are compatible with such approaches, we compare AAA with MobileBERT (Sun et al., 2020) in Table 7. The amount of performance dropped with the same sparsity is similar for both BERT and MobileBERT. Therefore, AAA's performance is not impeded by a model that is already compressed to reduce attention heads or hidden dimensions and can be integrated into such a model easily and effectively.
311
+
312
+ # 5 Conclusion
313
+
314
+ In this paper, we present a comprehensive analysis of sparse attention patterns. We demonstrate that while pre-training with sparse attention does improve performance on many tasks, using sparse attention only in fine-tuning sacrifices a bit of per
315
+
316
+ formance for a big gain in time and computational resource savings.
317
+
318
+ We compare the popular local and global patterns and conclude that either type provide an advantage depending on the task. We also show that allowing sparse patterns to be adaptive to the task or layers improves performance. Finally we present AAA which incorporated all these insights and learns important tokens during fine-tuning. Our model is consistently and considerably better than other sparse attention pattern models and rivals models that require extensive pre-training. For future work, we anticipate to integrate the adaptive diagonal pattern with our adaptive axis pattern to construct a fully learnable pattern.
319
+
320
+ # Ethical Considerations
321
+
322
+ The work presented in this paper deals with foundations aspects of representation learning for language tasks. We present experiments on core tasks dealing with textual semantic equivalence, which do not pose ethical concerns.
323
+
324
+ # Acknowledgments
325
+
326
+ This work was supported in part by Adobe Research. We thank anonymous reviewers and program chairs for their valuable and insightful feedback. Zihan Wang is supported by the UCSD Jacob School of Engineering Fellowship and the UCSD Haliccioglu Data Science Fellowship.
327
+
328
+ # References
329
+
330
+ Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. CoRR, abs/2004.05150.
331
+ Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. 2019. Generating long sequences with sparse transformers. CoRR, abs/1904.10509.
332
+ Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. 2019. What does BERT look at? an analysis of bert's attention. CoRR, abs/1906.04341.
333
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In *NAACL*.
334
+ Linyuan Gong, Di He, Zhuohan Li, Tao Qin, Liwei Wang, and Tieyan Liu. 2019. Efficient training of bert by progressively stacking. In ICML.
335
+ Qipeng Guo, Xipeng Qiu, Pengfei Liu, Yunfan Shao, Xiangyang Xue, and Zheng Zhang. 2019. Start-transformer. In NAACL.
336
+ Huggingface. 2021. https://github.com/huggingface/transformers/tree/master/examples/pytorch.
337
+ Eric Jang, Shixiang Gu, and Ben Poole. 2017. Categorical reparameterization with gumbel-softmax. In ICLR.
338
+ Olga Kovaleva, Alexey Romanov, Anna Rogers, and Anna Rumshisky. 2019. Revealing the dark secrets of BERT. In EMNLP-IJCNLP.
339
+ Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. 2019. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In NeurIPS.
340
+ Sachin Mehta, Marjan Ghazvininejad, Srinivasan Iyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. 2021. Delight: Deep and light-weight transformer. In ICLR.
341
+ Paul Michel, Omer Levy, and Graham Neubig. 2019. Are sixteen heads really better than one? In NeurIPS.
342
+ Han Shi, Jiahui Gao, Xiaozhe Ren, Hang Xu, Xiaodan Liang, Zhenguo Li, and James Tin-Yau Kwok. 2021. Sparsebert: Rethinking the importance analysis in self-attention. In ICML.
343
+ Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. 2020. Mobilebert: a compact task-agnostic BERT for resource-limited devices. CoRR, abs/2004.02984.
344
+
345
+ Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. 2021. Long range arena: A benchmark for efficient transformers. In ICLR.
346
+ Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. 2020. Efficient transformers: A survey. CoRR, abs/2009.06732.
347
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NeurIPS.
348
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019a. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR.
349
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. 2019b. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR.
350
+ Sinong Wang, Belinda Z Li, Madian Khabsa, Han Fang, and Hao Ma. 2020. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768.
351
+ Manzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontañón, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. 2020. Big bird: Transformers for longer sequences. In NeurIPS.
learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6087ff2babdecebcf184931c750f16531b84aad9b36df48e2bfae67dcbafd977
3
+ size 329381
learningadaptiveaxisattentionsinfinetuningbeyondfixedsparseattentionpatterns/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3aa0a05442734fb90a0f6ae26248dc7209d12dca1325dab433733314e15ec303
3
+ size 397169
learningandevaluatingcharacterrepresentationsinnovels/1faa467d-85d6-4412-80e4-5e8f2a70ba11_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f29aa5f350958de834a8bdd13d9fab20cf4259fc95d7bceac2e039612b7f4935
3
+ size 81491
learningandevaluatingcharacterrepresentationsinnovels/1faa467d-85d6-4412-80e4-5e8f2a70ba11_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:913c4a41b86b81c679f3eb706b5f60855963b84b29c2f0b862c3b298481b398e
3
+ size 99590
learningandevaluatingcharacterrepresentationsinnovels/1faa467d-85d6-4412-80e4-5e8f2a70ba11_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a7cae875b9b3fdcda665e9896a81dc2ae2c8e798fc57cb87b17cc610dcdfec4
3
+ size 819013
learningandevaluatingcharacterrepresentationsinnovels/full.md ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning and Evaluating Character Representations in Novels
2
+
3
+ Naoya Inoue, Charuta Pethe, Allen Kim, Steven Skiena
4
+ Stony Brook University
5
+
6
+ {ninoue,cpethe,allekim,skiena}@cs.stonybrook.edu
7
+
8
+ # Abstract
9
+
10
+ We address the problem of learning fixed-length vector representations of characters in novels. Recent advances in word embeddings have proven successful in learning entity representations from short texts, but fall short on longer documents because they do not capture full book-level information. To overcome the weakness of such text-based embeddings, we propose two novel methods for representing characters: (i) graph neural network-based embeddings from a full corpus-based character network; and (ii) low-dimensional embeddings constructed from the occurrence pattern of characters in each novel. We test the quality of these character embeddings using a new benchmark suite to evaluate character representations, encompassing 12 different tasks. We show that our representation techniques combined with text-based embeddings lead to the best character representations, outperforming text-based embeddings in four tasks. Our dataset is made publicly available to stimulate additional work in this area.
11
+
12
+ # 1 Introduction
13
+
14
+ High-quality distributed representations of characters (henceforth, character embeddings) play an important role for the computational analysis of narrative texts (Iyyer et al., 2016; Xanthos et al., 2016; Skorinkin, 2017; Azab et al., 2019; Labatut and Bost, 2019; Kubis, 2021; Brahman et al., 2021).
15
+
16
+ Ideally, characters who share similar properties such as job, gender and a relationship to other characters, should possess similar character embeddings even if they are in different stories (e.g. Cinderella and Juliet, both young women in forbidden romance situations). This paper aims for learning such fixed-length, distributed representations from novels.
17
+
18
+ The core problem of learning character embeddings is how to aggregate and embed the contextual information of characters into distributed rep
19
+
20
+ ![](images/fa0ee1e4d5ce64e206bf0ef24d7c30b34f156d3b74a3bc797a08617f80365017.jpg)
21
+ Figure 1: t-SNE visualization of our character embeddings for ten characters. Each character is sampled from more than 24 different books. The proposed method assigns similar representations to each character even though they exist in different books. The proposed method uses no surface form matching.
22
+
23
+ resentations. Conventionally, this has been extensively studied in word embeddings, including static word embeddings such as word2vec (Mikolov et al., 2013) and GloVe (Pennington et al., 2014), and in contextualized word embeddings such as ELMo (Peters et al., 2018) and BERT (Devlin et al., 2019). All these methods follow the Distributional Hypothesis: “words that occur in the same context tend to have similar meanings” (Harris, 1954).
24
+
25
+ One limitation of these approaches is that they represent word embeddings by local context: they split documents into individual sentences or small chunks, ignoring the document information of each input. To learn character embeddings, however, it is desirable for an embedding algorithm to be aware of document-level information. This enables us to extend the Distributional Hypothesis to more global context: characters that occur in the same books/authors tend to have similar or related properties (e.g. the Sherlock Holmes series tend to have detectives, policemen, criminals, etc.).
26
+
27
+ To overcome the weakness of such text-based embeddings, we propose two novel methods to learn character embeddings using document-level
28
+
29
+ information. First, we propose graph-based embeddings, where we build a full corpus-based character network accompanied with full book-level information and then use a graph neural network to learn character embeddings. Second, we propose positional embeddings, where we create low-dimensional embeddings from the occurrence pattern of characters in each novel.
30
+
31
+ To evaluate the quality of character embeddings, we construct a new character embedding benchmark (CEB) consisting of 12 different tasks. At training time, one is allowed to learn fixed-length character embeddings from novels. The learned embeddings are then tested if the important properties of characters such as gender can be recovered solely based on them, similar to recent work on probing pretrained language models (Hewitt and Manning, 2019; Voita and Titov, 2020, etc.).
32
+
33
+ The contribution of this paper can be summarized as follows:
34
+
35
+ - New methods for character embeddings – We propose two novel methods for learning character embeddings leveraging full book-level information (§4).
36
+ - Evaluation of character embeddings - We create a novel benchmark suite (CEB) for testing the quality of character embeddings, consisting of 12 different tasks ( $\S 5$ ). The dataset and evaluation script are publicly available at https://github.com/naoya-i/charembench.
37
+
38
+ Our experiments show that the proposed embedding methods combined with text-based embeddings leads to the best character embeddings, outperforming text-based embeddings in six CEB tasks (§6.3).
39
+
40
+ - Corpus-level views of character embeddings – We show that character embeddings cluster across large corpora by gender, protagonist status, profession/role, thus demonstrating the versatility of the techniques we employ (§7). Fig. 1 shows the key result, indicating that similar character representations are assigned to each cluster of character, even though they exist in different books.
41
+
42
+ # 2 Related work
43
+
44
+ There is a growing interest in computational narrative analysis, ranging from analyzing the structure of narratives (Kim et al., 2020, 2021; Pethe
45
+
46
+ et al., 2020), identifying important events in stories (Wilmot and Keller, 2020, 2021; Papalampidi et al., 2020; Otake et al., 2020) to analyzing the relationship between characters in novels (Iyyer et al., 2016; Xanthos et al., 2016; Skorinkin, 2017; Azab et al., 2019; Labatut and Bost, 2019; Kubis, 2021; Brahman et al., 2021). The most relevant work to ours is Azab et al. (2019), who apply word2vec (Mikolov et al., 2013) to learn character embeddings from movie scripts. However, they do not use full document-level information such as the author of documents for learning character embeddings. They also experiment on a small-scale dataset-18 movie scripts, while we experiment on 17k novels. Brahman et al. (2021) propose two benchmark tasks for character-centric narrative understanding, namely character identification and character description generation. We extend their benchmark by introducing additional 12 character-related tasks.
47
+
48
+ Character embeddings are closely related to both static word embeddings such as word2vec (Mikolov et al., 2013) and GloVe (Pennington et al., 2014), and contextualized word embeddings such as dynamic entity embeddings (Kobayashi et al., 2016), ELMo (Peters et al., 2018) and BERT (Devlin et al., 2019). As discussed in §1, these methods follow the Distributional Hypothesis (Harris, 1954), encoding the local context of words into distributed representations. We intend to complement this weakness by taking book-level context into account in the graph neural network-based embedding methods.
49
+
50
+ The task setting of CEB shares the similar spirit to a recent paradigm on probing pretrained language models (Hewitt and Manning, 2019; Petroni et al., 2019; Voita and Titov, 2020; Shin et al., 2020). The LAMA dataset (Petroni et al., 2019), for example, creates a sentence with blanks, e.g. was born in, and ask language models to predict words in the blanks solely based on the learned model parameters. Our benchmark also follows this task setting, where one learns character embeddings on a particular corpus and is asked to recover information solely based on the learned embeddings in 12 different tasks.
51
+
52
+ # 3 Baseline text-based methods
53
+
54
+ # 3.1 Static embeddings
55
+
56
+ One simple way to learn character embeddings is to treat each character name as one unique token
57
+
58
+ at the document-level and apply standard word embedding algorithms. Given a corpus, we convert all character mentions including pronouns to special tokens consisting of its document ID and character name (e.g. When 113_Mary was sent to...). To identify character mentions and coreference relations between them, we use Stanford CoreNLP (Manning et al., 2014). See §5.1 for further details.
59
+
60
+ We then apply word2vec (Mikolov et al., 2013). Because a corpus of novels alone may not provide enough data to learn non-character word vectors, we initialize non-character word vectors with GloVe pretrained embeddings (Pennington et al., 2014). Henceforth, we call this method w2v.
61
+
62
+ We also apply doc2vec (Le and Mikolov, 2014) to the preprocessed corpus, where we treat each character as one document and sentences that mention this character as the content of this document. Henceforth, we call this method d2v.
63
+
64
+ # 3.2 Context-aggregated embeddings
65
+
66
+ Another simple way to learn character embeddings is to aggregate contextual information of characters (Ethayarajh, 2019; Bommasani et al., 2020). Given a character $c$ , we extract set $S(c)$ of sentences that mention $c$ and generate a sentence representation $\mathbf{s}_i$ for each $s_i \in S(c)$ . We then aggregate them via averaging: $\mathbf{c} = \frac{1}{|S(c)|} \sum_{s_i \in S(c)} \mathbf{s}_i$ .
67
+
68
+ To generate $\mathbf{s}_i$ , we explore two methods. The first method is w_ag, which simply averages word embeddings learned in Sec. 3.1: $\mathbf{s}_i = \frac{1}{|s_i|}\sum_{w_j\in s_i}\mathbf{w}_j$ . We also make gl_ag, a variation of this model using vanilla GloVe pretrained embeddings (Pennington et al., 2014).
69
+
70
+ Another method is rb_ag, which uses contextualized word embeddings of characters generated by RoBERTa (Liu et al., 2019). Given $s_i \in S(c)$ , we first replace character mentions of $c$ with mask tokens. For example, suppose $c = Mary$ and $s_i = Mary$ was most attracted by the mother and Dickon. The sentence is then converted to [MASK] was most attracted by the mother and Dickon. To generate $s_i$ , we extract contextualized word embeddings of [MASK] tokens at the final layer.
71
+
72
+ # 3.3 Name embeddings (nam)
73
+
74
+ Ye et al. (2017) represent common first/last names using a vector representation that encodes gender, ethnicity, and nationality which is readily applicable to building classifiers and other systems. Name
75
+
76
+ ![](images/62aa31064b84e90e88cf7880319f744e3eb29144a9753bd427f0a30544a12501.jpg)
77
+ Figure 2: Example of character network. Characters (green) are connected through book-level information, i.e. books (orange) and authors (red). Context information (green) captures the attributes of characters.
78
+
79
+ embeddings exploit the phenomenon of homophily in communication, specifically that people tend to associate with similar people or popularly that "birds of a feather flock together." These embeddings are constructed from email contact lists of email, rosters of friends on social media, or followers on Twitter. The homophily-induced coherence of these contact lists enables us to derive meaningful features using word embedding methods. We used 100 dimensional embeddings from (Ye and Skiena, 2019).
80
+
81
+ # 4 Proposed methods
82
+
83
+ While text-based embeddings introduced in §3 can be expected to capture the local context of characters such as gender, they do not take into account full book-level information, such as the author. Intuitively, characters from the same book should have more relatively similar embeddings than those from different books, but the text-based embedding methods cannot use this kind of information. To address this weakness, we propose two methods for character embeddings: (i) gr: we build character network across books and then learn character embeddings using Graph Neural Networks (§4.1); and (ii) pos: we encode the occurrence pattern of characters into low-dimensional embeddings (§4.2).
84
+
85
+ # 4.1 Graph-based embeddings
86
+
87
+ # 4.1.1 Character network
88
+
89
+ Our character network is an undirected graph consisting of four types of nodes and four types of unlabeled edges as shown in Fig. 2.
90
+
91
+ Nodes. First, we introduce (i) book nodes (e.g. The Adventures of Tom Sawyer), (ii) author nodes (e.g. Mark Twain), and (iii) character nodes (e.g.
92
+
93
+ <table><tr><td>Node type</td><td># nodes</td><td>Edge type</td><td># edges</td></tr><tr><td>Book</td><td>17,275</td><td>Bk-Au</td><td>17,514</td></tr><tr><td>Character</td><td>718,324</td><td>Bk-Chr</td><td>712,332</td></tr><tr><td>Author</td><td>4,422</td><td>Chr-Con</td><td>30,934,451</td></tr><tr><td>Context</td><td>147,000</td><td>Chr-Chr</td><td>446,917</td></tr></table>
94
+
95
+ Table 1: Statistics of character network.
96
+
97
+ Tom Sawyer), each of which represents individual book, author, and character in the corpus. Note that we keep characters with the same name as separate nodes in the network (e.g. Tom Sawyer) because it is not obvious if these characters are indeed the same character or not at this point. As described later, if characters are inferred to be the same from book-level information, these embeddings become similar given the network configuration.
98
+
99
+ Second, we introduce (iv) context nodes which represent the local context information of characters (e.g. traded). Following Bamman et al. (2014), we extract words that are connected with a character name in agent, patient, possessive, or predicative dependency relations as context.
100
+
101
+ Edges. We introduce (i) book-author edges connecting book node $n_b$ with author node $n_a$ if $n_a$ is the author of $n_b$ (e.g. The Adventures of Tom Sawyer-Mark Twain), and (ii) book-character edges connecting book node $n_b$ with character node $n_c$ if $n_c$ appears in $n_b$ (e.g. The Adventures of Tom Sawyer-Tom Sawyer). To associate context with characters, we have (iii) character-context edges connecting context nodes with character nodes if they have a dependency relation described above (e.g. Tom Sawyer-traded). To capture the interaction between characters, we introduce (iv) character edges connecting two character nodes $n_{c_1}, n_{c_2}$ if $c_1$ and $c_2$ occur within 10 tokens of each other at least 10 times (e.g. Tom Sawyer-Huck Finn).
102
+
103
+ Table 1 shows the statistics of our character network constructed from 17,275 books from Project Gutenberg (see §5.1 for the details of dataset).
104
+
105
+ # 4.1.2 Learning embeddings
106
+
107
+ We use DeepWalk (Perozzi et al., 2014), which is a representation learning algorithm for graph-structured data. It samples graph paths by random walk and then applies word2vec algorithm (Mikolov et al., 2013) to the sampled paths, treating each node as one word.
108
+
109
+ The main advantage over the text-based methods is as follows. In the text-based methods, two characters from different novels never appear in
110
+
111
+ ![](images/aa4ec8ba8777d453b2abee1a29d063fd9f1d40a56858719f052156e3646b4f04.jpg)
112
+ Figure 3: Positional embeddings for characters from The Secret Garden. Mary and Colin, the main characters, indicate continuous appearance throughout the book, while Susan, one of the minor characters, indicates discontinuous appearance.
113
+
114
+ the same sentence. In contrast, in the graph-based method, two characters may appear in the same sentence (or path) if they are connected via book nodes or author nodes, which makes two character embeddings closer (e.g. two Tom Sawyer via Mark Twain in Fig. 2). In other cases, two characters from different novels may appear in the same sentence (or path) if they share context nodes (e.g. Tom Sawyer and Mary Lennox via found in Fig. 2), which makes two characters with similar properties closer. This means that we inject document-level information into character embeddings.
115
+
116
+ # 4.2 Positional embeddings
117
+
118
+ The main character in novels is likely to always appear throughout the story, while a minor character may appear a few times in one chapter and disappear. Such document-level occurrence patterns are not captured by text-based methods, but they may encode useful information about characters.
119
+
120
+ We thus propose pos embeddings purely based on the pattern of mention positions of characters. We divide a novel into 10 segments and count the occurrences of each character $i$ in each segment $j$ (denoted $c_{i,j}$ ). As exemplified in Fig. 3, we then create two 10-dimensional embeddings by (i) normalizing $c_{i,j}$ across characters, i.e. $\mathbf{c}_i^c = \mathbf{c}_i / \sum_i c_{i,j}$ , denoting how important the character is for the segment; (ii) normalizing $c_{i,j}$ across segments, i.e. $\mathbf{c}_i^s = \mathbf{c}_i / \sum_j c_{i,j}$ , denoting how important the segment is for the character. Finally, we concatenate these, i.e. $[\mathbf{c}_i^c;\mathbf{c}_i^s]$ , to form 20-dimensional embeddings. We repeat the same procedure with pronoun mentions, and concatenate these vectors to obtain final 40-dimensional positional embeddings for each character.
121
+
122
+ <table><tr><td>Task</td><td>Input</td><td>Output</td><td>Source</td><td>Size</td></tr><tr><td>Gender</td><td>One char</td><td>Male/Female</td><td>Heurstics (§5.2)</td><td>5,000</td></tr><tr><td>Role</td><td>One char, Four choices of roles</td><td>Role of a character (e.g. school-master)</td><td>Reference books</td><td>484</td></tr><tr><td>Protagonist</td><td>One char</td><td>Protagonist/Other</td><td>Frequency</td><td>5,000</td></tr><tr><td>Identity</td><td>Two chars from different books</td><td>Yes/No (if two chars are same)</td><td>Metadata</td><td>5,000</td></tr><tr><td>Cloze</td><td>Sentence w/ blank (e.g. __ is born in India), Four choices of chars</td><td>A character in the blank</td><td>Book content</td><td>5,000</td></tr><tr><td>Speaker</td><td>Quote, Four choices of chars</td><td>Speaker of the quote</td><td>Book content</td><td>2,879</td></tr><tr><td>Summary Cloze</td><td>Sentence w/ blank from chapter summary, Four choices of chars</td><td>A character in the blank</td><td>Literature websites</td><td>1,361</td></tr><tr><td>Desc</td><td>Description (e.g. A simple, but honest and loyal black worker...), Four choices of chars</td><td>A character that is best described by the given description</td><td>Literature websites</td><td>551</td></tr><tr><td>QA</td><td>Question (e.g. Who does Mary Lennox accept an invitation from?), Four choices of chars</td><td>Answer</td><td>Kočiský et al. (2017); Angelidis et al. (2019)</td><td>587</td></tr><tr><td>Author</td><td>Two chars</td><td>Yes/No (if two chars are from the same author&#x27;s books)</td><td>Metadata</td><td>5,000</td></tr><tr><td>Book</td><td>Two chars</td><td>Yes/No (if two chars are from the same books)</td><td>Metadata</td><td>5,000</td></tr><tr><td>Genre</td><td>One char, Genre</td><td>Yes/No (if the character belongs to a book with the given genre)</td><td>Metadata</td><td>44,152</td></tr></table>
123
+
124
+ Table 2: Overview of CEB, a benchmark suite for character embeddings.
125
+
126
+ # 5 CEB: Character Embedding Benchmark
127
+
128
+ To test the quality of character embeddings, we construct a new benchmark suite of character embeddings, as summarized in Table 2. The benchmark probes what kind of character-related information, ranging from gender to authors, is embedded in character embeddings. It consists of 12 different tasks categorized into three levels: (i) character-level tasks: identifying character attributes ( $\S 5.2$ ), (ii) context-level tasks: identifying the correct character that best describes a given context ( $\S 5.3$ ), and (iii) book-level tasks: identifying the attributes of books where characters come from ( $\S 5.4$ ).
129
+
130
+ # 5.1 Dataset
131
+
132
+ We extract 17,275 books from Project Gutenberg², a publicly available library of free eBooks. We use Stanford CoreNLP (Manning et al., 2014) for NER (Named Entity Recognition). We use the named entities of type PERSON as potential character mentions, and follow a rule-based approach similar to Vala et al. (2015) for clustering variants of the same name, and obtaining a final list of characters for each book. To ensure that tested character embeddings have sufficient information, we discarded characters with less than 100 mentions.
133
+
134
+ # 5.2 Character-level tasks
135
+
136
+ Gender Identify the gender of a given character $c$ (female or male). To identify the gold-standard gender of a character, we count the number of male and female pronouns referring to each character (as annotated by CoreNLP), and take a majority vote. If the male pronoun count outnumbers the female pronoun count by at least $10\%$ , we consider the character to be male, and vice versa for female.
137
+
138
+ Role Identify the role of a given character $c$ . We extract gold-standard character roles from two reference books of English literature (Magill, 1968, 1952), where character roles are represented by simple natural language phrases such as a French aristocrat. We extract only head nouns by the dependency parse given by Spacy.
139
+
140
+ Protagonist Identify whether a given character $c$ is a protagonist or not. As approximation, we identify the most frequent characters as the gold-standard protagonist.
141
+
142
+ Identity Given two characters $c_{1}, c_{2}$ from different books, identify whether $c_{1}$ is the same character as $c_{2}$ or not. We use characters with the same full name and the same author as a positive instance.
143
+
144
+ # 5.3 Context-level tasks
145
+
146
+ Cloze Given a sentence $S$ with a blank (e.g. stood up and tried to keep her eyes open while Mrs. Medlock collected her parcels.) from book $b$ and four candidate characters from $b$ , choose the character $c$ that best fits into the blank. To sample difficult wrong candidates, we sample characters with similar frequency in all the context-level tasks. Specifically, we use characters $c'$ s.t. $r(c) - 2 \leq r(c') \leq r(c) + 1$ , where $r$ is the rank of frequency.
147
+
148
+ Speaker Given a quote $Q$ (e.g. "Well, it was this way. I was leaning on the stile...") from book $b$ ( $\geq 50$ words) and four candidate characters from $b$ , choose the character that spoke this quote.
149
+
150
+ Summary Cloze Similar to Cloze, given a sentence $S$ with a blank from a chapter summary of book $b$ and four candidate characters from $b$ , choose the character that best fits into the blank. We extract chapter summaries from LitCharts, an online guide for English literature.
151
+
152
+ Desc Given a character description snippet $D$ (e.g. A simple, but honest...) and four candidate characters from the same book, choose the character that is best described by $D$ . We extract character descriptions from five reliable web sources.4
153
+
154
+ QA Given a question about characters (e.g. Who brings Mary Lennox the garden tools?) and four candidate characters from the same book $b$ , choose the character that best fits as the answer. We extract character-related questions (Angelidis et al., 2019) from NarrativeQA (Kocisky et al., 2017).
155
+
156
+ # 5.4 Book-level tasks
157
+
158
+ Author Given two characters from two different books $b_{1}, b_{2}$ , identify whether the authors of $b_{1}$ and $b_{2}$ are the same or not.
159
+
160
+ Book Given two characters from two books $b_{1}, b_{2}$ , identify whether $b_{1}$ and $b_{2}$ are the same.
161
+
162
+ Genre Identify the book genre of a given character $c$ . Because one book can belong to more than one genre, we manually selected 11 frequent subjects from Project Gutenberg's metadata and turn them into 11 binary classification tasks<sup>5</sup> and report
163
+
164
+ an average accuracy.
165
+
166
+ # 6 Evaluation
167
+
168
+ # 6.1 Setup
169
+
170
+ We follow recent work on probing word embeddings, which report that one should employ less expressive classifiers in order to prevent the classifier itself from learning to solve the probe tasks (Voita and Titov, 2020). At training time, one has access to all books and learns fixed-length character embeddings of each character. At test time, we freeze the learned character embeddings and train task-specific linear classifiers using the learned embeddings as a feature vector.
171
+
172
+ To solve classification tasks, we train a linear classifier that uses learned character embeddings as a feature vector. For pairwise classification, we merge two character embeddings by element-wise multiplication and absolute element-wise difference, i.e. $\left[\mathbf{c}_1\odot \mathbf{c}_2;|\mathbf{c}_1 - \mathbf{c}_2|\right]$ . In our experiments, we employ Support Vector Machines (Cortes and Vapnik, 1995). To solve multiple-choice tasks with context $x$ and characters $\{c_i\}_{i = 1}^4$ , we train a scorer $f(x,c_{i}) = (W\mathbf{x} + \mathbf{b})\cdot \mathbf{c}_{i}$ with a cross entropy loss, where $W,\mathbf{b}$ is a learned projection from the embedding space of context to characters. We use Sentence Transformers (Reimers and Gurevych, 2019)<sup>6</sup> to encode $x$ into $\mathbf{x}$ .<sup>7</sup>
173
+
174
+ The test instances with binary classification tasks are all balanced. Therefore, we use an accuracy as evaluation measure for all the tasks. To see overall picture, for each task category we calculate a final score by an average of task accuracies. We use 5-fold cross validation for evaluation and report an average accuracy. For the task with less than 2,000 instances (i.e. Role, Summary Cloze, Desc, QA), we use 10-fold cross validation to secure more training data.
175
+
176
+ # 6.2 Hyperparameters
177
+
178
+ For static embeddings, we use gensim implementation of word2vec (CBOW) and doc2vec. We kept only top one million words in the vocabulary and trained 300-dimensional vectors with 5 epochs, 10 context words, and 10 negative examples.
179
+
180
+ <table><tr><td rowspan="2">Model</td><td colspan="4">Character-level</td><td colspan="5">Context-level</td><td colspan="3">Book-level</td><td colspan="3">Final score</td></tr><tr><td>gen</td><td>role</td><td>prot</td><td>id</td><td>clz</td><td>spk</td><td>sclz</td><td>desc</td><td>QA</td><td>auth</td><td>book</td><td>genre</td><td>Ch</td><td>Co</td><td>Bk</td></tr><tr><td>rand</td><td>50.0</td><td>25.0</td><td>50.0</td><td>50.0</td><td>25.0</td><td>25.0</td><td>25.0</td><td>25.0</td><td>25.0</td><td>50.0</td><td>50.0</td><td>50.0</td><td>43.8</td><td>25.0</td><td>50.0</td></tr><tr><td>w2v</td><td>88.6</td><td>41.9</td><td>75.4</td><td>92.7</td><td>32.9</td><td>38.8</td><td>37.7</td><td>40.7</td><td>39.7</td><td>70.8</td><td>92.1</td><td>76.4</td><td>74.7</td><td>38.0</td><td>79.8</td></tr><tr><td>d2v</td><td>87.2</td><td>40.1</td><td>71.1</td><td>95.3</td><td>32.5</td><td>32.0</td><td>29.3</td><td>43.6</td><td>33.7</td><td>79.1</td><td>92.3</td><td>78.9</td><td>73.4</td><td>34.2</td><td>83.4</td></tr><tr><td>nam</td><td>85.9</td><td>28.5</td><td>54.9</td><td>99.9</td><td>27.5</td><td>27.7</td><td>32.6</td><td>31.8</td><td>30.2</td><td>52.7</td><td>56.6</td><td>57.4</td><td>67.3</td><td>30.0</td><td>55.6</td></tr><tr><td>gl_ag</td><td>91.3</td><td>29.7</td><td>69.5</td><td>95.9</td><td>37.0</td><td>32.4</td><td>40.6</td><td>36.5</td><td>37.1</td><td>79.9</td><td>90.0</td><td>80.5</td><td>71.6</td><td>36.7</td><td>83.5</td></tr><tr><td>w_ag</td><td>91.8</td><td>31.8</td><td>73.1</td><td>96.3</td><td>37.3</td><td>35.3</td><td>40.8</td><td>45.9</td><td>39.4</td><td>79.5</td><td>89.2</td><td>81.6</td><td>73.3</td><td>39.7</td><td>83.4</td></tr><tr><td>rb_ag</td><td>96.6</td><td>40.5</td><td>86.7</td><td>96.7</td><td>38.5</td><td>43.5</td><td>48.0</td><td>51.2</td><td>41.6</td><td>75.3</td><td>84.8</td><td>79.9</td><td>80.1</td><td>44.6</td><td>80.0</td></tr><tr><td>gr</td><td>98.6</td><td>36.1</td><td>75.0</td><td>96.7</td><td>32.5</td><td>49.5</td><td>40.2</td><td>38.1</td><td>34.4</td><td>85.6</td><td>95.5</td><td>80.2</td><td>76.6</td><td>38.9</td><td>87.1</td></tr><tr><td>pos</td><td>52.2</td><td>30.8</td><td>86.2</td><td>74.9</td><td>26.0</td><td>45.5</td><td>40.1</td><td>27.6</td><td>37.1</td><td>54.9</td><td>60.5</td><td>55.7</td><td>61.0</td><td>35.3</td><td>57.0</td></tr><tr><td>rb_ag+</td><td>98.1</td><td>43.2</td><td>92.4</td><td>97.8</td><td>36.6</td><td>48.5</td><td>46.5</td><td>50.6</td><td>42.7</td><td>83.9</td><td>95.6</td><td>81.2</td><td>82.9</td><td>45.0</td><td>86.9</td></tr><tr><td>gr+pos</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><td></td><td></td><td></td></tr></table>
181
+
182
+ Table 3: Results on CEB. Text-based embeddings capture character-level information better, while graph-based methods capture book-level information better. Combining these two methods leads to the best embeddings.
183
+
184
+ For graph-based embeddings, we use the original implementation of DeepWalk with 100-dimensional embeddings. We set the length of random walk path to 50 nodes and the number of random walks to start at each node to 20, and kept other hyperparameters as the default values.
185
+
186
+ We train the multiple-choice classifier for 10 epochs, using AdamW with batch size of 16, learning rate of 1e-3, and weight decay of 1e-2.
187
+
188
+ # 6.3 Results and discussion
189
+
190
+ The results are shown in Table 3. It shows that text-based methods perform better on character-level tasks and context-level tasks, while the graph-based method performs better on book-level tasks. This suggests that text-based methods can capture the local context of characters such as gender better, but it does not take into account document-level context discussed in §4.1. Name embeddings prove effective only at capturing gender.
191
+
192
+ Despite its simplicity, positional embeddings show surprisingly good performance on the character-level tasks (protagonist, identity) and context-level tasks (QA). This indicates that the occurrence patterns are deeply related to determining the importance of characters in books and that if the same character appears in different books, the occurrence patterns are also similar to each other. The good performance of QA indicates that the relationship between two characters are captured to some extent only by the occurrence patterns.
193
+
194
+ We then combined the best text-based embedding, rb_ag, with gr and pos (the last row).<sup>10</sup>
195
+
196
+ The results indicate that they complement each other's strength and weakness. For example, rb_ag's low performance on the author and book tasks and gr's low performance on the protagonist and cloze tasks improved. Overall, the proposed methods using book-level information outperformed the text-based methods in four tasks, indicating the importance of book-level information in character representations.
197
+
198
+ In order to investigate the effect of introducing global edges, we ablate author-book edges (a,b) and character-character edges (c,c) from the proposed graph embedding method. The results are shown in Table 4. $\cdot$ -(c,c)' experiences more performance degradation in context-level tasks and book-level tasks than $\cdot$ -(a,b), which indicates that character interaction provides useful information especially for these tasks. When both edges are removed, we observe performance drop in nine tasks, again indicating their need for character representations.
199
+
200
+ # 7 Qualitative analysis
201
+
202
+ To obtain further insights on the learned character embeddings, we visualize rb_ag+gr+pos by using t-SNE (van der Maaten and Hinton, 2008) with default hyperparameters.
203
+
204
+ # 7.1 Universality across books
205
+
206
+ In Fig. 1, we intend to check the universality of the learned character embeddings across books. We sampled characters with the same name and the same author from different books and plotted 281 samples of their character embeddings. This identifies characters that appear in a series of books, e.g.
207
+
208
+ 908-dimensional $(768 + 100 + 40)$ embeddings.
209
+
210
+ <table><tr><td rowspan="2">Model</td><td colspan="4">Character-level</td><td colspan="5">Context-level</td><td colspan="3">Book-level</td></tr><tr><td>gen</td><td>role</td><td>prot</td><td>id</td><td>clz</td><td>spk</td><td>sclz</td><td>desc</td><td>QA</td><td>auth</td><td>book</td><td>genre</td></tr><tr><td>graph</td><td>98.6</td><td>36.1</td><td>75.0</td><td>96.7</td><td>32.5</td><td>49.5</td><td>40.2</td><td>38.1</td><td>34.4</td><td>85.6</td><td>95.5</td><td>80.2</td></tr><tr><td>-(c,c)</td><td>98.6</td><td>44.8</td><td>74.7</td><td>95.5</td><td>32.2</td><td>46.8</td><td>37.0</td><td>35.6</td><td>40.2</td><td>81.4</td><td>89.4</td><td>79.1</td></tr><tr><td>-(a,b)</td><td>98.5</td><td>39.7</td><td>75.3</td><td>96.3</td><td>31.8</td><td>45.1</td><td>40.0</td><td>35.6</td><td>36.1</td><td>85.5</td><td>95.6</td><td>80.2</td></tr><tr><td>-(c,c)(a,b)</td><td>98.3</td><td>39.4</td><td>75.2</td><td>95.5</td><td>33.0</td><td>47.3</td><td>35.2</td><td>35.9</td><td>33.4</td><td>81.3</td><td>89.7</td><td>78.9</td></tr></table>
211
+
212
+ Table 4: Ablation study of character network embeddings.
213
+
214
+ ![](images/ff41175a14788e67a671d5f4c3fc76fa7c25ffe7addecc86ef4f4e40706ad1f2.jpg)
215
+ Figure 4: Character embeddings of historical figures.
216
+
217
+ ![](images/bb9deafb8118242b731f8882a438c6608afab7fca8ae9366776b8b516312ff31.jpg)
218
+ Figure 6: Plot of character embeddings colored by book.
219
+
220
+ ![](images/489f9a00738988d974e3e9645e3059988fe324e7bba41ff70f5b03c47eea84b9.jpg)
221
+ Figure 5: Character embeddings colored by author.
222
+
223
+ ![](images/0d8547ec0d8463e2d9e176ba2edb664a1ef9f33df00133b28914fdc65fc5306c.jpg)
224
+ Figure 7: Character embeddings colored by titles.
225
+
226
+ Peter Rabbit in The Tale of Peter Rabbit. Interestingly, Fig. 1 shows that even though such characters appear in different books, the learned embeddings are close to each other. This suggests that the proposed method can capture the book-independent, universal property of characters.
227
+
228
+ To further confirm the universality of character embeddings, we manually identified 662 famous, historical figures such as Jesus Christ and George Washington in Project Gutenberg books and plotted character embeddings in Fig. 4. Similar to Fig. 1, it shows one big cluster for Jesus Christ and small clusters for the rest of historical figures, again indicating the universal property of our character embeddings.
229
+
230
+ While our goal is to learn book-independent universal character embeddings, we check to see if the character embeddings also preserve book-level information. Fig 5 shows character embeddings colored by the author of the book that each character came from. Fig. 6 visualize the learned character
231
+
232
+ embeddings, where the datapoints are labeled by books. The results suggest that character embeddings also encode book-level information.
233
+
234
+ # 7.2 Character property
235
+
236
+ When characters have similar property (e.g. profession), it is desirable to have similar embeddings even though they exist in different books. This section studies the following three properties.
237
+
238
+ Profession/role Fig. 7 visualizes 2,232 characters that have manually specified titles (e.g. kings, aunts) across different books. We see a clear cluster for each title, and queens, kings and barons being close to each other (left). This indicates another book-independent, universal property of our embeddings from the profession/role's perspective. Note that our training methods do not exploit the titles for learning character embeddings: they convert the whole character name including the title as one unique special token (see §3).
239
+
240
+ <table><tr><td>Distance</td><td>Name</td><td>Gender</td><td>Book title</td><td>Book author</td><td>Juvenile?</td></tr><tr><td>0.00</td><td>Mary Lennox</td><td>Female</td><td>The Secret Garden</td><td>Burnett, Frances Hodgson</td><td>Y</td></tr><tr><td>1.44</td><td>Sibyl Ogilvie</td><td>Female</td><td>Daddy&#x27;s Girl</td><td>Meade, L. T.</td><td>Y</td></tr><tr><td>1.56</td><td>Margaret Montfort</td><td>Female</td><td>Margaret Montfort</td><td>Richards, Laura Elizabeth Howe</td><td>Y</td></tr><tr><td>1.60</td><td>Betty Randall</td><td>Female</td><td>The Children on the Top Floor</td><td>Rhoades, Nina</td><td>Y</td></tr><tr><td>1.61</td><td>Carol</td><td>Female</td><td>Sunny Slopes</td><td>Hueston, Ethel</td><td>N</td></tr><tr><td>1.62</td><td>Matilda Laval</td><td>Female</td><td>Trading</td><td>Warner, Susan</td><td>Y</td></tr></table>
241
+
242
+ Table 5: Five nearest neighbors for Mary Lennox from The Secret Garden.
243
+
244
+ ![](images/5680e420860150305fb1715e99f7d185ccb3a1ec43fcb13bd03076da99d07717.jpg)
245
+ Figure 8: Character embeddings colored by aunts (red) and non-aunt characters (blue).
246
+
247
+ ![](images/0497f9574b4005566d51f0e9818ba77aec03af6279fcc4349be88c7e511b527c.jpg)
248
+ Figure 9: Character embeddings colored by gender.
249
+
250
+ To see if characters playing a specific role are separated from ordinary characters in our embedding space, we extracted 1,360 characters with the name aunt $X$ and (non-aunt) $X$ across books and plotted their character embeddings in Fig. 8. We see that aunts and non-aunts form separate clusters. This again supports that our character embeddings also capture the profession/role of characters.
251
+
252
+ Gender Fig. 9 visualizes 4,000 random samples of character embeddings across books, each of which is labeled with their gender. This clearly shows the clusters of female, indicating that the character embeddings have learned their gender.
253
+
254
+ Protagonist status Fig. 10 visualizes 4,000 protagonists and non-protagonists across books (4.9% of them are the protagonist). This clearly indicates that the character embeddings have learned protagonist status.
255
+
256
+ ![](images/fe4581517020dfe213d9855521dd3e7661c586a18af14cd24d39e17e50b7462f.jpg)
257
+ Figure 10: Character embeddings colored by protagonist status.
258
+
259
+ # 7.3 Nearest neighbors
260
+
261
+ To give a closer inspection, we show the list of nearest neighbor characters for Mary Lennox, the main female character from The Secret Garden, in Table 5. It successfully lists characters with similar attribute at a both character-level and book-level. For example, Sibyl Ogilvie, Betty Randall are female children of age similar to Mary from juvenile books.
262
+
263
+ # 8 Conclusions
264
+
265
+ We have addressed the problem of learning fixed-length, dense character representations from book-length narrative texts. To overcome the weakness of the text-based embeddings, we have proposed graph-based embeddings and positional embeddings. To test the quality of character embeddings, we have also constructed CEB, a novel benchmark suite for evaluating character embeddings, consisting of 12 different tasks. Our experiments have demonstrated that the proposed embeddings combined with text-based embeddings lead to the best character embeddings, outperforming text-based embeddings in four tasks. We also showed that character embeddings capture both character-level and book-level information across books, demonstrating the versatility of the techniques we employed.
266
+
267
+ # Acknowledgements
268
+
269
+ We would like to thank anonymous reviewers for valuable and insightful feedback.
270
+
271
+ # References
272
+
273
+ Stefanos Angelidis, Lea Frermann, Diego Marcheggiani, Roi Blanco, and Lluis Marquez. 2019. Book QA: Stories of challenges and opportunities. In Proceedings of the 2nd Workshop on Machine Reading for Question Answering, pages 78-85, Hong Kong, China. Association for Computational Linguistics.
274
+ Mahmoud Azab, Noriyuki Kojima, Jia Deng, and Rada Mihalcea. 2019. Representing movie characters in dialogues. In Proceedings of the 23rd Conference on Computational Natural Language Learning (CoNLL), pages 99-109, Hong Kong, China. Association for Computational Linguistics.
275
+ David Bamman, Ted Underwood, and Noah A. Smith. 2014. A Bayesian mixed effects model of literary character. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 370-379, Baltimore, Maryland. Association for Computational Linguistics.
276
+ Rishi Bommasani, Kelly Davis, and Claire Cardie. 2020. Interpreting Pretrained Contextualized Representations via Reductions to Static Embeddings. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 4758-4781, Online. Association for Computational Linguistics.
277
+ Faeze Brahman, Meng Huang, Oyvind Tafjord, Chao Zhao, Mrinmaya Sachan, and Snigdha Chaturvedi. 2021. "let your characters tell their story": A dataset for character-centric narrative understanding. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 1734-1752, Punta Cana, Dominican Republic. Association for Computational Linguistics.
278
+ Corinna Cortes and Vladimir Vapnik. 1995. Support-vector networks. Machine learning, 20(3):273-297.
279
+ 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.
280
+ 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
281
+
282
+ 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 55-65, Hong Kong, China. Association for Computational Linguistics.
283
+ Zellig Harris. 1954. Distributional structure. Word, 10(2-3):146-162.
284
+ John Hewitt and Christopher D. Manning. 2019. A structural probe for finding syntax in word representations. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4129-4138, Minneapolis, Minnesota. Association for Computational Linguistics.
285
+ Mohit Iyyer, Anupam Guha, Snigdha Chaturvedi, Jordan Boyd-Graber, and Hal Daumé III. 2016. Feuding families and former Friends: Unsupervised learning for dynamic fictional relationships. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1534–1544, San Diego, California. Association for Computational Linguistics.
286
+ Allen Kim, Charuta Pethe, Naoya Inoue, and Steve Skiena. 2021. Cleaning dirty books: Post-OCR processing for previously scanned texts. In *Findings of the Association for Computational Linguistics: EMNLP* 2021, pages 4217–4226, Punta Cana, Dominican Republic. Association for Computational Linguistics.
287
+ Allen Kim, Charuta Pethe, and Steve Skiena. 2020. What time is it? temporal analysis of novels. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9076-9086, Online. Association for Computational Linguistics.
288
+ Sosuke Kobayashi, Ran Tian, Naoaki Okazaki, and Kentaro Inui. 2016. Dynamic entity representation with max-pooling improves machine reading. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 850-855, San Diego, California. Association for Computational Linguistics.
289
+ Tomáš Kocisky, Jonathan Schwarz, Phil Blunsom, Chris Dyer, Karl Moritz Hermann, Gábor Melis, and Edward Grefenstette. 2017. The narrativeqa reading comprehension challenge.
290
+ Marek Kubis. 2021. Quantitative analysis of character networks in Polish 19th- and 20th-century novels. Digital Scholarship in the Humanities, 36(Supplement_2):ii175-ii181.
291
+ Vincent Labatut and Xavier Bost. 2019. Extraction and analysis of fictional character networks. ACM Computing Surveys, 52(5):1-40.
292
+
293
+ Quoc Le and Tomas Mikolov. 2014. Distributed representations of sentences and documents. In Proceedings of the 31st International Conference on Machine Learning, volume 32 of Proceedings of Machine Learning Research, pages 1188-1196, Beijing, China. PMLR.
294
+ 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.
295
+ F.N. Magill. 1952. Masterpieces of World Literature in Digest Form. Harper.
296
+ F.N. Magill. 1968. Masterplots: 1510 Plot Stories & Essay Reviews from the World's Finest Literature. Salem Press.
297
+ Christopher D. Manning, Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. 2014. The Stanford CoreNLP natural language processing toolkit. In Association for Computational Linguistics (ACL) System Demonstrations, pages 55-60.
298
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. 2013. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems, volume 26. Curran Associates, Inc.
299
+ Takaki Otake, Sho Yokoi, Naoya Inoue, Ryo Takahashi, Tatsuki Kuribayashi, and Kentaro Inui. 2020. Modeling event salience in narratives via barthes' cardinal functions. In Proceedings of the 28th International Conference on Computational Linguistics, pages 1784-1794, Barcelona, Spain (Online). International Committee on Computational Linguistics.
300
+ Pinelopi Papalampidi, Frank Keller, Lea Frermann, and Mirella Lapata. 2020. Screenplay summarization using latent narrative structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1920-1933, Online. Association for Computational Linguistics.
301
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014. GloVe: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1532-1543, Doha, Qatar. Association for Computational Linguistics.
302
+ Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. 2014. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD '14, pages 701-710, New York, NY, USA. ACM.
303
+ Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke
304
+
305
+ Zettlemoyer. 2018. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227-2237, New Orleans, Louisiana. Association for Computational Linguistics.
306
+ Charuta Pethe, Allen Kim, and Steve Skiena. 2020. Chapter Captor: Text Segmentation in Novels. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 8373-8383, Online. Association for Computational Linguistics.
307
+ Fabio Petroni, Tim Rocttäschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. 2019. Language models as knowledge bases? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 2463-2473, Hong Kong, China. Association for Computational Linguistics.
308
+ Nils Reimers and Iryna Gurevych. 2019. SentenceBERT: Sentence embeddings using Siamese BERTnetworks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3982-3992, Hong Kong, China. Association for Computational Linguistics.
309
+ Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. 2020. AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4222-4235, Online. Association for Computational Linguistics.
310
+ D. A. Skorinkin. 2017. Quantitative analysis of character networks in Polish 19th- and 20th-century novels. In Proceedings of the International Conference Dialogue 2017, page 14 pages.
311
+ Hardik Vala, David Jurgens, Andrew Piper, and Derek Ruths. 2015. Mr. bennet, his coachman, and the archbishop walk into a bar but only one of them gets recognized: On the difficulty of detecting characters in literary texts. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 769-774, Lisbon, Portugal. Association for Computational Linguistics.
312
+ Laurens van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-sne. Journal of Machine Learning Research, 9(86):2579-2605.
313
+ 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 (EMNLP),
314
+
315
+ pages 183-196, Online. Association for Computational Linguistics.
316
+ David Wilmot and Frank Keller. 2020. Modelling suspense in short stories as uncertainty reduction over neural representation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1763-1788, Online. Association for Computational Linguistics.
317
+ David Wilmot and Frank Keller. 2021. Memory and knowledge augmented language models for inferring salience in long-form stories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 851-865, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
318
+ Aris Xanthos, Isaac Pante, Yannick Rochat, and Martin Grandjean. 2016. Visualising the dynamics of character networks. In Digital Humanities, pages 417-419.
319
+ Junting Ye, Shuchu Han, Yifan Hu, Baris Coskun, Meizhu Liu, Hong Qin, and Steven Skiena. 2017. Nationality classification using name embeddings. In Proceedings of the ACM Conference on Information and Knowledge Management (CIKM '17), pages 1897-1906.
320
+ Junting Ye and Steven Skiena. 2019. The secret lives of names? name embeddings from social media. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 3000-3008.
learningandevaluatingcharacterrepresentationsinnovels/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1372b340b6029514755fefcdaa56631b635a8bd78514b1ad9d3a1ed93384926c
3
+ size 668730
learningandevaluatingcharacterrepresentationsinnovels/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccd1a7607631a5d6747781fe0aecfdb8700dbb81da87c159afa304a05f5cf296
3
+ size 387113
learningbiasreducedwordembeddingsusingdictionarydefinitions/02ed04d2-bf51-4138-9bb1-95f1065577f5_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee32f0e7c53722cb82957b4e2626b84a916f766770c4eb8154d456de1a489bf3
3
+ size 109225
learningbiasreducedwordembeddingsusingdictionarydefinitions/02ed04d2-bf51-4138-9bb1-95f1065577f5_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7130c25f4949b36eef8f8ce642798cb78a0f3bdb11521a30212db2ef2e34e75c
3
+ size 128136
learningbiasreducedwordembeddingsusingdictionarydefinitions/02ed04d2-bf51-4138-9bb1-95f1065577f5_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2db224c6e166a4edfc73f3d4664884ca679a8b022698caa139ffd65c586e8420
3
+ size 1305487
learningbiasreducedwordembeddingsusingdictionarydefinitions/full.md ADDED
@@ -0,0 +1,473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Bias-reduced Word Embeddings Using Dictionary Definitions
2
+
3
+ Haozhe An*
4
+
5
+ University of Maryland, College Park
6
+
7
+ haozhe@umd.edu
8
+
9
+ Xiaojiang Liu and Jian Zhang
10
+
11
+ Apple
12
+
13
+ {xiaojiang_ Liu, donald_zhang}
14
+
15
+ @apple.com
16
+
17
+ # Abstract
18
+
19
+ Pre-trained word embeddings, such as GloVe, have shown undesirable gender, racial, and religious biases. To address this problem, we propose DD-GloVe, a train-time debiasing algorithm to learn word embeddings by leveraging dictionary definitions. We introduce dictionary-guided loss functions that encourage word embeddings to be similar to their relatively neutral dictionary definition representations. Existing debiasing algorithms typically need a precompiled list of seed words to represent the bias direction, along which biased information gets removed. Producing this list involves subjective decisions and it might be difficult to obtain for some types of biases. We automate the process of finding seed words: our algorithm starts from a single pair of initial seed words and automatically finds more words whose definitions display similar attributes traits. We demonstrate the effectiveness of our approach with benchmark evaluations and empirical analyses. Our code is available at https://github.com/haozhe-an/DD-GloVe.
20
+
21
+ # 1 Introduction
22
+
23
+ Word embeddings can meaningfully capture semantic and syntactic similarities between words. Popular embeddings are Word2Vec (Mikolov et al., 2013b), GloVe (Pennington et al., 2014), and FastText (Bojanowski et al., 2017). Although contextual word embeddings, like BERT embeddings (Devlin et al., 2019) and ELMo (Peters et al., 2018), gain increasing popularity, some recent research keeps using static word embeddings as input to their state-of-the-art algorithms in downstream natural language processing and computer vision applications (Guan et al., 2021; Gao et al., 2021).
24
+
25
+ Despite the effectiveness of word embeddings, biases in them reflect undesirable association between some concepts. Bolukbasi et al. (2016) first identify that the distance between man and
26
+
27
+ <table><tr><td colspan="3">Gender-specific examples</td></tr><tr><td>Word</td><td>Definition</td><td>Presence of gendered words</td></tr><tr><td>Saleswoman</td><td>A woman whose job involves selling or promoting commercial products.</td><td>Yes</td></tr><tr><td>Mistress</td><td>A woman in a position of authority or control.</td><td>Yes</td></tr><tr><td>King</td><td>The male ruler of an independent state, especially one who inherits the position by right of birth.</td><td>Yes</td></tr></table>
28
+
29
+ <table><tr><td colspan="3">Gender-biased examples</td></tr><tr><td>Word</td><td>Definition</td><td>Presence of gendered words</td></tr><tr><td>Programmer</td><td>A person who writes computer programs.</td><td>No</td></tr><tr><td>Doctor</td><td>A person who is qualified to treat people who are ill.</td><td>No</td></tr><tr><td>Housekeeper</td><td>A person employed to manage a household.</td><td>No</td></tr></table>
30
+
31
+ Figure 1: Definitions of example gender-specific and gender-biased words. Gender-specific words typically contain gendered words in their definitions, whereas gender-biased words tend to have neutral definitions.
32
+
33
+ woman is close to that between programmer and homemaker. Similar phenomena in word embeddings lead to biased interpretations in the word analogy task, associating certain words with gender, racial, and religious stereotypes (Manzini et al., 2019). Deploying such biased word embeddings in downstream tasks would cause allocational and representational harms (Blodgett et al., 2020). It is important to learn bias-reduced word embeddings.
34
+
35
+ Dictionary definitions, however, are a neutral source for mitigating biases in word embeddings. The objective, impartial, and concise definitions of words in a dictionary could be unbiased reference points. We propose to encourage word embeddings to be similar to their relatively neutral representations in a dictionary for bias reduction. We simultaneously train and debias the word embeddings from a new initialization point, so as to learn distributional representations and mitigate biases using dictionary definitions concurrently. In addition, several gender-debiasing algorithms rely on a list of pre-compiled seed words to approximate the gender direction, along which the vector component is removed for bias mitigation. We find that, given one pair of the initial seed words, dictionary definitions can help automatically search relevant seed words. Thus, the compilation of seed
36
+
37
+ words becomes automated. We also find that the automatically generated seed words better capture the notion of gender in the word embedding space.
38
+
39
+ Our contributions Leveraging the advantages of dictionary definitions, we propose DD-GloVe, a train-time debiasing algorithm to learn biasreduced GloVe word embeddings. In summary, we make the following contributions:
40
+
41
+ 1. We propose four dictionary-guided loss functions that encourage word embeddings to contain less biased information and richer semantic knowledge by referencing to their relatively neutral dictionary definition representations. (Sec. 3.1)
42
+ 2. DD-GloVe automatically approximates the bias direction given only one pair of initial seed words. This method finds the most attribute-specific definitions by computing the definition embeddings' projection onto the difference of the initial seed words' definition embeddings. We average the embeddings of the most attribute-specific words to approximate the bias direction. (Sec. 3.2)
43
+ 3. We empirically demonstrate that DD-GloVe effectively learns bias-reduced word embeddings as we achieve state-of-the-art results in WEAT. Also, our experiments show that debiasing is achieved without sacrificing semantic meanings. (Sec. 4)
44
+
45
+ # 2 Motivations
46
+
47
+ We analyze the limitations in current debiasing algorithms for word embeddings and present our corresponding solutions.
48
+
49
+ Debiasing algorithms Existing mainstream gender-debiasing algorithms are projection-based post-processing (Bolukbasi et al., 2016; Wang et al., 2020). They need a list of manually selected words (e.g. "she" and "he", "girl" and "boy", "woman" and "man") to compute a gender direction in the word embedding space. They then project the pre-trained word embeddings onto the gender direction and remove the vector component living in this direction. The resultant word vectors preserve useful semantic meanings but contain less gender information. However, these algorithms do not consider the possible usage of additional knowledge like dictionary definitions. Furthermore, there is a limitation in this projective post-processing approach. The manually compiled list to approximate the bias direction might be difficult to obtain for other types of biases. It would be helpful to find an alternative that involves
50
+
51
+ less human labor.
52
+
53
+ Our approach: using dictionary definitions Using dictionary definitions to train bias-reduced word embeddings could address the above limitation and gives us additional advantages.
54
+
55
+ (1) Dictionary definitions provide a source of unbiased word representations for debiasing. We define gender-specific words as words that are supposedly associated with a particular gender by their definitions. Some examples of gender-specific words are "countryman", "countrywoman", "fraternal", and "soralal." We define gender-biased words as words that could refer to a person of any gender but tend to be stereotypically recognized as one gender due to human biases. For example, "nurse", "cashier", and "driver" are gender-biased words. Gendered words are a list of 1,441 words compiled by Wang et al. (2020) that explicitly define or describe a gender. Examples of gendered words are like "man", "woman", "he", and "she." In a dictionary, gender-specific words typically contain gendered words in their definitions, whereas gender-biased words tend to have neutral definitions. Example words and their definitions from Oxford online dictionary<sup>1</sup> are shown in Fig. 1. We further obtain 379 gender-specific words, compiled by Wang et al. (2020), and 40 words of gender-biased occupations, compiled by Zhao et al. (2018a), to verify if this trend is general. For each definition of the words, we check whether any gendered words are present. We find that gendered words are absent from 39 out of 40 gender-biased occupations. This result shows dictionary definitions are almost bias-free. In contrast, gendered words are present in 327 out of 379 gender-specific words' definitions. This shows that if a definition contains a gendered word, it is highly likely that the word defined is gender-specific. Dictionary definitions can thus act as a reliable guidance for bias mitigation.
56
+
57
+ (2) Dictionary definitions could automate the process of finding seed words that approximate the bias direction. We compare definition similarities to find words that commonly associate with some attribute. It is relatively easy to obtain one pair of seed words that describe two opposite concepts associated with a protected attribute (e.g. "she" and "he" for gender). We then look into the definitions of these initial seed words, and find other words whose definitions are similar to theirs. As a measure of similarity, we compute the projection onto
58
+
59
+ the difference between the definition embedding of one initial seed word and the definition embedding of the other. Detailed algorithm is described in Sec. 3.2. This method avoids using manually compiled words to approximate the bias direction.
60
+
61
+ (3) Dictionary definitions offer additional semantic knowledge. Researchers improve word embeddings using dictionary definitions (Faruqui et al., 2015; Tissier et al., 2017). These works primarily enhance semantic meanings of word embeddings rather than reduce biases in them. Nevertheless, their successes indicate the possibility to preserve, or even enhance, the semantic meaning representations of word embeddings as we use dictionary definitions to debias them.
62
+
63
+ Existing dictionary debiasing algorithm A recent work makes the first attempt to debias word embeddings using dictionary definitions via post-processing (Kaneko and Bollegala, 2021). They compute a weighted average of pre-trained word vectors as the definition embeddings. They assume these definition embeddings are the "neutral" reference points for word embeddings. However, this is a major flawed assumption in post-processing debiasing. Due to the biases in pre-trained word vectors, the definition embeddings also contain biases. Partially owing to this flawed assumption, their resultant embeddings show limited effectiveness in several benchmark evaluations like the Word Embedding Association Test (Caliskan et al., 2017).
64
+
65
+ Our approach: training from scratch Training from scratch addresses the problem of biased definition embeddings computed from pre-trained, biased word vectors. As word embeddings are initialized randomly, they contain virtually no biases. Correspondingly, the definition embeddings obtained at this point will contain minimal biases. As training proceeds, the debiasing algorithm can continuously apply corrections, so as to learn distributional semantics and reduce biased information simultaneously. In Sec. 5.1, we empirically demonstrate that training from scratch could produce substantially more neutral definition embeddings that lead to improved debiasing.
66
+
67
+ # 3 DD-GloVe
68
+
69
+ We propose four dictionary-guided loss functions, namely (1) orthogonal loss, which mitigates general biases by diminishing the redundant component in word vectors that disagree with their defi
70
+
71
+ nition embeddings, (2) projection loss, which directly reduces a specific type of bias by minimizing the difference between word vectors' projection and definitions' projection onto the bias direction, (3) definition loss, which injects semantic meanings from definitions into word embeddings, and (4) bias-aware GloVe loss, which dynamically adjusts weights of co-occurrences for bias reduction.
72
+
73
+ In addition, we introduce a novel algorithm that automatically searches seed words for bias direction approximation with only one pair of initial seed words as the input.
74
+
75
+ Notations We use $w \in \mathbb{R}^d$ to denote word vectors with dimension $d$ . We overload the symbol $w$ to represent a word in some contexts. $s(w)$ denotes the definition embedding of word $w$ . A word can have multiple definitions in a dictionary. Since GloVe does not distinguish word meanings, we choose to use all available definitions for $w$ when computing $s(w)$ . Previous works compute definition embeddings by smoothed inverse frequency (Arora et al., 2017; Kaneko and Bollegala, 2021). We propose a simpler but empirically effective method that averages the definitional words. Therefore, our definition embedding is
76
+
77
+ $$
78
+ s (w) = \frac {1}{K} \sum_ {i = 1} ^ {K} h (w) _ {i} \tag {1}
79
+ $$
80
+
81
+ where $h$ is the function that returns all definitional words (excluding stop words) of $w$ , and $K = |h(w)|$ is the number of definitional words.
82
+
83
+ # 3.1 Dictionary-guided Loss Functions
84
+
85
+ Orthogonal loss for general debiasing The definition embedding $s(w)$ reflects the redundant encoding in $w$ , which is defined as
86
+
87
+ $$
88
+ \phi (w, s (w)) = w - \frac {w \cdot s (w)}{s (w) \cdot s (w)} s (w) \tag {2}
89
+ $$
90
+
91
+ where $(\cdot)$ is the dot product of vectors. $\phi (w,s(w))$ represents the unnecessary, and likely biased, meaning encoded in the word vector $w$ , because $\phi (w,s(w))$ is the component in $w$ that lives in the subspace orthogonal to $s(w)$ .
92
+
93
+ We minimize the squared dot product between $\phi (w,s(w))$ and $w$ by
94
+
95
+ $$
96
+ J _ {\text {o r t h o}} (w) = \left(\phi (w, s (w)) \cdot w\right) ^ {2}. \tag {3}
97
+ $$
98
+
99
+ This loss term is ignored if a word does not have definitions in the dictionary. The orthogonal loss
100
+
101
+ mitigates almost all general types of biases because it signals word embeddings to drop any information that is absent from their definition embeddings.
102
+
103
+ Projection loss for specific debiasing We design a projection-based loss to further enhance the debiasing effectiveness for a specific type of bias. The type of bias depends on use cases. With the definition embedding $s(w)$ as an unbiased reference for $w$ , we want the projection of $w$ onto the bias direction $g$ ( $g$ is explained in Sec. 3.2) to be similar to that of $s(w)$ . Thus,
104
+
105
+ $$
106
+ J _ {p r o j} (w) = \left\| \frac {w \cdot g}{g \cdot g} g - \frac {s (w) \cdot g}{g \cdot g} g \right\| _ {1}. \qquad (4)
107
+ $$
108
+
109
+ If the dictionary does not define $w$ , we assume $w$ should be a neutral word and $s(w) \cdot g = 0$ . Dictionary definitions would indicate if a word vector should express the meaning associated with a protected attribute. This loss function thus avoids human intervention or using an additional classifier to decide what word to debias.
110
+
111
+ Definition loss for semantic meaning This loss function aims to inject the semantic meaning represented in dictionary definitions into word embeddings. The definition loss encourages a word vector to be similar to its definition embedding. As a result, it signals word embeddings about what to keep and what is lacking in their semantic meaning representations. We propose to minimize the $l1$ -norm difference between $w$ and its definition embedding $s(w)$ via definition loss
112
+
113
+ $$
114
+ J _ {d e f} (w) = \| w - s (w) \| _ {1}. \tag {5}
115
+ $$
116
+
117
+ If a word is not defined in the dictionary, we skip its gradient update for this loss term.
118
+
119
+ Bias-aware GloVe loss The original GloVe loss is a log-bilinear regression of word co-occurrences. Each co-occurrence composes a word and its context word $(w, \tilde{w})$ . It is evident that if the training corpus has more balanced word co-occurrences over the protected attributes, the trained word embeddings show a smaller extent of bias (Hall Maudslay et al., 2019; Lu et al., 2020). For example, if "nurse" occurs equally likely with gendered words like "she" and "he", the embedding of "nurse" would be more neutral with respect to genders. To equivalently create more balanced word co-occurrences, we introduce the bias-aware Glove
120
+
121
+ loss. Different from static co-occurrence weights in the original Glove, bias-aware Glove loss adjusts co-occurrence weights according to the bias of a word and its context word.
122
+
123
+ What co-occurrences should be assigned new weights? If either $w$ or $\tilde{w}$ is biased, we modify its weight, so that the number of co-occurrences containing biased words are equivalently modified. To decide if $w$ (similarly for $\tilde{w}$ ) is biased in training, we quantify its genderedness by
124
+
125
+ $$
126
+ u (w) = \frac {w \cdot v _ {1}}{\| w \| \| v _ {1} \|} - \frac {w \cdot v _ {2}}{\| w \| \| v _ {2} \|} \tag {6}
127
+ $$
128
+
129
+ where $v_{1}, v_{2}$ are initial seed words like "she" and "he" (explained in Sec. 3.2). We then compare $u(w)$ with its neutral reference point $s(w)$ . Hence, the bias of a word is
130
+
131
+ $$
132
+ d (w) = | u (w) - u (s (w)) |. \tag {7}
133
+ $$
134
+
135
+ Increase or decrease the weights? If a biased $w$ and $\tilde{w}$ are associated with opposite genders (i.e. $u(w)$ and $u(\tilde{w})$ have opposite signs), we assign a higher weight, equivalently increasing such co-occurrences; if a biased $w$ and $\tilde{w}$ are associated with the same gender (i.e. $u(w)$ and $u(\tilde{w})$ have the same sign), we assign a lower weight, equivalently decreasing such co-occurrences.
136
+
137
+ By how much? The magnitude of the weight change is proportional to the maximum extent of bias in a given co-occurrence pair, which is computed by $\max (d(w),d(\tilde{w}))$
138
+
139
+ The proposed weight for a co-occurrence pair is
140
+
141
+ $$
142
+ \begin{array}{l} f ^ {\prime} (w, \tilde {w}) = \\ 1 - \alpha \cdot \operatorname {s g n} (u (w)) \cdot \operatorname {s g n} (u (\tilde {w})) \cdot \max (d (w), d (\tilde {w})) \tag {8} \\ \end{array}
143
+ $$
144
+
145
+ where we multiply a constant $\alpha$ to keep $f^{\prime}(w,\tilde{w})$ within a reasonable range, about [0.9, 1.1], for stable performance. The modified GloVe loss is
146
+
147
+ $$
148
+ \begin{array}{l} J _ {G - b i a s} = \sum_ {i, j = 1} ^ {| V |} f ^ {\prime} (w _ {i}, \tilde {w} _ {j}) f (X _ {i j}) (w _ {i} ^ {T} \tilde {w} _ {j} \\ + b _ {i} + \tilde {b} _ {j} - \log X _ {i j}) ^ {2} \tag {9} \\ \end{array}
149
+ $$
150
+
151
+ where $V$ is the set of vocabulary, and $b, \tilde{b}$ are scalar bias terms. $f$ is a function that assigns weights to co-occurrence pairs based on their frequency (introduced in GloVe). If a co-occurrence pair contains at least one word that is not defined, we set $f' = 1$ .
152
+
153
+ DD-GloVe loss function Putting all the proposed loss functions together, we have the loss function
154
+
155
+ $$
156
+ J = J _ {G - b i a s} + \beta J _ {o r t h o} + \gamma J _ {p r o j} + \lambda J _ {d e f} (1 0)
157
+ $$
158
+
159
+ where $\beta, \gamma, \lambda$ are hyperparameters.
160
+
161
+ # 3.2 Approximating the Bias Direction $g$
162
+
163
+ Algorithm 1 approximates the bias direction $g$ with a single pair of initial seed words. Let a pair of attribute-specific words be $(v_{1}, v_{2})$ such that word vector difference $v_{1} - v_{2}$ is similar to the true bias direction associated with the protected attributes $\mathcal{A}_{1}$ and $\mathcal{A}_{2}$ . For example, $(v_{1}, v_{2})$ could be "she" and "he" for gender debiasing, and the corresponding $\mathcal{A}_{1}$ and $\mathcal{A}_{2}$ are female and male respectively. We find two sets of most attribute-specific definitions $Q_{\mathcal{A}_{1}}$ and $Q_{\mathcal{A}_{2}}$ along $s(v_{1}) - s(v_{2})$ by looking at definition embeddings' projection onto this direction. The sizes of $Q_{\mathcal{A}_{1}}$ and $Q_{\mathcal{A}_{2}}$ are determined empirically based on the availability of words associated with a certain concept. For instance, in our experiment that focuses on gender-debiasing, we set $N = 30$ . One can run Algorithm 1 once at the beginning of training to obtain a set of seed words that will be used throughout the training, or run Algorithm 1 multiple times to update seed words periodically. We find that the former works better with attributes that have a large number of words associated with them, such as gender. The latter tends to fit attributes that have a smaller number of associated words, such as races.
164
+
165
+ # 4 Experiments
166
+
167
+ We present two settings for DD-GloVe. (1) In DD-GloVe<sub>gender</sub>, we mainly mitigate gender bias, thus using “she” and “he” as the initial seed words. (2) DD-GloVe<sub>race</sub>, we focus on reducing racial bias. The initial seed words are “black” and “white”.
168
+
169
+ For each word in the vocabulary of Glove, we try to find its definitions from the Oxford online dictionary. If the word has multiple definitions, we simply concatenate them into one definition. Stopwords are removed for pre-processing. We average the definitional words to obtain $s(w)$ by following Eqn. 1. Words that are not present in the Oxford dictionary are skipped. In total, we have 92,140 words with definitions.
170
+
171
+ We run GloVe (Pennington et al., 2014), Double Hard Debias (DHD) (Wang et al., 2020), dictionary-based debiasing (Dict Debias) (Kaneko and Bollegala, 2021), and GN-GloVe (Zhao et al., 2018b) as
172
+
173
+ Algorithm 1 Find seed words automatically and approximate the bias direction
174
+
175
+ Input: Initial seed words $(v_{1}, v_{2})$ , desired total number of seed words $N$ for each attribute
176
+
177
+ Output: Two sets of seed words $Q_{\mathcal{A}_1}, Q_{\mathcal{A}_2}$ , the approximated bias direction $g$
178
+
179
+ $$
180
+ Q _ {\mathcal {A} _ {1}} \leftarrow \{v _ {1} \}, Q _ {\mathcal {A} _ {2}} \leftarrow \{v _ {2} \}, R \leftarrow \emptyset
181
+ $$
182
+
183
+ $\triangleright$ Get each word's definition projection onto the difference between the definition embeddings of $v_{1}, v_{2}$ i.e. projection along $s(v_{1}) - s(v_{2})$ .
184
+
185
+ for all $w\in V$ do
186
+
187
+ $$
188
+ r (w) \leftarrow \frac {s (w) \cdot s \left(v _ {1}\right)}{\| s (w) \| \| s \left(v _ {1}\right) \|} - \frac {s (w) \cdot s \left(v _ {2}\right)}{\| s (w) \| \| s \left(v _ {2}\right) \|}
189
+ $$
190
+
191
+ $$
192
+ R \leftarrow R \cup \{(w, r (w)) \}
193
+ $$
194
+
195
+ end for
196
+
197
+ Find top $N$ most attribute-specific words and approximate the bias direction.
198
+
199
+ $R_{\text{sorted}} \gets \text{Sort } R$ by $r(w)$ in descending order
200
+
201
+ for $n\in \{1,2,\ldots ,N\}$ do
202
+
203
+ $$
204
+ w _ {1}, r (w _ {1}) \leftarrow R _ {\text {s o r t e d}} [ n ]
205
+ $$
206
+
207
+ $$
208
+ w _ {2}, r (w _ {2}) \leftarrow R _ {s o r t e d} \left[ \left| R _ {s o r t e d} \right| - n \right]
209
+ $$
210
+
211
+ $$
212
+ Q _ {\mathcal {A} _ {1}} \leftarrow Q _ {\mathcal {A} _ {1}} \cup \{w _ {1} \}, Q _ {\mathcal {A} _ {2}} \leftarrow Q _ {\mathcal {A} _ {2}} \cup \{w _ {2} \}
213
+ $$
214
+
215
+ end for
216
+
217
+ $$
218
+ g \leftarrow \frac {1}{\left| Q _ {\mathcal {A} _ {1}} \right|} \sum_ {w \in Q _ {\mathcal {A} _ {1}}} w - \frac {1}{\left| Q _ {\mathcal {A} _ {2}} \right|} \sum_ {w \in Q _ {\mathcal {A} _ {2}}} w
219
+ $$
220
+
221
+ belines for comparison. The detailed experimental setup is described in the appendix (A.1).
222
+
223
+ # 4.1 WEAT
224
+
225
+ To evaluate bias in word embeddings, researchers commonly use Word Embedding Association Test (WEAT) (Caliskan et al., 2017). This test quantifies the strength of association between a set of target words (such as science and arts) and a set of attribute words (such as male and female names). The test result produces effect size $d$ and $p$ -value. If there exist strong associations between target and attribute words, $d$ would be large and $p$ -value would be small. Bias-reduced word embeddings should ideally have low $d$ and high $p$ -values.
226
+
227
+ We report WEAT results in Table 1. We observe that DD-GloVe $_{\text{gender}}$ outperforms all the baselines in gender-related tests. DD-GloVe $_{\text{race}}$ performs as effectively as the state-of-the-art dictionary-based debiasing algorithm in racial association test. DD-GloVe $_{\text{race}}$ also shows some effects of gender debiasing in Gender-2 test and produces the best result in the nature test. It is evident that DD-GloVe can reduce multiple types of biases simultaneously with an emphasis on the bias we want to mitigate to the greatest extent. This phenomenon benefits
228
+
229
+ <table><tr><td>Embeddings</td><td colspan="2">Gender-1</td><td colspan="2">Gender-2</td><td colspan="2">Race</td><td colspan="2">Age</td><td colspan="2">Nature</td></tr><tr><td></td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td></tr><tr><td>GloVe</td><td>1.74</td><td>0.00</td><td>1.07</td><td>0.013</td><td>1.18</td><td>0.0029</td><td>1.03</td><td>0.0090</td><td>1.15</td><td>0.0029</td></tr><tr><td>DHD</td><td>1.38</td><td>0.0014</td><td>0.45</td><td>0.19</td><td>1.06</td><td>0.0076</td><td>0.88</td><td>0.023</td><td>1.22</td><td>0.0017</td></tr><tr><td>Dict Debias</td><td>1.68</td><td>0.00</td><td>1.15</td><td>0.0081</td><td>0.82</td><td>0.033</td><td>0.62</td><td>0.086</td><td>1.27</td><td>0.0012</td></tr><tr><td>GN-GloVe</td><td>1.80</td><td>0.00</td><td>1.18</td><td>0.0063</td><td>1.01</td><td>0.010</td><td>0.96</td><td>0.014</td><td>1.21</td><td>0.0018</td></tr><tr><td>DD-GloVegender</td><td>1.25</td><td>0.0029</td><td>0.083</td><td>0.44</td><td>1.01</td><td>0.011</td><td>0.94</td><td>0.017</td><td>1.01</td><td>0.0088</td></tr><tr><td>DD-GloVeRace</td><td>1.75</td><td>7.8e-5</td><td>0.77</td><td>0.063</td><td>0.80</td><td>0.037</td><td>0.64</td><td>0.078</td><td>0.99</td><td>0.0099</td></tr></table>
230
+
231
+ Table 1: WEAT results for various word embeddings. The gender attribute set contains male and female names. Gender-1 tests gender v.s. career & family. Gender-2 tests gender v.s. math & arts. The race set consists of European American names and African American names. The age set contains stereotypically young and old names (Nosek et al., 2002). The nature set composes flower and insects vocabulary (Greenwald et al., 1998). Attributes sets of race, age, and nature are tested against pleasant and unpleasant words (Caliskan et al., 2017). For GN-GloVe, we exclude the gender dimension in word embeddings for these tests.
232
+
233
+ <table><tr><td>Embeddings</td><td>Pro</td><td>Anti</td><td>Avg</td><td>Diff</td></tr><tr><td>GloVe</td><td>67.03</td><td>55.96</td><td>61.50</td><td>11.07</td></tr><tr><td>DHD</td><td>60.56</td><td>57.99</td><td>59.28</td><td>2.57</td></tr><tr><td>Dict Debias</td><td>66.30</td><td>57.22</td><td>61.76</td><td>9.08</td></tr><tr><td>GN-GloVe</td><td>64.67</td><td>60.78</td><td>62.73</td><td>3.89</td></tr><tr><td>DD-GloVe</td><td>65.53</td><td>57.59</td><td>61.56</td><td>7.94</td></tr></table>
234
+
235
+ Table 2: Coreference resolution F1-score (\%) using models trained with different embeddings. We also report the average F1-score (Avg) and the difference (Diff) between pro-stereotype and anti-stereotype subsets in WinoBias. We use all dimensions in GN-GloVe embeddings in this experiment.
236
+
237
+ from our design of loss functions: orthogonal loss reduces general types of biases while projection loss mitigates the chosen type of bias along $g$ .
238
+
239
+ # 4.2 Coreference Resolution
240
+
241
+ We verify the effects of bias-reduced word embeddings on a downstream task - coreference resolution. WinoBias (Zhao et al., 2018a) is a dataset tailored to measure a model's gender bias when clustering the denotative noun phrases referring to the same entity. It consists of pro-stereotype and anti-stereotype sentences. Every sentence in pro-stereotype subset has a counterpart in the anti-stereotype subset with the gendered pronoun replaced with the opposite one. Models should ideally have similar performance in these two subsets. We train the end-to-end coreference resolution model proposed by Lee et al. (2017) with OntoNotes 5.0 (Weischedel et al., 2012) using various word embeddings. The coreference resolution model is implemented using AllenNLP (Gardner
242
+
243
+ et al., 2017). We evaluate each model using Wino-Bias Type 1 set.
244
+
245
+ Model F1-scores are shown in Table 2 and training F1-scores are reported in the appendix. Compared to post-processing dictionary-based debiasing, DD-GloVe produces a lower F1-score difference, indicating less biased information is used to make coreference resolution predictions. DHD outperforms DD-GloVe in terms of F1-score difference, but DD-GloVe enjoys overall higher average. GN-GloVe performs the best in this task, likely because the occupations in WinoBias are found in their manually compiled male and female words. Their model could easily force these words to be completely neutral, whereas DD-GloVe would depend on dictionary definitions to decide the genderedness of words. The occasional noise in definitions may cause DD-GloVe to not outperform.
246
+
247
+ # 4.3 Semantic Meaning Preservation
248
+
249
+ We conduct experiments in word analogy and concept categorization to ensure semantic meaning of word embeddings are well preserved after bias mitigation. The word analogy task tests "A is to B as C is to what?" We find a word vector $w$ that is nearest to $w_{A} - w_{B} + w_{C}$ as the solution. We use Google word analogy (Mikolov et al., 2013a) and MSR (Mikolov et al., 2013c) for evaluation. Concept categorization aims to group words into various categories based on their semantic meanings. The metric for this task is purity (Schütze et al., 2008). We evaluate various embeddings with Almuhareb-Poesio (AP) (Almuhareb, 2006), ESS-LLI (Baroni et al., 2008), Battig (Battig and Montague, 1969), and BLESS (Baroni and Lenci, 2011).
250
+
251
+ <table><tr><td rowspan="2">Embeddings</td><td colspan="4">Word analogy (%)</td><td colspan="4">Concept categorization (%)</td></tr><tr><td>G-Sem</td><td>G-Syn</td><td>G-Total</td><td>MSR</td><td>AP</td><td>ESSLI</td><td>Battig</td><td>BLESS</td></tr><tr><td>GloVe</td><td>79.26</td><td>63.19</td><td>70.48</td><td>54.10</td><td>57.71</td><td>66.91</td><td>49.42</td><td>83.50</td></tr><tr><td>DHD</td><td>79.77</td><td>61.65</td><td>69.87</td><td>53.25</td><td>59.20</td><td>67.00</td><td>46.57</td><td>79.50</td></tr><tr><td>Dict Debias</td><td>79.46</td><td>63.22</td><td>70.59</td><td>53.89</td><td>60.95</td><td>66.91</td><td>53.31</td><td>83.00</td></tr><tr><td>GN-GloVe</td><td>77.11</td><td>61.88</td><td>68.79</td><td>50.55</td><td>57.96</td><td>60.47</td><td>46.68</td><td>81.00</td></tr><tr><td>DD-GloVe</td><td>80.27</td><td>62.67</td><td>70.66</td><td>53.69</td><td>58.71</td><td>67.78</td><td>48.06</td><td>76.00</td></tr></table>
252
+
253
+ Table 3: Experiments to verify semantic meaning preservation of debiased word embeddings. G-Sem, G-Syn, and G-Total refer to Google-Semantic subset accuracy, Google-Syntactic subset accuracy, and Google word analogy total accuracy respectively.
254
+
255
+ ![](images/bd976b4de105ad841a90afa1f2a52a6abeb8b7af084068f61ba6aaf62d2fab9d.jpg)
256
+ Figure 2: Scatter plots of definition embedding projections against word embedding projections for gender-neutral profession vocabularies. Both the definition embeddings and word embeddings in DD-GloVe consistently have closer-to-zero projection values.
257
+
258
+ KMeans clustering is run for categorization.
259
+
260
+ We obtain the top-1 accuracy for word analogy task and purity for concept categorization shown in Table 3. We see that there is minimal degradation in performance in most datasets we have tested. Sometimes, DD-GloVe achieves marginally higher top-1 accuracy or purity than the baseline GloVe. Two reasons lead to the improvement: it is partially due to the trend that using additional knowledge to train word vectors enhances their semantic meaning representations; also, reducing biased information enables fairer predictions in these tasks.
261
+
262
+ In addition to these experiments, we conduct more extrinsic evaluations for semantic meaning preservation in the appendix (A.2). We find that DD-GloVe preserves useful semantic meanings that help models to perform well in a variety of downstream tasks such as coreference resolution, sentiment analysis, and document classification.
263
+
264
+ # 5 Discussion
265
+
266
+ # 5.1 Benefit of Training from Scratch
267
+
268
+ Training from scratch plays a key role in DD-GloVe because it significantly reduces the biases in definition embeddings, which are used as reference points for word embedding debiasing. We
269
+
270
+ use the gender-neutral profession words provided by Bolukbasi et al. (2016). We project their definition embedding and word embedding onto the direction $\vec{\mathrm{he}} -\vec{\mathrm{she}}$ . We present the scatter plots for three embeddings in Fig. 2. We fix the scale for both axes for easy comparison. In GloVe, a more biased occupation word tends to have a more biased definition embedding. This trend is visible from the strong linear correlation between definition embedding projections and word embedding projections ( $p = 1.16 \times 10^{-18}$ ). Due to the biases in definition embeddings, using the GloVe definition embeddings as the optimization objective in post-processing would not effectively mitigate word embedding biases. Consequently, Dict Debias exhibits a similar trend in its definition embeddings and word embeddings. However, training from scratch allows word vectors to learn semantic meanings from a new random initialization, at which word vectors do not contain meaningful biased information. The definition embeddings will thus contain negligible biases. During training, these more neutral definition embeddings can consistently function as relatively neutral reference points for word embeddings to drop redundant information and keep useful semantic meanings. Shown in Fig. 2, DD-GloVe generates more neutral word and definition embeddings.
271
+
272
+ # 5.2 Bias Direction Approximation
273
+
274
+ We present part of the word list produced by Algorithm 1 in Table 4. Most choices are interpretable by human as they specifically refer to or describe a particular gender. We also quantitatively evaluate the quality of gender direction approximation. Similar to Antoniak and Mimno (2021)'s argument, a good gender direction should have large magnitude in cosine similarity with gender specific words while the signs are opposite for the two gen
275
+
276
+ <table><tr><td>Female</td><td>ex-wife, girl, jane, woman, wife, witch, women, she, pilipinas, heroine, maids, hens, dona, wives</td></tr><tr><td>Male</td><td>he, son, brother, brothers, boys, sons, boy, businessman, yang, gentleman, wizard, headmaster, statesman</td></tr></table>
277
+
278
+ ![](images/a025d648853f9d489abb7c5be6d67d1f5a491f00682ee6ee34decce12b916550.jpg)
279
+ (a) GloVe embeddings
280
+
281
+ ![](images/516b6afb1b66f26a4109dc19beb14e9bca1e1c1d162d270820536c987a2fafa4.jpg)
282
+ (b) DD-GloVe embeddings
283
+ Figure 3: Average cosine similarities between gender specific words and gender directions. "10-Pair" refers to the gender direction computed using the 10 pairs of seed words provided by Bolukbasi et al. (2016). We normalize the cosine values so that their mean is 0 and standard deviation is 1.
284
+
285
+ ders. This phenomenon would imply that the male-specific words and female-specific words are far apart from the other set when they are projected onto the gender direction.
286
+
287
+ We borrow 190 male-specific words and 177 female specific words used by Wang et al. (2020) and compute their average cosine similarities with different gender directions. Fig. 3a shows that gender-specific words have similar cosine similarities with both the gender direction used by Bolukbasi et al. (2016) and the gender direction found by our Algorithm 1. This indicates that, in the GloVe embedding space, our gender direction is as effective as the baseline to capture the notion of gender. In DD-GloVe embeddings, our gender direction has greater magnitude of average cosine similarities for both genders. Consequently, the difference between male and female cosine similarity is larger, indicating a clearer manifestation of gender.
288
+
289
+ # 5.3 Choice of Initial Seed Words
290
+
291
+ We conduct experiments to understand if different initial seed words affect the performance of DD-GloVe. We report our results in Table. 5. While all settings show similarly good semantic meaning preservation, we see that the choice of initial seed
292
+
293
+ Table 4: Sample words chosen by our dictionary-guided algorithm (Algorithm 1) to approximate the gender direction. The full list can be found in the appendix (A.3)
294
+
295
+ <table><tr><td>Initial seed</td><td>G-Sem (%)</td><td>d ↓</td><td>p ↑</td></tr><tr><td>she-he</td><td>80.47</td><td>1.25</td><td>0.0029</td></tr><tr><td>herself-himself</td><td>79.63</td><td>1.30</td><td>0.0012</td></tr><tr><td>her-his</td><td>80.25</td><td>1.50</td><td>7.8e-5</td></tr><tr><td>girl-boy</td><td>81.18</td><td>1.38</td><td>0.0011</td></tr><tr><td>mother-father</td><td>80.81</td><td>1.71</td><td>7.8e-5</td></tr><tr><td>woman-man</td><td>80.20</td><td>1.69</td><td>7.8e-5</td></tr></table>
296
+
297
+ Table 5: Performance of DD-GloVe on Google-Sem (%) and WEAT gender tests with different initial seed words. We finetune the hyper-parameter for each setting.
298
+
299
+ words gives rise to varying debiasing results. This is mainly due to the fact that some words have more diverse definitions than others. For example, definition of "he" contains mainly gendered words like "man", "boy", and "male", whereas the definition of "man" can be far more general, where it has definitions like "a human being of either sex; a person." As a result, the gender direction approximated by Algorithm 1 may suffer from the noisy definitional words, leading to less effective debiasing results.
300
+
301
+ # 5.4 Does DD-GloVe Simply Hide Biases?
302
+
303
+ We use the neighborhood metric (Gonen and Goldberg, 2019) to evaluate if the debiased word embeddings actually reduce biases. We cluster these most biased words using the classical KMeans algorithm for different embeddings. We expect effective bias-mitigated word embeddings to achieve a classification accuracy close to 0.5, which indicates word embeddings do not encode any useful information regarding the protected attributes in these words and the clustering algorithm can only make random guesses. Fig. 4 illustrates tSNE projections of the word embeddings of top 500 most gender-biased words in GloVe. The visualization shows that DD-GloVe<sub>gender</sub> mixes up the embeddings in a similar fashion as Double Hard Debias. In contrast, using dictionary definitions for post-processing debiasing and GN-GloVe tend to hide biases since the two clusters remain easily separable.
304
+
305
+ # 5.5 Ablation Study
306
+
307
+ We carry out an ablation study to better understand the role of each loss in DD-GloVe. Detailed discussions are in the appendix (A.4). We summarize our findings from the ablation study here.
308
+
309
+ $J_{ortho}$ contributes to both semantic meaning enhancement and general bias reduction in word embeddings when its weight is small. Nonetheless,
310
+
311
+ ![](images/ada850e77719957f7a39d9e688540a8303ebb23008fe06090013eff9947aa7df.jpg)
312
+ (a) GloVe
313
+
314
+ ![](images/32315aa7e364317ead031a19c34fab1d86ca24c5ba97e8846c780a7874dd174c.jpg)
315
+ (b) DHD
316
+
317
+ ![](images/3116f4f179146bebc2df8ee08f968127f190adfe3a81d1d78bc82b91356a35c4.jpg)
318
+ (c) Dict Debias
319
+ Figure 4: tSNE projections of word vectors for neighborhood metric evaluation. The most biased words in GloVe are found by projecting word vectors onto the difference between boy and girl.
320
+
321
+ ![](images/81635e4e0964c943a1e8191327788d3303f37b9ff6c8699effe8a118d52a1d99.jpg)
322
+ (d) GN-GloVe
323
+
324
+ ![](images/7bff1668c820fd91f6892a72edcf2822f0c2f4f44c0181d5d1cc12689829f799.jpg)
325
+ (e) DD-GloVe $\text{gender}$
326
+
327
+ this loss term reduces biases at the expense of semantic meaning preservation as its weight gets higher. Hence, the weight for $J_{ortho}$ should be kept relatively low. We also find that $J_{ortho}$ is not the most effective component for bias mitigation but it is still a crucial part for reducing general biases. $J_{proj}$ is essential for effective bias reduction. We find the projection-based loss function largely contributes to debiasing. $J_{def}$ enhances semantic meaning representation but does not help much in bias mitigation. $J_{G-bias}$ further mitigates bias, suggesting that adjusting word co-occurrence weights could help learn bias-reduced word embeddings.
328
+
329
+ # 6 Related Work
330
+
331
+ # 6.1 Biases in Word Embeddings
332
+
333
+ Biases in embeddings can cause harms in downstream tasks. Gender bias is found in coreference resolution (Rudinger et al., 2018; Zhao et al., 2018a), dialogue systems (Henderson et al., 2018) and machine translation models (Escudé Font and Costa-jussà, 2019). Researchers also find pretrained word embeddings exhibit racial and religious biases (Manzini et al., 2019).
334
+
335
+ # 6.2 Debiasing Word Embeddings
336
+
337
+ Algorithms to debias word embeddings can be classified into projection-based post-processing, dictionary-based post-processing, and train-time algorithms. Projection-based post-processing subtracts a word vector's projection onto the bias direction. Bolukbasi et al. (2016), Wang et al. (2020), Ravfogel et al. (2020), Kumar et al. (2020), Kaneko and Bollegala (2019), Dev and Phillips (2019), and Karve et al. (2019)'s works fall into this category. Dictionary definitions have been largely overlooked by debiasing algorithms. Kaneko and Bollegala (2021) uses dictionary definitions via post-processing, but its effectiveness is limited due to using biased definition embeddings as reference
338
+
339
+ points. Train-time algorithms either introduce bias-decreasing objectives (Zhao et al., 2018b) or counter-factly augment training data (Lu et al., 2020; Hall Maudslay et al., 2019).
340
+
341
+ # 6.3 Using Additional Knowledge
342
+
343
+ Researchers have attempted to learn word embeddings with resources outside the training corpora. Faruqui et al. (2015); Mrkšić et al. (2017); Tissier et al. (2017); Bosc and Vincent (2018); Zhang et al. (2020) are successful in enhancing semantic meaning representations with the aid of semantic relationships in word graphs or dictionaries. However, these works do not mitigate biases. In DD-GloVe, we specifically design loss functions that utilize dictionary definitions for bias alleviation.
344
+
345
+ # 7 Conclusion
346
+
347
+ In this paper, we propose DD-GloVe, a train-time debiasing algorithm to learn word embeddings leveraging dictionary definitions. We achieve effective debiasing results while preserving semantic meanings. The bias direction in DD-GloVe is automatically approximated using our dictionary-guided algorithm given a single pair of initial seed words. Our current implementation is based on GloVe, but the idea of using dictionary definitions to mitigate biases can be generalized to other word embeddings since our dictionary-guided losses are orthogonal to word embedding objectives. It is also likely that incorporating dictionary definitions can alleviate biases in contextualized word embeddings. This is out of the scope of this paper and remains an open research problem.
348
+
349
+ # Acknowledgements
350
+
351
+ We thank the anonymous reviewers for their constructive feedback. We also thank Professor Rachel Rudinger for her helpful discussion when we prepared the manuscript.
352
+
353
+ # References
354
+
355
+ Abdulrahman Almuhareb. 2006. Attributes in lexical acquisition. Ph.D. thesis, University of Essex.
356
+ Maria Antoniak and David Mimno. 2021. Bad seeds: Evaluating lexical methods for bias measurement. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1889-1904, Online. Association for Computational Linguistics.
357
+ Sanjeev Arora, Yingyu Liang, and Tengyu Ma. 2017. A simple but tough-to-beat baseline for sentence embeddings. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. Open-Review.net.
358
+ Marco Baroni, Stefan Evert, and Alessandro Lenci. 2008. Bridging the gap between semantic theory and computational simulations: Proceedings of the essli workshop on distributional lexical semantics. Hamburg, Germany: FOLLI.
359
+ Marco Baroni and Alessandro Lenci. 2011. How we blessed distributional semantic evaluation. In Proceedings of the GEMS 2011 Workshop on GEometrical Models of Natural Language Semantics, pages 1-10.
360
+ William F Battig and William E Montague. 1969. Category norms of verbal items in 56 categories: a replication and extension of the connecticut category norms. Journal of experimental Psychology, 80(3p2):1.
361
+ Su Lin Blodgett, Solon Barocas, Hal Daumé III, and Hanna Wallach. 2020. Language (technology) is power: A critical survey of "bias" in NLP. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5454-5476, Online. Association for Computational Linguistics.
362
+ Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. 2017. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5:135-146.
363
+ Tolga Bolukbasi, Kai-Wei Chang, James Y Zou, Venkatesh Saligrama, and Adam T Kalai. 2016. Man is to computer programmer as woman is to homemaker? debiasing word embeddings. In Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc.
364
+ Tom Bosc and Pascal Vincent. 2018. Auto-encoding dictionary definitions into consistent word embeddings. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 1522–1532, Brussels, Belgium. Association for Computational Linguistics.
365
+
366
+ Aylin Caliskan, Joanna J Bryson, and Arvind Narayanan. 2017. Semantics derived automatically from language corpora contain human-like biases. Science, 356(6334):183-186.
367
+ Sunipa Dev and Jeff Phillips. 2019. Attenuating bias in word vectors. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 879-887. PMLR.
368
+ 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.
369
+ Joel Escudé Font and Marta R. Costa-jussa. 2019. Equalizing gender bias in neural machine translation with word embeddings techniques. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pages 147-154, Florence, Italy. Association for Computational Linguistics.
370
+ Manaal Faruqui, Jesse Dodge, Sujay Kumar Jauhar, Chris Dyer, Eduard Hovy, and Noah A. Smith. 2015. Retrofitting word vectors to semantic lexicons. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1606-1615, Denver, Colorado. Association for Computational Linguistics.
371
+ Chen Gao, Jinyu Chen, Si Liu, Luting Wang, Qiong Zhang, and Qi Wu. 2021. Room-and-object aware knowledge reasoning for remote embodied referring expression. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 3064-3073.
372
+ Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson F. Liu, Matthew Peters, Michael Schmitz, and Luke S. Zettlemoyer. 2017. Allennlp: A deep semantic natural language processing platform.
373
+ Hila Gonen and Yoav Goldberg. 2019. Lipstick on a pig: Debiasing methods cover up systematic gender biases in word embeddings but do not remove them. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 609-614, Minneapolis, Minnesota. Association for Computational Linguistics.
374
+ Anthony G Greenwald, Debbie E McGhee, and Jordan LK Schwartz. 1998. Measuring individual differences in implicit cognition: the implicit association test. Journal of personality and social psychology, 74(6):1464.
375
+
376
+ Chaoyu Guan, Xin Wang, and Wenwu Zhu. 2021. Autoattend: Automated attention representation search. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 3864-3874. PMLR.
377
+ Rowan Hall Maudslay, Hila Gonen, Ryan Cotterell, and Simone Teufel. 2019. It's all in the name: Mitigating gender bias with name-based counterfactual data substitution. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 5267-5275, Hong Kong, China. Association for Computational Linguistics.
378
+ Peter Henderson, Koustuv Sinha, Nicolas Angelard-Gontier, Nan Rosemary Ke, Genevieve Fried, Ryan Lowe, and Joelle Pineau. 2018. Ethical challenges in data-driven dialogue systems. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pages 123-129.
379
+ Masahiro Kaneko and Danushka Bollegala. 2019. Gender-preserving debiasing for pre-trained word embeddings. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1641-1650, Florence, Italy. Association for Computational Linguistics.
380
+ Masahiro Kaneko and Danushka Bollegala. 2021. Dictionary-based debiasing of pre-trained word embeddings. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 212-223, Online. Association for Computational Linguistics.
381
+ Saket Karve, Lyle Ungar, and João Sedoc. 2019. Conceptor debiasing of word representations evaluated on WEAT. In Proceedings of the First Workshop on Gender Bias in Natural Language Processing, pages 40-48, Florence, Italy. Association for Computational Linguistics.
382
+ Vaibhav Kumar, Tenzin Singhay Bhotia, Vaibhav Kumar, and Tanmoy Chakraborty. 2020. Nurse is closer to woman than surgeon? mitigating gender-biased proximities in word embeddings. Transactions of the Association for Computational Linguistics, 8:486-503.
383
+ Kenton Lee, Luheng He, Mike Lewis, and Luke Zettlemoyer. 2017. End-to-end neural coreference resolution. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 188-197, Copenhagen, Denmark. Association for Computational Linguistics.
384
+ Kaiji Lu, Piotr Mardziel, Fangjing Wu, Preetam Amancharla, and Anupam Datta. 2020. Gender bias in neural natural language processing. In Logic, Language, and Security, pages 189-202. Springer.
385
+
386
+ Thomas Manzini, Lim Yao Chong, Alan W Black, and Yulia Tsvetkov. 2019. Black is to criminal as caucasian is to police: Detecting and removing multiclass bias in word embeddings. 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 615-621, Minneapolis, Minnesota. Association for Computational Linguistics.
387
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013a. Efficient estimation of word representations in vector space. In 1st International Conference on Learning Representations, ICLR 2013, Scottsdale, Arizona, USA, May 2-4, 2013, Workshop Track Proceedings.
388
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. 2013b. Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pages 3111-3119.
389
+ Tomas Mikolov, Wen-tau Yih, and Geoffrey Zweig. 2013c. Linguistic regularities in continuous space word representations. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 746-751, Atlanta, Georgia. Association for Computational Linguistics.
390
+ Nikola Mrkšić, Ivan Vulic, Diarmuid Řeşahdha, Ira Leviant, Roi Reichart, Milica Gašić, Anna Korhonen, and Steve Young. 2017. Semantic specialization of distributional word vector spaces using monolingual and cross-lingual constraints. Transactions of the Association for Computational Linguistics, 5:309-324.
391
+ Brian A Nosek, Mahzarin R Banaji, and Anthony G Greenwald. 2002. Harvesting implicit group attitudes and beliefs from a demonstration web site. Group Dynamics: Theory, Research, and Practice, 6(1):101.
392
+ 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, pages 1532-1543, Doha, Qatar. Association for Computational Linguistics.
393
+ Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. 2018. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 2227-2237, New Orleans, Louisiana. Association for Computational Linguistics.
394
+
395
+ Shauli Ravfogel, Yanai Elazar, Hila Gonen, Michael Twiton, and Yoav Goldberg. 2020. Null it out: Guarding protected attributes by iterative nullspace projection. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7237-7256, Online. Association for Computational Linguistics.
396
+
397
+ Rachel Rudinger, Jason Naradowsky, Brian Leonard, and Benjamin Van Durme. 2018. Gender bias in coreference resolution. 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 8-14, New Orleans, Louisiana. Association for Computational Linguistics.
398
+
399
+ Hinrich Schütze, Christopher D Manning, and Prabhakar Raghavan. 2008. Introduction to information retrieval, volume 39. Cambridge University Press Cambridge.
400
+
401
+ Julien Tissier, Christophe Gravier, and Amaury Habrard. 2017. Dict2vec : Learning word embeddings using lexical dictionaries. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 254-263, Copenhagen, Denmark. Association for Computational Linguistics.
402
+
403
+ Tianlu Wang, Xi Victoria Lin, Nazneen Fatema Rajani, Bryan McCann, Vicente Ordonez, and Caiming Xiong. 2020. Double-hard debias: Tailoring word embeddings for gender bias mitigation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5443-5453, Online. Association for Computational Linguistics.
404
+
405
+ Ralph Weischedel, Sameer Pradhan, Lance Ramshaw, Jeff Kaufman, Michelle Franchini, Mohammed El-Bachouti, Nianwen Xue, Martha Palmer, Jena D Hwang, Claire Bonial, et al. 2012. Ontonotes release 5.0.
406
+
407
+ Yichi Zhang, Yinpei Dai, Zhijian Ou, Huixin Wang, and Junlan Feng. 2020. Improved learning of word embeddings with word definitions and semantic injection. In *Interspeech* 2020, 21st Annual Conference of the International Speech Communication Association, Virtual Event, Shanghai, China, 25-29 October 2020, pages 4253-4257. ISCA.
408
+
409
+ Jieyu Zhao, Tianlu Wang, Mark Yatskar, Vicente Ordonez, and Kai-Wei Chang. 2018a. Gender bias in coreference resolution: Evaluation and debiasing methods. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 15–20, New Orleans, Louisiana. Association for Computational Linguistics.
410
+
411
+ Jieyu Zhao, Yichao Zhou, Zeyu Li, Wei Wang, and Kai-Wei Chang. 2018b. Learning gender-neutral word embeddings. In Proceedings of the 2018 Conference
412
+
413
+ on Empirical Methods in Natural Language Processing, pages 4847-4853, Brussels, Belgium. Association for Computational Linguistics.
414
+
415
+ # A Appendix
416
+
417
+ # A.1 Experimental Set-up
418
+
419
+ We give a more detailed description of our experimental set-up in this section.
420
+
421
+ We use Wikipedia dump available on Hugging Face $^2$ as our training corpora. We follow the same pre-processing procedure in the original GloVe implementation. We build a vocabulary of 400,000 most frequently occurring words. We set the dimension of word vector to be 300. Although the baseline GloVe is trained with 100 iterations, we find that training about 40 iterations yields excellent debiasing result while keeping the quality of word embeddings in other semantic tasks. We clip the values in word vectors to be within $[-1,1]$ to avoid numerical difficulties.
422
+
423
+ In the setting of DD-GloVe $\text{gender}$ , we place major emphasis on minimizing gender bias while mitigating other types of biases. We use one pair of initial seed words, "she" and "he". We run Algorithm 1 once at the beginning with $N = 30$ . We then use the same set of seed words throughout. Gender direction is approximated once in each iteration. We choose the hyperparameter values in Eqn. 10 to be $\beta = 1 \times 10^{-4}$ , $\gamma = 0.2$ , $\lambda = 1 \times 10^{-4}$ . Note that the difference in the magnitude is caused by the trend that definition loss and orthogonal loss have considerably larger values because the losses are not normalized by the vector dimension. We set $\alpha$ in Eqn. 8 to be 0.4.
424
+
425
+ We also conduct experiments that targets to mitigate racial bias. In this experiment DD-GloVe<sub>race</sub>, we find seed words using Algorithm 1 in the first 5 iterations and update them every 10 iterations. The initial seed words are "black" and "white." We choose the hyperparameter values $\beta = 1 \times 10^{-4}$ , $\gamma = 0.05$ , $\lambda = 1 \times 10^{-4}$ . $\alpha$ in Eqn. 8 remains 0.4.
426
+
427
+ We run GloVe (Pennington et al., 2014), Double Hard Debias (DHD) (Wang et al., 2020), dictionary-based debiasing (Dict Debias) (Kaneko and Bollegala, 2021), and GN-GloVe (Zhao et al., 2018b) as baselines for comparison. When reproducing the baselines, we follow the default hyperparameter settings in their released code. Each baseline algorithm represents a major debiasing
428
+
429
+ <table><tr><td>Embeddings</td><td>OntoNotes 5.0</td></tr><tr><td>GloVe</td><td>60.50</td></tr><tr><td>DHD</td><td>59.61</td></tr><tr><td>Dict Debias</td><td>60.66</td></tr><tr><td>GN-GloVe</td><td>60.78</td></tr><tr><td>DD-GloVe</td><td>60.44</td></tr></table>
430
+
431
+ Table 6: Coreference resolution F1-score (\%) using models trained with different embeddings. These results show that Dd-GloVe keeps useful semantic meanings in embeddings since the F1-score on OntoNotes 5.0 is similar to the baseline and its counterparts.
432
+
433
+ <table><tr><td>Word Embeddings</td><td>Sentiment Analysis</td><td>Document Classification</td></tr><tr><td>GloVe</td><td>87.94</td><td>74.16</td></tr><tr><td>DD-GloVe</td><td>88.34</td><td>74.45</td></tr></table>
434
+
435
+ technique: DHD uses projective correction via post-processing; Dict Debias uses dictionary definitions in post-processing. GN-GloVe trains GloVe from scratch with new objectives for debiasing.
436
+
437
+ # A.2 Additional Experimental Results
438
+
439
+ We report coreference resolution models' F1-score on the training set OntoNotes 5.0 in Table 6. These results indicate that DD-GloVe is able to preserve useful semantic meanings that help train coreference resolution models.
440
+
441
+ We conduct additional experiments to evaluate model F-1 scores in downstream tasks. We train an LSTM model with pre-trained word embeddings for sentiment analysis on an IMDB dataset<sup>3</sup>. We also train a CNN model with pre-trained word embeddings for document classification using the 20 Newsgroups data set<sup>4</sup>. We report F-1 scores of models in both tasks' test set in Table. 7. We see that DD-GloVe performs marginally better than the baseline GloVe in these two tasks. These results demonstrate that DD-GloVe preserves semantic meanings in the debiased word embeddings.
442
+
443
+ Table 7: F-1 score $(\%)$ of models in two downstream tasks. These results show that DD-GloVe well preserve semantic meaning of word vectors after debiasing.
444
+
445
+ <table><tr><td>Female</td><td>ex-wife, girl, jane, woman, wife, witch, women, she, pilipinas, heroine, maids, hens, dona, wives, fiancée, goddess, bint, sheila, hostess, hen, nun, sisters, girls, waitress, doe, sister, actress, businesswoman, chairwoman, goddesses</td></tr><tr><td>Male</td><td>he, son, brother, brothers, boys, sons, boy, businessman, yang, gentleman, wizard, headmaster, statesman, nobleman, policeman, salesman, bahadur, stallion, fiance, manny, englishman, beau, widower, chicano, workmen, councilman, stallions, schoolmaster, scotsman, horseman</td></tr></table>
446
+
447
+ Table 8: Full lists of words chosen by our dictionary-guided algorithm (Algorithm 1) to approximate the gender direction.
448
+
449
+ # A.3 Full List of Seed Words
450
+
451
+ We report the full list of chosen seed words by running Algorithm 1 for approximating gender direction in Table. 8.
452
+
453
+ # A.4 Ablation Study
454
+
455
+ To understand the role of each dictionary-guided loss in DD-GloVe, we conduct an ablation study that only uses one of the proposed losses, and an experiments that avoid using one of the losses but optimizes the other two in Table. 10. We have made the following observations.
456
+
457
+ $J_{ortho}$ contributes to both semantic meaning preservation and general bias reduction Both word analogy accuracy and WEAT results improve as the weight of $J_{ortho}$ increases from $1e - 5$ to 0.01, as shown in Table. 10. However, if the weight of $J_{ortho}$ gets large, it debiases word embeddings at the expense of semantic meaning representations. We should keep its weight low for both semantic meaning preservation and bias mitigation. We see that $J_{ortho}$ is not the most effective component for bias mitigation because the debiasing effect does not suffer a significant drop when $J_{ortho}$ is not used to train DD-GloVe, shown in Table. 10. However, $J_{ortho}$ remains an important component in the loss function because of its ability to reduce general types of biases. In Table. 9, we report the WEAT results of DD-GloVe without using $J_{ortho}$ and com
458
+
459
+ <table><tr><td>Setting</td><td colspan="2">Gender-1</td><td colspan="2">Gender-2</td><td colspan="2">Race</td><td colspan="2">Age</td><td colspan="2">Nature</td></tr><tr><td></td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td><td>d ↓</td><td>p ↑</td></tr><tr><td>GloVe</td><td>1.74</td><td>0.00</td><td>1.07</td><td>0.013</td><td>1.18</td><td>0.0029</td><td>1.03</td><td>0.0090</td><td>1.15</td><td>0.0029</td></tr><tr><td>All losses</td><td>1.25</td><td>0.0029</td><td>0.083</td><td>0.44</td><td>1.01</td><td>0.011</td><td>0.94</td><td>0.017</td><td>1.01</td><td>0.0088</td></tr><tr><td>w/o Jortho</td><td>1.22</td><td>0.0037</td><td>0.025</td><td>0.48</td><td>1.17</td><td>0.0035</td><td>1.09</td><td>0.0061</td><td>1.06</td><td>0.0064</td></tr></table>
460
+
461
+ Table 9: WEAT results when orthogonal loss is not used, compared with GloVe and DD-GloVe trained with all proposed loss terms. Without orthogonal loss, DD-GloVe can still mitigate gender bias but non-gender WEAT tests show similar results as the original GloVe. These results indicate that $J_{ortho}$ can reduce general types of biases.
462
+
463
+ <table><tr><td>Setting</td><td>Weight</td><td>G-Sem (%)</td><td>d↓</td><td>p↑</td></tr><tr><td colspan="5">References</td></tr><tr><td>GloVe</td><td></td><td>79.26</td><td>1.74</td><td>0.00</td></tr><tr><td>DHD</td><td></td><td>79.77</td><td>1.38</td><td>0.0014</td></tr><tr><td>DD-GloVegender</td><td></td><td>80.27</td><td>1.25</td><td>0.0029</td></tr><tr><td colspan="5">Only using one of the losses</td></tr><tr><td rowspan="5">Jorthoonly</td><td>0.001</td><td>80.56</td><td>1.75</td><td>0.0</td></tr><tr><td>0.005</td><td>80.93</td><td>1.73</td><td>0.0</td></tr><tr><td>0.01</td><td>81.50</td><td>1.73</td><td>7.8e-5</td></tr><tr><td>0.1</td><td>76.89</td><td>1.71</td><td>0.0</td></tr><tr><td>0.2</td><td>71.61</td><td>1.68</td><td>7.8e-5</td></tr><tr><td rowspan="5">Jprojonly</td><td>0.2</td><td>79.96</td><td>1.40</td><td>8.6e-4</td></tr><tr><td>0.25</td><td>79.69</td><td>1.26</td><td>0.0023</td></tr><tr><td>0.3</td><td>79.10</td><td>1.03</td><td>0.017</td></tr><tr><td>0.35</td><td>78.93</td><td>1.13</td><td>0.010</td></tr><tr><td>0.4</td><td>79.39</td><td>0.99</td><td>0.021</td></tr><tr><td rowspan="4">Jdefonly</td><td>1e-5</td><td>80.09</td><td>1.77</td><td>7.8e-5</td></tr><tr><td>1e-4</td><td>80.22</td><td>1.76</td><td>0.0</td></tr><tr><td>0.001</td><td>80.54</td><td>1.74</td><td>0.0</td></tr><tr><td>0.005</td><td>81.29</td><td>1.78</td><td>0.0</td></tr><tr><td colspan="5">Without using one of the losses</td></tr><tr><td>w/o Jortho</td><td></td><td>79.60</td><td>1.22</td><td>0.0037</td></tr><tr><td>w/o Jproj</td><td></td><td>80.29</td><td>1.76</td><td>0.0</td></tr><tr><td>w/o Jdef</td><td></td><td>79.78</td><td>1.23</td><td>0.0044</td></tr><tr><td>w/o JG-bias</td><td></td><td>80.35</td><td>1.39</td><td>7.8e-4</td></tr></table>
464
+
465
+ Table 10: Ablation study to understand the effects of each loss in DD-GloVe. The table shows the performance of DD-GloVe in Google-sem word analogy (G-Sem) and WEAT Gender-1 test (effect size $d$ and $p$ -value). In the experiment without $J_{G-bias}$ , we replace $J_{G-bias}$ with the original GloVe loss function.
466
+
467
+ pare them with the baseline GloVe and DD-GloVe with all losses used. It is evident that the absence of $J_{ortho}$ causes race, age, and nature WEAT test to have worse results.
468
+
469
+ $J_{proj}$ is essential for effective bias reduction Table. 10 shows that WEAT results improve significantly as we increase the weight of $J_{proj}$ . When the projection loss is not used, there is a significant degradation in debiasing performance in Table. 10.
470
+
471
+ $J_{def}$ enhances semantic meaning representation In Table. 10, we see that the word analogy task enjoys higher accuracy when the weight of $J_{def}$ increases. This benefits from the additional semantic meaning injected from dictionary definitions. In terms of debiasing, $J_{def}$ does not help much as illustrated in Table. 10. This finding explains why simply doing retrofitting with dictionary definitions does not mitigate biases.
472
+
473
+ $J_{G - bias}$ further mitigates bias We find that when $J_{G - bias}$ is replaced with the original GloVe loss function, there remains evidence of debiasing but it is less effective, as shown in Table. 10. This suggests that adjusting co-occurrence weights according to the word bias and context word bias can learn more neutral word embeddings.
learningbiasreducedwordembeddingsusingdictionarydefinitions/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8eec703a8351f87e99abdd5904745106dccf1318d452b7aad4b3e3d4c545b65
3
+ size 644630
learningbiasreducedwordembeddingsusingdictionarydefinitions/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ce36f4a276bf1bbfbf74cfd9608caea12edab8683c9461e57dadaa9f7a46db0
3
+ size 516749
learningfrommissingrelationscontrastivelearningwithcommonsenseknowledgegraphsforcommonsenseinference/2527e2a3-c784-400e-949e-fa375f54f325_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5bc8377361de5684472caccc6c42433caa9b1279d40599222ed0c11da6aa304
3
+ size 69863
learningfrommissingrelationscontrastivelearningwithcommonsenseknowledgegraphsforcommonsenseinference/2527e2a3-c784-400e-949e-fa375f54f325_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc2883d8368c5bb034141850c6c5cf9ea50de242950d7a04e51e95150b3894a7
3
+ size 83344