Chiosa
NLP & Language

A tokenizer reuses chat history to cut first-token delays

Delta Tokenizer: Reference-Identical Tokenization of Session Deltas and Segment-Parallelism for Long Prompts on Multicore CPUs · arXiv:2610.19801

3 min
Updated

In plain words

When coding assistants continue a long conversation, each new request may add only a little text. Yet the usual tokenizer, software that turns text into numbered pieces for the model, reads the whole conversation again, even when most of it is already cached.

Delta Tokenizer remembers earlier pieces, checks where it can safely reuse them, and splits eligible long requests into pieces that CPU workers can handle between short updates. In one SGLang test with 100,000-token chat histories, it cut median time to first output by 59% versus the reference tokenizer. Short contexts showed little gain.

The research

When a coding-agent call adds only a short update to a very long conversation, why should the CPU turn the old text into the model’s numbered pieces again? Can serving avoid that repeated work while preserving the pieces the model receives?

Delta Tokenizer is a CPU system that turns text into model-readable pieces, reuses verified pieces from earlier turns, and splits eligible long requests into safe chunks for serving.

The researchers compared Delta Tokenizer, a CPU system that reuses verified numbered text pieces, with the Hugging Face reference tokenizer, the standard software that converts text into those pieces, in SGLang using Qwen3-8B.

They tested rendered chat requests with 100,000-token contexts and 400-character appends. Across 60 warm turns, median delay from scheduled arrival to the first streamed token was 59.61 ms with Delta Tokenizer and 144.80 ms with the reference.

Because these requests reused session history, the result supports the conclusion that avoiding a full CPU re-encode can reduce delay when tokenization holds up serving. Short contexts showed little gain.

The gains depend on the workload: short contexts showed little benefit because model work set the delay, and when every long document was new, GPU processing set the tail. Some tokenizer configurations and processing paths were not tested equally.

What the evidence shows

  • Long histories, small updates

    Delta Tokenizer is a CPU tokenization front end for language-model serving. The problem it addresses appears in recorded Claude Code and Codex sessions: each call added a median of about 1,500 characters to a history of 86,000 to 123,000 tokens, and the model’s cache for earlier input reused most of the conversation.

    The reference tokenizer, software that turns text into the numbered pieces a model reads, nevertheless re-encoded the whole history. The question is whether a serving system can avoid that repeated CPU work while returning the same pieces.

  • Reuse only after a check

    For a continuing session, Delta Tokenizer re-encodes the appended text plus a short tail of the previous request. It reuses earlier IDs only after checking that the saved text is still an exact prefix and that the old and new token sequences agree across a stable boundary.

    A failed check means a wider re-encode or a reference encode, preserving correctness at the cost of some saved work.

  • Chunks create scheduling points

    The system also handles long requests without reusable session state. It splits them only at text boundaries that preserve the tokenizer’s processing, then concatenates the exact encodings of the pieces.

    In a four-worker FIFO test with million-character requests arriving at 26 per second, this chunking cut 99th-percentile request latency, the delay at or below which 99% of requests finished, from 374 ms to 103 ms versus whole-request tasks. That test measures the scheduling effect for this specific stateless workload.

  • The serving bottleneck matters

    In SGLang with Qwen3-8B, rendered chat requests with 100,000-token contexts and 400-character updates had a median time to first output of 59.61 ms with Delta Tokenizer, versus 144.80 ms with the reference, across 60 warm turns.

    The result supports a benefit when repeated tokenization is delaying serving. When all long documents were new, GPU processing set the tail instead, and changing the tokenizer made little difference to P99 delay.

  • Reference checks and their scope

    Exactness checks compared complete token-ID sequences with the reference. Across 41.8 billion whole-document comparisons for eleven admitted tokenizer configurations, no sequence differed.

    A control on 100,000 adversarial Qwen3 strings found 2,115 differing sequences after removing the normalization check, illustrating why the cut guard matters for that test. The large whole-encode check and the control cover specific paths and inputs, not every configuration equally.

Deep

Next paperA vision-language reward model learns from caption edits