Skip to content

[Router][Feat] --tokenizer: local token-id computation for served-name deployments - #1

Open
tyler2cr wants to merge 1 commit into
router-kvaware-chat-completionsfrom
router-tokenizer-override
Open

[Router][Feat] --tokenizer: local token-id computation for served-name deployments#1
tyler2cr wants to merge 1 commit into
router-kvaware-chat-completionsfrom
router-tokenizer-override

Conversation

@tyler2cr

Copy link
Copy Markdown
Owner

For the PVAMU K8s/platform team to consider, stacked on the kvaware chat-tokenization branch (upstream PR vllm-project#1045) so this diff is ONLY the override.

What it does

A router flag supplying the tokenizer the router should load for kv-aware/load-aware token-id computation, instead of the name the engines advertise:

vllm-router --routing-logic kvaware --tokenizer RedHatAI/gemma-4-31B-it-FP8-block ...

Why you'd want it

Your engines serve under --served-model-name gemma4_31b_it — an alias, not a resolvable tokenizer id — so the router can never tokenize locally and pays one HTTP round trip to an engine's /tokenize (plus engine CPU) on every routing decision. With the override, the router loads the real tokenizer once and computes token ids in-process: zero network on the routing hot path. Also works air-gapped: the flag accepts a local directory of tokenizer files baked into the image or mounted.

The one correctness rule

The override must be the same tokenizer your engines run (for you: the exact repo the engines load, RedHatAI/gemma-4-31B-it-FP8-block). A different tokenizer means router-side ids drift from engine-side KV hashes and kv-aware silently degrades to QPS fallback — the flag's help text carries this warning.

Scope / sequencing

2 tests added (override preferred over served name — the endpoint stub has no model_names at all, proving the endpoints aren't consulted; no-override path unchanged); suite 238/238.

🤖 Generated with Claude Code

…utation

Engines that serve under a vLLM --served-model-name advertise an alias
that is not a resolvable tokenizer id, so the router can never load a
tokenizer locally and pays a remote /tokenize round trip (plus engine CPU)
on every kv-aware/load-aware routing decision. --tokenizer supplies the
real tokenizer id or a local path; _ensure_tokenizer prefers it over the
served name, so routing tokenizes in-process after a one-time load. Works
air-gapped (point it at a mounted directory of tokenizer files). Must
name the same tokenizer the engines run, or router-side ids drift from
engine-side KV hashes and kv-aware routing silently degrades - the help
text carries that warning.

Signed-off-by: tyler <tcr@enfuse.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants