ResearchPublication
The hidden cost of UUIDs in AI prompts: a 95.6% token optimization solution
A post of August 2025 by Floris Fok. A UUID costs a language model many tokens, so the post swaps each one in a prompt for a short number and puts the UUIDs back in the answer.

Where this comes from
This is a post on the Prosus AI Tech Blog, written by Floris Fok and published there on 20 August 2025. The same text first appeared on his own Medium page on 23 July 2025. It is about what the identifiers in a prompt cost a language model, and it is listed here as published work from Prosus’s AI blog. What follows is from the post.
What the post asks
UUIDs are the standard way to identify things in modern distributed systems, and so they turn up in the prompts sent to language models. One looks like a simple identifier, and a model reads it as nearly 23 tokens. The post measures that, and asks how a prompt can carry the same identifiers in fewer. Processing time and cost both grow in step with the number of tokens, so every token an identifier takes costs both time and money.
What it measured
The author counted the tokens of over a thousand randomly generated UUIDs in three formats, the standard one, one without hyphens and one in upper case, and compared them with short numbers such as 001, 002 and 003. Taking out the hyphens saved a few tokens, upper case saved none, and a short number took a single token. The cause, the post says, lies in “how language models process hexadecimal strings and hyphen separators”, which do not look like the natural language that tokenizers are built for.
- tokens on average for one standard UUID
- 22.83
- for a short number such as 001 in its place
- 1 token
- fewer tokens for each identifier
- 95.6%
- fewer tokens for a whole prompt, in the post’s test scenarios
- 59% to 74%
The method
An identifier only has to be unique within the one analysis a model is asked to make. So the method gives each UUID a short number for as long as the model works on the prompt, and keeps a table to turn the numbers back.
Find
Every UUID in the prompt is detected and taken out.
Map
A table is made that leads from each UUID to a number and back again.
Replace
Each UUID in the prompt becomes its number, in sequence: 001, 002, 003 and so on.
Ask
The model reads the shorter prompt and answers with the numbers.
Restore
The numbers in the answer are turned back into the original UUIDs, and that answer is the one returned.
The post presents the method as invisible to the model and to the people using it, needing no change to the systems around it, and reversible. Its example is a prompt of three lines about one user who logs in, opens a document and shares it with another user: with the UUIDs swapped for numbers, the same three lines take a fraction of the tokens. It tried the method on four scenarios, the analysis of user behavior, of system logs, of database queries and of security alerts, and found the savings consistent across them.
What it means for cost
Since tokens set both time and price, the post expects faster answers, lower bills for a model’s API and more work through the same infrastructure. It gives two rough yearly estimates for workloads of many prompts a day, counting input tokens alone at its stated price for GPT-4.1, and adds that the saving could double where answers carry many UUIDs too. An example implementation is on GitHub, as PromptCleaner.
The post concludes that the way UUIDs are tokenized is a significant inefficiency that is easy to address, and that techniques of this kind matter more as prompt engineering grows in importance while the rest of the pipeline matures.
The post
The Hidden Cost of UUIDs in AI Prompts: A 95.6% Token Optimization SolutionFloris Fok. Prosus AI Tech Blog, 2025Author
Floris Fok
References
- The Hidden Cost of UUIDs in AI Prompts: A 95.6% Token Optimization SolutionFloris Fok. Prosus AI Tech Blog, Medium, 20 August 2025
- PromptCleanerFloris Fok. GitHub, the example implementation the post links