Human languages are full of metaphorical expressions. Metaphors help people understand the world by connecting new concepts and domains to more familiar ones. Large pretrained language models (PLMs) are therefore assumed to encode metaphorical knowledge useful for NLP systems. In this paper, we investigate this hypothesis for PLMs, by probing metaphoricity information in their encodings, and by measuring the cross-lingual and cross-dataset generalization of this information. We present studies in multiple metaphor detection datasets and in four languages (i.e., English, Spanish, Russian, and Farsi). Our extensive experiments suggest that contextual representations in PLMs do encode metaphorical knowledge, and mostly in their middle layers. The knowledge is transferable between languages and datasets, especially when the annotation is consistent across training and testing sets. Our findings give helpful insights for both cognitive and NLP scientists. Pre-trained language models (PLMs) (Peters et al., 2018; Devlin et al., 2019), are now used in almost all NLP applications, e.g., machine translation (Li et al., 2021), question answering (Zhang et al., 2020), dialogue systems (Ni et al., 2021), and sentiment analysis (Minaee et al., 2020). They have sometimes been referred to as foundation models (Bommasani et al., 2021) due to their significant impact on research and industry. Metaphors are important aspects of human languages. In conceptual metaphor theory (CMT) (Lakoff and Johnson, 2008), metaphor is defined as a cognitive phenomenon associating two different concepts or domains. This phenomenon is built in cognition and expressed in language. The creativity and problem solving (i.e., generalization to new (cid:63) Equal contribution. problems) depend on the analogies and metaphors a cognitive system, like our brain, relies on. Modeling metaphors is therefore essential in building human-like computational systems that can relate emerging concepts to the more familiar ones. So far, there has been no comprehensive analysis of whether and how PLMs represent metaphorical information. We intuitively assume that PLMs must encode some information about metaphors due to their great performance in metaphor detection and other language processing tasks. Confirming that experimentally is a question that we address here. Specifically, we aim to know whether generalizable metaphorical knowledge is encoded in PLM representations or not . The outline of our work is presented in Figure 1. We first do probing experiments to answer questions such as: (i) with which accuracies and ex-tractablities do different PLMs encode metaphorical knowledge? (ii) how deep is the metaphorical knowledge encoded in PLM multi-layer representations? We take two probing methods, edge probing (Tenney et al., 2019b) and minimum description length (Voita and Titov, 2020), and apply them to four metaphor detection datasets, namely LCC (Mohler et al., 2016), TroFi (Birke and Sarkar, 2006), VUA pos, and VUA Verbs (Steen, 2010). To better estimate the generalization of metaphorical knowledge in PLMs, we design two setups in which testing comes from a different distribution than training data: cross-lingual and cross-dataset metaphor detection. Each setup can reveal important information on whether or not the metaphorical knowledge is encoded consistently in PLMs. Four languages (English, Farsi, Russian and Spanish) and four datasets (LCC, TroFi, VUA pos, and VUA Verbs) are considered in these generalization experiments. In summary, this paper makes the following contributions:  For the first time, and through careful probing analysis, we confirm that PLMs do encode metaphorical knowledge. We show that metaphorical knowledge is encoded better in the middle layers of PLMs. We evaluate the generalization of metaphorical knowledge in PLMs across four languages and four dataset sources, and find out that there is considerable transferability for the pairs with consistent data annotation even if they are in different languages. 1 2 Related Work Metaphor detection using PLMs. The metaphor detection task (Mason, 2004; Birke and Sarkar, 2007; Shutova et al., 2013) is a good fit for analyzing the metaphorical knowledge. Using PLMs for metaphor detection has been common in recent years, setting new state-of-the-art results, indicating implicitly that PLMs represent metaphorical information. Choi et al. (2021) introduce a new architecture that integrates metaphor detection theories with BERT. They use the definitions as well as example usages of words jointly with PLM representations. Similarly, Song et al. (2021) presents a new perspective on metaphor detection task by framing it as relation classification, focusing on the verbs. These approaches beat the earlier work of using PLMs (Su et al., 2020; Chen et al., 2020; Gong et al., 2020), RNN-based (Wu et al., 2018; Mao et al., 2019) and feature-based approaches (Turney et al., 2011; Shutova et al., 2016). Note that our goal is not to compete with these models, but to probe and analyze the relevant knowledge in PLMs. Tsvetkov et al. (2014) present cross-lingual metaphor detection models using linguistic features and word embeddings. Bilingual dictionaries map different languages. Their datasets are quite small (1000 training and 200 testing examples), making them unsuitable for a robust evaluation. However, this paper still remains as the only cross-lingual evaluation of metaphor detection, to the best of our knowledge. Here, using multilingual PLMs, we perform zero-shot cross-lingual transfer for metaphor detection. Our goal is to test if PLMs represent metaphorical knowledge transferable across languages. Probing methods in NLP. Probing is an analytical tool used for assessing linguistic knowledge in language representations. In probing, the information richness of the representations is inspected by the quality of a supervised model in predicting linguistic properties based only on the representations (Kohn, 2015; Gupta et al., 2015; Yaghoobzadeh and Schutze, 2016; Conneau et al., 2018; Tenney et al., 2019b,a; Yaghoobzadeh et al., 2019; Hewitt and Manning, 2019; Zhao et al., 2020; Belinkov, 2022). Here, we apply probing to perform our study on whether metaphorical knowledge is present in PLM representations, and whether that is generalizable across languages and datasets. A popular probing method introduced by Tenney et al. (2019b) is edge probing (Figure 2). They propose a suite of span-level tasks, including POS tagging and coreference resolution. Despite the widespread use of edge probing and other conventional probes, the question of whether the probing classifier is learning the task itself rather than identifying the linguistic knowledge raises concerns. An Information-theoretic view can solve this issue (Voita and Titov, 2020) by reformulating probing as a data transmission problem. They consider the effort needed to extract linguistic knowledge in addition to the final quality of the probe, showing that this approach is more informative and robust than normal probing methods. We employ both edge and MDL probing in this work. Probing multilingual PLMs. The application of probing methods in NLP is extended to multilingual PLMs as well (Pires et al., 2019; Eichler et al., 2019; Ravishankar et al., 2019a,b; Choenni and Shutova, 2020). Choenni and Shutova (2020) introduce probing tasks for typological features of multiple languages in multilingual PLMs. Ravis-2038 hankar et al. (2019a,b) extend the probing tasks of Conneau et al. (2018), to a few other languages. Pires et al. (2019) study the generalization of multilingual-BERT across languages when performing cross-lingual downstream tasks. Here, as part of our study, we probe the generalization of metaphorical knowledge in XLM-R (Conneau et al., 2020), a notable multilingual PLM. been no earlier work on studying or evaluating out-of-distribution generalization in metaphor detection. This generalization refers to scenarios where testing and training sets come from different distributions (Duchi and Namkoong, 2018; Hendrycks et al., 2021, 2020). Here, we have scenarios where testing and training data are in different languages or domains / datasets. These are challenging evaluation scenarios for the generalization of encoded information (metaphoricity in our case). Metaphors are used frequently in our everyday language to convey our thoughts more clearly. There are related theories in linguistics and cognitive science. Following linguistic theories, metaphoricity is mostly annotated using metaphor identification procedure (MIP). MIP identifies a word in a given context as a metaphor if it has a basic or literal meaning that contrasts with its context words. Based on conceptual metaphor theory (CMT) (Lakoff and Johnson, 2008), one target domain (e.g., ARGUMENT) is explained using a source domain (e.g., WAR). The source domain is usually more concrete or physical, while the target is more abstract. Relating these two theories, metaphors are expressed in language connecting two contrasting domains. For example, in We won the argument, the domain of ARGUMENT is linked to the domain of WAR by using the word won. The word won is a metaphor here since its primary domain contrasts with its contextual domain. The same word won in a sentence like The Allies won the war refers to its literal meaning and therefore is not a metaphor. The task of metaphor detection is defined to do this classifica-tion of literal and metaphor. Accordingly, when designing a metaphor detection system, to figure out if a token is a metaphor in a particular context, we assume following a process like: (i) finding if the token has multiple mean-Figure 2: Probing architecture for metaphors employed in edge probing and MDL probing. ings in different domains, including a more basic, concrete, or body-related meaning. For example, fight, win and mother satisfy this condition. (ii) finding if the source domain of the token contrasts with the target domain. Here the contrast is important and finding the exact domains might not be necessary. The source domain, in which its literal / basic meaning resides, is a non-contextual attribute, while the target domain is mainly found using the contextual clues (WAR and ARGUMENT for won in the above example). Here, we use the metaphor detection datasets annotated based on these theories and analyze the PLM representations to see if they encode metaphorical knowledge and if the encoding is generalizable. To do so, we first probe PLMs for their metaphorical information, generally and also across layers. This gives us intuition on how well metaphoricity is encoded and how local or contextual that is. Then, we test if the knowledge of metaphor detection can be transferred across languages and if multilingual PLMs capture that. Finally, the generalization of metaphorical knowledge across datasets is examined to see if the theories and annotations followed by different datasets are consistent, and if PLMs learn generalizable knowledge rather than dataset artifacts. Here, we aim to answer general questions about metaphors in PLMs: do PLMs encode metaphorical information and, if so, how it is distributed in their layers. We do not attempt to achieve the best metaphor detection results but to analyze layers of PLMs to test if they contain the necessary information to perform this task. In trying to answer this question, we apply probing methods, discussed as follows, to focus on the representation itself by freezing the PLM parameters and training classi-fiers on top. We hypothesize that metaphorical information does exist in PLM layers and more in the middle layers. As we discussed earlier, metaphor detection depends on contrast prediction between source and target domains of a token. We assume that this prediction is made mainly based on the initial layers of PLM representations of either the token itself or its context or both. In higher layers of PLMs, the representations are dominated by contextual information, making it hard to retrieve the source domain, and so, reasoning about the contrast of the source and target domains becomes difficult. Methods We employ edge probing (Tenney et al., 2019b) and MDL (Voita and Titov, 2020). Edge probing consists of a classifier in which word representations obtained from PLMs are fed as inputs after projecting to 256-dimensional vectors first. The quality of the classifier illustrates how well the representations encode a specific linguistic knowledge. This method is designed for span-level tasks, i.e., the classifier can only access the representations of a limited part of the input sentence specified in the dataset. Edge probing has two pooler sections for making fixed-sized vectors; one pools representations across the words in the span and the other pools representations across the layers. The Minimum Description Length (MDL) probing is based on information theory and combines the quality of the classifier and the amount of effort needed to achieve this quality. Voita and Titov (2020) propose two methods for computing MDL:  variational coding  and  online coding.  The former computes the complexity of the classifier with a Bayesian model. In the latter, the classifier is trained gradually on different portions of the dataset, and the code length will be the sum of the cross-entropies, each for a data portion. Voita and Titov (2020) show that the two methods' results are consistent with each other. Accordingly, we opted for the  online coding  method since it is more straightforward in implementation. Since the code length is related to the size of the dataset N , we report the  compression , which is equal to 1 for a random classifier and larger for better models, and is defined as: compression = N  log 2 ( K ) MDL See extra details in Voita and Titov (2020). To see if PLMs encode generalizable metaphorical knowledge, we evaluate them in settings where testing and training data are in different distributions. We explore transferability analysis across languages and datasets as two sources of distribution. We explain each in the following sections. Multilingual encoders project the representations in multiple languages into a shared space so that semantically similar words and sentences across languages end up close to each other. If we use a multilingual PLM model, and our classifier shows that representations in language S are informative about metaphoricity, what happens if we apply this classifier to the representations in language T ? We hypothesize that if the representation is rich in both languages, the annotation of metaphor is consistent, and the concept of metaphor is transferable across languages, then the classifier would be able to predict metaphoricity in language T from what it learns in S . When testing cross-lingual generalization, the linguistic and cultural differences of metaphoricity are important as well. We assume that metaphors are conceptualized in a similar process across languages, and metaphor detection is defined consistently. The lexicalization is, of course, different, but that is something that multilingual PLMs are supposed to handle to some extent. When training and testing on the same distribution, any learning model often uses heuristics and annotation biases. The consequence is the recurring overestimation of the capabilities of PLMs in doing hard tasks. This might be the case for our probing experiments as well. Therefore, another generalization dimension we consider is cross-dataset transfer, i.e., training on dataset S and testing on dataset T . S and T could be annotated by different people with possibly different goals in mind, and their raw sentences could come from different domains. However, they must be annotated for the same task of metaphor detection. POS types (e.g., TroFi is only verbs, but LCC is not). Further, the annotation process is different as each follows its own guidelines. However, the essential task of metaphor detection, i.e., distinguishing metaphor and literal usages, is the same for all. Therefore, we expect some transferability across datasets but with differences aligned with their mismatches. Datasets We use four metaphor detection datasets in our study. The annotations of LCC (Mohler et al., 2016) are done mostly on web crawled data as well as news corpora. It provides metaphoricity scores including 0 as no , 2 as conventional, and 3 as clear metaphor. 2 We use the examples with score 0 as literal, and others as metaphor. of metaphoric and literal usages of 51 English verbs from WSJ. VUA (Steen, 2010) corpus consists of words in the academic, fiction, and news subdomains of the British National Corpus (BNC). The authors published two versions: VUA POS and VUA Verbs. LCC contains annotations in four languages: English, Russian, Spanish, and Farsi. The other three datasets, TroFi, VUA Verbs and VUA POS, are in English only. We have label-balanced all the datasets to get a more straightforward interpretation of results (the accuracy of a fair-coin random baseline is 50% in all cases) and have split the datasets to train / dev / test sets with ratios of 0.7 / 0.1 / 0.2. The statistics of the datasets are shown in Table 2. Example sentences with the corresponding annotations can be seen in Table 1. Setup In implementing the edge probe, we use batch size = 32 and learning rate = 5e-5 and train for five epochs in all experiments. For the MDL probe, the same structure of edge probing is employed. We apply a logarithm to the base two instead of the natural logarithm in cross-entropy loss to have all the obtained code lengths in bits (see extra details in Voita and Titov 2020). Our experiments are done using the GPUs provided by Google Colab free and pro. Here, BERT (Devlin et al., 2019), RoBERTa (Liu et al., 2019), and ELECTRA (Clark et al., 2020) represent our PLMs. Due to our resource limitations, we conduct all experiments on the base version of the models (12 layers, 768 hidden size, 110M parameters) implemented in HuggingFace's Transfomers (Wolf et al., 2020). We employ edge probing for evaluating overall metaphorical knowl-2041 Baseline BERT RoBERTa ELECTRA Dataset Acc. edge in our selected PLMs, and MDL for the layer-wise comparisons. MDL is shown to be more effective for layer-wise probing (Fayyaz et al., 2021). Table 3 shows the edge probing accuracy and MDL probing compression results for our three PLMs. Accordingly, RoBERTa and ELECTRA are shown to encode metaphorical knowledge better than BERT on both metrics. This is consistent with their better performance on various tasks, acquired by having better pre-training objectives and / or enjoying more extensive pre-training data. The higher probing quality of ELECTRA's representations, is also consistent with Fayyaz et al. (2021) results on various linguistic knowledge tasks, including dependency labeling, named entity recognition, semantic role labeling, and coreference resolution. MDL probing compression across layers is demonstrated in Figure 3. We see the numbers increase mostly at the first 3 to 6 layers, depending on the dataset, but it decreases afterwards 3 . In other words, metaphorical information is more concentrated in the middle layers, where the representations are relatively contextualized but not as much as higher layers. To put this in perspective, we can consider Tenney et al. (2019a) and Fayyaz et al. (2021) where the best layers for various linguistic knowledge tasks in BERT are within 4 and 9. This shows that metaphor detection in PLM representations can be resolved earlier than some basic linguistic tasks. In 3.1, we elaborated a hypothesis that the process of detecting metaphors is not very deep since what it needs to do is mainly contrast prediction between source and target domains, and the deep layers do not represent the source domain well. Our reported probing results confirm that metaphor detection is not deep in PLM layers. To further evaluate our reasoning, we probe the domain knowledge in PLM representations across layers. We employ LCC's annotation of source and target domains, and run a similar MDL probing on different PLMs but for domain prediction. The obtained results, shown in Figure A.1 in appendix, demonstrate that the source domain information is represented in the initial layers (2-6), confirming that the source domain is dominated by other information in higher layers. On the other hand, target domain information generally increases across layers. Therefore, the middle layers can be the best place for contrasting source and target domains. 3 For RoBERTa and in the case of TroFi and VUA Verbs, we see exceptional increases in the last layers. As our PLMs, we use XLM-R (Conneau et al., 2020) for cross-lingual and BERT for cross-dataset experiments. To compare the cross-lingual and cross-dataset transferability, in 4.3.3, we employ the same setup, including using XLM-R as PLM for both. The results in 4.3.1 and 4.3.2 are not comparable. We apply the same edge probing architecture as in the probing experiments. We sometimes refer to both language and dataset as distribution . We run two experiments for each case of a source distribution S and a target distribution T : one with the PLM and one with a randomized version of the PLM where weights are set to random values. Randomly initialized Transformers with the same architecture as PLMs are common baselines in the community. The difference between the two gives evidence about the helpfulness of the encoded knowledge gained during pre-training in doing the task. When S = T , this effect is measured for in-distribution and when S (cid:54) = T , for out-of-distribution generalization. Comparing results of in-distribution (e.g., training and testing on English data) and out-of-distribution (e.g., training on Spanish and testing on English) setups demonstrates how generalizable the metaphorical knowledge in PLM is and how consistent the annotations are. The four LCC datasets corresponding to four languages are used here. We subsample from the datasets to have the same number of examples in the training sets, i.e., 12,238 which is the size of the Russian training set. The results are shown in Table 4. The random baseline is acquired using a randomly initialized XLM-R. knowledge learned during the pre-training is transferable across languages. This considerable transferability can be attributed to the ability of XLM-R to build language-universal representations useful for metaphoricity transfer. Moreover, the innate similarities of metaphors in distinct languages can contribute to higher transferability, despite the lexicalization differences. E.g., analogizing a concept to a tool (en) occurs the same way in other languages like instrumento (es),  (fa) and (ru). Finally, the constraints of the dataset producers in, for instance, keeping the languages in relatively similar target and source domains, could be influential. (See Figures A.2 and A.3). An interesting observation is that training on Russian shows the best out-of-distribution results when testing on other languages. We analyze this further. First, we observe that LCC(ru) has almost the closest target domain distribution to all other languages (See Table A.2 in Appendix). Second, the reported results can also be influ-enced by the amount of data from each of these languages in the pre-training data of XLM-R. Russian has the second largest size after English (Con-neau et al., 2020). Finally, for English, the higher-resource language with closer target domain distribution, we find out that there are considerable number of examples in the LCC(en) related to GUNS and CONTROL OF GUNS. These domains are not covered in other LCC datasets (See Figure A.3 in Appendix). Similar to the cross-lingual evaluations, here we have four datasets used as sources and targets. We set the train size of each to the minimum of all, i.e., 3,838. For each pair, we run two experiments: one with randomized and one with pre-trained BERT as our PLM. Results are shown in Table 5. 2043 Train Dataset LCC(en) TroFi VUA POS VUA Verbs T e s t D a t a s e t LCC(en) 84.26 (54.93) 62.04 (50.05) 70.35 (50.69) 70.37 (50.14) TroFi 59.49 (50.58) 68.73 (64.96) 55.38 (49.45) 59.67 (53.68) VUA POS 62.23 (51.47) 55.29 (50.47) 76.86 (56.01) 71.6 (53.47) VUA Verbs 60.20 (50.88) 54.55 (51.73) 72.6 (56.01) 75.21 (60.03) Table 5: Cross-dataset edge probing accuracy results on BERT is shown in pairs: pre-trained model and, in the parenthesis, the randomly initialized model. PLM is much better than random in all out-of-distribution cases, suggesting the presence of generalizable metaphorical information. As expected, VUA Verbs and POS achieve the best results when mutually tested, because, apart from the POS, they have the same distribution. VUA datasets and LCC(en) show good transferability, but the gap with in-distribution results is still considerable ( > 13% absolute). VUA Verbs is the best source for TroFi, likely because of the POS match between them. Overall, apart from the two VUA datasets, the gap between inand out-of-distribution performance is large. The random PLM accuracies range from about 54%-64% and 50%-56% for inand out-of-distribution cases. We hypothesize that this drop in the out-of-distribution is related to the annotation biases, which a randomly initialized classifier can leverage better when testing and training sets are from the same distribution. When the sets have different distributions, the biases do not transfer well. using XLM-R and evaluating different training sources on LCC(en) test set. We make the size of each train set to be the same (3,838). The results are shown in Table 6, where the first and second rows belong to cross-lingual and cross-dataset, respectively. To base our results, we include the in-distribution result of training on LCC(en), i.e., 82.31%. Clearly, there is a substantial gap between cross-lingual and cross-dataset accuracies. The annotation guideline is consistent in the LCC language datasets, while for the cross-dataset settings, we have datasets that differ in many aspects, including annotation procedure and definitions, covered part-of-speeches (e.g., Trofi and VUA Verbs vs. LCC and VUA POS) and sentence lengths (LCC: 25.9, VUA: 19.4, Trofi: 28.3). Metaphors are important in human cognition, and if we seek to build cognitively inspired or plausible language understanding systems, we need to work more on their best integration in the future. Therefore, any work in this regard is impactful. Our probing experiments showed that PLMs do in fact represent the information necessary to do the task of metaphor detection. We assume this information is related to metaphorical knowledge learned during pre-training. Further, the layer-wise analysis confirmed our hypothesis that middle layers are more informative. Even though our probing experiments did show that metaphorical knowledge is present in PLMs, it was still unclear if this knowledge is generalizable beyond the training data. So, to probe the probe and evaluate generalization, we ran cross-lingual and cross-dataset experiments. Our results showed that the transferability across languages 2044 works quite well for the four languages in LCC annotation. However, when the definitions and annotations were inconsistent across different datasets, the cross-dataset results were not satisfactory. Overall, we conclude that metaphorical knowledge does exist in PLM representations and in middle layers mainly, and it is transferable if the annotation is consistent across training and testing data. We will explore more the cross-lingual transfer of metaphors and the impact of cross-cultural similarities in the future. Also, the application of metaphorical knowledge for text generation is something important that we will address. We would like to thank the anonymous reviewers and action editors who helped us greatly in improving our work with their comments.
abstain abstain abstain objective method abstain abstain abstain other abstain abstain abstain abstain abstain abstain abstain abstain method method objective objective abstain abstain method method abstain abstain objective result result objective abstain abstain abstain abstain abstain abstain objective abstain abstain abstain abstain method objective abstain abstain other method abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain method method abstain abstain abstain abstain abstain abstain method abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain method abstain abstain method abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain method abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain method abstain abstain method abstain abstain abstain abstain abstain method method abstain method method method method method method abstain method abstain abstain abstain abstain method abstain method abstain method method method method abstain abstain abstain method method method abstain method method method abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain method method abstain abstain method abstain method method method other abstain abstain abstain abstain abstain abstain method abstain abstain method abstain method abstain method method abstain result method method result method result abstain abstain objective abstain other