Language Invariant Properties in Natural Language Processing (2022)

Abstract: Meaning is context-dependent, but many properties of language (should) remain the same even if we transform the context. For example, sentiment or speaker properties should be the same in a translation and original of a text. We introduce language invariant properties: i.e., properties that should not change when we transform text, and how they can be used to quantitatively evaluate the robustness of transformation algorithms. Language invariant properties can be used to define novel benchmarks to evaluate text transformation methods. In our work we use translation and paraphrasing as examples, but our findings apply more broadly to any transformation. Our results indicate that many NLP transformations change properties. We additionally release a tool as a proof of concept to evaluate the invariance of transformation applications.

## introduction the progress in natural language processing has bloomed in recent years, with novel neural models being able to beat the score of different benchmarks. however, current evaluation benchmarks often do not look at how properties of language vary when text is transformed or influenced by a change in context. for example, the meaning of a sentence is influenced by a host of factors, among them who says it and when: "that was a sick performance" changes meaning depending on whether a 16-yearold says it at a concert or a 76-year-old after the opera. 1 however, there are several properties of language that do (or should) not change when we transform a text (i.e., change the surface form of it to another text, see also section 2). if the text was written by a 25-year-old female, it should not be perceived as written by an old man after we apply a paraphrasing algorithm. the same goes for other properties, like sentiment: a positive message like 1 example due to veronica lynn. paraphrasing, summarization, style transfer, and machine translation are all nlp transformation tasks that should respect lips. if they do not, it is a strong indication that the system is picking up on spurious signals and needs to be recalibrated. for example, machine translation should not change speaker demographics or sentiment, and paraphrasing should not change entailment or topic. but what happens if a transformation does violate invariants? violating invariants is similar to breaking the cooperative principle @xcite : if we do it deliberately, we might want to achieve an effect. for example, @xcite showed how words can be replaced to obfuscate author gender, thereby protecting their identity. style transfer can therefore be construed as a deliberate violation of lips. in most cases, though, violating a lip will result in an unintended outcome or interpretation of the transformed text: for example, violating lips on sentiment will generate misunderstanding in the interpretation of messages. any such violation might be a signal that models are not ready for production @xcite . in this paper, we suggest a novel type of evaluation benchmark based on lips. we release a tool as a proof of concept of how this methodology can be introduced into evaluation pipelines: we define the concept of lips, but also integrate contributions. we introduce lips: properties of language that should not change during a transformation. our contribution also focuses on the proposal of an evaluation methodology for lips and the release of a python application that can be used to test how well systems can preserve lips. 3 we believe that this contribution can help the community to work on benchmarking and understanding how properties change when text is transformed. ## language invariant properties to use the concept of lips, we first need to make clear what we mean by it. we formally define lips and transformations below. assume the existence of a set s of all the possible utterable sentences. let us define a and b as subsets of s. these can be in the same or different languages. now, let's define a mapping function t : @xmath0.e., t(•) is a transformation that changes the surface form of the text a into b. a language property p is a function that maps elements of s to a set p of property values. p is invariant if and only if lips are thus based on the concept of text transformations. machine translation (mt) is a salient example of a transformation and a prime example of a task for which lips are important. mt can be viewed as a transformation between two languages where the main fundamental lip that should not be broken is meaning. however, lips are not restricted to mt but have broader applicability, e.g., in style transfer. in that case, though, some context has to be defined. when applying a formal to polite transfer, this function is by definition not invariant anymore. nonetheless, many other properties should not be influenced by this transformation. finally, for paraphrasing, we have only one language, but we have the additional constraint that t(a) ̸ = a. for summarization, the constraint instead is that len(t(a)) < len(a). lips are also what make some tasks in language more difficult than others: for example, data augmentation @xcite cannot be as easily implemented in text data as in image processing, since even subtle changes to a sentence can affect meaning and style. changing the slant or skew of a photo will still show the same object, but for example word replacement easily breaks lips, since the final meaning of the final sentence and the perceived characteristics can differ. even replacing a word with one that is similar can affect lips. for example, consider machine translation with a parallel corpus: "the dogs are running" can be paired with the translation "i cani stanno correndo" in italian. if we were to do augmentation, replacing dogs with its hyperonym animals does not corrupt the overall meaning, as the new english sentence still entails all that is entailed by the old one. however, the italian example is no longer a correct translation of the new sentence, since cani is not the word for animals. lips are also part of the communication between speakers. the information encoded in a sentence uttered by one speaker contains lips that are important for efficient communication, as misunderstanding a positive comment as a negative one can create issues between communication partners. note that we are not interested in evaluating the quality of the transformation (e.g., the translation or paraphrase). there are many different metrics and evaluation benchmarks for that (bleu, rouge, bertscore etc.: @xcite @xcite . our analysis concerns another aspect of communication for which we wish to propose an initial benchmark. ## related work there have been different works in nlp that have investigated issues arising from language technology @xcite @xcite @xcite @xcite @xcite @xcite . in our paper, we focus on issues that can arise from the usage of text transformation algorithms (for example, we will see examples of gender bias in transformation, inspired by @xcite , in section 5) and we describe a method that can allow us to analyze them. the idea that drives lips have spawned across different work in the nlp literature; for example, @xcite discuss the effect that machine translation can have on sentiment classifiers. at the same time, ideas of conserving meaning during style transfer are also presented in the work by @xcite . we propose lips as a term to give a unified view on the problem of preserving these properties during transformation. lips share some notions with the checklist by @xcite and the adversarial reliability checks by @xcite . however, lips evalu-ate how well fundamental properties of discourse are preserved in a transformation, the checklist is made to guide users in a fine-grained analysis of the model performance to better understand bugs in the applications with the use of templates. as we will show later, lips can be quickly tested to any new annotated dataset. some of the checklist's tests, like replace neutral words with other neutral words, can be seen as lips. the general idea of adversarial attacks, meanwhile, also requires lips to hold in order to work. nonetheless, we think the frameworks are complementary. ## benchmarking transformation invariance for ease of reading, we will use translation as an example of a transformation in the following. however, the concept can be applied to any of the transformations we mentioned above. we start with a set of original texts a to translate into a set of texts b. 4 we thus need a translation model t from the source language of a to a target language of b. to test the transformation wrt a lip, a should be annotated with that language property of interest, this is our ground truth and we are going to refer to this as p(a). we also need a classifier for the lip of interest, which serves as language property function p. for example, a lip classifier could be a gender classifier that, given an input text, returns the inferred gender of the speaker. here, we need one cross-lingual classifier, or two classifiers, one in the source and one in the target language. 5 once we apply the translation, we can use the lip classifier on the original data a and the new set of translated data b obtaining respectively, p(a) and p(b). we can then compare the difference between the distribution of the lip in the original data and either prediction. i.e., we compare the differences in distribution of p(a)p(a) to p(a)p(b) to understand the effect of the transformations. we show a visual explanation on how to benchmark lips in figure 2 . note that we are not interested in the actual performance of the classifiers, but in the difference in performance on the two datasets. we observe two possible phenomena (as in @xcite ): 1) if there is a classifier bias, both the predictions based on the original language and the predictions based on the translations should be skewed in the same direction with respect to the distribution in a. e.g., for gender classification, both classifiers predict a higher rate of male authors in the original and the translated text. 2) instead, if there is a transformation bias, then the distribution of the translated predictions should be skewed in a different direction than the one based on the original language. e.g., the gender distribution in the original language should be less skewed than the gender ratio in the translation. note that we assume that the lip classifiers used for the source and one in the target language have similar biases; if this were not true and the classifiers had different biases phenomena 1) could be caused both by the bias in translations or bias in the models. this mostly depends on the quality of the classifiers, that has to be assessed before the evaluation of the lips. ## evaluation we evaluate four tasks, i.e., combinations of transformations and lips; the combination is determined by the availability of the particular property in the respective dataset. ## benchmark tool we release an extensible benchmark tool foot_6 that can be used to quickly assess a model's capability to handle lips. the benchmark has been designed to provide a high-level api that can be integrated into any transformation pipeline. users can access the dataset text, transform, and score it (see figure 6 ). thus, this pipeline should be very easy to use. the tool allows the users to run the experiments multiple time to also understand the variations that depends on the model themselves. figure 6 : the benchmark has been designed to provide a high-level api that can be integrated in any transformation pipeline. users can access the dataset text, transform, and score it. we hope this benchmark tool can be of help, even as an initial prototype, in designing evaluation pipelines meant at studying how lips are preserved in text. ## conclusion this paper introduces the concept of language invariant properties, properties in language that should not change during transformations. we also describe a possible evaluation pipeline for lips showcasing that some of the language transformation technologies we use suffer from limitations and that they cannot often preserve important lips. we believe that the study of lips can improve the performance of different nlp tasks and to provide better support in this direction we release a benchmark that can help researchers and practitioners understand how well their models handle lips.