Can Language Models Encode Perceptual Structure Without Grounding? A Case Study in Color (2021)

Abstract: Pretrained language models have been shown to encode relational information, such as the relations between entities or concepts in knowledge-bases — (Paris, Capital, France). However, simple relations of this type can often be recovered heuristically and the extent to which models implicitly reflect topological structure that is grounded in world, such as perceptual structure, is unknown. To explore this question, we conduct a thorough case study on color. Namely, we employ a dataset of monolexemic color terms and color chips represented in CIELAB, a color space with a perceptually meaningful distance metric. Using two methods of evaluating the structural alignment of colors in this space with text-derived color term representations, we find significant correspondence. Analyzing the differences in alignment across the color spectrum, we find that warmer colors are, on average, better aligned to the perceptual color space than cooler ones, suggesting an intriguing connection to findings from recent work on efficient communication in color naming. Further analysis suggests that differences in alignment are, in part, mediated by collocationality and differences in syntactic usage, posing questions as to the relationship between color perception and usage and context.

## introduction without grounding or interaction with the world, language models (lms) learn representations that encode various aspects of formal linguistic structure (e.g., morphosyntax @xcite ) and semantic information (e.g., lexical similarity @xcite ). beyond this, it has been suggested that text-only training data is enough for lms to also acquire factual and relational information about the world @xcite . this includes, for instance, some * for correspondence: {abdou,soegaard}@di.ku.dk features of concrete and abstract concepts, such as objects' attributes and affordances @xcite . furthermore, the representational geometry of lms has been found to naturally reflect human lexical similarity and relatedness judgements, as well as analogy relationships @xcite . however, the extent to which these models reflect the structures that exist in humans' perceptual world-such as the topology of visual perception @xcite , the structure of the color spectrum (ennis and zaidi, 2019; provenzi, 2020), or of odour spaces @xcite -is not well-understood. if lms are indeed able to capture such topologies-in some domains, at least-it would mean that these structures are a) somehow reflected in language and, thereby, encoded in the textual training data on which models are trained, and b) learnable using models' current training objectives and architectural inductive biases. to the extent they are not, the question becomes whether the information is not there in the data, or whether model and training objective limitations are to blame. certainly, this latter point relates to an ongoing debate regarding what exactly language models can be expected to learn from ungrounded form alone @xcite @xcite . while there have been many inter-esting theoretical debates around this topic, few studies have tried to address this question empirically. in this paper, we conduct a case study on color. indeed, color perception in humans and its relation to speakers' use of color terms has long been the subject of studies in cognitive science @xcite @xcite . to this end, spaces have been defined in which euclidean distances between related colors are correlated with reported perceptual differences. 1 in addition, the semantics of color terms have long been understood to hold particular linguistic significance, as they are theorised to be subject to universal constraints that arise directly from the neurophysiological mechanisms and properties underlying visual perception and cognition @xcite @xcite . 2 due to these factors, color offers a useful test-bed for investigating whether or not structural information about the topology of the perceptual world might be encoded in linguistic representations. to explore this in detail, we employ a dataset of english color terms and their corresponding color chips 3 , the latter of which are represented in cielab -a perceptually uniform color space. in addition to the color chip cielab coordinates, we extract linguistic representations for the corresponding color terms. with these two representations in mind (see figure 1 for a demonstrative plot from our experiments), we employ two methods of measuring structural correspondence, with which we evaluate the alignment between the two spaces. figure 2 shows an illustration of the experimental setup. we find that the structures of various language model representations show alignment with the structure of the cielab space, demonstrating that some approximation of perceptual color space topology can indeed be learned from text alone. 1 the differences between color stimuli which are perceived by human observers. we also show that part of this distributional signal is learnable by simple models -e.g. models based on pointwise mutual information (pmi) statistics -although large-scale language model pretraining (e.g., bert) encodes the topology markedly better. analysis shows that larger language models align better than smaller ones and that much of the variance in cielab space can be explained by low-dimensional subspaces of lm-induced color term representations. to better understand the results, we also analyse the differences in alignment across the color spectrum, observing that warm colors are generally better aligned than cool ones. further investigation reveals a connection to findings reported in work on communication efficiency in color naming, which posits that warmer colors are communicated more efficiently. finally, we investigate various corpus statistics which could influence alignment, finding that a measure of color term collocationality based on pmi statistics corresponds to lower alignment, while the entropy of a color term's dependency relation distribution (i.e. terms occurring as adjectival modifiers, nominal subjects, etc.) and how often it occurs as an adjectival modifier correspond to a stronger one. ## methodology color data we employ the color lexicon of american english, which provides extensive data on color naming. the lexicon consists of 51 monolexemic color name judgements for each of the 330 munsell chart color chips 4 @xcite . the color terms are solicited through a free-naming task, resulting in 122 terms. perceptual color space following previous work @xcite @xcite , we map colors to their corresponding points in the 3d cielab space, where the first dimension l expresses lightness, the second a expresses position between red and green, and the third b expresses the position between blue and yellow. distances between colors in the space correspond to their perceptual difference. language models our analysis is conducted on three widely used language models (lms): bert @xcite and roberta @xcite , both of which employ a masked language modelling objective, and electra @xcite , 2020), which is trained instead with a discriminative token replacement detection objective. 5 baselines in addition to the aforementioned language models, we consider two different baselines: the result is a vocabulary length vector quantifying the likelihood of co-occurrence of the color term with every other vocabulary item in within that window. representation extraction we follow bommasani et al. (2020) and vulić et al. (2020) in defining configurations for the extraction of word-type representations from lm hidden states. in the first configuration (nc), a color term is encoded without context, with the appropriate delimiter tokens attached (e.g. [cls] red [sep] for bert). in the second, s sentential contexts that include the color term are encoded and the hidden states representing these contexts are mean pooled. these s contexts are either randomly sampled from common crawl (rc), or deterministically generated to allow for control over contextual variation (cc). if a color term is split by an lm's tokenizer into more than one token, subword token encodings are averaged over. for each color term and configuration, an embedding vector of hidden state dimension d lm is extracted per layer, per model. controlled context to control for the effect of variation in the sentence contexts used to construct color term representations, we employ a templative approach to generate a set of identical contexts for all color terms. when generating controlled contexts, we create three frames in which the terms can appear: we use these frames in order to limit the contextual variation across colors (<@xmath0, all while retaining a naturalistic quality to the input. we also aggregate over numerous object nouns (<@xmath1, which the color terms are used to describe. we select objects from the @xcite data which are labelled in the latter as plausibly occurring in many colors and which are stratified across 13 category sets, e.g. @xmath2, @xmath3, etc. collapsing over categories, we generate sentences combinatorially across frames, objects and color terms, resulting in 3 × 122 × 18 = 6588 sentences, 366 per term. ## evaluation we employ two complimentary evaluation methods to gauge the correspondence of the color term text-derived representations to the perceptual color space. the first, representation similarity analysis (rsa), is non-parametric and uses pairwise comparisons of stimuli to provide a measure of the global topological alignment between two spaces. the second employs a learned linear mapping, evaluating the extent to which two spaces can be aligned via transformation @xcite . rsa @xcite is a method of relating different representational modalities, which was first employed in neuroscientific studies. rsa abstracts away from activity patterns themselves (e.g. neuron values in representational vectors) and instead computes representational (dis)-similarity matrices (rsms), which characterize the information carried by a given representation method through global (dis)-similarity structure. kendall's rank correlation coefficient (τ ) is computed between rsms derived from the two spaces, providing a summary statistic indicative of the overall representational alignment between them. rsa is non-parametric and therefore circumvents many of the various methodological weaknesses associated with the probing paradigm @xcite . for each color term, we compute a centroid in the cielab space following the approach described in @xcite . each centroid is defined as the average cielab coordinate of the samples (i.e. color chips) that were named with the corresponding term (across the 51 subjects). this results in n parallel points in the color term embedding and perceptual color spaces, where n is the number of color terms considered. for our analysis, we exclude color terms used less frequently than a cutoff @xmath4, leaving us with the 18 most commonly used color terms. 7 we then separately construct an n × n rsm for each of the lm spaces and for cielab . each cell in the rsm corresponds to the similarity between the activity patterns associated with pairs of experimental conditions n i , n @xmath5. for the color term embedding space, we employ pearson's correlation coefficient (r) as a similarity measure between each pair of embeddings n i , n @xmath6. for the cielab space, we elect to use the following method, per @xcite suggestion: sim(n i , n j ) = exp(-c × [dist(n i , n j )] 2 ), where c is a scaling factor (set to 0.001 in all ex-periments reported here) and dist(n i , n j ) is the cielab distance (∆ e_cmc * ) foot_4 between chips n i and n j . this similarity measure is derived from the psychological literature on categorization and is meant to model the assumption that beyond a certain distance colors appear entirely different, so that increasing the distance has no further effect on dissimilarity. finally, we report the mean kendall's τ between the color term embedding and color space rsms. we also report τ per color term (i.e. per row in the rsm), which corresponds to how well-aligned each individual color term is. linear mapping we train regularised linear regression models to map from color term embedding space @xmath7, minimising l(w ; α) = xw -y 2 2 + α w 1 , where @xmath8. we vary α across a wide range of settings to examine the effect of probe complexity, which we measure using the nuclear norm of the linear projection matrix @xcite . the fitness of the regressors, evaluated using n-fold cross-validation (@xmath9, given a linear transformation. centroids corresponding to each munsell color chip are computed in the color term embedding space via the weighted mean of the embeddings of the 51 terms used to label it. as in the rsa experiments, terms occurring less frequently than the cutoff (@xmath10. for evaluation, we compute the average (across splits and datapoints) proportion of explained variance as well as the ranking of a predicted color term embedding according to the pearson distance (1 -r) to gold. @xcite , we construct a random control task for the linear mapping experiments, wherein we randomly swap each color chip's cielab code for another. this is meant to break the mapping between the color chips and their corresponding terms. control task results are reported as the mean of 10 different random re-mappings. we report probe selectivity, which is defined as the difference between proportion of explained variance in the standard experimental condition and in the control task (hewitt and liang, 2019). we run similar control for the rsa experiments, where the cielab space centroids are randomly shuffled. ## results figure 3 shows the breakdown of correlations per color term for the three lms under cc, as well as for fasttext. we find that this ranking of color terms is largely stable across models and layer. full rsms for all models and cielab are in appendix c. the rsms show evidence of the higher correlations for colors like violet, orange, and purple, being driven by general clusterings of similarity/dissimilarity. for instance, for both the cielab and cc bert rsms, violet's top nearest neighbors include purple, lavender, pink, and orange, and its furthest neighbors include aqua, olive, black, and gray. correlations do not, however, appear to be driven by consistently aligned partial orderings within the clusters. in addition, we compute rsa correlations between the different 9 in particular, results for nc show large variances across layers. the mean correlation across layers in this setup is near zero, even though max correlations for bert and roberta are significant; this is unsurprising, however, as the lm has likely never encountered single color term tokens in isolation (cf. 2 ). this validates our intuition that controlling for variation in sentence context would reveal increased alignment to color space. furthermore, we observe that, over the full range of probe complexities for the experimental condition and the control task (described as in §3), all models demonstrate high selectivity (see g for full results). it is, therefore, safe to attribute the fitness of the probes to information encoded in the color term representations, rather than to memorization. in terms of individual colors, figure 4a depicts the ranking of predicted cielab codes per munsell color chip for bert (cc). we find that these results are largely stable across models and layers (see appendix f for full set of results and for reference chart). also, we observe that clusterings of chips with certain modal color terms (green, blue) show worse rankings than the rest. ## analysis and discussion having demonstrated the existence of models' alignment to cielab across various configurations, we now present an analysis and discussion of these results. ## related work distributional word representations have long been theorized to capture various types of information about the world @xcite . early work in this regard employed semantic similarity and relatedness datasets to measure alignment to human judgements @xcite @xcite . @xcite , however, question whether the distributional hypothesis is equally applicable to all types of semantic information, finding that taxonomic properties (such as animacy) are better modelled than attributive ones (color, size, etc.). to a similar end, @xcite analyze how well distributional representations encode various aspects of grounded meaning. they investigate whether language models would "be worse off for not having physically bumped into walls before they hold discussions on wall-collisions?", finding that perceptual features are poorly modelled compared to encyclopedic and taxonomic ones. more recently, several studies have asked related questions in the context of language models. for example, @xcite and @xcite mine lms for factual and commonsense knowledge by converting knowledge base triplets into cloze statements that are used to query the models. in a similar vein, @xcite investigate lm representations' encoding of object properties (e.g., oranges are round), and affordances (e.g. oranges can be eaten), as well as the interplay between the two. @xcite demonstrate that lms can capture stereotypic tacit assumptions about generic concepts, showing that they are adept at retrieving concepts given their associated properties (e.g., bear given a ___ has fur, is big, and has claws.). similar to other work, they find that lms better model encyclopedic and functional properties than they do perceptual ones. in an investigation of whether or not lms are able to overcome reporting bias, shwartz and choi (2020) extract all sentences in wikipedia where one of 11 color terms modifies a noun and test how well predicted the color term is when it is masked. they find that lms are able to model this relationship between concepts and associated colors to a certain extent, but are prone to over-generalization. finally, @xcite train a probe to map lm representations of textual captions to paired visual representations of image patches, in order to evaluate how useful the former are for discerning between different visual representations. they find that many recent lms yield representations that are effective at retrieving semantically-aligned image patches, but still far under-perform humans. ## outlook it is commonly held that the learning of phenomena which rely on sensory perception is only possible through direct experience. indeed, the view that people born blind could not be expected to acquire coherent knowledge about colors has been prevalent since at least the empiricist philosophers @xcite and still holds currency @xcite . nevertheless, recent research highlighting the contribution of language and of semantic associations between concepts towards learning has demonstrated that the congenitally blind do in fact show a striking understanding of both color similarity @xcite and object colors @xcite . this paper investigated whether representations of color terms that are derived from text only express a degree of isomorphism to the structure of humans' perceptual color space. 12 results from our experiments evidenced that such a topological correspondence exists. notably, color term representations based on simple co-occurance statistics already demonstrated correspondence; those extracted from language models aligned more closely. we observed that warm colors, on average, show more alignment than cooler ones, linking to recent findings on communication efficiency in color naming @xcite . further analysis based on surprisal -an information theoretic measure, used to evaluate how efficiently a color is communicated between a speaker and a listener -revealed a correlation between lower topological alignment and higher color chip surprisal, suggesting that the kind of contexts a color occurs in play a role in determining alignment. exploring this, we tested a set of color term corpus-derived statistics for how well they predict alignment, finding that a measure of a color term's collocationality corresponds to lower alignment, while the entropy of its dependency relation distribution and it occurring more frequently as and adjectival modifier correspond to closer alignment. our results and analyses present empirical evidence of topological alignment between text-based color term representations and perceptual color spaces. with respect to the debate started by bender and koller (2020), we hope that this work offers a modest step towards furthering our understanding of the kinds of "meaning" we expect language models to acquire, with and without grounded or embodied learning approaches, and that it will provide motivation for further work in this direction.