Probing Relational Knowledge in Language Models via Word Analogies (2022)

Abstract: Understanding relational knowledge plays an integral part in natural language comprehension. When it comes to pre-trained language models (PLM), prior work has been focusing on probing relational knowledge this by filling the blanks in pre-defined prompts such as “The capital of France is —". However, these probes may be affected by the co-occurrence of target relation words and entities (e.g. “capital”, “France” and “Paris”) in the pre-training corpus. In this work, we extend these probing methodologies leveraging analogical proportions as a proxy to probe relational knowledge in transformer-based PLMs without directly presenting the desired relation. In particular, we analysed the ability of PLMs to understand (1) the directionality of a given relation (e.g. Paris-France is not the same as France-Paris); (2) the ability to distinguish types on a given relation (both France and Japan are countries); and (3) the relation itself (Paris is the capital of France, but not Rome). Our results show how PLMs are extremely accurate at (1) and (2), but have clear room for improvement for (3). To better understand the reasons behind this behaviour and mistakes made by PLMs, we provide an extended quantitative analysis based on relevant factors such as frequency.

## introduction a major area of research in nlp in the past years has been devoted to probing pre-trained language models (plms) to measure the extent of which the relational/factual knowledge is captured by their representations @xcite @xcite . seeking insight into the hidden representational space of plms, recent studies have been exploiting the word prediction capabilities of language models in a cloze-style fillthe-blank configuration as a more direct method to probe factual knowledge in plms @xcite . for example, in order to query for the capital of paris, one can use the plm to fill the blank in a prompt such as 'the capital of paris is -' by predicting the most probable word as a response. first, while there have been studies that attempted to find automatic templates that may overcome the reliance of specific prompts @xcite , it has also been shown that plms may fail to understand simple features such as negation @xcite . indeed, plms may even be biased towards the words on the prompt, and base their answers on this or other confounds (e.g. co-occurrences) instead of understanding the relation itself. for instance, in the previously-mentioned prompt 'the capital of paris is -', capital is already mentioned in the prompt. to address this, one possible solution is to rely on word analogies. in order to study the existence of a target relation between a pair of words (e.g. the 'country:capital' relation between paris and france), one could simply put them together with another pair holding the target relation (e.g. rome and italy) in an analogy sentence (e.g. 'paris to france is like rome to italy') and probe the model in a binary classification setting to check whether the analogy holds. foot_0 . taking word analogies as the main reference, our aim is therefore to understand whether the transformer-based language models hold sufficient relational information to classify an analogy as being true or false. while from previous work we know that plms are indeed able to solve various types of analogies @xcite , we are interested in analyzing three different aspects for which we propose three probe tasks. in short, these probes are aimed at understanding the plms capability for (1) making fine-grained distinctions between concepts within the same types; (2) capturing the directionality of unidirectional relations; and (3) distinguishing types such as the difference between capital and country. ## methodology in this section, we describe our methodology to probe relational knowledge from language models through word analogies. given two different tuples (h 1 , t 1 ) and (h 2 , t 2 ), and an analogy template t , we can generate an analogy sentence by inserting the head and tail words of tuples into their respective positions in t . an analogy sentence holds with respect to relation r if both tuples used in the generation process are members of the relation set r. for instance, the tuples (p aris, f rance) and (rome, italy) form a correct analogy for the 'country:capital' relation. ## probe evaluation in this section, we present the results of our probe evaluation based on the methodology described in the previous section. first, we describe the embedding-based baselines in section 3.1, and then we present the experimental results in section 3.2. ## analysis since the goal of this paper is to probe plms for relational knowledge, for this extended analysis we focus on the supervised setting of the plain roberta-large, which is more in line with most downstream applications. word frequency first, we estimated the number of word occurrences in the underlying pre-training corpora foot_1 , and following @xcite we took the harmonic mean of occurrences of words in an output tuple as an estimate of tuple occurrence frequency. we hypothesized that most of the errors may be produced when the frequency of the output pair is low, as the roberta may be less familiar with the words themselves. to this end, we computed a kolmogorov-smirnov for each relation type in which we separated the instances by correct and wrong decisions made by the model in the 'random' probe. for most relation types (over two thirds), p-values are higher than 0.05 for which we can conclude that frequency does not play a significant role in the performance. those relation types where the effect seems more significant are male-female and adj:comparative. ## conclusion in this paper, we have presented three probes to understand to what extent plms (or any model in general) understand different aspects of the relations. in general, the 'random' probe proves the most challenging for plms, which is aimed at capturing some fine-grained information between the different types in a relation. in contrast, these models can accurately capture the aspects related to directionality and the word categories (or types) involved in a relation. when investigating the reasons of this discrepancy, we did not find a clear correlation between word frequency and performance for the 'random' probe, except for specific relation types. in general, however, based on our unsupervised experiments, plms seem to be better equipped to solve this probe when comparing between different pairs, even without task-specific training data.