Trimming a small model’s vocabulary cut one company’s AI costs by 77%

Dharma AI rebuilt the vocabulary of a small language model around what each token costs to serve, and its essay grader became cheaper and more accurate.

1 min read

Hugging Face

At a glance

lower measured inference cost
77%
average response length in tokens
350 → 101
quality score, up from 0.703
0.81
What’s new
VocabX picks new vocabulary entries by how much they save in serving cost, weighting output tokens more heavily, and merges long repeated phrases such as JSON boilerplate into single tokens.
Who it affects
Companies running fine-tuned small models at scale, where inference is the main bill.

Models fine-tuned from general ones like Qwen and Gemma keep a vocabulary built for every language and domain. That splits a specialist’s most common phrases into many pieces and wastes effort scoring tokens it will never use. Dharma AI tested this on its Portuguese essay grader, built on Qwen3-4B, keeping the same base model, data and training recipe. In that grader, a token saved in the answer was worth 7.4 times one saved in the input. Across five public domains and three model families, VocabX compressed text more than the strongest existing method in all fifteen tests. The figures come from a paper still under review.

Why it matters

The tokenizer is usually treated as a fixed part of a model. This work suggests it can be one of the biggest cost levers for a specialised model, and it is set before any training starts. For companies serving one narrow task over and over, that could add up. The results come from the company’s own grader and a paper still under review, so independent tests will tell.

How Specializing the Vocabulary of SLMs Can Cut Inference Cost by 77% in Real Applications

Hugging Face

huggingface.co

Summary by Second Order AI. Full reporting is at the original source.