Revisiting subword tokenization: A case study on affixal negation in large language models (2024)

Abstract: In this work, we measure the impact of affixal negation on modern English large language models (LLMs). In affixal negation, the negated meaning is expressed through a negative morpheme, which is potentially challenging for LLMs as their tokenizers are often not morphologically plausible. We conduct extensive experiments using LLMs with different subword tokenization methods, which lead to several insights on the interaction between tokenization performance and negation sensitivity. Despite some interesting mismatches between tokenization accuracy and negation detection performance, we show that models can, on the whole, reliably recognize the meaning of affixal negation.

## introduction negation is central to language understanding but is not properly captured by modern nlp methods @xcite . while state-of-the-art large language models (llms) have improved negation-related capabilities, challenges remain, such as the ability to correctly determine the enclosed scope of negation, or when negation interacts with other linguistic constructions like quantifiers @xcite . negations in common english nlp benchmarks are typically marked by separate negation cues such as not or no. however, in practice, negation can also be expressed through morphemes (or affixes) of words, i.e. by negative prefixes or suffixes such as in uninteresting or effortless. while humans can identify affixal negation by leveraging morphological cues, nlp systems only rarely consider word-internal structure, beyond normalizing syntactic variation @xcite . modern nlp methods such as language models employ subword tokenization, in which words are broken down into smaller units. this has an advantage * also at google research. of reducing vocabulary size, as well as learning shared representation between words with similar subwords. the intent to improve such representation by making tokenization methods more linguistically sound has driven the invention of several morphology segmentation methods, such as morfessor @xcite . however, these have not been broadly adopted in modern llms as they do not scale well. we hypothesize that current subword tokenization methods could lead to sub-optimal performance on language understanding tasks involving negation, because they do not correctly break words down morphologically. for instance, in this work, we analyze the impact of affixal negations on transformer-based language models, where two main tokenization methods are employed, namely: byte-pair encoding @xcite and unigram language model @xcite . we consider three research questions: rq1: are current subword tokenization methods able to preserve negative affixes? we analyzed the performance of various subword tokenization methods used in modern lms. we find that most do not effectively produce the correct negative affixes. rq2: are modern lms aware of the presence of negation in affixal negations? we design a negation prediction task to probe models' awareness of affixal negation. we find that despite not performing well on the tokenization task, current llms can reliably infer the negated meaning of words with negative affixes. for this task, there is only a weak positive correlation between tokenizer and classifier performance. rq3: what are the impacts of affixal negation on downstream tasks? as negation and sentiment are closely related, we measure the impact on a downstream sentiment analysis task by looking at samples containing affixal negations from common datasets. results show that models perform well on those samples, implying that the impact of affixal negation is minimal. however, there exists a bias in predicting negative sentiment for affixal negations. ## related work there are two popular ways of constructing the vocabulary for lms using subword tokenization methods: byte-pair encoding ("bpe": @xcite ) and unigram language model ("unigram lm": @xcite ). bpe starts from a base character set, then merges those characters based on bigram frequency to form subword units (bottom-up), whereas unigram language models start from a large subword vocabulary, which is then reduced based on a regularization method (topdown). there are multiple variants of bpe, differing in how the base vocabulary is represented and how the merging is done. wordpiece @xcite uses characters to represent the base vocabulary, then selects pairs that maximize the likelihood of training data, byte-level bpe uses bytes instead of unicode to represent the base vocabulary; the merging is done based on the frequency count of bigrams. in contrast, the unigram language model starts from a large base vocabulary and iteratively trims down tokens based on unigram lm perplexity until a target vocabulary size is reached. both methods assume that the input text uses spaces to separate words, which is not true for languages such as chinese or vietnamese. therefore, a word segmentation step must be performed in advance. sentencepiece @xcite was introduced to solve this problem by considering whitespace as part of words, essentially treating the whole input stream as the smallest unit to perform tokenization on. then, either bpe or unigram lm can be applied to construct the vocabulary. regardless of method, they purely rely on statistical information and thus are not expected to produce morphologically-aligned subword tokens. there have been efforts to build linguisticallysound word tokenization methods, most notably morfessor and its variants @xcite . building morphology-aligned segmentation methods, especially in a multilingual setting, is an active line of research through recent sigmor-0 250 500 750 1000 1250 1500 1750 2000 count bert electra gpt-2 roberta llama-2 gpt-4 xlnet albert t5 correct under-segmented over-segmented (a) negmorph by models (albert and xlnet use ulm, while the rest employ bpe) 0 20 40 60 80 100 percentage re ef di para over tra syn a hypo dys im il de mal ab in dis extra anti super ir down contra ex less mis hyper un out an off under e non sub counter no free on ill correct under-segmented over-segmented (b) negmorph by affixes phon shared tasks @xcite . these methods outperform general tokenizers in producing morphologically-aligned tokens, but their benefit on downstream tasks is often negligible @xcite . in this work, we examine if morphologically correct tokenization is important for llms to deal with negation. bert and its variants have been shown to be insensitive to negation @xcite , affecting many downstream nlp tasks such as sentiment analysis, nli, or qa @xcite @xcite . compared to previous models, current llms have improved negation handling ability, but still struggle with some unconventional types of negation and linguistic constructions @xcite . here, we investigate the treatment of affixal negation in modern lms, with the intuition that subword tokenization methods that don't appropriately reflect this morphology will lead to misinterpretation of their semantics. ## experimental settings we focus our analysis particularly on how affixal negations are represented in modern llms, designing probing tasks to test their awareness of negation, and the effect on downstream tasks. all code for the experiments is available at https://github.com/joey234/ affixal-negation . ## a look into token attribution we perform an interpretation analysis to attain insights into what drives model predictions. for this analysis, we use the flan-t5-xxl model, as we could not obtain probabilities (logprobs) from gpt-4. we calculate the attribution for each token corresponding to the predictions using the integrated gradient method @xcite , with probability as the scoring function, implemented in inseq @xcite . overall, we observe high attribution scores from relevant tokens, such as the subword tokens of the target words, showing that models know where to pay attention to when performing inference. ## conclusion in this work, we conducted an in-depth analysis into how well modern llms handle affixal negation, a type of negation where morphology is essential to understanding word semantics. we have shown that there is significant room for improvement in current tokenization methods in terms of producing negative affix-preserving tokens. despite that, the effect of morphologically incorrect tokenization on the ability of models to understand word meaning in downstream tasks, including sentiment analysis, is minimal. regardless, designing better subword tokenization methods may have many immediate benefits such as reducing vocabulary size, learning better word representations, and improving model interpretability.