[None][fix] Fix GPT-OSS KV-aware router hashing#13675
Open
SimengLiu-nv wants to merge 5 commits intoNVIDIA:feat/bench_xfrom
Open
[None][fix] Fix GPT-OSS KV-aware router hashing#13675SimengLiu-nv wants to merge 5 commits intoNVIDIA:feat/bench_xfrom
SimengLiu-nv wants to merge 5 commits intoNVIDIA:feat/bench_xfrom
Conversation
Route GPT-OSS chat requests through Harmony tokenization before
computing KV-aware router block hashes, and make the Harmony serving
path honor pre-tokenized prompt_token_ids from the router. Also forward
cache_salt from chat_harmony into generation.
Add regression coverage for cache-salt hash partitioning, zero-block
prompt routing, and partial final-block matched-token accounting.
Signed-off-by: Simeng Liu <simengl@nvidia.com>
Bind the C++ BlockKeyHasher path for token IDs with optional cache salt and route all Python block hashing through it. Add use_harmony as an explicit router override while preserving GPT-OSS name/config detection when unset. Keep router tokenization side-effect free so generation workers can retokenize requests, and cover the behavior with router tests. Signed-off-by: Simeng Liu <simengl@nvidia.com>
dongfengy
reviewed
May 1, 2026
| tool.model_dump() if hasattr(tool, "model_dump") else tool | ||
| for tool in request.tools | ||
| ]) | ||
|
|
Collaborator
There was a problem hiding this comment.
Not sure if matters, but if tools=[], it will return [], but for chat_harmony, it will return None: https://github.com/SimengLiu-nv/TensorRT-LLM/blob/035da99a662d86a975de63a10e595b521642b3c6/tensorrt_llm/serve/openai_server.py#L1483-L1485
tools_dict None vs [] seems to be treated differently: https://github.com/SimengLiu-nv/TensorRT-LLM/blob/035da99a662d86a975de63a10e595b521642b3c6/tensorrt_llm/serve/harmony_adapter.py#L762-L771
Add stable round-robin tie breaking for KV-aware router candidate sets and ignore weak prefix-cache matches so low-affinity requests fall back to load balancing. Make KV-cache scheduling tolerate stale or already removed sequences instead of throwing during simulated pause accounting. Signed-off-by: Simeng Liu <simengl@nvidia.com>
Preserve visible streaming output when Harmony parsing fails by decoding a fallback batch, stripping only Harmony control framing, and resetting parser state for later chunks. Treat failed or timed-out context KV transfers as transfer errors instead of clean context completions, and avoid re-storing context blocks that were already stored for asynchronous disaggregated transfer. Signed-off-by: Simeng Liu <simengl@nvidia.com>
Match the router Harmony tokenization path to chat_harmony when a request explicitly provides an empty tools list, and include pre-commit formatting updates for the changed branch files. Signed-off-by: Simeng Liu <simengl@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Route GPT-OSS chat requests through Harmony tokenization before
computing KV-aware router block hashes, and make the Harmony serving path honor pre-tokenized prompt_token_ids from the router. Also forward cache_salt from chat_harmony into generation.
Add regression coverage for cache-salt hash partitioning, zero-block
prompt routing, and partial final-block matched-token accounting.
@coderabbitai summary
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.