It is a Bird Therefore it is a Robin: On BERT ’s Internal Consistency Between Hypernym Knowledge and Logical Words (2023)

Abstract: The lexical knowledge of NLP systems shouldbe tested (i) for their internal consistency(avoiding groundedness issues) and (ii) bothfor content words and logical words. In thispaper we propose a new method to test the understandingof the hypernymy relationship bymeasuring its antisymmetry according to themodels. Previous studies often rely only on thedirect question (e.g., A robin is a ...), where weargue a correct answer could only rely on collocationalcues, rather than hierarchical cues. We show how to control for this, and how it isimportant. We develop a method to ask similarquestions about logical words that encode anentailment-like relation (e.g., because or therefore).Our results show important weaknessesof BERT-like models on these semantic tasks.

## introduction the main training task of transformer-based architectures @xcite @xcite is to predict which word may occur in a given position in a sentence. as a first pass, syntax understanding is an important prerequisite to complete this task through which systems learn the distribution of words within sentences, satisfying the constraints imposed by the linguistic environments these words are in. accordingly, these models have shown strong syntactic capabilities @xcite @xcite . what do they learn about semantics? hypernymy offers a strong opportunity to study this question as it is very close to entailment, the cornerstone relation in semantics. also, it can be studied solely through the masked language modelling task, and without fine-tuning. for instance, in the prompt a robin is a @xcite , bert assigns a high probability to bird in the mask position @xcite . these models have thus captured semantic information about the relations between content words, here a relation between robin and bird. in this work, we begin by following up on the nuanced findings in this area @xcite , using and refining methods to assess the understanding of hypernymy, pair by pair. then we use these initial results and measurements to study the semantics of logical words, and more specifically connectives, such as thus or because. the idea is to evaluate the internal coherence of the system. specifically, we ask whether nlp models coherently assign a high probability to thus in the place of the mask in this is a robin, @xcite this is a bird, exactly in these cases where the pair robin-bird is independently (and ungroudedly) registered as a hyponym-hypernym pair. we thus raise and answer these research questions: do bert-like models understand the asymmetric taxonomic relationship of hypernymy (or only a symmetric co-occurrence relation between hypo-hypernyms)? do they use entailment-like connectives appropriately? do they show internal consistency: using entailment connectives to connect cases where they detect hypernymy (i.e. indepedently of whether hypernymy actually holds)? hence, our contributions are as follows: ## semantics as internal consistency one classical approach to semantics is that knowing the meaning of a sentence is knowing in which situations this sentence is true, that is, being able to map (sentence, situation) pairs onto truth-values @xcite . text-only-trained machines surely cannot do so, simply because they only take sentences as inputs, not situations. however, semantics may also be seen as the graph of all entailment relations between sentences. these entailment relations can follow from taxonomic relations between content words: the fact that all robins are birds will create entailment relations between sentences (e.g., john saw a robin entails john saw a bird). being able to identify these is showing a strong command of the meaning of the words robin and bird, independently of how these words are grounded in the actual world. entailment relations between sentences can also follow from the meaning of the logical words they contain. in a "proof-theoretic" approach, one may even say that this is all there is to the semantics of logical words, which are not grounded: the power to create a consistent net of entailment relations. our work is part of this recent vision of the notion of meaning for non-grounded lms @xcite . ## related work nlp models have been tested for their syntactic abilities @xcite @xcite @xcite @xcite for which they obtain strong results, but to a lesser extent for their semantic abilities @xcite @xcite for which they show more fragile performances. models such as bert encode world knowledge @xcite . the first part of our work is a direct follow-up of prompt studies @xcite targeting knowledge of hypernymy which has been shown to be high but fragile and inconsistent @xcite @xcite . we leverage this knowledge to extend the investigation to logical words. for more than 30% of the pairs, the target hypernym is the top-1 word predicted, and in 80% of the pairs, it is in the top-100 @xcite . this indicates that bert recognizes that robin and bird are likely to co-occur in a sentence. we ask whether the system recognizes that the hyponymhypernym relation is not symmetric, a critical fact that makes hypernymy a variant of entailment (and not of relevance). we do so by correcting the above probability with the probability of that same hypernym, albeit in the reverse configuration. thus, we consider the log-ratio of (1) and (2): furthermore, like @xcite , we explore a set of prompts and not just one. for each pair of hyponym-hypernym (h, c) (h the head and c the class to which h belongs) we start from a template det 1 h rel det 2 c, with det i determiners (e.g. the, a, an, ϵ) and rel an instantiation of the hypernymy relation (e.g. is, is a subclass of, is a kind of, is a sort of, is a type of ). we use the model to compute a score for a set of determiners and relations and then we select the prompt with the highest one (more details in appendix b, with explanations as to how this optimizes the form of the prompt without a priori biasing the final log-ratio scores). once the prompt is selected, we compute the following hypernymy score σ: ## experiment 2: logical words the previous experiment establishes how models capture semantic relations between content nouns. we can use these results to investigate how the same models understand logical words. concretely, one would expect a high probability for words like thus, so, therefore in the following sentence, and a low probability for words like because, since, for as they encode this entailment the other way around: it's a robin mask it's a bird. results on hypernym-hyponym pairs show great variability hence, the high probability for thuslogical words in the sentence above is expected only if that particular pair, (robin, bird), is assigned a high hypernymy score by the model. for pairs that receive a very negative score, the expectation is in fact that the results would be reversed. this approach thus allows us to test the semantic consistency of the system. consistency could be perfect for logical words, even if there are grounding errors with content words and world knowledge. we tested 7 logical words of the thus class (thus, therefore, consequently, then, accordingly, so, hence), and 5 logical words of the because class (because, since, for, seeing, considering). ## conclusion we propose an approach to the semantic study of bert-type networks. first we evaluate the models on the non-symmetry of an entailment-like relation, namely hypernymy. the tested models show an average positive understanding of this relation. but this is accompanied with a large variance, showing that the relation is very often captured backward. thanks to these results we moved to testing logical words of type thus and because, which impersonate the entailment relation at the core of all enterprises in semantics. its non-symmetry is one of its fundamental property. the models capture on average the non-symmetry of the words of type thus appropriately and they also show good consistency results, that is, a stronger signal for pairs that are themselves well-captured. however, the models obtain similar scores for the words of type because and, applying the same standards, they thus capture them backwards. moreover all these results are to be qualified by their great variability across models and knowledge sources. these properties albeit simple are yet at the core of what human semantics is however they are not reliably captured. this failure on these basic logical tests then raises questions regarding their otherwise impressive success. they also provide a method to reconstruct their actual semantics, if it is not human-like, and offers challenging tasks for these models.