ACL-OCL / Base_JSON /prefixI /json /insights /2020.insights-1.1.json
Benjamin Aw
Add updated pkl file v3
6fa4bc9
raw
history blame contribute delete
No virus
34.8 kB
{
"paper_id": "2020",
"header": {
"generated_with": "S2ORC 1.0.0",
"date_generated": "2023-01-19T07:13:10.915580Z"
},
"title": "Domain adaptation challenges of BERT in tokenization and sub-word representations of Out-of-Vocabulary words",
"authors": [
{
"first": "Anmol",
"middle": [],
"last": "Nayak",
"suffix": "",
"affiliation": {},
"email": ""
},
{
"first": "Hariprasad",
"middle": [
"P"
],
"last": "Timmapathini",
"suffix": "",
"affiliation": {},
"email": ""
},
{
"first": "Karthikeyan",
"middle": [],
"last": "Ponnalagu",
"suffix": "",
"affiliation": {},
"email": ""
},
{
"first": "Vijendran",
"middle": [],
"last": "Venkoparao",
"suffix": "",
"affiliation": {},
"email": "gopalanvijendran.venkoparao@in.bosch.com"
},
{
"first": "{anmol",
"middle": [],
"last": "Nayak",
"suffix": "",
"affiliation": {},
"email": ""
}
],
"year": "",
"venue": null,
"identifiers": {},
"abstract": "BERT model (Devlin et al., 2019) has achieved significant progress in several Natural Language Processing (NLP) tasks by leveraging the multi-head self-attention mechanism (Vaswani et al., 2017) in its architecture. However, it still has several research challenges which are not tackled well for domain specific corpus found in industries. In this paper, we have highlighted these problems through detailed experiments involving analysis of the attention scores and dynamic word embeddings with the BERT-Base-Uncased model. Our experiments have lead to interesting findings that showed: 1) Largest substring from the left that is found in the vocabulary (in-vocab) is always chosen at every sub-word unit that can lead to suboptimal tokenization choices, 2) Semantic meaning of a vocabulary word deteriorates when found as a substring in an Out-Of-Vocabulary (OOV) word, and 3) Minor misspellings in words are inadequately handled. We believe that if these challenges are tackled, it will significantly help the domain adaptation aspect of BERT.",
"pdf_parse": {
"paper_id": "2020",
"_pdf_hash": "",
"abstract": [
{
"text": "BERT model (Devlin et al., 2019) has achieved significant progress in several Natural Language Processing (NLP) tasks by leveraging the multi-head self-attention mechanism (Vaswani et al., 2017) in its architecture. However, it still has several research challenges which are not tackled well for domain specific corpus found in industries. In this paper, we have highlighted these problems through detailed experiments involving analysis of the attention scores and dynamic word embeddings with the BERT-Base-Uncased model. Our experiments have lead to interesting findings that showed: 1) Largest substring from the left that is found in the vocabulary (in-vocab) is always chosen at every sub-word unit that can lead to suboptimal tokenization choices, 2) Semantic meaning of a vocabulary word deteriorates when found as a substring in an Out-Of-Vocabulary (OOV) word, and 3) Minor misspellings in words are inadequately handled. We believe that if these challenges are tackled, it will significantly help the domain adaptation aspect of BERT.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Abstract",
"sec_num": null
}
],
"body_text": [
{
"text": "BERT is one of the prominent models used for a variety of NLP tasks. With the Masked Language Model (MLM) method, it has been successful at leveraging bidirectionality while training the language model. The BERT-Base-Uncased model has 12 encoder layers, with each layer consisting of 12 self-attention heads. The word representations are context-dependent 768 dimensional dynamic embeddings. In order to leverage the learnings of such pre-trained networks, fine tuning is commonly done while building NLP applications in industries.The BERT-Base-Uncased vocabulary has a size of 30522 with only 994 unused slots (in comparison, BERT-Base-Cased has only 101 unused slots). While the unused slots in the vocabulary can be used to include domain specific words, the representations of these will have to be fine tuned with domain specific corpus before they can be utilized. Hence, it is essential that the tokenization algorithm performs well to handle domain specific OOV words.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "BERT relies on the WordPiece algorithm (Schuster and Nakajima, 2012) to create the vocabulary, that chooses those sub-word units for the vocabulary towards maximising the language model likelihood. However, the tokenization using this vocabulary is not done semantically. This leads to a poor tokenization that induces a semantic information loss in terms of dealing with OOV words for domain centric downstream tasks. While the largest substring tokenization problem can be alleviated to a large extent by integrating recent algorithms like BPE-Dropout (Provilkov et al., 2019) or Sen-tencePiece (Kudo and Richardson, 2018) , that use frequency and/or language model based tokenization, the remaining aforementioned challenges still persist. In the following section, we discuss these challenges with respect to two categories: Tokenization and Sub-word representations.",
"cite_spans": [
{
"start": 554,
"end": 578,
"text": "(Provilkov et al., 2019)",
"ref_id": "BIBREF3"
},
{
"start": 597,
"end": 624,
"text": "(Kudo and Richardson, 2018)",
"ref_id": "BIBREF2"
}
],
"ref_spans": [],
"eq_spans": [],
"section": "Introduction",
"sec_num": "1"
},
{
"text": "The experiments we performed are using the pretrained BERT-Base-Uncased model without any domain specific fine tuning as the examples were chosen with the purpose of highlighting the challenges with BERT across various domains. The 12 th encoder layer dynamic embeddings were used for all the analysis tasks. In case a word was OOV, the average of its sub-word units embeddings was considered as its embedding. Otherwise, the embedding for the word was considered as it is. In all cases, we ignore the [CLS] Table 2 : Cosine similarity score count for words vs misspelled versions in the TOEFL-Spell corpus when the error occurs at the beginning, middle or end of the word. ticular word. The ## counterpart of a word is ## prefixed to the word. For example, the ## counterpart of the word active is ##active. We also made a subtle change to the tokenizer to leave untouched any word beginning with ##.",
"cite_spans": [
{
"start": 502,
"end": 507,
"text": "[CLS]",
"ref_id": null
}
],
"ref_spans": [
{
"start": 508,
"end": 515,
"text": "Table 2",
"ref_id": null
}
],
"eq_spans": [],
"section": "Experiments",
"sec_num": "2"
},
{
"text": "BERT always picks the largest substring from the left that is in-vocab at every sub-word unit for the tokenized output. While this performs reasonably well for words where the root (or stem) are suffixed, prefixed words are vulnerable to a poor tokenization.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Tokenization problems",
"sec_num": "2.1"
},
{
"text": "Taking deconstructed, deactivated and unequal as examples, even though the vocabulary had the prefixes de and un as well as the words constructed, activated and equal, the tokenizer chose the substrings deco, dea and une (see Table 1 ). In comparison since SentencePiece is a likelihood based tokenization algorithm, it has managed to generate better tokenizations (deconstructed: de, con, struct, ed; deactivated: de, activated; unequal: unequal). We believe that if the BERT tokenizer correctly separates the prefixes while the model is being trained, it can help the model to learn better representations for the prefix as well as the subword units since the attention mechanism would understand the influence of the different categories of prefixes. Further it can be seen in Section 2.2 how a poor tokenization can lead to weaker semantic representations for the word.",
"cite_spans": [],
"ref_spans": [
{
"start": 226,
"end": 233,
"text": "Table 1",
"ref_id": "TABREF1"
}
],
"eq_spans": [],
"section": "Tokenization problems",
"sec_num": "2.1"
},
{
"text": "Domain specific corpus often contain a large amount of jargons that can be misspelled frequently. Taking the in-vocab word cabbage as an example, ccabbage, cababge and cabbagee were chosen as the misspelled versions. The cosine similarities of cabbage with ccabbage, cababge and cabbagee were 0.33, 0.44 and 0.63 respectively. To verify that the low cosine similarity scores in the misspelled versions were not due to lack of surrounding context, we checked the cosine similarity score between cabbage and onion (in-vocab) and found it to be 0.88.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Tokenization problems",
"sec_num": "2.1"
},
{
"text": "To analyze the extent of this problem and the im- ) and word vs in-vocab ## counterpart (Count' L=4, 5, 6 ). pact of the position of the error in the word on the tokenization, we chose the TOEFL-Spell corpus that contains over 6000 common spelling errors. 1 We took the intersection of the common words between the TOEFL-Spell corpus and the BERT vocabulary words. The corpus was segregated depending on whether the spelling error occurred in the word within the starting 33% of the letters, in the middle or at the end. As we can see in Table 2 , since the BERT tokenizer has the largest substring problem, the penalty of a spelling error earlier in the word is more harmful as it leads to subsequent sub-word tokenization choices to be suboptimal.",
"cite_spans": [
{
"start": 256,
"end": 257,
"text": "1",
"ref_id": null
}
],
"ref_spans": [
{
"start": 538,
"end": 545,
"text": "Table 2",
"ref_id": null
}
],
"eq_spans": [],
"section": "Tokenization problems",
"sec_num": "2.1"
},
{
"text": "Cosine similarity Count L=4 Count L=5 Count L=6 Count' L=4 Count' L=5 Count' L=6 0.0-0.1 0 0 0 0 0 0 0.1-0.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Tokenization problems",
"sec_num": "2.1"
},
{
"text": "For a model to handle OOV words well, it should learn strong representations of a words constituents. While OOV words that begin with an in-vocab root (or stem) will retain its semantic meaning when tokenized, they become vulnerable in other cases as the root (or stem) will be broken down into smaller constituent sub-word units.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Semantic meaning deterioration from sub-word representations",
"sec_num": "2.2"
},
{
"text": "To see how BERT handles this, we created two sets of words from the vocabulary of length 4,5 and 6 that were consisting of: 1) Words whose ## counterparts were OOV and 2) Words whose ## counterparts were in-vocab. We chose these particular words since a word with length less than 4 would be commonly be found as a sub-word across many words, while a word with length larger that 6 would be rarer to be found as a sub-word. The cosine similarity between a word and its ## counterpart was computed (see Table 3 ). This problem is not a concern when the ## counterpart is in-vocab as the average cosine similarity was around 0.66, which can be improved if supplied with a context in a sentence. However, when the ## counterpart is not part of the vocab, the average cosine similarity drops to a low value of 0.48, which makes it difficult for the network to recover from.",
"cite_spans": [],
"ref_spans": [
{
"start": 502,
"end": 509,
"text": "Table 3",
"ref_id": "TABREF3"
}
],
"eq_spans": [],
"section": "Semantic meaning deterioration from sub-word representations",
"sec_num": "2.2"
},
{
"text": "To further analyze this problem, we compared the embeddings of the words unsaturated (OOV but un and saturated are in-vocab) with saturated. The cosine similarity between unsaturated and saturated was only 0.30. In comparison, the cosine similarity between un saturated and saturated is 0.81. To verify that this low similarity was being Table 4 : Difference in inward and outward attention scores between saturated and ##sat ##ura ##ted.",
"cite_spans": [],
"ref_spans": [
{
"start": 338,
"end": 345,
"text": "Table 4",
"ref_id": null
}
],
"eq_spans": [],
"section": "Semantic meaning deterioration from sub-word representations",
"sec_num": "2.2"
},
{
"text": "Nearest neighbours saturated bacon, nutrition, cereal, obesity, flour, tobacco, humidity, mustard, cigarettes, vitamin ##sat ##ura ##ted destruction, egypt, erosion, malaria, morphology, concussion, organ, topography, aroused, sample caused by the poor representation learning of the constituents of saturated, we compared the average embedding of ##sat, ##ura, ##ted (since unsaturated was tokenized into sub-word units) with saturated and found their cosine similarity to be only 0.35. Further, to rule out the possibility that it was being caused due to lack of surrounding context, we compared the average embedding of ##sat, ##ura, ##ted with saturated as found in the following sentences: pork has saturated fat and pork has ##sat ##ura ##ted fat.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Word",
"sec_num": null
},
{
"text": "The cosine similarity even in this case was found to be only 0.57. For the above sentences, we wanted to see the impact of this problem by an-alyzing the attention scores in each encoder layer. The multi-head (12 heads) attention score matrix across the 12 encoder layers is of size 12 x 12 x 6 x 6 for the first sentence and 12 x 12 x 8 x 8 for the second sentence. Within each layer, we averaged the attention scores across the 12 heads. This resulted in 12 x 6 x 6 and 12 x 8 x 8 sized attention scores matrices for the two sentences respectively. We wanted to observe the inward influence of other words on saturated as well as outward influence of saturated towards the other words in both sentences. For the first sentence, the attention score matrix was hence reduced to a size of 12 x 5 x 5. In the second sentence, we averaged the inward and output influence for ##sat ##ura ##ted, leading to a reduced matrix of size 12 x 5 x 5. The two matrices were then subtracted to see the difference in the inward and outward influences for the word saturated (see Table 4 ).",
"cite_spans": [],
"ref_spans": [
{
"start": 1064,
"end": 1071,
"text": "Table 4",
"ref_id": null
}
],
"eq_spans": [],
"section": "Word",
"sec_num": null
},
{
"text": "Since the difference was taken, a positive value means saturated as found in the first sentence had a larger inwards or outwards attention influence compared to the second sentence. Clark et al. (2019) previously showed that a large number of attention heads in the early layers of BERT put >50% of their attention on previous and next tokens. As we can see in Table 4 , the values in bold show a significant difference in attention scores, especially in the case for the neighbouring words of saturated, which we believe has caused the loss of semantic meaning between saturated and when tokenized to ##sat, ##ura, ##ted. The inward attention visualization for fat in Encoder layer 1 -Attention head 3 generated using BertViz (Vig, 2019) can be seen in Figure 1 . Further, we checked the top 10 cosine similar neighbours in the BERT-Base-Uncased vocabulary (using their dynamic embeddings) for the embeddings of saturated and ##sat ##ura ##ted from the above sentences. We found that while saturated as found in the first sentence had semantically similar neighbours, its occurrence in the second sentence had neighbours which had a completely irrelevant semantic meaning (see Table 5 ). This confirmed that such a challenge can lead to cascading problems in the network.",
"cite_spans": [
{
"start": 182,
"end": 201,
"text": "Clark et al. (2019)",
"ref_id": "BIBREF0"
},
{
"start": 727,
"end": 738,
"text": "(Vig, 2019)",
"ref_id": "BIBREF6"
}
],
"ref_spans": [
{
"start": 361,
"end": 368,
"text": "Table 4",
"ref_id": null
},
{
"start": 754,
"end": 762,
"text": "Figure 1",
"ref_id": "FIGREF0"
},
{
"start": 1178,
"end": 1185,
"text": "Table 5",
"ref_id": "TABREF5"
}
],
"eq_spans": [],
"section": "Word",
"sec_num": null
},
{
"text": "In this paper we highlighted various challenges in the BERT model which if solved could significantly boost the models accuracy, especially in domain specific applications. These are mainly due to BERT lacking a semantic tokenization algorithm and its semantic information loss from sub-word representations in OOV scenarios.",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "Conclusion",
"sec_num": "3"
},
{
"text": "https://github.com/ EducationalTestingService/TOEFL-Spell",
"cite_spans": [],
"ref_spans": [],
"eq_spans": [],
"section": "",
"sec_num": null
}
],
"back_matter": [],
"bib_entries": {
"BIBREF0": {
"ref_id": "b0",
"title": "What does BERT look at? an analysis of BERT's attention",
"authors": [
{
"first": "Kevin",
"middle": [],
"last": "Clark",
"suffix": ""
},
{
"first": "Urvashi",
"middle": [],
"last": "Khandelwal",
"suffix": ""
},
{
"first": "Omer",
"middle": [],
"last": "Levy",
"suffix": ""
},
{
"first": "Christopher",
"middle": [
"D"
],
"last": "Manning",
"suffix": ""
}
],
"year": 2019,
"venue": "Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP",
"volume": "",
"issue": "",
"pages": "276--286",
"other_ids": {
"DOI": [
"10.18653/v1/W19-4828"
]
},
"num": null,
"urls": [],
"raw_text": "Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. 2019. What does BERT look at? an analysis of BERT's attention. In Pro- ceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 276-286, Florence, Italy. Association for Computational Linguistics.",
"links": null
},
"BIBREF1": {
"ref_id": "b1",
"title": "BERT: Pre-training of deep bidirectional transformers for language understanding",
"authors": [
{
"first": "Jacob",
"middle": [],
"last": "Devlin",
"suffix": ""
},
{
"first": "Ming-Wei",
"middle": [],
"last": "Chang",
"suffix": ""
},
{
"first": "Kenton",
"middle": [],
"last": "Lee",
"suffix": ""
},
{
"first": "Kristina",
"middle": [],
"last": "Toutanova",
"suffix": ""
}
],
"year": 2019,
"venue": "Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies",
"volume": "1",
"issue": "",
"pages": "4171--4186",
"other_ids": {
"DOI": [
"10.18653/v1/N19-1423"
]
},
"num": null,
"urls": [],
"raw_text": "Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: Pre-training of deep bidirectional transformers for language under- standing. 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. Associ- ation for Computational Linguistics.",
"links": null
},
"BIBREF2": {
"ref_id": "b2",
"title": "SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing",
"authors": [
{
"first": "Taku",
"middle": [],
"last": "Kudo",
"suffix": ""
},
{
"first": "John",
"middle": [],
"last": "Richardson",
"suffix": ""
}
],
"year": 2018,
"venue": "Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
"volume": "",
"issue": "",
"pages": "66--71",
"other_ids": {
"DOI": [
"10.18653/v1/D18-2012"
]
},
"num": null,
"urls": [],
"raw_text": "Taku Kudo and John Richardson. 2018. SentencePiece: A simple and language independent subword tok- enizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66-71, Brussels, Belgium. Association for Computational Linguistics.",
"links": null
},
"BIBREF3": {
"ref_id": "b3",
"title": "Bpe-dropout: Simple and effective subword regularization",
"authors": [
{
"first": "Ivan",
"middle": [],
"last": "Provilkov",
"suffix": ""
},
{
"first": "Dmitrii",
"middle": [],
"last": "Emelianenko",
"suffix": ""
},
{
"first": "Elena",
"middle": [],
"last": "Voita",
"suffix": ""
}
],
"year": 2019,
"venue": "",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {
"arXiv": [
"arXiv:1910.13267"
]
},
"num": null,
"urls": [],
"raw_text": "Ivan Provilkov, Dmitrii Emelianenko, and Elena Voita. 2019. Bpe-dropout: Simple and effective subword regularization. arXiv preprint, arXiv:1910.13267.",
"links": null
},
"BIBREF4": {
"ref_id": "b4",
"title": "Japanese and korean voice search",
"authors": [
{
"first": "Mike",
"middle": [],
"last": "Schuster",
"suffix": ""
},
{
"first": "Kaisuke",
"middle": [],
"last": "Nakajima",
"suffix": ""
}
],
"year": 2012,
"venue": "2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)",
"volume": "",
"issue": "",
"pages": "5149--5152",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "Mike Schuster and Kaisuke Nakajima. 2012. Japanese and korean voice search. In 2012 IEEE Interna- tional Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5149-5152. IEEE.",
"links": null
},
"BIBREF5": {
"ref_id": "b5",
"title": "Attention is all you need",
"authors": [
{
"first": "Ashish",
"middle": [],
"last": "Vaswani",
"suffix": ""
},
{
"first": "Noam",
"middle": [],
"last": "Shazeer",
"suffix": ""
},
{
"first": "Niki",
"middle": [],
"last": "Parmar",
"suffix": ""
},
{
"first": "Jakob",
"middle": [],
"last": "Uszkoreit",
"suffix": ""
},
{
"first": "Llion",
"middle": [],
"last": "Jones",
"suffix": ""
},
{
"first": "Aidan",
"middle": [
"N"
],
"last": "Gomez",
"suffix": ""
},
{
"first": "\u0141ukasz",
"middle": [],
"last": "Kaiser",
"suffix": ""
},
{
"first": "Illia",
"middle": [],
"last": "Polosukhin",
"suffix": ""
}
],
"year": 2017,
"venue": "Advances in neural information processing systems",
"volume": "",
"issue": "",
"pages": "5998--6008",
"other_ids": {},
"num": null,
"urls": [],
"raw_text": "Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, \u0141ukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in neural information pro- cessing systems, pages 5998-6008.",
"links": null
},
"BIBREF6": {
"ref_id": "b6",
"title": "A multiscale visualization of attention in the transformer model",
"authors": [
{
"first": "Jesse",
"middle": [],
"last": "Vig",
"suffix": ""
}
],
"year": 2019,
"venue": "",
"volume": "",
"issue": "",
"pages": "",
"other_ids": {
"arXiv": [
"arXiv:1906.05714"
]
},
"num": null,
"urls": [],
"raw_text": "Jesse Vig. 2019. A multiscale visualization of at- tention in the transformer model. arXiv preprint arXiv:1906.05714.",
"links": null
}
},
"ref_entries": {
"FIGREF0": {
"uris": null,
"text": "Inward Attention visualization for fat in Encoder layer 1 -Attention head 3.",
"num": null,
"type_str": "figure"
},
"TABREF1": {
"type_str": "table",
"html": null,
"content": "<table><tr><td colspan=\"4\">Cosine similarity Count beg Count mid Count end</td></tr><tr><td>0.0-0.1</td><td>0</td><td>1</td><td>0</td></tr><tr><td>0.1-0.2</td><td>6</td><td>1</td><td>1</td></tr><tr><td>0.2-0.3</td><td>39</td><td>44</td><td>19</td></tr><tr><td>0.3-0.4</td><td>160</td><td>232</td><td>113</td></tr><tr><td>0.4-0.5</td><td>368</td><td>562</td><td>232</td></tr><tr><td>0.5-0.6</td><td>264</td><td>442</td><td>213</td></tr><tr><td>0.6-0.7</td><td>96</td><td>145</td><td>179</td></tr><tr><td>0.7-0.8</td><td>15</td><td>60</td><td>145</td></tr><tr><td>0.8-0.9</td><td>0</td><td>0</td><td>23</td></tr><tr><td>0.9-1.0</td><td>0</td><td>0</td><td>1</td></tr><tr><td>Avg. similarity:</td><td>0.474</td><td>0.49</td><td>0.552</td></tr></table>",
"text": "BERT tokenized representations.",
"num": null
},
"TABREF3": {
"type_str": "table",
"html": null,
"content": "<table/>",
"text": "Cosine similarity score count for word vs OOV ## counterpart(Count L=4, 5, 6",
"num": null
},
"TABREF5": {
"type_str": "table",
"html": null,
"content": "<table/>",
"text": "Top 10 cosine similar nearest neighbours in the vocabulary for saturated and ##sat ##ura ##ted as found in the sentences.",
"num": null
}
}
}
}