Skip to content

Cookies

We use cookies to enhance your experience. Learn more

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.

Three long rows of tiny cream and peach paper squares across the top of terracotta paper, and under them a short row of three single dark blue squares.

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%
Floris Fok, Prosus AI Tech Blog, 20 August 2025

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.

  1. Find

    Every UUID in the prompt is detected and taken out.

  2. Map

    A table is made that leads from each UUID to a number and back again.

  3. Replace

    Each UUID in the prompt becomes its number, in sequence: 001, 002, 003 and so on.

  4. Ask

    The model reads the shorter prompt and answers with the numbers.

  5. 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, 2025

Author

  • Floris Fok

References

  1. The Hidden Cost of UUIDs in AI Prompts: A 95.6% Token Optimization SolutionFloris Fok. Prosus AI Tech Blog, Medium, 20 August 2025
  2. PromptCleanerFloris Fok. GitHub, the example implementation the post links

Keep reading

  • Publication

    One model for the whole home page

    A shopping app’s home page is filled by many recommenders, each tuned for its own slot. This model writes one page per person, per meal moment: the title, the subtitle and what to show. In a live test on one slot it brought 137% more orders from that list.

  • Publication

    New robots, old tricks: teaching robots to speak AI

    A post of November 2026 on a year of wiring Darwin, the Prosus humanoid robot. Five parts spoke five protocols, and the post asks what a robot should tell an AI agent about its actions before the agent can use it.

  • Method

    Meet the large commerce model

    Language models learn from text. Magnet Decision learns from what people search for, look at, buy and come back for. Here’s how it’s built.