W ord T ies: Measuring Word Associations in Language Models via Constrained Sampling (2022)

Abstract: Word associations are widely used in psychology to provide insights on how humans perceive and understand concepts. Comparing word associations in language models (LMs) to those generated by human subjects can serve as a proxy to uncover embedded lexical and commonsense knowledge in language models. While much helpful work has been done applying direct metrics, such as cosine similarity, to help understand latent spaces, these metrics are symmetric, while human word associativity is asymmetric. We propose WordTies, an algorithm based on constrained sampling from LMs, which allows an asymmetric measurement of associated words, given a cue word as the input. Comparing to existing methods, word associations found by this method share more overlap with associations provided by humans, and observe the asymmetric property of human associations. To examine possible reasons behind associations, we analyze the knowledge and reasoning behind the word pairings as they are linked to lexical and commonsense knowledge graphs.When the knowledge about the nature of the word pairings is combined with a probability that the LM has learned that information, we have a new way to examine what information is captured in LMs.

## introduction what do you think of when you see a word? word association is a task where a human participant is shown a cue word, and is asked to quickly list words (formally responses) that come to the mind without thinking @xcite . these associations provide a way to measure human representations of semantic knowledge @xcite . similarly, researchers have been mirroring the human word association task on pretrained language models (lms), as a method for intrinsic evaluations of our code and data are available at https://github. com/u-alberta/wordties . english and french are the official languages of canada. language english information linux software folklore prose spanish french vocabulary cue: language lm constrained sampling conditional probability word associations figure 1 : overview of the workflow of our word association probing algorithm. the network plotted shows example word associations where the word language is a cue or response. the associations are probed from bert @xcite using the proposed algorithm. the radius of a word circle represents the average frequency of the word being a response for one of the cues. the length of connections represents the relative associative strength between words. note that the lengths might not be the same for the two directions between the same pair of words. instead of investigating embedding spaces, we propose to perform association rule mining on discrete word sequences sampled from lms with constraints. to the best of our knowledge, this is the first application of association rule mining on the investigation of word associations in distributional semantic models. this novel approach more closely imitates human word association, and allows us to probe language models as a whole and without the use of external inputs. our algorithm, named wordties, samples sentences from language models with the constraint that the cue word must appear in the sentence, and uses the conditional probability that a word co-occurs with the cue word in the sample as the associativity score. the workflow of the wordties algorithm is illustrated figure 1. we validate our probing method by measuring the overlap between associations found in lms by our algorithm and human associations, and testing if distance properties of human associations, like asymmetry, are preserved by our algorithm. in another part of this work, we attempt to uncover what linguistic and commonsense knowledge and reasoning are involved in the word association process, for both humans and language models. in order to reach a reasonable cause for a given cue to response association, we link the two words simultaneously to a lexical knowledge graph @xcite and a commonsense knowledge graph (ascent++; @xcite , which leads to new discoveries about word associations. ## human word associations human word associations exhibit certain intriguing properties, such as stability, asymmetry and intransitivity @xcite . stability is the property that different people usually come up with similar associations, which correlates with one definition of commonsense knowledge that they are shared among most human beings @xcite . this suggests that word associations could potentially be used as a signal for inferring commonsense knowledge. secondly, some associations are not symmetric, as demonstrated by @xcite example that participants indicate that north korea is more closely associated with china than vice versa. finally, intransitivity means the associations do not follow the triangular inequality. for example, iphone is associated with apple and apple is associated with sour, but iphone is not associated with sour. these two geometric properties indicate that traditional tools for interpreting language models, such as vector norms for word embeddings, will not be sufficient to discover word associations as humans do. it was previously shown that humans often associate words based on similarity, contrast, and contiguity @xcite . we further investigated what specific types of semantic knowledge and reasoning, including lexical and commonsense knowledge and reasoning, are involved in human word associations, by breaking down the relations between the cue and response word pairs. ## language model word associations wordties, as a more suitable method for probing word associations in lms, enables us to scrutinize ## related work the study of @xcite is mostly similar to ours, where they concluded that properties of human word associations, discovered in the 1970s @xcite @xcite , still hold in language models. they probed associations by ranking words by the cosine similarity of embeddings in the vocabulary layer, and measured asymmetry by handcrafted templates. @xcite also tested word associations with word embeddings, but they held the same view as us that it is self-contradictory to obtain decontextualized embeddings from contextualized lm, and therefore did not extend their study on lms. measuring and mitigating social biases in pre-trained lms, often formulated as measuring associations to a certain set of words, is a more popular task. associations to the words related to social aspects are often measured by the cosine similarity of embeddings aggregated from context sentences @xcite @xcite . as we have been arguing, cosine similarity is not compatible with the asymmetry of word associations, while our algorithm takes asymmetry into consideration. in some work, biases are also measured via constrained generation, where the constraints (often prompts or templates) are collected from the web @xcite or by crowdsourcing @xcite . in comparison, our method relies on no external resources, and no confounder is introduced consequently. constrained text generation is used to evaluate the commonsense reasoning ability of lms through other tasks. commongen (lin et al., 2020) is a task where, instead of only one cue word as in our study, multiple words pertaining to commonsense concepts are required to be present in the generated text, as a way to measure how well lms can link concepts together with commonsense knowledge. in abductive commonsense reasoning @xcite , lms are used to complete text when the beginning and ending are given, to test their ability to reason about pre-and post-conditions. it is considered non-trivial to impose constraints on left-to-right generations for causal lms. mostly, recent work @xcite focus on constrained (also known as controlled) decoding, a related problem of finding the sequence that maximizes the likelihood, by modifying the original distribution. prior to the langevin dynamics algorithm by @xcite and @xcite proposed cgmh, a constrained sampling algorithm in discrete space based on metropolis-hasting sampling, but it uses a bidirectional causal lm to reduce computation (i.e. the lm also predicts the previous word based on suffixes). more recent causal lms, such as gpt @xcite , are uni-directional, and it is therefore not very meaningful to apply cghm in our work. in a broader context, it has been an interesting idea to try to explain the behavior of neural networks by optimizing over the input. sampling from a language model, as in our wordties algorithm and in @xcite , can be seen as optimizing over the discrete input text sequence to minimize the negative log-likelihood with noise, and it provides a way to uncover how lms associate words or properties of the training corpus. bäuerle and wexler (2020) optimized the activation of certain neurons in bert over the input sequence, as an attempt to find the responsibilities of individual neurons, and @xcite applied similar thoughts on vision-language models. ## conclusion in this study, we verified the proposition that examining discrete sequence samples from lms is a better approach than inspecting embedding spaces for word associations. we also explored properties related to semantic knowledge and reasoning in both human and lm word associations. these revealed the high potential of using word associations as a proxy for probing, and as a signal for finetuning language models.