Concepts · Level 1 · Note 2
Why Hindi costs more tokens than English, and why that is a security issue
Tokenizers, tokenizer bias and logit bias explained in plain words, with the measured Hindi and Indic numbers and the security checks that follow from them.
Short answer
AI models read text as tokens and you pay per token. Tokenizers were built mostly on English, so the same sentence takes far more tokens in other languages: 4.79 times as many in Hindi on the cl100k_base tokenizer in one Oxford study. That gap raises bills and shrinks the usable context window, and the same shortage of training text leaves safety training weaker in those languages. Logit bias, a setting that nudges the next word, was used by researchers to extract part of a production model for under $20. Budget by tokens, test in every language you serve, and limit who can set logit bias.
A language model reads your words as tokens, and everything about the service is counted in them: the price, the speed, how much fits in one request. Two ideas from that layer matter for security. Tokenizer bias is about how text is cut into tokens. Logit bias is about how the model chooses the next one.
Tokens, in plain words
Think of a box of building bricks. For English the box has ready-made bricks for whole common words: one brick for “the”, one for “house”. For a language the box wasn’t designed around, there are no ready-made bricks, so each word has to be assembled from many tiny pieces.
You’re charged per brick. The same sentence costs more in the second language, though it says exactly the same thing.
Animated: the same sentence cut into tokens in two languages
English sentence
The same sentence in Hindi
- The tokenizer has ready-made pieces for common English words, so four words become four tokens.
- Now the same sentence in Hindi. The tokenizer saw far less Hindi when it was built.
- With few ready-made pieces, each word is cut into many small ones.
- You pay per token. On one 2023 measurement Hindi needed 4.79 times the tokens of English, so 4 becomes about 19.
- The same gap eats the context window: less of your document fits.
- For security that means higher bills an attacker can run up and less room for your instructions. The same thin training data also leaves safety training weaker in that language.
Tokens, technically
A tokenizer cuts text into pieces before the model reads it. OpenAI’s help page says “Tokens can be thought of as pieces of words”, and gives the English rule of thumb: “1 token ~= 4 chars in English”, or about three quarters of a word.
Most tokenizers are built with a method called byte pair encoding, or BPE. The Hugging Face course describes how it is trained: start from the smallest units, then keep merging the pair of neighbors that appears together most often, until the vocabulary reaches its target size. Whatever shows up most in the training text earns its own token. Text from languages and scripts that were rare in that training text gets split into much smaller pieces.
OpenAI says the same thing in fewer words: “How words are split into tokens is also language-dependent”, and “The higher token-to-char ratio can make it more expensive to implement the API for languages other than English.”
Tokenizer bias: the measured numbers
Researchers at the University of Oxford measured the gap in a NeurIPS 2023 paper. They took “the same 2000 sentences taken from Wikipedia and human-translated to 200 different languages” and counted tokens. The ratio against English is what they call the premium.
On cl100k_base, the tokenizer that ChatGPT and GPT-4 shared at the time, the premiums for five languages were:
Tokens needed for the same sentences, English = 1
So the “Hindi costs 4x” line you see on social media is close for that tokenizer. On the older GPT-2 tokenizer the same paper puts Hindi at 7.46 times.
The gap comes from what the tokenizer was trained on, so it tells you nothing about the language itself. In the same table MuRIL, a tokenizer built for Indian languages, brings Hindi down to 1.16.
A second team, from the University of Washington, Carnegie Mellon and the Allen Institute for AI, reached the same conclusion from the billing side at EMNLP 2023: some languages “require up to 5× more tokens to convey the same information”, and “we spend up to 4× more for both prompting and generation in Telugu and Amharic”.
Both studies are from 2023. Tokenizers have changed since, so measure your own model with your own text before you quote a number.
Why tokenizer bias is a security issue
Start with the bill. If your limits count requests or characters, a Hindi message can carry several times the tokens of an English one of the same length and still pass. OWASP lists this under Unbounded Consumption, where “attackers exploit the cost-per-use model of cloud-based AI services”. The 2026 edition of the list moved that risk up to sixth place, as we covered in OWASP Top 10 for LLM Applications 2026 vs 2025.
The context window shrinks too, because more tokens per sentence means less room. The Oxford paper notes that in the worst-hit languages “one can process less than a tenth of the content”.
Safety filters are the third problem. Safety training is thinner where training text was thinner. A Brown University team translated 520 harmful requests from a standard test set and sent them to GPT-4 (version gpt-4-0613). In English, fewer than 1% got through. Trying the same request in Zulu, Scots Gaelic, Hmong and Guarani and counting a success if any one worked, 79.04% got through. Hindi alone was 6.54% and Bengali 13.27%, both well above English. A second study, published at ICLR 2024, found users of low-resource languages (those with little training text) were “approximately three times more likely to unintentionally come across harmful content”. Both tested 2023 models. The Brown paper reports no fix, and the second proposes a fine-tuning method (extra training) that lowered the unsafe rate without removing it.
The guardrail in front of the model can be fooled as well. Many apps put a small classifier ahead of the model to catch prompt injection or abuse. That classifier has its own tokenizer. In June 2025 HiddenLayer published TokenBreak: add one letter to a trigger word, as in “ignore previous finstructions”, and the classifier’s tokenizer splits it into pieces it doesn’t recognize, while the model behind it still understands the sentence. The accompanying paper tested nine classifiers. HiddenLayer’s summary: “Models using BPE (Byte Pair Encoding) or WordPiece tokenization strategies were found to be vulnerable”, and none of the models using a Unigram tokenizer were fooled.
One sentence, two readers
Logit bias, in plain words
Before a model picks its next word, every candidate gets a score. Picture a row of contestants holding up scorecards.
Logit bias is a thumb on the scale. You name a contestant and add or subtract points before the judging. Add enough and that one always wins. Subtract enough and it can never win.
Animated: how logit bias changes which word wins
Candidates for the next word: "The sky is ..."
- Before the model picks a word, every candidate has a score. Here "blue" is the favorite.
- A logit bias of -100 on "blue" is a thumb on the scale. That word can no longer be chosen.
- The remaining candidates share the odds, so "gray" is now the favorite.
- A bias of +100 does the opposite. It forces one word, here "falling", every time.
- The risk: push chosen words into view with a bias, read back their scores, and repeat. Researchers recovered the final layer of a production model this way in 2024. The vendor has since blocked it.
- So treat logit bias and score readouts as power tools. Don't pass them through to end users.
Logit bias, technically
Those scores are called logits. OpenAI’s API reference describes the logit_bias setting as a way to “Modify the likelihood of specified tokens appearing in the completion.” You pass token IDs with a bias “from -100 to 100”, and “the bias is added to the logits generated by the model prior to sampling.” Small values nudge. At the extremes, “values like -100 or 100 should result in a ban or exclusive selection of the relevant token.”
A related setting, logprobs, returns the model’s probabilities for the tokens it chose, and top_logprobs returns up to 20 of the most likely tokens at each position.
Both are useful. Banning a token makes a particular word much less likely, though a word can map to several tokens and each variant needs its own ban. Reading log probabilities tells you how sure a classifier was.
Why logit bias is a security issue
Put together, those two settings let researchers read out part of a model.
In March 2024 a team from Google DeepMind, ETH Zurich, the University of Washington, OpenAI and McGill published “Stealing Part of a Production Language Model”. Using logit bias to push chosen tokens into the visible top results, then reading their log probabilities, they rebuilt the model’s full score table query by query. From that they recovered the model’s final layer, up to a mathematical transformation: “For under $20 USD, our attack extracts the entire projection matrix of OpenAI’s ada and babbage language models.” They also found the exact hidden size of gpt-3.5-turbo (the width of its internal vectors) and estimated the same extraction there “would cost under $2,000 in queries”.
That’s one layer out of a whole model. It’s still proprietary information that the API was never meant to give out, and the vendors treated it that way. The paper reports that both OpenAI and Google “implemented defenses to prevent our attack or make it more expensive”, and that OpenAI “removed the ability for logit bias to impact the top logprobs”.
The numbers to remember
What to check, with an example
Take a support chatbot for an Indian bank that answers in English and Hindi.
- Meter tokens, not requests. On the 2023 measurements a Hindi conversation could use close to five times the tokens of the same conversation in English. Set per-user budgets in tokens and a maximum output length on every call. OWASP’s wording: “Apply rate limiting and user quotas”.
- Test safety in Hindi, and in Hinglish. Run your red-team prompts (the attack prompts you test with) in every language and script your users type in. A test run only in English leaves the others untested.
- Find out what tokenizer your guardrail uses. If the filter in front of your model uses BPE or WordPiece, test it with trigger words that have an extra letter added at the front. HiddenLayer reported BERT, DistilBERT and RoBERTa classifiers as susceptible in its tests, and DeBERTa-v2 and v3 as not.
- Size the context window in the user’s language. A document that fits in English may not fit in Hindi. Truncation is a security problem when the part cut off is your instructions.
- Don’t pass
logit_biasandlogprobsthrough to end users. If your app is a thin layer over a model API, strip those parameters from user-controlled requests. OWASP’s guidance is to “Restrict or obfuscate the exposure of logit_bias and logprobs in API responses.” The extraction risk matters most if you serve your own or a fine-tuned model. On a hosted API the reason is different: a user who can set logit bias can ban the words a refusal starts with, or force an answer.
For the wider picture of where these checks sit, see LLM security: the risks, the fixes and where to start.
Sources (all checked 23 November 2026)
- OpenAI Help Center, “What are tokens?”: help.openai.com
- Hugging Face LLM Course, “Byte-Pair Encoding tokenization”: huggingface.co
- Petrov, La Malfa, Torr, Bibi (University of Oxford), “Language Model Tokenizers Introduce Unfairness Between Languages”, NeurIPS 2023: arxiv.org/abs/2305.15425
- Ahia et al., “Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Models”, EMNLP 2023: arxiv.org/abs/2305.13707 and aclanthology.org
- Yong, Menghini, Bach (Brown University), “Low-Resource Languages Jailbreak GPT-4”, 2023: arxiv.org/abs/2310.02446
- Deng, Zhang, Pan, Bing, “Multilingual Jailbreak Challenges in Large Language Models”, ICLR 2024: arxiv.org/abs/2310.06474
- HiddenLayer, “The TokenBreak Attack”, 12 June 2025: hiddenlayer.com
- HiddenLayer, “TokenBreak: Bypassing Text Classification Models Through Token Manipulation” (paper): arxiv.org
- OWASP GenAI Security Project, “LLM10:2025 Unbounded Consumption”: genai.owasp.org
- OpenAI API reference, Chat Completions (logit_bias, logprobs): developers.openai.com
- Carlini et al., “Stealing Part of a Production Language Model”, 2024: arxiv.org/abs/2403.06634