# 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.

- Published: 2026-11-23
- Topics: AI security, LLM security, Tokenization
- Canonical page: https://thesecguy.com/notes/tokenizer-bias-logit-bias-security/
- Publisher: The Sec Guy (https://thesecguy.com)

**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.

<figure class="fig">
<p class="fig-k">One word, two languages, different brick counts</p>
<div class="flow">
<div class="node"><b>A common English word</b><span>Has its own ready-made brick</span><div class="chips"><i class="chip">1 token</i></div></div>
<div class="node"><b>The same word in a language the tokenizer saw less of</b><span>Built from several small pieces</span><div class="chips"><i class="chip">piece</i><i class="chip">piece</i><i class="chip">piece</i><i class="chip">piece</i><i class="chip">piece</i></div></div>
<div class="node"><b>What you pay</b><span>Price, speed and space are all counted per brick</span><div class="chips"><i class="chip">more tokens, higher bill</i></div></div>
</div>
<figcaption>Our illustration. The measured gaps for real languages are in the chart further down.</figcaption>
</figure>

## 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](https://huggingface.co/learn/llm-course/chapter6/5) 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](https://arxiv.org/abs/2305.15425) 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:

<figure class="fig">
<p class="fig-k">Tokens needed for the same sentences, English = 1</p>
<div class="hbars">
<div class="hbar hot"><em>Hindi</em><div class="track"><i style="width:32%"></i></div><b>4.79x</b></div>
<div class="hbar"><em>Bengali</em><div class="track"><i style="width:39%"></i></div><b>5.84x</b></div>
<div class="hbar"><em>Tamil</em><div class="track"><i style="width:51%"></i></div><b>7.65x</b></div>
<div class="hbar"><em>Telugu</em><div class="track"><i style="width:55%"></i></div><b>8.34x</b></div>
<div class="hbar"><em>Shan (the largest gap)</em><div class="track"><i style="width:100%"></i></div><b>15.05x</b></div>
</div>
<figcaption>Source: Petrov, La Malfa, Torr and Bibi, "Language Model Tokenizers Introduce Unfairness Between Languages", University of Oxford, 2023, appendix table for the cl100k_base tokenizer.</figcaption>
</figure>

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](https://arxiv.org/abs/2305.13707) 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](https://thesecguy.com/notes/owasp-llm-top-10-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](https://arxiv.org/abs/2310.02446) 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](https://arxiv.org/abs/2310.06474), 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](https://hiddenlayer.com/innovation-hub/the-tokenbreak-attack/): 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](https://arxiv.org/html/2506.07948v1) 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.

<figure class="fig">
<p class="fig-k">One sentence, two readers</p>
<div class="flow">
<div class="node"><b>1. Attacker types</b><span>"ignore previous finstructions"</span><div class="chips"><i class="chip">one extra letter</i></div></div>
<div class="node"><b>2. Guardrail tokenizer</b><span>Splits the odd word into pieces that don't match what it learned to flag</span><div class="chips"><i class="chip">passes</i></div></div>
<div class="node"><b>3. Main model</b><span>Still reads it as "ignore previous instructions"</span><div class="chips"><i class="chip">understands</i></div></div>
</div>
<figcaption>Our layout of the TokenBreak technique published by HiddenLayer, 12 June 2025. In HiddenLayer's own demo the bypass did not lead to a harmful action.</figcaption>
</figure>

## 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.

<figure class="fig">
<p class="fig-k">A thumb on the scale: banning one word</p>
<div class="hbars">
<div class="hbar"><em>Before: "blue"</em><div class="track"><i style="width:60%"></i></div><b>60%</b></div>
<div class="hbar"><em>Before: "gray"</em><div class="track"><i style="width:25%"></i></div><b>25%</b></div>
<div class="hbar"><em>Before: "falling"</em><div class="track"><i style="width:10%"></i></div><b>10%</b></div>
<div class="hbar hot"><em>After a bias of -100 on "blue"</em><div class="track"><i style="width:0%"></i></div><b>banned</b></div>
<div class="hbar"><em>After: "gray" is now the favorite</em><div class="track"><i style="width:62%"></i></div><b>62%</b></div>
</div>
<figcaption>Our illustration, using the same example odds as the temperature explanation in our sampling note. The -100 ban is from the OpenAI API reference.</figcaption>
</figure>

## 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"](https://arxiv.org/abs/2403.06634). 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".

<figure class="fig">
<p class="fig-k">The numbers to remember</p>
<div class="tiles">
<div class="tile hot"><b>4.79x</b><span>tokens for Hindi vs English</span><small>cl100k_base, Oxford 2023</small></div>
<div class="tile"><b>79.04%</b><span>of harmful requests got past GPT-4 via four low-resource languages</span><small>under 1% in English</small></div>
<div class="tile"><b>&lt;$20</b><span>to extract one layer of two OpenAI models</span><small>via logit bias, 2024, since blocked</small></div>
</div>
<figcaption>Sources: Petrov et al. 2023; Yong, Menghini and Bach 2023; Carlini et al. 2024.</figcaption>
</figure>

## What to check, with an example

Take a support chatbot for an Indian bank that answers in English and Hindi.

1. **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".
2. **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.
3. **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.
4. **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.
5. **Don't pass `logit_bias` and `logprobs` through 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](https://thesecguy.com/notes/llm-security-guide/).

---

**Sources** (all checked 23 November 2026)
- OpenAI Help Center, "What are tokens?": [help.openai.com](https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them)
- Hugging Face LLM Course, "Byte-Pair Encoding tokenization": [huggingface.co](https://huggingface.co/learn/llm-course/chapter6/5)
- Petrov, La Malfa, Torr, Bibi (University of Oxford), "Language Model Tokenizers Introduce Unfairness Between Languages", NeurIPS 2023: [arxiv.org/abs/2305.15425](https://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](https://arxiv.org/abs/2305.13707) and [aclanthology.org](https://aclanthology.org/2023.emnlp-main.614)
- Yong, Menghini, Bach (Brown University), "Low-Resource Languages Jailbreak GPT-4", 2023: [arxiv.org/abs/2310.02446](https://arxiv.org/abs/2310.02446)
- Deng, Zhang, Pan, Bing, "Multilingual Jailbreak Challenges in Large Language Models", ICLR 2024: [arxiv.org/abs/2310.06474](https://arxiv.org/abs/2310.06474)
- HiddenLayer, "The TokenBreak Attack", 12 June 2025: [hiddenlayer.com](https://hiddenlayer.com/innovation-hub/the-tokenbreak-attack/)
- HiddenLayer, "TokenBreak: Bypassing Text Classification Models Through Token Manipulation" (paper): [arxiv.org](https://arxiv.org/html/2506.07948v1)
- OWASP GenAI Security Project, "LLM10:2025 Unbounded Consumption": [genai.owasp.org](https://genai.owasp.org/llmrisk/llm102025-unbounded-consumption/)
- OpenAI API reference, Chat Completions (logit_bias, logprobs): [developers.openai.com](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create)
- Carlini et al., "Stealing Part of a Production Language Model", 2024: [arxiv.org/abs/2403.06634](https://arxiv.org/abs/2403.06634)
