Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Models (2023)

Abstract: Language models have graduated from being research prototypes to commercialized products offered as web APIs, and recent works have highlighted the multilingual capabilities of these products. The API vendors charge their users based on usage, more specifically on the number of “tokens” processed or generated by the underlying language models. What constitutes a token, however, is training data and model dependent with a large variance in the number of tokens required to convey the same information in different languages. In this work, we analyze the effect of this non-uniformity on the fairness of an API’s pricing policy across languages. We conduct a systematic analysis of the cost and utility of OpenAI’s language model API on multilingual benchmarks in 22 typologically diverse languages. We show evidence that speakers of a large number of the supported languages are overcharged while obtaining poorer results. These speakers tend to also come from regions where the APIs are less affordable, to begin with. Through these analyses, we aim to increase transparency around language model APIs’ pricing policies and encourage the vendors to make them more equitable.

## introduction language models (lms) have come to be known as general-purpose solutions capable of performing many tasks by following natural language instructions @xcite @xcite , and generalizing to new tasks at test time using a handful of demonstrations @xcite . motivated by their potential for commercial use, many industrial research institutions have moved away 1 openai's tokenizer interface displays byte tokens absent from their vocabulary as "?". what is the capital of morocco? ποια είναι η πρωτεύουσα του μαρόκου;? what is the capital of morocco? η πρωτεύουσα του μαρόκου είναι η πόλη ραμπάτ, ή επίσης γνωστή ως ραμπάτ σαλέ. the capital of morocco is rabat. ## conclusion by analyzing popular language model apis on challenging multilingual benchmarks, we find that (a) api tokenizers disproportionately favor latin scripted languages and over-fragment less represented languages and scripts, (b) the api pricing policy of charging based on the number of tokens is flawed and extremely unfair towards speakers of the over-fragmented languages, and (c) the api performs poorly on such languages compared to the less-fragmented counterparts. in the current nlp research landscape, where more and more industrial labs are building their own apis, this is a concerning trend that may reduce the accessibility of these technologies to already marginalized communities. hence, we encourage the vendors to be more transparent about their models' limitations and rethink their pricing policy.