Key takeaways

  • A bytes ÷ 3 token estimate under-counted in every language. A packet sized at 800 tokens really held 919 to 1,084, measured with a real tokenizer on 462 synthetic texts.
  • The guess about which language would break was wrong. Hindi, at three bytes a character, came closest. English and Hinglish were furthest, because a packet's frame, ids and dates tokenise densely.
  • The simple fix cost answers. Dividing by two at the same 800 budget made the numbers honest, but cut the items served by about 44% and lost answers in English and Hinglish.
  • The fix that held changed the numbers, not the bytes. Dividing by two and raising every cap by half sends exactly the same bytes as before, under honest token numbers. Tool answers that hold ids and code state a byte cap instead of a token claim.
  • It is accepted in the Lab, not live. The live service still runs the old estimate, with the measured factor reported beside every token number.

The need: a context budget you can trust

A memory packet is part of the agent's context window. If the memory layer says "at most 800 tokens" and sends 1,060, every downstream budget is wrong and bloat goes unseen. So the budget is a promise, not a hint.

Counting real tokens on every request would mean sending the user's memory text to a counting service on the hot path. We rule that out. So the estimate has to live in code, and it has to be measured.

Why we expected Hindi to break it

Devanagari takes three bytes a character in UTF-8, and Latin text takes one. A byte-based estimate could be right for one script and wrong for the other. We wrote three pass lines before counting anything:

  1. Safe: over rendered packets, the 95th percentile of real ÷ estimated tokens is at most 1.00 in every language.
  2. Not wasteful: the median is at least 0.60.
  3. Equal treatment: Hindi's and Hinglish's medians are each within 0.25 of English's.

How we counted

  • Texts: synthetic only, never a user's words. Hand-written test sentences and packets rendered from synthetic memory items, in all three languages, at the sizes the service builds.
  • Counter: the token counter of the model family that reads our packets (Claude's, through its free counting endpoint), asked for three models. All three gave identical counts on every text.
  • One fault on our side, disclosed: the first run counted nothing, because our baseline text was a single space, which the counter refuses. We changed it to "." before any number was seen, and recorded the change.

The results (1 Dec 2026)

Real tokens ÷ estimated tokens, over rendered packets:

Language Median 95th percentile
English 1.328 1.346
Hinglish 1.404 1.421
Hindi 1.176 1.201
  • Line 1 failed in every language. Lines 2 and 3 held.
  • Packets the budget had filled to 800:
    • English held 1,051 to 1,066 real tokens;
    • Hinglish held 1,066 to 1,084;
    • Hindi held 919 to 936.
  • In plain sentences, Hindi was the one place the estimate over-counted (median 0.889, against 1.125 in English and 1.417 in Hinglish). The packet's frame, ids and dates are what push Latin-script packets over.
  • The real cost of Devanagari is items, not error. At the same budget, a full Hindi packet shows 7 items, against 11 in English and 10 in Hinglish.

The first fix: divide by two, keep 800

Dividing by two made the promise true. On a fresh count of 657 texts, written by someone who wrote neither the proposal nor the first count, the packets' 95th percentile was 0.948 at worst. The old divisor failed again on the same fresh text, at 1.439.

But the promise got smaller as well as truer. We replayed a fixed set of 387 synthetic prompts (eight fictional people at one fictional company) through the serving path twice, at one code revision: once with the old estimate and once with the new one. On the held-out share, with the line set at most 0.02 worse per language:

Language Need prompts Missed answers, old → new Gold found, old → new
English 163 0.067 → 0.153 231 → 203 of 262
Hinglish 37 0.000 → 0.054 58 → 49 of 63
Hindi 17 0.118 → 0.118 27 → 23 of 32

Served items fell about 44% in each language. The packet budget was the binding limit: lists averaged 7.81 items before and 4.35 after. It failed its line, so it was not accepted.

The fix that held: honest numbers, the same bytes

The second option divides by two and scales every cap by three halves. The packet becomes "1,200 tokens", which is the same 2,400 bytes as before. The checkpoint's stated number gets a 10% margin. Nothing served should change. Only the numbers become true.

We tested that claim rather than assuming it:

  • Parity: on the 387-prompt replay, the deterministic ranked list differed in 2 of 387 prompts. Each lost its last item, and nothing else moved. Answers and recall on the held-out share were identical in every language.
  • The cause, proved: the packet header states its cap, and "at most 1200 tokens" is one byte longer than "at most 800 tokens". Measured at the old header's width, the new estimate gave 0 differences across 1,389 unit cases and 636 Lab renders.
  • A new count, by a fresh author: packets, checkpoints and profiles all held line 1 (95th percentile at most 0.982, in Hinglish). The two tool answers did not: search results reached 1.086 and record fetches 1.077. Their text is ids, handles and code-like lines.
  • So the tool answers now state bytes: "at most 2,400 bytes" and "at most 9,000 bytes", with no token claim, cut by byte length. An answer of exactly the cap is served, and one byte more holds the item back.

A finding about measuring itself: two runs of the old estimate on two builds differed in 603 of 2,709 served lists, all in older list variants and none in the deterministic one, with matching outcomes. We now judge parity on the deterministic list and the outcomes.

What's next, and what we'd suggest

Next for us:

  • Adopting the new numbers into the design and switching them on live both need our product owner's sign-off, then an install behind a full gate and a verified backup.
  • Until then, every token number from the live service is reported beside its measured factor.
  • Hinglish headroom is thin, at 0.982. All counts use one tokenizer family.

If you budget context with an estimate:

  1. Count your rendered packets, not your sentences. Frames, ids and dates change the ratio.
  2. Test every script you serve. Our intuition about which one would break was backwards.
  3. Write the pass lines before counting, including the one that can fail.
  4. Before you shrink a budget to make it honest, measure what it serves. Making the number honest and keeping the bytes may be the better trade.
  5. Give dense tool answers a byte cap. A token claim there is hard to keep.

Frequently asked questions

How many tokens does a byte-based estimate miss?

On our synthetic packets, real tokens were about a third more than bytes ÷ 3 estimated in English and Hinglish, and about a sixth more in Hindi.

Why was Hindi closer than English?

Devanagari costs three bytes a character, which the estimate partly absorbs. Latin-script packets carry many ids, dates and frame words that tokenise densely.

Why not just divide by two?

At the same budget, it served about 44% fewer items and missed answers in English and Hinglish. Raising the cap alongside it kept every byte served.

Is this live?

No. It is accepted in the Lab. Going live needs our product owner's sign-off, an install candidate, a full gate and a verified backup.

Yukti Memory is Melta's Memory Infra. We publish what we measure, including what fails.